Skip to content

Instantly share code, notes, and snippets.

#include <filesystem>
#include <iostream>
namespace fs = std::filesystem;
namespace {
void PrintUsage(const wchar_t *exePath) {
std::wcout << L"usage: " << exePath
<< L"watchlist_dir source_dir0 [source_dir1 ...]";
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\qbittorrent.exe]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\qbittorrent.exe\PerfOptions]
"CpuPriorityClass"=dword:00000001
"IoPriority"=dword:00000000
"PagePriority"=dword:00000001
@hg
hg / run.sh
Last active August 15, 2020 05:23
asus ze500kg bloatware
#!/bin/sh
set -e
if [ $EUID -ne 0 ] then
echo >&2 'run as root'
exit 1
fi
mount -o remount,rw /system
static bool setup_default_deny(bool can_exec, scmp_filter_ctx ctx) {
ALLOW_CALL(rt_sigprocmask);
ALLOW_CALL(poll);
ALLOW_CALL(prctl);
ALLOW_CALL(_llseek);
ALLOW_CALL(accept);
ALLOW_CALL(arch_prctl);
ALLOW_CALL(bind);
ALLOW_CALL(brk);
@hg
hg / tld.md
Last active February 10, 2023 13:23
tld spam badness scores
@hg
hg / mullvad-lean.sh
Created May 13, 2024 18:24
lightweight ui to change active mullvad server
#!/usr/bin/bash
set -euo pipefail
for exe in sudo rofi wg curl jq; do
type "$exe" &>/dev/null || {
echo >&2 "please install $exe"
exit 1
}
done
@hg
hg / purelymail-alias.sh
Created July 19, 2024 13:28
quickly create / list / delete purelymail.com aliases
#!/bin/bash
set -euo pipefail
readonly token=purely-mail-token
readonly url=https://purelymail.com/api/v0
readonly domain=mail-domain.com
readonly target=name@$domain
request() {
@hg
hg / lato.css
Created November 29, 2025 18:05
lato.css
@font-face {
font-family: "Lato";
src: url("Hairline.woff2") format("woff");
font-weight: 100;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Lato";
src: url("HairlineItalic.woff2") format("woff");
@hg
hg / aspnet.md
Last active March 28, 2026 13:20
ASP.NET/Serilog config for the lnav log viewer
@hg
hg / postgresql-snake-case.md
Last active May 1, 2026 18:36
PostgreSQL / EF Core snake case naming

EFCore.NamingConventions is easier to use, but it does not rename "system" tables ("AspNetUsers" and the like).

protected override void OnModelCreating(ModelBuilder builder) {
  base.OnModelCreating(builder);

  // keep last or newly created objects won't be renamed