Cheat sheet
This is a ever growing list of commands that I discovered while searching for quick ways for doing stuff on my computer. I use it as a reference more often then I would like :v.
Terminal
- Temporarily disable sleep on lid close:
systemd-inhibit --what=handle-lid-switch sleep 1d
Printer
- Print file:
lp -d EPSON_L3110_Series file - List printers:
lpstat -p -d - CUPS server address: http://localhost:631/
Image processing
- Add a few null bytes to the end of af file to change it's MD5 signature:
truncate -s +10 <yourfile>.<ext>
- Cut black borders out of images:
mogrify -fuzz 4% -define trim:percent-background=0% -trim +repage -format jpg image.jpg
- Downscale video to 720p:
ffmpeg -y -i "file.mp4" -vf "[in]scale=iw*min(480/iw\,320/ih):ih*min(480/iw\,320/ih)[scaled]; [scaled]pad=480:320:(480-iw*min(480/iw\,320/ih))/2:(320-ih*min(480/iw\,320/ih))/2[padded]; [padded]setsar=1:1[out]" -c:v libx264 -c:a copy "shrink.mp4"
Losseless gif:
- Generate pallete:
ffmpeg -y -i image.png -vf palettegen palette.png
- Generate lossless gif:
ffmpeg -y -i images.png -i palette.png -filter_complex paletteuse -r 10 file.gif
Emacs
- Emacs learn on topic
M-<TAB>completion-at-point (with corfu)M-ybrowse through kill ringM-.go to definition
Emacs Repeating commands
C-x zrepeatC-x <ESC> <ESC>repeat-complex-commandC-x (andC-x )to record macro,C-x eto run it
Org
C-c .For inserting a plain timestampC-c C-sFor inserting a schedule dateC-c C-dFor inserting a deadline- With the cursor on the checkbox,
C-c C-cfor ticking it.C-c C-x C-bif your cursor is in the line of the tickbox. C-c 'for editing the source code block- Insert source code blocks fast with (
C-c C-,) (doesn't work for html) org-toggle-link-displayfor showing literal links in org-mode
Marks
M-@mark wordC-M-@mark balanced expressionM-hmark to beginning of paragraphC-M-hmark defunC-x hmark to beginning of the bufferC-u C-<SPC>to pop/move up a previous mark
(Custom) Movement
C-; charavy jumps to a wordC-: charavy jumps to a charC-M-; charavy jumps to a char in the current line
Dired
Rto rename single file, or move selected filesvfor a quick view (read only mode),qto quit