Skip to content

Instantly share code, notes, and snippets.

View Nullcaller's full-sized avatar

Gleb Salmanov Nullcaller

  • 14:46 (UTC +03:00)
View GitHub Profile
@Nullcaller
Nullcaller / Typography.ahk
Created August 15, 2023 22:39
An AutoHotkey script that allows for mac-like easy usage of the dash and the paragraph symbols on Windows.
!-::
{
Send "—"
}
!`::
{
Send "§"
}
@Nullcaller
Nullcaller / facebook-cdn-vpn
Last active October 4, 2023 11:17
A RouterOS v7.8-compatible script for automatic generation of an address list containing all Facebook CDN addresses required for maintaining a normal connection from the DNS cache entries. Designed for decent stability and low CPU usage spikes. This is a combination of scripts by @jgrossiord and @ZloyXEP with some additions.
:delay delay-time=#REPLACE_THIS_WITH_SOME_ARBITRARY_RESULT_OF_HITTING_YOUR_NUMPAD_WITH_A_FIST#ms;
:foreach i in=[/ip dns cache find] do={
# Turn this on while turning off other delays for ease of manual use. Don't forget to reenable later.
# :delay delay-time=5ms;
:delay delay-time=50ms;
:local cacheName [/ip dns cache all get $i name];
:local cacheType [/ip dns cache all get $i type];
:if (($cacheType="A" or $cacheType="CNAME") and (($cacheName~"^([0-9A-Za-z\\-]*\\.)*facebook(\\.[0-9A-Za-z\\-]*)*\\.?\$") or ($cacheName~"^([0-9A-Za-z\\-]*\\.)*fbcdn(\\.[0-9A-Za-z\\-]*)*\\.?\$") or ($cacheName~"^([0-9A-Za-z\\-]*\\.)*fbstatic(\\.[0-9A-Za-z\\-]*)*\\.?\$") or ($cacheName~"^([0-9A-Za-z\\-]*\\.)*fbexternal(\\.[0-9A-Za-z\\-]*)*\\.?\$"))) do={
# IP-based rule
:if ($cacheType="A") do={
@Nullcaller
Nullcaller / uunlk.md
Last active March 14, 2024 16:34
USB-key unlock on rootfs on Ubuntu Server 22.04 LTS

Unlock Your Root File System with a USB Key

Setting up disk encryption for Ubuntu is pretty straightforward. You just enter all the neccessary information in the installer, and it magically works. But if you want to use a USB key not to enter your passphrase each and every time you boot your machine, as you would obviously want to do with, say, a server, for some reason things get really complicated really quickly.

So if you want your machine conveniently encrypted with a USB key unlock option, then join me, on this journey of frustration, bitter disappointment, and, as is always the case with linux, new knowledge.

What to Do If You Messed Up

You may think that the main point of this document is to teach you how to set up the USB key unlock. In fact, this is not the case. The most valuable piece of information you will find here lies ahead. The how do you recover from "cryptsetup failed: bad password or options or moon phase or guess what it is" error section.

@Nullcaller
Nullcaller / VKDR
Last active March 30, 2023 20:20
An *AdGuard* Adblocker filter to remove all distractions from VKontakte. The latest version of this filter is always available at https://gist.github.com/Nullcaller/10e4f99f29c9580c1eab09730a8f5428/raw
! Title: VKontakte Distractions Removal
! Block Mobile Manifest (Block installation as PWA)
||m.vk.com^$replace=/<link rel=\"manifest\".*>//
! Mobile VKontakte
m.vk.com##div[class="upanel bl_cont "]
m.vk.com###lm_cont > div.pcont.fit_box:first-child > nav:nth-child(3) > ul.main_menu > li.mmi_feed:first-child > a.mm_item.al_menu
m.vk.com###lm_cont > div.pcont.fit_box:first-child > nav:nth-child(3) > ul.main_menu > li.mmi_recommended:nth-child(2) > a.mm_item.al_menu
m.vk.com###lm_cont > div.pcont.fit_box:first-child > nav:nth-child(3) > ul.main_menu > li.mmi_services:nth-child(10) > a.mm_item.al_menu
m.vk.com###lm_cont > div.pcont.fit_box:first-child > nav:nth-child(3) > ul.main_menu > li.mmi_apps:nth-child(11) > a.mm_item.al_menu
m.vk.com###lm_cont > div.pcont.fit_box:first-child > nav:nth-child(3) > ul.main_menu > li.mmi_ads:nth-child(14) > a.mm_item.al_menu
@Nullcaller
Nullcaller / YTDR
Last active March 30, 2023 20:20
An *AdGuard* Adblocker filter to remove all distractions from YouTube. Home page is emptied, recommendations, subscriptions, likes and dislikes are removed. As to why, see below. The latest version of this filter is always available at https://gist.github.com/Nullcaller/aae72d791e0e277777a6bc721d942ceb/raw
! Title: YouTube Distractions Removal
! Mobile YouTube
m.youtube.com###header-bar > header.mobile-topbar-header.cbox > button.mobile-topbar-header-endpoint:first-child
m.youtube.com##ytm-watch-next-secondary-results-renderer.ytm-watch-flexy.style-scope
m.youtube.com##a.ytm-suggestion-set.ytm-videowall-still
m.youtube.com##ytm-browse[page-subtype=home]
m.youtube.com###app > div.page-container:nth-child(2) > ytm-watch > ytm-single-column-watch-next-results-renderer.watch-content.big-thumbnail-experiment:last-child > ytm-item-section-renderer.scwnr-content:last-child > lazy-list
m.youtube.com###app > ytm-pivot-bar-renderer.pivot-bar-slide-in:nth-child(2) > ytm-pivot-bar-item-renderer:nth-child(3)
m.youtube.com###app > ytm-pivot-bar-renderer.pivot-bar-slide-in:nth-child(2) > ytm-pivot-bar-item-renderer:nth-child(3) > div.pivot-bar-item-tab.pivot-subs
m.youtube.com###app > ytm-pivot-bar-renderer:nth-child(2) > ytm-pivot-bar-item-renderer:nth-child(3) > div.pivot-bar-item-tab.pivot-subs
@Nullcaller
Nullcaller / Unsafe.java
Created January 19, 2019 23:09
A class for quick code execution without exception handling. (use lambda expressions)
public interface Unsafe {
public void code() throws Throwable;
public static void execute(Unsafe unsafe) {
try {
unsafe.code();
} catch(Throwable t) {
throw new RuntimeException(t);
}
}
@Nullcaller
Nullcaller / ModRecipeRemover.java
Created July 9, 2017 11:33
Remove TE Steel Recipe
package com.arlesten.reciperemover;
import java.util.List;
import cofh.lib.util.helpers.ItemHelper;
import cofh.thermalexpansion.util.managers.machine.SmelterManager;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;