Case studies
#powershell#debugging#windows#electron#docker#pterodactyl#python#csharp#wpf#bash#security#cpp#git#performance#ci#nodejs#pyside6#react-native
80 posts
·5 min read

Rust image for Pterodactyl: sizing cargo jobs from the cgroup CPU quota
Cargo counts the host's cores, not the container's quota. The Rust yolk reads cpu.max, pins the toolchain and finds the binary through cargo's JSON output.
In short
- Cargo sizes its parallelism from the host's core count, but a Pterodactyl container is capped by a cgroup CPU quota, and every extra rustc job costs memory at the peak of a build.
- The start script reads /sys/fs/cgroup/cpu.max, rounds the quota up to whole CPUs and exports it as CARGOBUILDJOBS unless the user already set it.
- Two smaller decisions made the image behave: pinning RUSTUPTOOLCHAIN against a project's rust-toolchain.toml, and asking cargo for JSON output to find the binary to run.
#docker#rust#cgroups#pterodactyl
·5 min read

Pterodactyl yolks · Story
Vaultwarden on a game-server panel: hashing the admin token at every start
A panel variable should be something a person can type. The Vaultwarden image hashes the admin password with argon2 on each boot, and unsets the token when the field is empty.
In short
- The panel variable VWADMINPASSWORD is hashed with the argon2 CLI at each start and exported as ADMINTOKEN; an empty variable unsets the token and disables /admin.
- The image is the official Vaultwarden one, re-based to run as an unprivileged container user, with all state under /home/container/data and the port taken from the panel's allocation.
- The script also warns when a saved config.json exists, because settings saved on the admin page override the panel's variables, and it turns a bare domain into an https:// one.
#docker#bash#vaultwarden#pterodactyl#argon2
·5 min read

DailyBrief · Story
I made the wheel pan a kanban board, then cut it down to Ctrl+wheel two months later
A careful wheel handler that scrolled a column first and the board second still felt wrong. I replaced 21 lines with 10 and paid for it with Ctrl+wheel zoom over the board.
In short
- On 25 Aug (dfd8ecd) a plain wheel over the board panned it sideways once the column under the cursor had nothing left to scroll. On 26 Oct (8cf68ae) I replaced that with Ctrl+wheel only.
- The old handler needed a loop up the DOM tree to ask each element whether it could still scroll. The new one has no such guesswork; the commit diff is 10 lines added and 21 removed.
- Ctrl+wheel was already the zoom gesture, so the handler calls preventDefault() and the window loses wheel zoom while the cursor is over the board. I kept that trade and documented it in the zoom hint.
#electron#javascript#ux#scrolling
·5 min read

A .task note is a zip: one file for text and images, saved by swapping a temp file
A TaskPad note that keeps its screenshots: a zip with note.txt and images/, a per-path cache while open, and the guards a zero-byte file and hostile entry names needed.
In short
- A .task file is a ZIP holding note.txt, an images/ folder and a one-byte format marker, so a note and its pictures travel as one file.
- While a note is open it is unpacked to a per-path cache folder; saving first copies stray images in, then writes a temp file and swaps it over the original.
- The edge cases that needed code: a zero-byte file created by Explorer, duplicate image names, and entries that try to climb out of the cache folder.
#csharp#wpf#file-format#zip
·6 min read

Removing a work folder in DailyBrief no longer triggers a full disk rescan
Saving the work-folder list used to rescan every root, even when I only removed one. The fix compares the effective root sets before and after and rescans only when a folder was gained.
In short
- Every save of the work-folder list cleared the cache and started a project discovery run plus a monitor run, including saves that only removed or switched off a folder.
- The handler now builds the effective root set before and after the save and rescans only if the new set contains a root the old one lacked.
- A removal now just saves, and the UI says its projects leave the list at the next scan, within 30 minutes.
#electron#nodejs#performance#powershell
·5 min read

TaskPad reminders: a time window instead of a flag, and a five-way hotkey fallback
TaskPad rings deadlines from the tray every 30 seconds. The design choice was to ask which deadlines fell inside the last tick, not which are overdue, plus a global hotkey that falls back through five shortcuts.
In short
- Reminders check a half-open window (last tick, now], so a deadline rings once, when it arrives, and old overdue tasks stay quiet.
- Timed deadlines get a second notification 15 minutes ahead, tracked in an in-memory set keyed by file, text and time.
- The quick-capture hotkey tries five combinations in order and uses the first one Windows lets it register.
#csharp#wpf#win32#notifications#design
·5 min read

A Jellyfin image that finishes its own setup wizard from the start script
A fresh Jellyfin server is open to whoever reaches the setup wizard first. My Pterodactyl image closes that gap by completing the wizard over HTTP from a background shell function.
In short
- Jellyfin reads its port from config/network.xml, so the start script rewrites that file on every boot to match the panel allocation.
- A background function polls the server, and if the wizard is still open it completes it with an admin account taken from environment variables.
- If the password variable is empty the script does nothing and says so, rather than inventing a default password.
#docker#bash#jellyfin#pterodactyl#security
·5 min read

TaskPad hot exit: debounced backups, an atomic session file, splits as text
Closing TaskPad never asks to save. How Session.cs keeps unsaved text across a crash: a two second debounce, a temp-file swap, ordered cleanup and a layout string like (H 0 (V 1 2)).
In short
- Session.cs writes a small tab-separated session file plus one backup-N.txt per document that has unsaved or untitled text, debounced two seconds after each edit.
- The session file is written to a temp file and swapped in with File.Replace, and stale backups are deleted only after the new file is in place.
- Window splits are saved as a tiny text language, for example (H 0 (V 1 2)), and a parse failure falls back to one empty group instead of throwing.
#csharp#wpf#persistence#editor#reliability