diff --git a/todo-recipes/ffmpeg.md b/todo-recipes/ffmpeg.md new file mode 100644 index 0000000..76266e1 --- /dev/null +++ b/todo-recipes/ffmpeg.md @@ -0,0 +1,25 @@ +# ffmpeg + +Everyone's favourite impossible-to-use tool + +Coordinates are counted from the top left corner like so: + +``` +0- +x +| ++y +``` + +## 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 +``` diff --git a/todo-recipes/gifs.md b/todo-recipes/gifs.md new file mode 100644 index 0000000..146b634 --- /dev/null +++ b/todo-recipes/gifs.md @@ -0,0 +1,13 @@ +# GIFs + +## MP4 to GIF + +```bash +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 + +```bash +ffmpeg -f gif -i infile.gif outfile.mp4 +``` diff --git a/todo-recipes/git.md b/todo-recipes/git.md new file mode 100644 index 0000000..4074432 --- /dev/null +++ b/todo-recipes/git.md @@ -0,0 +1,24 @@ +# git + +everyone's favourite VCS + +## what's going on between these two branches + +relevant: `man gitrevisions` + +### print commits in develop but not in main + +``` +git log origin/main..origin/develop +``` + +## git reset --hard a directory + +[source](https://stackoverflow.com/a/15404733) + +``` +git restore --source=HEAD --staged --worktree -- aDirectory +# or, shorter +git restore -s@ -SW -- aDirectory +``` + diff --git a/todo-recipes/latex.md b/todo-recipes/latex.md new file mode 100644 index 0000000..0d7815b --- /dev/null +++ b/todo-recipes/latex.md @@ -0,0 +1,14 @@ +# LaTeX + +## Enable/disable page numbering + +```latex +% disable numbering on this page +\thispagestyle{empty} + +% turn it off entirely 🦃 +\pagenumbering{gobble} + +% turn it back on +\pagenumbering{arabic} +``` diff --git a/todo-recipes/nix.md b/todo-recipes/nix.md new file mode 100644 index 0000000..1c9e572 --- /dev/null +++ b/todo-recipes/nix.md @@ -0,0 +1,31 @@ +# Nix + +A very nice package management system with some confusing command syntax. + +## Investigate a derivation + +[nix-diff](https://github.com/Gabriel439/nix-diff) can be used to find why +derivations are different. + +``` +nix-diff /nix/store/...-a.drv /nix/store/...-b.drv +``` + +Find the derivation for a given nix store path: + +``` +nix-store -q --deriver /nix/store/...-name-0.0.0 +``` + +Dump a derivation as JSON: + +``` +nix show-derivation /nix/store/...-a.drv +``` + +Find why a derivation has a dependency: + +``` +nix why-depends -a -f default.nix 'attrnameHere' 'theDepAttrName' +``` + diff --git a/todo-recipes/pdf.md b/todo-recipes/pdf.md new file mode 100644 index 0000000..69a0a66 --- /dev/null +++ b/todo-recipes/pdf.md @@ -0,0 +1,22 @@ +# pdf + +## Pull a page range from a pdf + +```bash +pdftk {filename.pdf} cat {page ranges} output {output.pdf} +``` + +## Get metadata of a pdf + +```bash +pdfinfo {filename.pdf} +``` + +## Concatenate a bunch of pdfs + +Note: I think this overwrites the last input file if you forget to specify an output!! + +```bash +pdfunite {file.pdf...} {output.pdf} +``` + diff --git a/todo-recipes/selinux.md b/todo-recipes/selinux.md new file mode 100644 index 0000000..3279849 --- /dev/null +++ b/todo-recipes/selinux.md @@ -0,0 +1,9 @@ +# 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](https://people.redhat.com/duffy/selinux/selinux-coloring-book_A4-Stapled.pdf). \ No newline at end of file diff --git a/todo-recipes/svg-to-png.md b/todo-recipes/svg-to-png.md new file mode 100644 index 0000000..f55c93b --- /dev/null +++ b/todo-recipes/svg-to-png.md @@ -0,0 +1,5 @@ +# SVG rasterization (to PNG) + +```bash +rsvg-convert --keep-aspect-ratio -w 1024 -h 1024 infile.svg outfile.png +``` diff --git a/todo-recipes/vim.md b/todo-recipes/vim.md new file mode 100644 index 0000000..07adc47 --- /dev/null +++ b/todo-recipes/vim.md @@ -0,0 +1,7 @@ +# Vim incantations + +## Delete lines matching + +`:g//` executes an ex command `` on lines matching +``. Use the command `d` to delete the lines. + diff --git a/todo-recipes/word.md b/todo-recipes/word.md new file mode 100644 index 0000000..fd08d45 --- /dev/null +++ b/todo-recipes/word.md @@ -0,0 +1,10 @@ +# 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 + +```vb +ActiveDocument.ConvertNumbersToText +```