Notes
Notes to refer back to at a later date.
git
-
After doing a large rebase check you only changed what you intended with no surprises using
git diff origin/branchname HEAD -- filenamebefore pushing back to origin. -
Before a history rewrite (squash, rebase,
reset --hard, …) drop a safety tag onHEAD:1 2 3git tag backup-refs HEAD # do the thing git tag -d backup-refs # once happy it workedTo recover if things go wrong:
1 2 3git log backup-refs # inspect the old state git diff HEAD backup-refs # compare against the new state git reset --hard backup-refs # restore the old stateThe tag keeps the old history reachable (reflog entries expire) and is trivially deleted. For a dated backup tag use
git tag backup-$(date +%Y%m%d) HEAD.
helix
- Multiline Cursors
- On instances of a word
Add word to search buffer with/<word>or*, select it with visual modeVand pressnto select the instances you want. Then enter insert mode with multiple cursors!
- On instances of a word
Librewolf
- When installing via homebrew on mac it raises an issue due to removal of the
--no-quarantineflag by brew. To get around this install as normal, but then run:Librewolf codeberg source1sudo xattr -r -d com.apple.quarantine /Applications/LibreWolf.app
pFUnit
- There is an implicit limit on test names of 36 characters.
The
@testmacro expands names to:and Fortran lines are limited to 132 characters. The 2023 standard raises the limit to 10,000 characters, and there exist compiler flags to adjust it.1call suite%addTest(makeCustomTest('<name>', <name>, testParameter))
Quarto
- To get a pdf of a quarto presentation from a browser use
decktape
.
- To preserve animations (somewhat) use:
1npx decktape reveal <slides URL> <output file>.pdf --pause 500 --fragments --progress
- To preserve animations (somewhat) use:
Server distribution upgrades
When upgrading the OS LTS version on a server these often happen and I have to remind myself of the fix each time.
- dpkg prompts about
.protoconf files (e.g./etc/postfix/main.cf.proto) These are safe to resolve either way: the.protofiles are just package templates, the live config is the file without the suffix. AnswerYto take the maintainer’s version; the old one is kept as*.dpkg-old. - Apache modules for old package versions can be left enabled after an upgrade, e.g.
php8.3.loadpointing at a.sothat no longer exists. Find them with:then swap to the installed version and restart:1 2 3apache2ctl configtest ls /etc/apache2/mods-enabled/ dpkg -l | grep -E 'libapache2-mod-php|php[0-9]+\.[0-9]+-cli'(1 2 3sudo a2dismod php8.3 sudo a2enmod php8.5 sudo systemctl restart apache2rcentries indpkg -lare just leftover configs from removed packages;sudo apt purgethem to tidy up.) This results in sites not showing, and apache warnings during the upgrade process. - Flask app venvs break when the system Python they were built with is upgraded. Recreate them and reinstall the app/requirements.