Skip to content

Instantly share code, notes, and snippets.

View derde's full-sized avatar

Derde derde

  • Low earth orbit
View GitHub Profile
@derde
derde / tcp-reset-connection.sh
Last active July 15, 2022 17:40
Reset idle TCP connection using gdb to send shutdown()
#! /bin/sh
# Reset TCP connections with gdb
PORT="$1"
HOST="$2"
[ "$1" ] || {
echo "Usage: $0 local-port host-ip-address"
echo "e.g. $0 192.168.0.55 80 # reset tcp connection from 192.168.0.55 to local port 80"
exit 1;
@derde
derde / pppns.py
Created May 20, 2022 07:18
Give network interface to namespace, run shell, cleanup after exit
#! /usr/bin/python3
''' pppns - set ip netns for ppp0 '''
import os
import pwd
import sys
import optparse
r={
'ip': 'sudo ip',
@derde
derde / Qjumble.py
Created February 13, 2021 22:57
Rearrange the books of the Bible in the jumble that the Quaran follows
#! /usr/bin/python
"""Jumble the Bible according to Quran ordering ideas: shortest to longest"""
import urllib2,os
def QuranCmp(b,a):
return cmp(len(a[1]),len(b[1]))
kjvpcefile='kj.txt'
@derde
derde / epson-printer-utility.sh
Created June 27, 2020 10:07
Run epson-printer-utility_1.0.2-1lsb3.2_amd64.deb under ubuntu focal, providing missing libQtCore4
#! /bin/bash
# Run epson-printer-utility from epson-printer-utility_1.0.2-1lsb3.2_amd64.deb
# using downloaded libqt4 libraries from previous Ubuntu version (not provided
# in Ubuntu 20.04 "focal fossa"
#
# This downloads the deb files and extracts them in a libs directory in the
# current directory, and then runs the utility
#
# Fix for:
@derde
derde / stabilise.mp4.sh
Created June 8, 2020 21:29
ffmpeg video stabiliser with a bit of slow dynamic zoom
#! /bin/bash
for i in "$@" ; do
trf=transform.$$.trf
ffmpeg -i "$i" -vf "vidstabdetect=shakiness=5:accuracy=15:result=$trf" "$i.tmp.mp4"
rm "$i.tmp.mp4"
ffmpeg -i "$i" -vf "vidstabtransform=$trf:optzoom=2:maxangle=0.1,unsharp=5:5:0.8:3:3:0.4" "$i.unshake.mp4"