Weeknotes 108
A better world
-
The war on beeps is taking the internet by storm, which is to say that three friends have separately told me they were inspired to disable “acoustic signals” on their own appliances after reading about mine. I see this as confirmation that a better world is possible.
-
On Wednesday the electricity went out briefly in my flat. When it came back on, all the appliances reverted to their factory settings and resumed beeping at every opportunity. I had no choice but to work my way around the kitchen turning off the beeps again, my face set in a grimace of determination. War on beeps!
-
I think this is largely rational behaviour but rest assured I’m keeping an eye on it.
-
I went to the dentist again and it was fine except for how disconcerting it is to have anything done to a tooth because your teeth are effectively connected to your skull and you can’t turn away. I worked up the courage to ask about the Blu Tack but there really was no good time.
-
Yesterday I hired a Zipcar Flex for the first time and took Nat on a romantic trip to the dump to drop off some bulky recycling.
Flex worked well but its per-minute pricing did introduce the background anxiety of how much every minute was costing; of course this cost exists in any other car too, but it’s usually abstracted away enough that I don’t think about it. Fortunately it was still cheap and I appreciated being able to use the car on our own schedule and drop it off wherever we wanted.
-
After 14 months of working on TruffleRuby I’ve rotated onto a different project called Ruby Conventions. We’re working on introducing mandatory MFA and gem signing to RubyGems which is turning out to be really interesting so far. I’ll miss working with my TruffleRuby teammates but everyone on the new team is similarly clever & friendly and the work is all new to me, which should help to give my sleepy brain a dose of novelty.
-
While implementing chapter 4 of Crafting Interpreters I decided, for variety’s sake, to have my tokeniser incrementally consume an
Enumerator
of characters — and produce anEnumerator
of tokens — rather than work with more mundane strings and arrays.A small obstacle was that the book’s Lox language requires two characters of lookahead, whereas
Enumerator
(and hence#each_char
) only provides one. I got around this by wrapping the underlyingEnumerator
in an object which supports external iteration with arbitrary lookahead:class LookaheadIterator def initialize(enumerator) self.enumerator = enumerator self.buffer = [] end def peek(lookahead: 0) until lookahead <= buffer.length buffer.push(enumerator.next) end if lookahead < buffer.length buffer.slice(lookahead) else enumerator.peek end end def next if buffer.empty? enumerator.next else buffer.shift end end private attr_accessor :enumerator, :buffer end
I find this elegant and satisfying:
#peek
transparently delegates to the underlyingEnumerator
whenever possible, but otherwise advances it just far enough to answer the question while filling a buffer for future queries. It’s a bit of a shame that Ruby doesn’t already include something like this but it was fun to roll my own. -
I do most of my recreational writing & programming in Vim on an iPad while SSHed into a Screen session elsewhere. One inconvenience is that Screen’s connection to the iPad’s forwarded
ssh-agent
goes stale when I reconnect, so I have to retype a passphrase to decrypt a remote SSH key every time Igit fetch
orgit push
, which gets sort of tedious after a while.It finally became annoying enough that I searched for solutions and settled on putting this in my
~/.zshrc
:if [[ -S "$SSH_AUTH_SOCK" && ! -h "$SSH_AUTH_SOCK" ]]; then ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock fi export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
Symlinking the socket is a pretty blunt instrument which won’t work in more complicated cases but it’s made my simple life easier for now.
-
No mice yet. 🐁 👀