CLI Toolbox

ffmpeg

Convert a mkv file to mp4 (source).

ffmpeg -i "vid.mkv" -map 0 -c copy -c:a aac "MP4/vid.mp4"

entr

Use entr to execute a command every time a file is modified. For example, to watch the changes on a PDF file with a Markdown source while you edit it.

echo input_file.md | entr pandoc input_file.md -o output_file.pdf

imagemagick

Convert images to a reduced, dithered and monochrome version to use in the website. The resultant images weight less than a third of the original size! Inspired by Low Tech Magazine

for oldimg in ../*.jpg; do 
    newimg="$(basename -s .jpg "$oldimg").png"
    magick "$oldimg" \
        -resize 800x800 \
        -ordered-dither o4x4\
        -colorspace gray \
        -colors 6 \
        "$newimg"
done