MP4 to GIF

ffmpeg -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos" -c:v pam -f image2pipe - | convert -delay 10 - -loop 0 -layers optimize output.gif

GIF to MP4

ffmpeg -f gif -i infile.gif outfile.mp4


ausearch -m avc to find denials. If there are none, that's probably because some distro maintainer decided that the denial should be silent:

semodule -DB turns on dontaudit events, semodule -B turns them back off.

When trying to get things to work correctly with audit2allow, skip the 15 minutes of doing things over and over triggering different denials and running audit2allow -M mymodule < fails; semodule -i mymodule.pp by just doing a quick setenforce 0 before doing it once. All of the actions (AVCs?) in creating a file will show up in the log in one shot. Obviously turn on enforcing mode afterwards.

When in doubt, consult the colouring book.


Pull a page range from a pdf

pdftk {filename.pdf} cat {page ranges} output {output.pdf}

Get metadata of a pdf

pdfinfo {filename.pdf}

Concatenate a bunch of pdfs

Note: I think this overwrites the last input file if you forget to specify an output!!

pdfunite {file.pdf...} {output.pdf}

SVG rasterization (to PNG)

rsvg-convert  --keep-aspect-ratio -w 1024 -h 1024 infile.svg outfile.png

Vim incantations

Delete lines matching

:g/<pattern>/<cmd> executes an ex command <cmd> on lines matching <pattern>. Use the command d to delete the lines.

MS Word

To execute a macro, press Alt+F11 for the macro editor, then Ctrl+G for the immediate window.

Convert automatic numbers to manual numbering



Everyone's favourite impossible-to-use tool

Coordinates are counted from the top left corner like so:

0- +x

Add text

This puts the text in a transparent box with opacity 0.25.

ffmpeg -i input.mp4 -vf drawtext="fontfile=/usr/share/fonts/adobe-source-sans-pro/SourceSansPro-Regular.otf: text='THE TEXT': fontcolor=white: fontsize=250: box=1: boxcolor=black@0.25: boxborderw=5: x=(w-text_w)/2: y=(h-550)" -codec:a copy output.mp4

Download a m3u8 playlist

ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i 'https://host/playlist.m3u8' -c copy video.mp4


Enable/disable page numbering

% disable numbering on this page

% turn it off entirely 🦃

% turn it back on