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

DailyBrief only worked on my disk, so I split install from per-user data
The packaged exe held my own OneDrive path and the pipeline rewrote the app's HTML page. One env var, DAILYBRIEF_DATA, now separates a read-only install from each Windows user's data.
In short
- A packaged build pointed at one hardcoded project path, and the daily pipeline also rewrote the app's own HTML page with each day's plan.
- I separated an install root (read-only, shared) from a data folder under the user's app data, chosen once in main.js and passed to every script as DAILYBRIEFDATA.
- Running a script by hand without the variable still works, because the data folder falls back to the script folder.
#electron#packaging#powershell#architecture
·6 min read

DailyBrief · Story
Georgian text turned into mojibake, and I repaired it with a reversed cp1252 table
UTF-8 read as Windows-1252 turned my Georgian task titles into Latin garbage. A Latin-1 round trip cannot undo it, so the fix is cp1252's own table reversed, with guards that never touch good text.
In short
- An older version of my PowerShell scripts read UTF-8 as Windows-1252 and saved the result back as UTF-8, so Georgian text turned into Latin-looking garbage.
- A Latin-1 round trip cannot undo it, because cp1252 maps bytes 0x80-0x9F to characters outside Latin-1, and Georgian UTF-8 is full of those bytes.
- The repair is a reverse table plus two safety checks, and it runs on read, so the files heal themselves.
#encoding#utf-8#electron#powershell#georgian
·6 min read

My video compressor picks a GPU encoder from a list, and never asks the GPU
ffmpeg -encoders lists what the build contains, not what the machine can run. Reading my own encoder selection code, I found a silent CPU fallback, two option vocabularies and a discarded error.
In short
- Hardware encoder choice is a substring check on ffmpeg -encoders, which lists what the build contains, not what the machine can run.
- A missing encoder silently falls back to libx264 or libx265, and the encoder options differ between the software and hardware paths.
- When a hardware encode fails, the only message the user gets is FFmpeg exited with code N.
#electron#ffmpeg#nvenc#error-handling
·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
·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

DailyBrief's board file only grew, so I added a daily compactor that moves, never deletes
Every AI run in DailyBrief reads kanban.json, and that file only ever appended. A 169-line PowerShell script now moves old notes and finished tasks into an archive once a day, losslessly.
In short
- kanban.json was append-only, and every digest and AI check re-read all of it, so each run cost more than the last.
- core/compact-kanban.ps1 moves old aiNotes and tasks finished or deleted more than 30 days ago into kanban-archive.json, once a day, under the board lock.
- Nothing is deleted: items move whole with their comments and ids, the script is idempotent, and it writes the archive before it shrinks the board.
#powershell#electron#json#performance#data-retention
·5 min read

DailyBrief · Story
My workspace on G: was invisible to DailyBrief, and the fix exposed a 3 minute scan
Every scan root was hardcoded under the user profile, so a workspace on another drive never showed up. Making folders configurable meant fixing a walk that entered every node_modules first.
In short
- The scan roots were a hardcoded list of folders under %USERPROFILE%, so a workspace on another drive was invisible to every script.
- Get-ChildItem -Recurse entered every nodemodules and .git folder and filtered the results afterwards; the source comment in core/walk.ps1 puts that at three minutes per monitor run on G:\Desktop.
- A shared roots.ps1 now feeds every script, a pruned walk never enters dependency folders, and removing a folder no longer triggers a full rescan.
#powershell#filesystem#performance#electron
·5 min read

DailyBrief's run estimate averaged two programs, so I switched to a median by kind
The pre-run cost estimate averaged the last 10 runs, including ones from before the lean runner and slow outliers. A median over same-kind lean runs fixed it, with tests.
In short
- estimateRun averaged the last 10 ok runs of a mode, mixing pre-lean runs, slow outliers, and per-project checks with whole-board checks.
- The replacement is a pure module, src/estimate.js: lean-era runs only, the median of the newest 9, and runs of the same kind when there are at least 2 of them.
- Seed defaults were re-measured per kind of check, and five node:test cases pin the behaviour.
#javascript#electron#testing#estimation