Skip to content

Instantly share code, notes, and snippets.

@drbr
Last active May 26, 2025 00:31
Show Gist options
  • Save drbr/09218a1fc2de80325d45fe7019f2fdf6 to your computer and use it in GitHub Desktop.
Save drbr/09218a1fc2de80325d45fe7019f2fdf6 to your computer and use it in GitHub Desktop.
Shell commands for various tasks
#/bin/bash
# Convert all the files in a directory from M4A (Apple Lossless) to FLAC
find . -name "*.m4a" | sort -n | while read -r filename
do
ffmpeg -i "$filename" -f flac "$filename.flac"
done
# Rename all the files from `.m4a.flac` to `.flac`
# Afterward, clean up with `rm "*.m4a"`
find . -name "*.flac" | sort -n | while read -r filename
do
mv "$filename" "$( echo "$filename" | sed 's/\(.*\)\.m4a\.flac$/\1.flac/' )"
done
#/bin/bash
# Split a PDF of 2-page spreads (left/right) into separate pages.
# Splits the width of the page exactly in 2, so the original PDF
# needs to be cropped correctly before running this.
mutool poster -x 2 -r <input.pdf> <output.pdf>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment