Piping output to a pager

When you run git diff on a project where you’ve made more than a screenful of changes, the output is automatically redirected to a pager and you can browse through your changes using the familiar less interface. This post shows a minimal example piping output to less. To achieve…

Myers' Diff Algorithm in Clojure

If you’re a programmer, you’re probably fairly comfortable with understanding and interpreting diff patches of the kind that git and other version control systems use. In this post we’ll walk through a Clojure implementation of the Myers’ diff algorithm, which is the algorithm used by Git. I…

Summary of Recent Reading(July-September 2019)

* The Little Elixir & OTP Guidebook by Benjamin Tan Wei Hao: an introduction to the Elixir programming language and the OTP framework that comes with it. It focusses on Elixir’s concurrency features and shows you what OTP can do(the book mostly focusses on GenServers and Supervisors) without spending…

Summary of recent reading(April-June 2019)

* Peak by Anders Ericsson and Robert Pool: a book on deliberate practice by one of the researchers who originally coined the term. This book lays out a framework for how to achieve expertise. Briefly, this goes as follows: identify what skills and mental representations an expert possesses, design a step-by-step…

Summary of recent reading(January-March 2019)

* Messy by Tim Harford: how pursuing tidy systems is harming us and why we should embrace messy systems that better reflect the unpredictableness of the real world. The systems in question can be anything from how you organize your inbox to how cities are laid out. Although it struck me…

Disk-based algorithms

I have lately been studying how databases work under the hood. There are many problems that a database has to solve. At the moment, I’ve been having fun exploring how data is stored on disk. Previously, I wrote about how a hashtable is stored on disk. This post is…

Implementing a Key-value Store, Part 2

In the last post, I introduced the idea of linear hashing. This post will describe a Rust implementation of the algorithm. I won’t go through every last line of code, but hopefully enough to give you a good understanding of how the whole thing works. I should also mention…