william

Keep Calm and Markdown.

Screen capture on a LAN web app needs https, and macOS refuses a lazy self-signed certificate

My team’s internal portal runs on plain http on the LAN, at http://192.168.1.82:8888. I wanted its note editor to grab a screenshot of another window straight from the browser, Flameshot-style, with getDisplayMedia(). On that address the API isn’t there at all: browsers only offer screen capture in a secure context, and an http page on a LAN IP is not one.

The fix is https next to http, with a certificate signed by a small local CA that each computer trusts once. My first attempt, the usual one-line self-signed openssl req -x509, made the wrong kind of certificate: a CA certificate with no serverAuth usage, which Apple’s rules reject.

Profiling Neovim on big logs: a growing 87 MB log froze the UI 11 s out of every 15

After the startup pass, the slowest thing left in my Neovim was big log files. ~/log holds logs from 0.5 MB to 136 MB. The one I read most is 87 MB: 176,939 lines of about 500 characters, growing by about 2 lines a second while I read it. Opening it took 1.9 s before Neovim accepted a key. n, /, typing and <Esc> each stalled. Just reading the log while it grew froze the UI for about 11 of every 15 seconds.

No single plugin was to blame. Several separate pieces of work grew with the file, and one key mapping slowed n in every file. Medians of 5 runs in a real terminal:

before after
open the 87 MB log until keys are accepted 1857 ms 199 ms
n 523 ms 21 ms
UI blocked per 15 s while reading the growing log 10963 ms 0 ms

docker buildx: the builder had a proxy, the client didn't

My image build script started failing on its very first line, FROM python:3.10, with failed to fetch anonymous token ... TLS handshake timeout. The odd part: the buildx builder I use is created with a proxy for exactly this reason, and from another shell the same build worked.

The token request is not made by the builder. It is made by the docker buildx client in your own shell, using your shell’s proxy variables. My interactive zsh exports none, so that one request went direct and timed out. Two export lines in the build script fixed it.

Logging a full pandas DataFrame from an f-string: rebuild it from the caller's source

A daily script of mine logs its intermediate DataFrames with log.crt(f"""...{tgt = }..."""). The log showed 10 of the 90 rows, with the header stuck to the end of tgt = . Switching to tgt.to_string() printed every row, but the header ended up two columns left of the data.

The fix I ended up with keeps the f-string as it is and adds one argument: log.crt(f"...{tgt = }...", full=True). That looks impossible, because the f-string is already built when the logger runs. The logger gets around it by finding the f-string in the caller’s source and evaluating it a second time.

Fixing duplicated tmux status bars and missing icons in Termius on iPhone

My tmux status bar looked fine on Linux, but connecting to the same session from Termius on my iPhone left repeated copies of the bar at the bottom of the screen. Moving it to the top was a useful workaround. I wanted to keep it at the bottom and keep the desktop’s colors and useful widgets.

The fix was a compact renderer for clients below 100 columns, followed by a targeted replacement for an icon the phone could not render. This extends my one-job status renderer: the phone still uses one status job, and a desktop attached to the same session keeps its full layout. The app is Termius, although I initially called it Terminus.

Profiling Neovim startup: lazy-loaded plugins that weren't lazy

Update 2026-10-17: the next pass looked at big log files, and found an nc mapping that made every n wait timeoutlen (500 ms) in every file. See Profiling Neovim on big logs.

After tmux and zsh, I looked at Neovim. My config has grown to 138 plugins on lazy.nvim and LazyVim. Almost every spec has an event, cmd or keys, so I assumed most of them were lazy. They weren’t: 89 of the 138 plugins loaded at startup.

None of the causes was a slow plugin. They were config mistakes that only show up once you ask lazy.nvim why each plugin loaded. I fixed them in two rounds:

before after
CPU time to first screen, opening a new file ~150 ms ~120 ms
CPU time to first screen, no file (dashboard) 69 ms 50 ms
plugins loaded at startup 89 73
0%