Skip to content

Instantly share code, notes, and snippets.

View sfan5's full-sized avatar

sfan5

  • Germany
  • 10:36 (UTC +02:00)
View GitHub Profile
@sfan5
sfan5 / nginx-libressl.sh
Last active April 17, 2025 12:51
Compiles nginx statically linked with LibreSSL
#!/bin/bash -e
LIBRESSL_VERSION=4.0.0
NGINX_VERSION=1.27.5
NGINX_CONFIG=(
--with-pcre-jit --with-threads
--with-http_ssl_module
--with-http_v2_module
--with-http_realip_module
--with-http_stub_status_module
--with-http_auth_request_module
@sfan5
sfan5 / alpine-container.sh
Last active February 15, 2025 13:49
Create bootable systemd-nspawn containers with Alpine, Arch Linux or Ubuntu
#!/bin/bash -e
# Creates a systemd-nspawn container with Alpine
MIRROR=http://dl-cdn.alpinelinux.org/alpine
VERSION=${VERSION:-v3.21}
APKTOOLS_VERSION=2.14.6-r3
wget_or_curl () {
if command -v wget >/dev/null; then
@sfan5
sfan5 / webm_twopass.txt
Last active April 28, 2017 21:08
script for twopass encoding of webms
#!/bin/bash -e
src="2QO90IaN_UM.mkv"
dst="a.webm"
opts="-vf scale=1280:720 -threads 10"
aopts="-c:a libopus -b:a 128k"
vopts="-c:v libvpx-vp9 -b:v 1024k -tile-columns 6 -frame-parallel 1 -row-mt 1"
vopts_final="-auto-alt-ref 1 -lag-in-frames 25"
ffmpeg -i "$src" $opts \
@sfan5
sfan5 / cutshit.vpy
Last active March 15, 2023 22:00
VapourSynth script for "simple" frame exact cutting of video & audio
import vapoursynth as vs
import csv
core = vs.get_core()
if "input" not in dir():
print("ERROR: Provide input file via --arg input=./spec.txt")
assert False
vsrc = None
asrc = None
@sfan5
sfan5 / build-static-ocserv.sh
Last active March 17, 2019 17:13
Builds OpenConnect server (http://www.infradead.org/ocserv/) into a portable, static Linux binary
#!/bin/bash -e
triple=x86_64-unknown-linux-musl
CC=/tmp/tc/bin/x86_64-unknown-linux-musl-gcc
v_nettle=3.4.1
v_gnutls=3.6.6
v_libev=4.25
v_ocserv=0.12.3
@sfan5
sfan5 / blacknode.py
Created November 2, 2016 22:10
Removes a single node from a whole Minetest world (SQLite3 backend only)
#!/usr/bin/env python3
import sys
import os.path
import struct
import zlib
import sqlite3
class BufferConsumer():
def __init__(self, buf):
assert(type(buf) == bytes)
@sfan5
sfan5 / remove_br_wrapper.sh
Created September 8, 2016 15:33
Removes toolchain-wrapper added by recent versions of Buildroot
#!/bin/bash
if [ ! -f toolchain-wrapper ]; then
echo "Not a bin folder or wrapper already removed"
exit 1
fi
echo ":: Replacing symlinks to toolchain-wrapper"
for file in *; do
@sfan5
sfan5 / mapblock-parse.py
Last active March 11, 2022 03:59
parses serialized MapBlock
#!/usr/bin/env python3
import sys
import struct
import binascii
import zlib
import getopt
try:
import zstandard
except ModuleNotFoundError:
zstandard = None
@sfan5
sfan5 / brnboot_brute.py
Last active May 2, 2016 15:25
Bruteforces brnboot command mode password (required either broken firmware (unbootable) or manual resets)
#!/usr/bin/env python2
import time
import serial
class PasswordGen(object):
def __init__(self):
self.charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
self.cur_pw = [0 for i in range(16)]
self.cur_i = 0
def restore(self, pw):
@sfan5
sfan5 / 2gateway.sh
Created April 8, 2016 17:24
Support multiple gateways on one machine
#!/bin/bash -e
IFACE=wlp0s18f2u1
TBLN=10
# TBLN needs to be different for each interface
IPADDR=`ip addr show dev $IFACE | grep "inet " | awk '{print $2}' | cut -d '/' -f1`
IPSUBNET=`ip route show | grep "dev $IFACE" | grep "src $IPADDR" | awk '{print $1}'`
IPGATEWAY=`ip route | grep "default via" | grep "dev $IFACE" | awk '{print $3}'`