week 43, 2021

Timing With Curl

When faced with a potential latency issue in web services, this is often one of the first commands I run several times from multiple clients because the results form this command help to get a quick sense of the layer that might be responsible for the latency issue.

Source: Timing With Curl, an article by Susam Pal.

Cross-compiling and Static-linking with Nix

I was having a problem at work with an ARM64 Linux edge device. I have an ARM64 binary on the edge device, and I wanted to look at which dynamic libraries it is linked to with the readelf program. Unfortunately, readelf is not installed on the device. I was unable to figure out how to use the device's package manager.

I was able to build a readelf binary that I could use on the device by cross-compiling and statically-linking one from Nixpkgs. This post explains how to easily cross-compile and statically-link packages from Nixpkgs.

Source: Cross-compiling and Static-linking with Nix, an article by Dennis Gosnell.

Nmap In The Movies

For reasons unknown, Hollywood has decided that Nmap is the tool to show whenever hacking scenes are needed. At least it is a lot more realistic than silly 3D animation approach used in many previous movies (e.g. "hacking the Gibson" on Hackers, or the much worse portrayals on Swordfish). We always like to see Nmap in the movies, so we have catalogued known instances here.

Source: Movies Featuring the Nmap Security Scanner.

9 (2009)

A rag doll that awakens in a postapocalyptic future holds the key to humanity's salvation.

In the early evening Alice, Adam, and I watched 9. I liked the movie a lot and give it an 8 out of 10.

Just Mercy (2019)

World-renowned civil rights defense attorney Bryan Stevenson works to free a wrongly condemned death row prisoner.

In the evening I watched Just Mercy. I liked the movie and give it a 7.5 out of 10.

Introducing Swift Distributed Actors

We’re thrilled to announce a new open-source package for the Swift on Server ecosystem, Swift Distributed Actors, a complete server-oriented cluster library for the upcoming distributed actor language feature!

This library provides a complete solution for using distributed actors in server use-cases. By open-sourcing this project early, alongside the ongoing work on the language feature, we hope to gather more useful feedback on the shape of the language feature and associated transport implementations.

Source: Introducing Swift Distributed Actors, an article by Konrad Malawski.

Infix operators

Python has the wonderful "in" operator and it would be nice to have additional infix operator like this. This recipe shows how (almost) arbitrary infix operators can be defined.

Source: Infix operators an article by Ferdinand Jamitzky.

Writing a Compiler in Rust

During my final term at UWaterloo I took the CS444 compilers class with a project to write a compiler from a substantial subset of Java to x86, with a language and two teammates of your choice. My group of three chose to write our compiler in Rust and it was a fun experience. We spent time coming to design decisions that worked out really well and used Rust’s strengths. Our compiler ended up being around 6800 lines of Rust and I personally put in around 60 hours of solid coding and more on code review and design. In this post I’ll go over some of the design decisions we made and some thoughts on what it was like using Rust.

Source: Writing a Compiler in Rust, an article by Tristan Hume.

Consistent Hashing for Dummies

Today I'll discuss about an interesting concept: consistent hashing. It's a widely employed technique to properly perform sharding in distributed storage systems. I'm not aiming at a rigorous explanation (please don't use the raw snippets I provide in production code!), but I hope I can make the concept simple enough.

Source: Consistent Hashing for Dummies, an article by Alan Franzoni.


PyCaret is an open source, low-code machine learning library in Python that allows you to go from preparing your data to deploying your model within minutes in your choice of notebook environment.

Source: PyCaret.

When to Use Each of the Git Diff Algorithms

As of time of writing, the latest version of git is 2.28.0, and it supports a total of 4 diff algorithms, namely myers, minimal, patience, and histogram. In the following sections, I give my take on when each of these algorithms should be used. This post does not cover a breakdown of how the algorithm works, and/or its complexity – you can find these via a quick search.

Source: When to Use Each of the Git Diff Algorithms, an article by Lup Peng.

A comprehensive guide to go generate

While Go does not have macros or other forms of metaprogramming, it's a pragmatic language and it embraces code generation with support in the official toolchain.

The go generate command has been introduced all the way back in Go 1.4, and since then has been widely used in the Go ecosystem. The Go project itself relies on go generate in dozens of places; I'll do a quick overview of these use cases later on in the post.

Source: A comprehensive guide to go generate, an article by Eli Bendersky.

Pants supports PEP 517

Pants has industry-leading support for Python builds - covering steps such as resolving 3rd-party dependencies, running tests, generating code, running formatters and linters, packaging python executables, building Docker images, and more.

One important build step that Pants has supported for a long time is building Python package distributions, namely sdists and wheels.

We just cut the first release candidate for Pants 2.8, so this is a good time to talk about the significant enhancements to its distribution-building capabilities, including support for native extensions and for PEP-517.

Source: Pants supports PEP 517, an article by Benjy Weinberger.

macOS 12 Monterey: The Ars Technica review

Monterey feels of a piece with maintenance-mode macOS updates like El Capitan or Sierra or High Sierra—change the default wallpaper, and in day-to-day use you can easily forget that you've upgraded from Big Sur at all. It's not that there aren't any new features here—it's just that improving any operating system as mature as macOS involves a lot of tinkering around the edges.

But there are plenty of things to talk about in even the most minor of macOS releases, and Monterey is no different. The update refines the Big Sur design and rethinks automation and what's possible via local wireless communication between devices. It also makes a long list of minor additions that won't be exciting for everyone but will be interesting for some subset of Mac users.

Source: macOS 12 Monterey: The Ars Technica review, an article by Andrew Cunningham.

How to Clean Install macOS Monterey Easily

Apple today released macOS 12 Monterey, and whenever a new operating system is released for the Mac, some users prefer to perform a clean installation. This article explains how to perform what is effectively a clean install of Monterey using a brand new option that's available on Apple silicon-powered Macs and Intel Macs with a T2 security chip.

Source: How to Clean Install macOS Monterey Easily Using the New Erase Mac Option, an article by Tim Hardwick.

Specialized extensions using generic type constraints

Combining Swift’s powerful generics system with the fact that any Swift type can be extended with new APIs and capabilities enables us to write targeted extensions that conditionally add new features to a type or protocol when it fits certain requirements.

It all starts with the where keyword, which lets us apply generic type constraints in a range of different situations. In this article, let’s take a look at how that keyword can be applied to extensions, and what sort of patterns that can be unlocked by doing so.

Source: Specialized extensions using generic type constraints, an article by John Sundell.