week 33, 2021

C++20 Concepts: The Definitive Guide

C++20 introduces concepts as a way to write powerful self-documenting templates. At their core, concepts are logical binary expressions that can be used to constrain the template parameters of any class or function template. These logical expressions are evaluated at compile time to determine whether the template parameters satisfy the given constraints.

Source: C++20 Concepts: The Definitive Guide, an article by Rajat Jain.


gitfs is a FUSE file system that fully integrates with git. You can mount a remote repository’s branch locally, and any subsequent changes made to the files will be automatically committed to the remote.

Source: What is Gitfs.

Large Rust Workspaces

In this article, I’ll share my experience with organizing large Rust projects. This is in no way authoritative — just some tips I’ve discovered through trial and error.

Source: Large Rust Workspaces, an article by Aleksey Kladov.

Making Taint support optional in Perl

One of the changes to Perl that we're considering on p5p (the perl5-porters mailing list) is the removal of taint support. The first step towards that is to add a Configure option that lets you build a Perl without taint support.

In this post I'll explain what we're considering, and why. The purpose of this post is to let everyone beyond p5p know about this, and give you a chance to comment.

Source: Making Taint support optional in Perl, an article by Neil Bowers.

Learning Rust by building a CLI tool

Creating small CLI tools is a fun way to get more familiar with a programming language. If you are coming from an infrastructure background, a CLI tool that you can use to send commands to devices/servers might be considered a neat starting point getting into Rust. This is how I started off learning Python, by writing small things that were usefull in a context that I was familiar with. Back then, I used argparse, getpass and netmiko. Starting with Rust is pretty daunting, and I have found that using similar tactic used to learn Python can also be applied when learning Rust.

Source: Learning Rust by building a CLI tool, an article by Said van de Klundert.

Gentle Guide to Get Started With tmux

tmux is a terminal multiplexer, meaning it is a window manager within your terminal. It allows you to open multiple windows (sessions) within one terminal window (session). So it enables other programs to run from it, allowing you to manipulate them easily. Most of the folks find that one of the features to use tmux on a daily basis.

Source: Gentle Guide to Get Started With tmux, an article by Nikola Đuza.

It never had to be like this: the git “index”

Hot on the heels of another Git-related article that was making the rounds recently, I was reminded of Git’s own structure and how it influences user experience. Specifically what we assume is part of how Git works, is actually a part of the porcelain (in Git speak, the user interface and commands that back it). As someone developing a Git client, it’s interesting to think Git’s user experience could be significantly different with a different interface, particularly because people have a particular mental model of Git influenced by the default interface. Said influence is enough that libgit2’s API emulates the porcelain’s semantics, in-process.

Source: It never had to be like this: the git "index".

The Blinding Knife

Gavin Guile is dying.

He'd thought he had five years left - now he's got less than one. With fifty thousand refugees, a bastard son and an ex-fiancée who may have learned his darkest secret, Gavin's got problems on every side.

As he loses control, the world's magic runs wild, threatening to destroy the Seven Satrapies. The old gods are being reborn and their army of colour wights is unstoppable.

The only salvation may be the brother whose freedom and life Gavin stole sixteen years ago.

In the morning I started in The Blinding Knife, Book 2 of Lightbringer series by Brent Weeks.

It's Time to Retire the CSV

If you’ve worked with data for any length of time, you’ve come across the Comma-Separated Values (CSV) format. Its simplicity and ubiquity make CSV an extremely popular way for organizations to exchange data both internally and externally. While many programs can’t read or write Excel spreadsheets, almost anything can read and write CSVs, and a human can open a CSV file in any text editor and understand roughly what it contains.

Despite this ubiquity and ease of access, CSV is a wretched way to exchange data. The CSV format itself is notoriously inconsistent, with myriad competing and mutually-exclusive formats that often coexist within a single dataset (or, if you’re particularly unlucky, a single file). Exporting a dataset as a CSV robs it of a wealth of metadata that is very hard for the reader to reconstruct accurately, and many programs’ naïve CSV parsers ignore the metadata reconstruction problem entirely as a result. In practice, CSV’s human-readability is more of a liability than an asset.

Source: It's Time to Retire the CSV, an article by Alex Rasmussen.

B-Trees: More Than I Thought I'd Want to Know

Recently, I’ve been reading through the excellent Database Internals (Alex Petrov, 2019). The first half of the book is dedicated to the implementation of database storage engines – the subsystem(s) of a DBMS that handles long-term persistence of data. A surprising amount of this section discusses the implementation and optimization of various B-Tree data structures.

Source: B-Trees: More Than I Thought I'd Want to Know, an article by Ben Congdon.

Modern LZ Compression

This article walks through the components of a modern LZ compressor. It's amazing how rich and deep the compression field is. If you enjoy algorithms and data structures, there are not too many better places to play. I hope you enjoy reading it as much as I enjoyed writing it!

By the end, we will have a compressor that can beat gzip while decompressing at almost the same speed — in less than 1000 lines.

Source: Modern LZ Compression, an article by Gary Linscott.

Slice Patterns

Rust 1.26 introduced a nifty little feature called Basic Slice Patterns which lets you pattern match on slices with a known length. Later on in Rust 1.42, this was extended to allow using .. to match on “everything else”.

As features go this may seem like a small addition, but it gives developers an opportunity to write much more expressive code.

Source: Slice Patterns, an article by Michael F. Bryan.

How to write fast Rust code

Since I wrote How to write really slow Rust code and its sequence, Part 2, I have received so much feedback and suggestions to make my Rust code run faster that I decided I had enough material to write another post, this time focusing on more advanced tools and techniques available to Rust developers rather than on how to avoid noobie mistakes that will totally destroy your Rust code performance, as the previous blog posts did.

Source: How to write fast Rust code, an article by Renato Athaydes.

Email Authenticity 101: DKIM, DMARC, and SPF

If you use email with your own domain, a lot of the burden of authenticity has suddenly shifted from your service provider to you. This guide will hopefully give you the information and practices you need to keep your domain's email authentic and less vulnerable to spoofing.

We'll cover the three major components of modern email domain security: DKIM for signing, SPF for sender verification, and DMARC for stricter enforcement of the other two. It is assumed the reader has a basic understanding of DNS and has experience using email with their own domain.

Source: Email Authenticity 101: DKIM, DMARC, and SPF, an article by Alex Blackie.

I figured out how DMARC works, and it almost broke me

Recently, I encountered a problem. My domain didn't correctly implement SPF, DKIM, or DMARC.

Then, I encountered a second problem: I had no idea what those were, and seemingly nobody has written about SPF, DKIM, or DMARC in a way that a human can understand, not to mention implement. Every article I found was either highly technical, trying to game SEO to sell me something, or too high level to be useful.

As a result, I've had to do a lot of hard work and research to understand this problem. Hopefully, because I had to do this, you won't.

There's two main sections here: a human explanation of what these things are, followed by a reasonably straightforward way to implement them.

Source: I figured out how DMARC works, and it almost broke me, an article by Simon Andrews.

Introducing the Python Launcher for Unix

Let's say you have more than one version of Python installed on your machine. What version does python3 point to? If you said, "the newest version", you may actually be wrong. That's because python3 points at the last version of Python you installed, not necessarily the newest; python3 typically gets overwritten every time you install some version of Python.

This is a bit annoying when you simply want to work with the newest version of Python (e.g., creating a new virtual environment). It would be convenient if there was a command which just always used the newest version of Python that's installed ...

Source: Introducing the Python Launcher for Unix, an article by Brett Cannon.