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-y
browse through kill ringM-.
go to definition
Emacs Repeating commands
C-x z
repeatC-x <ESC> <ESC>
repeat-complex-commandC-x (
andC-x )
to record macro,C-x e
to run it
Org
C-c .
For inserting a plain timestampC-c C-s
For inserting a schedule dateC-c C-d
For inserting a deadline- With the cursor on the checkbox,
C-c C-c
for ticking it.C-c C-x C-b
if 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-display
for showing literal links in org-mode
Marks
M-@
mark wordC-M-@
mark balanced expressionM-h
mark to beginning of paragraphC-M-h
mark defunC-x h
mark to beginning of the bufferC-u C-<SPC>
to pop/move up a previous mark
(Custom) Movement
C-; char
avy jumps to a wordC-: char
avy jumps to a charC-M-; char
avy jumps to a char in the current line
Dired
R
to rename single file, or move selected filesv
for a quick view (read only mode),q
to quit