Skip to content

Instantly share code, notes, and snippets.

@hrz6976
hrz6976 / disable_windows_mail_migration.cmd
Created July 1, 2024 19:53
Try to avoid Windows Mail from constantly switching to the shi!tty new Outlook
@echo off
setlocal
REM Check if Windows Mail is running
tasklist /FI "IMAGENAME eq HxOutlook.exe" 2>NUL | find /I /N "HxOutlook.exe">NUL
if "%ERRORLEVEL%"=="0" (
echo HxOutlook.exe is running. Closing it...
taskkill /F /IM HxOutlook.exe
) else (
echo HxOutlook.exe is not running.
@hrz6976
hrz6976 / SMB Symlinks on TrueNAS Scale.md
Created May 12, 2024 17:44
Hacking through the limitations by iXSystems and get insecure wide links to work on TrueNAS Scale
@hrz6976
hrz6976 / AX6000.md
Last active September 12, 2023 17:05
红米AX6000路由器 官方固件改造
@hrz6976
hrz6976 / bangumi_renamer.py
Created July 21, 2023 14:25
Move unnested bangumi files into named folders
from dataclasses import dataclass
from functools import lru_cache
from json import JSONDecodeError
import logging
import re
import os
import shutil
from urllib.parse import quote
import requests
@hrz6976
hrz6976 / .env
Last active June 9, 2023 07:06
Champion IPv6 Fix for OpenWRT Routers
WAN_IFACE="eth1.5"
LAN_IFACE="br-lan"
GATEWAY_V6="240c:c001:a:128::1"
GATEWAY_V6_T="fe80::200:ff:fe00:1"
LOCAL_V6_PREFIX="240c:c001:"
LOCAL_V6_TEMPFILE="/tmp/local_v6s"
@hrz6976
hrz6976 / connect
Last active May 18, 2023 11:40
Check and connect to PKU network gateway
# Copy it to /etc/cron.d
*/5 * * * * user test -f /home/user/pku-auto-connect/connect.sh && bash /home/user/pku-auto-connect/connect.sh >> /home/user/pku-auto-connect/connect.log 2>&1
@hrz6976
hrz6976 / kill-before-oom
Last active May 18, 2023 11:48
Checks the memory usage and kill the process occupying the most mem regularly
# copy it to /etc/cron.d
*/5 * * * * root test -f /home/user/kill-before-oom/kill-before-oom.sh && bash /home/user/kill-before-oom/kill-before-oom.sh >> /home/user/kill-before-oom/kill-before-oom.log 2>&1
@hrz6976
hrz6976 / dns
Last active May 18, 2023 11:50
Update CloudFlare dns record on a schedule
# Copy to /etc/cron.d
*/30 * * * * user test -f /home/user/cloudflare/dns.sh && bash /home/user/cloudflare/dns.sh >> /home/user/cloudflare/dns.log 2>&1
@hrz6976
hrz6976 / download.sh
Created May 12, 2023 19:10
Sync gharchive dataset to clickhouse on a schedule
#!/bin/bash
set -e
# import settings from .env
CWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )
source $CWD/.env
FILELIST_PATH=$(realpath $CWD/filelist.txt)
@hrz6976
hrz6976 / clickhouse_ghtorrent.sql
Created May 9, 2023 20:25
Import ghtorrent dataset to clickhouse (clickhouse-client --password <PASSWORD> --send-timeout=3600 --receive-timeout=600 < clickhouse_ghtorrent.sql
SET input_format_null_as_default = 1;
SET input_format_allow_errors_num = 100000;
SET input_format_allow_errors_ratio = 0.1;
SET date_time_input_format = 'best_effort';
CREATE DATABASE IF NOT EXISTS `ghtorrent`;
DROP TABLE IF EXISTS `ghtorrent`.`organization_members` ;
CREATE TABLE `ghtorrent`.`organization_members` (