fragmented knowledge

bruchstückhaftes Wissen


autostart container:

docker update --restart=always 0576df221c0b

e-mail from cli via remote smtp server

using swaks

echo "Das ist eine Nachricht" | swaks --to \
--from FROM_EMAIL --server FQDN:PORT --auth PLAIN \
--auth-user "USERNAME" --auth-password "SECRET" \
-tls --header "Subject: foo" --body -


show all stored procedures/user defined functions with the pattern anon42:

\df *anon42*

professional downloading with youtube-dl

Downloading the (most AVC/H.264) video track with the given height in pixel and merge (+) it wit the best audio track (aac) provided in an a4m container. The default behaviour is: ‘bestvideo+bestaudio’.

youtube-dl -f 'bestvideo[height=1080][ext=mp4]+bestaudio[ext=a4m]' URL


build simple maven project

mvn archetype:generate -DgroupId=XXX -DartifactId=YYY -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4

invoke single test method within test class

mvn -Dtest=TestClass#testMethod test

validate XML against DTD

xmllint -noout --dtdvalid recipes.dtd recipes.xml

disable mouse acceleration

get mouse description

xinput list

list mouse properties

xinput list-props 'USB Optical Mouse'

disable acceleration

xinput --set-prop 'USB Optical Mouse' 'libinput Accel Profile Enabled' 0, 1

svn: create ignore rules

Ignore rules effecting directories and only suport globbing (wildcard *)

svn propedit svn:ignore ./path



shrink images (prevent data trash)

for i in `ls -1` ; do convert $i  -quality 90 -resize 3200  $i ; done

in parallel with gnu-parallel:

find . -iname "*jpg" | parallel -I% --max-args 1 convert %  -quality 90 -resize 3200  %

epub optimization for mobile e-ink reader

for i in `ls -1` ; do convert $i -colorspace Gray  -quality 80 -resize 50%  $i ; done

remote wireshark per ssh

ssh [TARGET] sudo tcpdump -i [INTERFACW] -U -w -port 22 | wireshark -i – -k

sort and rename files according to atime (bash)

IFS=$'\n' ; i=0 ; for file in `ls -1 -u --sort=time -r` ; do let i++; \
newfile=$(printf "%03d-%s" $i $file); mv $file $newfile ; done

SSH Portforwarding


I have no direct connection to, i have to tunnel through


ssh -L


I tell the SSH gateway to open up a port and forward this one to my machine.

CLIENT <--> SSH-GATEWAY <--> BigBadInternet

ssh -R 9000:localhost:3000 

no tty

ssh -nNT -L

concatenate pdf files

pdftk *.pdf cat output onepdf.pdf

extract partition from image

sfdisk -l -uS image-file
dd if=image-file of=partition-file skip=NUM count=NUM

Linux Ramdisk

mount -o size=1G -t tmpfs none /mnt/tmpfs

awk oneliners:

Linux iptables: statisches NAT:

iptables -t nat -A PREROUTING -d -i eth0 -j DNAT --to-destination
iptables -t nat -A POSTROUTING -s -o eth1 -j SNAT --to-source

Linux iptables: Portforwarding:

iptables -t nat -A PREROUTING -p tcp -i eth2 -d --dport 2222  -j DNAT --to

IPv6 privacy extensions unter Linux aktivieren (RFC3041):

sysctl net.ipv6.conf.wlan0.use_tempaddr=2

ASCII-armored PGP with Sylpheed

Der MUA Sylpheed ist nicht in der Lage ascii-armored gpg/pgp Nachrichten zu entschlüsseln. Man kann jedoch mit einer selbstdefinierten “Aktion” Abhilfe schaffen:

urxvt -e /bin/bash -c "/usr/bin/gpg -d %p | less"

convert an hex string to ascii, using perl:

perl -e 'chomp($HEX=); while($i < length($HEX)) {$PART=substr($HEX,$i,2);print chr(hex($PART)); $i=$i+2;}'

bash IFS-variable, only split on Newline:

export IFS=$'\n'

Next post: about