# spellbook notes for things i find myself searching for over and over. i know they're faster to find here than somewhere else. ## ffmpeg - convert a bunch of stils into a webm file ```bash ffmpeg -framerate 30 -i name%4d.webp -c:v libvpx-vp9 -pix_fmt yuva420p -lossless 1 out.webm ``` - reverse ```bash ffmpeg -i input.webm -vf reverse reverse.webm ``` - stitch two files together ```bash > cat input.txt file 'one.webm' file 'two.webm' ffmpeg -f concat -i input.txt -c copy output.webm ``` ## imagemagick - see [tkacz.pro] also - rotate ```bash convert INPUT_FILE -rotate "+90" OUTPUT_FILE ``` - resize ```bash convert INPUT_FILE -resize 70% OUTPUT_FILE convert INPUT_FILE -resize 640x480 OUTPUT_FILE ``` use `mogrify` for processing multiple files at once generally - invert colors ```bash convert INPUT -channel RGB -negate OUTPUT ``` - make transparent ```bash convert INPUT -transparent white OUTPUT ``` ## vim profiling: ```bash :profile start profile.log :profile func * :profile file * " At this point do slow actions :profile pause :noautocmd qall! ``` ## linux special characters first, choose a compose key in your os keyboard settings. i set mine to the right alt key. - For ë you press Compose+", e. - For ẽ you press Compose+~, e. - For ô you press Compose+^, o. - For á you press Compose+', a. - For à you press Compose+`, a. - For € you press Compose+=, e. - For £ you press Compose+-, l. ## ubuntu/debian ### dist upgrade ```bash sudo apt update sudo apt upgrade sudo apt dist-upgrade sudo apt autoremove sudo do-release-upgrade sudo reboot now ``` sometimes after that there are some random dpkg / apt errors: ```bash sudo dpkg --configure -a sudo apt --fix-broken install ``` ## add desktop launcher (popos) - example file in `/usr/share/applications/wally.desktop` ```bash [Desktop Entry] Type=Application Name=Wally Comment=USB Flasher for Ergodox EZ Version=3.0.23 Exec=/usr/local/bin/wally Icon=/opt/wally/appicon.png Terminal=False Categories=Firmware ``` ### clean up ```bash sudo apt-get clean sudo apt-get autoremove --purge ``` ## arch linux These are some notes for myself when setting up arch. ### pacman #### setup before you can use the package manager `pacman` you need to run: ```bash pacman-key --init ``` This sets up your ability to set some keys and then use them to check the fingerprints on packages you're going to install. If you're on a raspberry pi, you'll need to add the keys for `archlinuxarm` in particular: ```bash pacman-key --populate archlinuxarm ``` Thereafter you can go about installing whatever you need. If you need to remove all the keys you have added to start over, you can: ```bash rm -rf /etc/pacman.d/gnupg ``` before running the init again. ### base packages In order to get make, and a bunch of basic tooling: ```bash pacman -S base-devel ``` ### AUR client I always need to download some AUR packages. Usually we still need to download a client: ```bash git clone https://aur.archlinux.org/yay.git cd yay makepkg -si ``` ## PopOS Sometimes my system76 laptop's audio just stops working. This seems to fix it: ```bash systemctl --user restart pulseaudio rm -r ~/.config/pulse pulseaudio -k ``` ### Setup LUKS + GNOME Keyring for one password unlock 1. **Edit `/etc/crypttab`** ``` cryptdata UUID= none luks,keyscript=decrypt_keyctl ``` 2. **Edit `/etc/pam.d/common-password`** Add or update this line: ``` password optional pam_gnome_keyring.so use_authtok ``` 3. **Rebuild initramfs and reboot** ```bash sudo apt install initramfs-tools sudo update-initramfs -k all -c sudo reboot now ``` I got this from [reddit] ### inserting emojis I can _never_ remember this: - `Ctrl + Shift + E + Space`: then search via word tags ## disk space ```bash df -h du -h -d 1 . --exclude proc ``` journal logs ```bash journalctl --rotate journalctl --vacuum-size=100M journalctl --vacuum-time=10d ``` docker ```bash docker system prune -a docker volume prune -a ``` snap ```bash snap set system refresh.retain=2 ``` ## parted resize /manage partitions ``` parted ``` - `print` - `resizepart 100%` ## btrfs scrub ```bash btrfs scrub start -B / ``` check / investigate ```bash btrfs filesystem show btrfs filesystem df / btrfs filesystem usage / ``` resize disks if partitions are wrong ```bash # numbers are each device btrfs filesystem resize 1:max / btrfs filesystem resize 2:max / ``` migrate raid type ```bash # begin balance - d is for data, m is for metadata btrfs balance start -dconvert=raid1 -mconvert=raid1 / # monitor btrfs balance status / ``` ## memory sometimes you run out of memory on tiny machines. don't forget to use swap! ```bash sudo fallocate -l 1G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile sudo swapon --show sudo cp /etc/fstab /etc/fstab.bak echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab cat /proc/sys/vm/swappiness sudo sysctl vm.swappiness=10 ``` ## doas - install doas with your package manager - modify `/etc/doas.conf` as root - example contents for user `lemongrab` and group `candy` ```doas permit persist lemongrab as root permit nopass lemongrab as root cmd apt permit nopass lemongrab as root cmd apt-get permit persist :candy as root ``` then just use doas instead of sudo ## dmidecode a tool for looking at ram slots without opening your computer. see how many slots you have on your hardware, maximum ram ```shell sudo dmidecode -t 16 ``` see whats in them ``` sudo dmidecode -t 17 ``` ## proxmox setup - note the debian version might change when revisiting this - add no subscription to `/etc/apt/sources.list.d/pve-no-enterprise.list` ``` deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription ``` - comment out or delete `/etc/apt/sources.list.d/pve-enterprise.list` - comment out or delete `/etc/apt/sources.list.d/ceph.list` - proxmox otherwise tries to use their special enterprise lists o ## avahi - for when you dont want to remember the IP everytime - allows you to use the hostname.local for discovery/ssh - ```bash apt-get install avahi-daemon cp /usr/share/doc/avahi/daemon/examples/ssh/service /etc/avahi/service systemctl service start avahi-daemon.service ``` ## cloud init - - 8000 is arbitrary, as is 135 ```bash wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img qemu-img resize jammy-server-cloudimg-amd64.img +2G # Create new vm qm create 8000 --memory 2048 --core 2 --name ubuntu-cloud --net0 virtio,bridge=vmbr0 # Import the the image qm importdisk 8000 jammy-server-cloudimg-amd64.img local-lvm # Create a fake disk, attach to the cloud init, set boot, enable serial/vga for vnc terminal qm set 8000 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-8000-disk-0 qm set 8000 --ide2 local-lvm:cloudinit qm set 8000 --boot c --bootdisk scsi0 qm set 8000 --serial0 socket --vga serial0 # Save as template qm template 8000 # now setup cloud init things like username, ssh, dhcp versus static # Deploy as nodes qm clone 8000 135 --name kropotkin --full qm clone 8000 136 --name bakunin --full qm clone 8000 137 --name graeber --full # start them all for i in 135 136 137; do qm start $i; done # destroy them all for i in 135 136 137; do qm stop $i && qm destroy $i; done ``` ## openpgp / gpg ### expiration for better or worse, OpenPGP keys expire. here is how i update that. ```shell gpg --list-keys gpg --edit-key (key id) ``` you may need to select a subkey with `key 1` for example. then ```shell gpg> expire (follow prompts) gpg> save ``` then ```shell gpg --keyserver keys.openpgp.org --send-keys (key id) ``` i realized that thunderbird also has a keymanager that can help here too. ## Makefile Declare all targets PHONY, basically: ```makefile MAKEFLAGS += --always-make ``` ## termux termux uses `pkg` which i think underlying uses `apt`. so debian sources of sorts can be added in the same way, in /etc/apt/sources.d - however the root location of these things are always in `/data/data/com.termux/files/`, which is set to a special variable `$PREFIX` in your shell. setting up ssh ```bash pkg install openssh # generates a key for you cp /data/data/com.termux/files/usr/etc/ssh/some_key* ~/.ssh/ ``` setting up storage access ```bash termux-setup-storage ``` changing font (e.g. to a patched font) ```bash mv something.ttf ~/.termux/font.ttf ``` when using neovim, the mason-lsp installer sometimes can't find a version of the binary that fits the architecture of the phone. this wrapper script helps install language servers into the right location for mason to use: - also: consider buying the termux:style app for $2 to support the developer :) or downloading it for free: https://wiki.termux.com/wiki/termux:styling ## bluetooth controllers Fix for PS3 Controller bluetooth not working on Linux: * edit `/etc/bluetooth/input.conf` * uncomment `ClassicBondedOnly=true` and change to `ClassicBondedOnly=false` * restart bluetooth: `systemctl restart bluetooth` ## graphics Graphics issues when booting? Get previous boot `dmesg` output: ``` journalctl -o short-precise -k -b -1 ``` Gemini Links: => gemini://metasyn.pw/index.gmi index and recent changes => gemini://metasyn.pw/directory.gmi directory of all pages Web Links: => https://tkacz.pro/some-useful-convert-imagemagick-commands tkacz.pro => https://www.reddit.com/r/pop_os/comments/uhj78q/comment/ix87a2u reddit