Skip to content

Instantly share code, notes, and snippets.

View sfan5's full-sized avatar

sfan5

  • Germany
  • 10:05 (UTC +02:00)
View GitHub Profile
@sfan5
sfan5 / cjpeg-dssim.sh
Created August 30, 2015 13:12
Better version of technopagan/cjpeg-dssim
#!/usr/bin/env bash
###############################################################################
#
# Intro:
# Automatically find the ideal JPEG quality setting for a JPEG image by
# calculating the output images dissimilarity from the input JPEG. This
# frees us from having to rely on the unstandardized quality integer.
@sfan5
sfan5 / sonar.http_parse.py
Last active December 10, 2021 23:47
Converts result from https://opendata.rapid7.com/sonar.http/ into masscan-like format
#!/usr/bin/env python3
import base64
import sys
import os
try:
import simplejson as json
except ImportError:
import json
# Takes decompressed https://opendata.rapid7.com/sonar.http/ scan file on stdin
@sfan5
sfan5 / 000readme.md
Last active November 30, 2022 16:45
More and better configuration for youtube-dl (mpv)

DO NOT USE THIS. It is unmaintained and will not work with newer versions of mpv, youtube-dl, yt-dlp or at all.

@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}'`
@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 / 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 / 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 / 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 / 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 / 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