Snippets are a handy productivity tool. However, if you use snippets a lot, you may run into an aliasing problem: something you have typed turns out to be a registered snippet. Your snippet engine fires, causing confusion. I found that using a comma as the leader key for my snippets solves the ambiguity really well. Comma has all the desirable properties: Comma is easily reachable as a key...
This note shows how I’ve configured home row mods (HRM) with Karabiner-Elements (KE). I developed this configuration to address shortcomings in solutions I’ve found on Internet, e.g., lost key presses or inability to press multiple modifiers simultaneously. It turns out, it is suprisingly non-trivial to implement such a popular mod as HRM. Configuration Here’s a snippet of the approach for co...
Problem This note is about a problem of efficiently storing 12 billion account IDs, which are 40-bit integers. I mean to use this set of integers in an event-processing service to filter out events that do not belong to an account in the set. I compare three popular data structures: Roaring bitmaps Bloom filters Elias-Fano encoding Theoretical limits Let’s calculate the theoretical ...
In this blog post: I describe the use of Lua coroutines in the context of Lua programming for Neovim. I provide generic converters from callback-based code for easy interaction with existing, non-coroutine codebases. The big pay-off of using coroutines is making asynchronous code significantly more readable. Motivation Neovim has adopted Lua as its de-facto config and plugin language ...
This note introduces the parsing recipe pattern. This Haskell parsing pattern addresses the newtype proliferation problem that arises with typeclass-based generic parsers like Cassava or Aeson. At the same time, the recipe pattern keeps the ergonomy of auto-deriving parsers. It’s a pattern I haven’t seen yet anywhere else as of December 2023 , and I think it could be a good addition to Haskell’...