Shell Snippets

Symmetric GPG

1
2
#!/bin/bash
gpg --symmetric --cipher-algo=AES256 --digest-algo=SHA512 $@

Deterministic tar

1
2
3
#!/bin/bash
export LC_ALL=C
tar --force-local --sort=name --mtime='1970-01-01 00:00:00+00:00' --owner=root --group=root --numeric-owner -cf "$1.tar" "$1"

EAC-compatible CRC of FLAC audio

1
2
#!/bin/bash
flac -s -f -d "$1" --force-raw-format --endian=little --sign=signed -o - | rhash --printf='%C\n' -

MIDI to PulseAudio (via GStreamer)

1
2
#!/bin/bash
timidity --output-24bit -A120 "$1" -Ow -o - | gst-launch-0.10 filesrc location=/dev/stdin ! decodebin ! pulsesink > /dev/null

GNOME-GPG with fallback

1
2
3
4
5
6
#!/bin/bash
if [[ -z "$DISPLAY" ]]; then
  gpg $@
else
  gnome-gpg $@
fi