// Personal website of
Chris Smith
About
Posts
Projects
3D Prints
Snippets
Snippets / How-tos
These are small snippets of code or other instructions that I find useful.
Android
Enable SQLite logging
CSS
Dark mode selector
Text area resizing
Docker
Volumes in a rootless container
Eleventy
Deploy assets in page bundles
Render templates in shortcodes and filters
Use ES modules
Firefox
Stop searching for single word domains
Stop using certain local fonts
Git
Tidy up merged branches
Go
Alternative YAML representations
Check if a string is an integer
Download a file
Extracting a Zip file
Generate a random string
Handling interrupts
Listing Files in a directory
Listing files recursively
Modify path of a URL
Read line-by-line
Reverse Part of a slice
Tests with golden data
GTK
Unicode input
HTML
Provide dark and light mode versions of images
HTTP
Redirect types
IDEA
Changing SQL scope
Java
Class file versions
JavaScript
Array intersection
Load JSON
Remove all child elements
Run code when document is loaded
Jetpack Compose
Mix Composables and Views
Override composition locals
Nginx
Allow CORS requests from certain origins
Log only partial IP addresses
Redirect to canonical domain
Serve WebP images
Pacman
Overwriting conflicting files
PDFTK
Splitting pages out of a PDF
PostgreSQL
Adding a new user and database
Systemd
Check calendar event formats
Listing available targets
Passing env vars to a service
Running a service on a cron-like timer
Thunderbird
Remove signature delimiter
TLS
Alert codes
X
Get symbolic names for keycodes
XXD
Convert hex to binary