Recipes

pdf

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}

SELinux

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.

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

ActiveDocument.ConvertNumbersToText

GIFs

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

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.