Six refactors that caught real bugs

by Nikolay Bryskin

7 min read

I had a working scraper. A few thousand articles, an embedding model, some analysis scripts. It ran, it produced numbers, and it was riddled with the sort of smells you tell yourself you'll clean up later: a boolean flag here, a bare tuple there, a two-hundred-line main().

So I cleaned them up, expecting a cosmetic hour. Instead, four of the six refactors uncovered a bug that was live in the code at that moment, and the other two made a class of bug unrepresentable. The smells weren't cosmetic. They were the places where the code was vague about what it meant, and the bugs had moved into exactly those places.

Continue reading →

My SSH tunnel survived 3 minutes dead

by Nikolay Bryskin

10 min read

I killed the process holding an SSH tunnel, waited three minutes, and brought it back. Same pid, same socket, same encrypted session. The forwards started carrying traffic again on the first request, and the machine on the other end never learned that anything had happened.

That should not work. SSH has no session resumption: the keys are negotiated once per connection and live only in the memory of the two processes. There is no ticket to present, nothing to reconnect with. And yet the connection came back, because "lives only in memory" turns out to be a much weaker statement than it sounds.

Continue reading →

Battery over WiFi

by Nikolay Bryskin

11 min read

Part one ended with a mouse plugged into one computer and working on another: netevent reading /dev/input/event8 on a little ARM board, a socket-activated stream over Tailscale, a uinput clone on the laptop. The cursor moves, the mouse never found out.

It left one thing behind. The G502 is wireless — it has a battery, it knows how full that battery is, and it tells anyone who asks. On the laptop, the power panel lists the internal battery, the USB-C sources, a Bluetooth keyboard. The one power source I actually hold in my hand is the only one that isn't there.

Continue reading →

More posts can be found in the archive.