import recipes: todo add to site
This commit is contained in:
parent
3e4932f921
commit
33de49464e
10 changed files with 160 additions and 0 deletions
25
todo-recipes/ffmpeg.md
Normal file
25
todo-recipes/ffmpeg.md
Normal file
|
|
@ -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
|
||||||
|
```
|
||||||
13
todo-recipes/gifs.md
Normal file
13
todo-recipes/gifs.md
Normal file
|
|
@ -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
|
||||||
|
```
|
||||||
24
todo-recipes/git.md
Normal file
24
todo-recipes/git.md
Normal file
|
|
@ -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
|
||||||
|
```
|
||||||
|
|
||||||
14
todo-recipes/latex.md
Normal file
14
todo-recipes/latex.md
Normal file
|
|
@ -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}
|
||||||
|
```
|
||||||
31
todo-recipes/nix.md
Normal file
31
todo-recipes/nix.md
Normal file
|
|
@ -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'
|
||||||
|
```
|
||||||
|
|
||||||
22
todo-recipes/pdf.md
Normal file
22
todo-recipes/pdf.md
Normal file
|
|
@ -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}
|
||||||
|
```
|
||||||
|
|
||||||
9
todo-recipes/selinux.md
Normal file
9
todo-recipes/selinux.md
Normal file
|
|
@ -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).
|
||||||
5
todo-recipes/svg-to-png.md
Normal file
5
todo-recipes/svg-to-png.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# SVG rasterization (to PNG)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rsvg-convert --keep-aspect-ratio -w 1024 -h 1024 infile.svg outfile.png
|
||||||
|
```
|
||||||
7
todo-recipes/vim.md
Normal file
7
todo-recipes/vim.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
10
todo-recipes/word.md
Normal file
10
todo-recipes/word.md
Normal file
|
|
@ -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
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue