Skip to content

Instantly share code, notes, and snippets.

View Satyani's full-sized avatar

Alexander Leon Satyani

View GitHub Profile
@Satyani
Satyani / bridgemaster.py
Last active March 26, 2026 08:52
Get obfs4 Tor bridges, test latencies, maintain DB and feed fastest bridges to Tor
#!/usr/bin/env python3
import re
import sqlite3
import subprocess
import os
import atexit
global con # globals for atexit
global file # FH to close on exit
@Satyani
Satyani / fix-torrents.sh
Last active March 7, 2026 22:33
Transmission: Check for corrupt seedings and fix it (one at time, /etc/cron.hourly/fix-torrents)
#!/bin/bash
job() {
while read line; do
if [[ ${line} =~ Id:\ ([0-9]+) ]]; then
id="${BASH_REMATCH[1]}"
continue
fi
if [[ ${line} =~ Piece\ \#[0-9]+\ is\ corrupt. ]]; then
logger -t fix-torrents -p local3.info "Fixing corrupt torrent $id"
@Satyani
Satyani / haproxy.cfg
Created February 23, 2026 16:15
HAProxy SOCKS balancer
global
maxconn 32000
ulimit-n 65535
uid 0
gid 0
#chroot /var/run/haproxy/
daemon
nosplice
#debug
#nbproc 2
@Satyani
Satyani / obfs4_get.sh
Created February 23, 2026 12:01
Get obfs4 Tor bridges and feed 'em to torrc
#!/bin/bash
declare torrc="/etc/tor/torrc"
declare obfs4_url="https://raw.githubusercontent.com/Delta-Kronecker/Tor-Bridges/refs/heads/main/working_obfs4.txt"
declare buf=""
declare -i n=0
declare -A ipport_hash=() # to avoid duplicates
process() {
while read line; do
@Satyani
Satyani / sys_backup.sh
Created February 21, 2026 14:03
Pi backup
#!/bin/bash
PATH="/usr/sbin:$PATH"
named_pipe=/var/tmp/$$.tmp
trap "rm -f $named_pipe" EXIT
mknod $named_pipe p
logger <$named_pipe -t sys_backup -p local3.info & # start logger in background with STDIN from named pipe
exec 1>$named_pipe 2>&1 # redirect stderr and stdout to named pipe