week 50, 2022

Writing a disk-based key-value store in Golang

I'd been mulling around reading a computer science paper and implementing a project based on it. Distributed systems, Networking and Databases are some of the things that fascinate me a lot. However, I had been looking to implement a more approachable project to avoid getting inundated initially. And I happened to chance upon the Bitcask paper through Avinash's project: CaskDB.

After giving a quick read of this reasonably short paper, I decided to write a Golang implementation of the same, as it looked like an exciting project.

Source: Writing a disk-based key-value store in Golang, an article by Karan Sharma.

Probability Monads from scratch in 100 lines of Haskell

I recently spent some time trying to learn Haskell, when I stumbled across the concept of probabilistic functional programming, originally based on this PFP library. Due to Haskell’s syntax sugar for monad computations, expressing probability distributions as monads allows you to implement something like a mini probabilistic programming language in less than 100 lines of code. I thought that’s pretty neat, so I decided to write this post that walks through a simple implementation from scratch.

Source: Probability Monads from scratch in 100 lines of Haskell, an article by Denny Britz.

Getting started with nmap

Nmap (Network mapper) is an open-source tool for network and security auditing. It is used for host and service discovery on networks and has a wide range of use cases. It can scan ports, discover live hosts, detect service and OS versions, runs vulnerability scans, and can be used with many scripts.

I'll show you the basics of nmap in this post. This is more than enough to get started.

Source: Getting started with nmap.

Using Org Mode to keep track of exercise

I have been using Org mode to keep a daily journal of useful notes for around a year now. One such type of note is the amount of exercise I’ve done on a particular day. While this is a useful record, I wanted to expand upon it and to produce a table at the end of each month so that I can track how I’m (hopefully) progressing.

This post details how I used Emacs, Org mode and a sprinkling of Elisp to do this.

Source: Using Org Mode to keep track of exercise.

A practical issue with YAML

These days, YAML is used as the configuration file format for an increasing amount of systems that I need to set up and operate for work. I have my issues with YAML in general (1, 2), but in the process of writing configuration files for programs that use YAML, I've found an entirely practical one, which I will summarize this way: a YAML schema description is not actually documentation for a system's configuration file.

Source: A practical issue with YAML: your schema is not actually documentation, an article by Chris Siebenmann.

The Lost Patient (2022)

The 19 years old Thomas wakes up in a hospital after three years in a coma. He doesn't remember anything. The psychologist Anna tells him that his family has been murdered and that he is the only survivor of the massacre while his sister Laura is still missing.

In the evening Esme and I watched The Lost Patient. I liked the movie and give it a 7.5 out of 10.

I also like the movie's French song Baisers Bizarre composed by Alex Beaupain. The female voice singing in this track is the actress Rebecca Williams who plays Laura in the movie.

Why I moved away from Poetry for Python

As with a simple Bash script, it started out simple enough and things mostly just worked. Over time though I started running into issues: Poetry would take an inordinately long time to resolve the required dependencies to install a package. Perhaps it was a one-off type of thing? Unfortunately not. It got to the point where I actively avoided using poetry to install dependencies and resorted to adding the dependency in pyproject.toml by hand, installing it locally using pip, and exporting the requirements as I did before8. At that point I felt invested enough that I just couldn’t ditch it entirely, that would mean a whole bunch of busywork just to root it out9.

Source: Why I moved away from Poetry for Python, an article by Üllar Seerme.

Building binary deb packages

A deb file is an archive that contains data. Marked with the .deb extension, it is used to easily distribute and install programs for Linux Debian and derivatives. Deb files are handy when your app needs to take care of additional dependencies, integrate itself with the desktop, run pre and post install scripts and so on.

In this quick tutorial I want to show you how to generate a deb package from scratch that will install a binary executable in the target system.

Source: Building binary deb packages: a practical guide.

Black Adam (2022)

Nearly 5,000 years after he was bestowed with the almighty powers of the Egyptian gods--and imprisoned just as quickly--Black Adam is freed from his earthly tomb, ready to unleash his unique form of justice on the modern world.

In the evening Alice, Esme, and I watched Black Adam. I was expecting something different. Still, the movie was OK and I give it a 7 out of 10.

Native Reflection in Rust

Today, I’m releasing deflect, an implementation of reflection for Rust. Deflect can be used to recover the concrete types of trait objects, inspect the internal state of async generators, pretty-print arbitrary data, and much more.

Source: Native Reflection in Rust, an article by Jack Wrenn.

SSH server hardening

We all know that it is important to secure your machines. I am going to show you some ways to do so. Some are trivial and should be set immediately, and some require some more work. Part 2 will follow with the advanced options.

Source: SSH server hardening.

Emacs: Context-aware yasnippets

Back in 2020, I wrote a semi-automatic yasnippet to generate Swift initializers. I say semi-automatic because it could have been a little smarter. While it helped generate some of the code, what I really wanted was full context-aware generation. The Swift struct already had a few properties defined, so a smarter yasnippet should have been able to use this info for code generation.

Source: Emacs: Context-aware yasnippets, an article by Álvaro Ramírez.

A Look at dyn* Code Generation

As I’ve written about before, an important goal for async Rust is to support async functions everywhere, including in trait objects (dyn Trait). To this end, we are adding a new experimental type called dyn* that will give us more flexibility to support dynamic dispatch for async methods. We now have experimental support for dyn* in nightly Rust now, so we can start to kick the tires and use our experience to inform future development.

Source: A Look at dyn* Code Generation, an article by Eric Holk.

Tips for analyzing logs

I’m going to talk about log analysis in the context of distributed systems debugging (you have a bunch of servers with different log files and you need to work out what happened) since that’s what I’m most familiar with.

Source: Tips for analyzing logs, an article by Julia Evans.