Skip to content

Instantly share code, notes, and snippets.

View Nullcaller's full-sized avatar

Gleb Salmanov Nullcaller

  • 18:44 (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 June 1, 2024 08:35
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 May 11, 2024 09:27
USB-key unlock on Ubuntu Server 22.04 LTS

Unlock rootfs and Encrypted Drives with a USB Flash Drive [Linux/Ubuntu Server 22.04 LTS]

Setting up full disk encryption for Ubuntu is pretty straightforward. Enter all the neccessary info during instllation, and it magically works. But if you want to use a USB key not to enter the passphrase each and every time you boot your machine, as you would want to do with, say, a server, things quickly get really complicated.

But be not afraid, for you have found the right place to make it just a little bit easier. Join me, on this journey of frustration, bitter disappointment, and, as is always the case with linux, new knowledge.

Also, I should note, while using sudo -s generally is a bad idea, you might consider doing that, as pretty much all commands here require root access anyway. You'll just be typing five extra characters per command.

Setting up USB Unlock for rootfs

@Nullcaller
Nullcaller / VKDR
Last active May 11, 2024 08:37
(defunct) 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 May 11, 2024 08:36
(defunct) 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;