diff --git a/how_to b/how_to index a3c7e6f..9553431 100644 --- a/how_to +++ b/how_to @@ -218,6 +218,8 @@ PDF : Extract pages : pdftk input.pdf cat output out.pdf # range can be -, more info at pdftk --help + Uncompress pdf file content : + pdftk input.pdf output output.pdf uncompress Add images and other files in a single pdf: convert [jpg|png|txt|pdf|...] output.pdf # Might need to tweak /etc/ImageMagick-7/policy.xml @@ -225,6 +227,8 @@ PDF : Fill form & annotate: For well formatted interactive forms: evince + For Adobe type forms (AcroForm / XFA): + pdfjs # (supports forms since 2.6.347 / firefox 81) For non-interactive PDF: xournal libreoffice Draw @@ -370,6 +374,16 @@ Video and audio editing: xdotool selectwindow getwindowgeometry | awk '/Position/{printf $2" "$4" "} /Geometry/{printf $2" "}' | sed 's/)//' | read OFFSET SCREEN SIZE; ffmpeg -video_size $SIZE -framerate 30 -f x11grab -i "$DISPLAY.$SCREEN+$OFFSET" -vf "scale=2*trunc(iw/2):-2,setsar=1" -pix_fmt yuv420p out.mp4 Filter doc: # https://trac.ffmpeg.org/wiki/FilteringGuide + Create captioned gif from mp4: + # https://nickcanzoneri.com/ffmpeg/gif/2018/11/20/captioned-gifs-with-ffmpeg.html + # https://stackoverflow.com/a/14283648 // recale + # https://video.stackexchange.com/a/20106 // font style + text.srt: + 1 # Sequence number + 00:00:00,000 --> 00:00:01,900 # Start and end timestamps + Your text here # Actual text + # Mandatory empty line + ffmpeg -i in.mp4 -vf "scale=512:-2:flags=lanczos,split[x][z];[z]palettegen[y];[x][y]paletteuse,subtitles=text.srt:force_style='FontName=Oswald,Fontsize=80,FontWeight=Bold'" -r 10 out.gif ImageMagick: crop to aspect ratio @@ -402,13 +416,23 @@ Mount as user: sudo chown /mnt Borg backup: - borg init --encryption=repokey-blake2 - borg create -v --stats --progress --compression zlib "/mnt//home/::{now}" /home/ + # Example repo: /mnt//home + # Dry run: -n + # Avoid mixing users in single repo (don't create archives from different users in a single repo) + [sudo] borg init --encryption=repokey-blake2 + borg create -v --stats --progress --compression zlib --exclude ~/.local/share/Steam "::{now}" /home/ + sudo borg create -v --stats --progress --compression zlib "::etc-{now}" /etc + sudo borg create -v --stats --progress --compression zlib --exclude /var/cache --exclude /var/tmp "::var-{now}" /var borg list borg check --verify-data --progress borg mount borg prune -v --list --keep-daily=7 --keep-weekly=4 --keep-monthly=6 + # Restoring + borg list + borg mount ::"" /mnt/borg + borg umount /mnt/borg + Serial terminal st -l /dev/ttyUSB0 @@ -564,6 +588,8 @@ Maildir tweaking: for f in new/*; do mv "$f" "cur/${f##*/}:2,S"; done # ${f##*/} removes path prefix. # ":2,S" is a maildir suffix (S=seen) + Cleanup maildir folder after messing around (requires mblaze): + mlist | mrefile Install 64 bits kernel on 32 bits system (and 64 bits hardware) (bad idea) wiki.archlinux.org/index.php/Migrating_between_architectures @@ -892,3 +918,51 @@ MacOS survival guide (Because the "user friendly" OS has worse affordances than Release Maximizing window WITHOUT fullscreen Double click window title bar + +Mounting .bin/.cue image files: + $ sudo pacman -S bchunk + $ bchunk file.bin file.cue output + $ sudo mount output01.iso /mnt -o loop,ro + +Manual IMAP connection: + # https://www.atmail.com/blog/imap-101-manual-imap-sessions/ + # https://stackoverflow.com/questions/14959461/how-to-talk-to-imap-server-in-shell-via-openssl + + $ openssl s_client -connect :993 -crlf [-quiet] + $ openssl s_client -connect :143 -crlf -starttls imap [-quiet] + # IMAP needs an incrementing prefix before each command + A1 login "" + # list everything + A2 list "" "*" + # list everything under a particular prefix + A3 list "INBOX" "*" + A99 logout + +gdb tricks: + Easily print attributes of array elements: + # https://agateau.com/2008/gdb-trick-the-poor-man-loop + (gdb) set $pos = 0 + (gdb) print foo[$pos++].attribute + (gdb) + (gdb) + ... + Or use a real loop: + (gdb) set $i = 0 + (gdb) while ($i < ) + > print foo[$i++].attribute + > end + +Non-standard zsh cd trick: + # https://dataswamp.org/~solene/2020-09-04-cd-command.html + $ pwd + /tmp/pobj/foobar-1.2.0/work + $ cd 1.2.0 2.4.0 + /tmp/pobj/foobar-2.4.0/work + +Check for available package updates with Arch/Artix: + sudo pacman -S pacman-contrib + checkupdates + +Git push and pull using different URL/protocols: + # https://www.scivision.dev/git-pull-https-push-ssh/ + git config url."git@example.org:user/".pushInsteadOf "https://example.org/user/"