Plurrrr

week 24, 2021

A visit to the Rijksmuseum in Amsterdam

For Father's Day Esme had planned a visit to the Rijksmuseum in Amsterdam. So a bus, a train, a metro, and a tram later we arrived.

Adam, Alice, and Esme in the garden of the Rijksmuseum
Adam, Alice, and Esme in the garden of the Rijksmuseum.
Stained glass windows showing Lucas van Leijden and Rembrandt
Stained glass windows showing Lucas van Leijden and Rembrandt.

After some walking around we arrived at the famous Night Watch. Because the Rijksmuseum is carrying out a detailed study of Rembrandt's masterpiece it was in a huge glass box and surrounded by equipment.

Operation Night Watch
Operation Night Watch.
Alice enjoying a doll's house
Alice enjoying a doll's house.
The library of the Rijksmuseum
The library of the Rijksmuseum.
At the first level of the museum
At the first level of the museum.
Esme, Adam, and Alice with Vincent van Gogh's self-portrait
Esme, Adam, and Alice with Vincent van Gogh's self-portrait.
At the ground level of the museum
At the ground level of the museum.
Rijksmuseum tuinhuis
Rijksmuseum tuinhuis.

After the museum we took a tram to the center and walked in the direction of the train station. On our way Alice and Adam each bought a book. Alice bought Five Nights at Freddy's - The Silver Eyes and Adam bought the sequel Five Nights at Freddy's - The Twisted Ones.

Tumblelog 5.1.2

In the early evening I pushed tumblelog version 5.1.2 to GitHub. This version mqkes it easier to style the calendar pages, the month overview pages, the tags and individual tag pages. I also added a new argument; --feed-size. The integer value that must follow this option determines the number of items in each feed. This used to be 14, the same as the number of days (--days), but I changed it to 25.

Version 5.1.2 of tumblelog is available on GitHub. As always feedback is very welcome.

Harry Potter and the Prisoner of Azkaban (2004)

Harry Potter, Ron and Hermione return to Hogwarts School of Witchcraft and Wizardry for their third year of study, where they delve into the mystery surrounding an escaped prisoner who poses a dangerous threat to the young wizard.

In the evening Esme, Alice, and I watched Harry Potter and the Prisoner of Azkaban. Adam had been to a birthday party and was sound asleep. I had seen the movie before. I liked the movie and give it an 8 out of 10.

Cleaning $HOME on macOS

Apple computers include a custom operating system - macOS, which has a few annoying features. Among the annoyances a special place has to be reserved for the inability to remove or rename the folders located in $HOME. On the web countless macOS users are looking for the ways to bypass this restriction. Multiple suggestions are provided as possible solutions. You can: replace the folders with files; hide the folders from ‘Finder’ and make them inaccessible; or simply learn to live with them, as the system will recreate those folders by itself anyway.

Source: Cleaning $HOME on macOS, an article by Karolis Koncevičius.

Rust is Exciting

Rust is an exciting language. I recently bought The Rust Programming Language Book. It’s quite dense with a lot of concepts I haven’t thought about since college. Working in high-level programming languages such as Java, Python, and TypeScript have allowed me to mostly forget about the woes of low-level programming. Rust has both re-introduced me to these problems, and then immediately solved them with the advanced static analysis that its compiler provides.

Source: Rust is Exciting, an article by Jerred Shepherd.

A Hungry Scorpion

In the afternoon I noticed that Adam's Heterometrus silenus was out and about. We keep this scorpion in a plastic container on my desk. As it was actively searching for food I decided to give it a mealworm.

A hungry Heterometrus silenus with two mealworms
A hungry Heterometrus silenus with two mealworms.

It grabbed the mealworm and even the tweezers I used; it was quite hungry. When it had transferred the mealworm to its "mouth" it kept looking for food so I gave it another mealworm. This is the first time the scorpion is this active, maybe because of the high temperatures in my office (±28°C).

Comparison of Python HTTP clients

There are a huge number of HTTP clients available for Python - a quick search for “Python HTTP Clients” on Github returns over 1700 results(!) How do you make sense of all of them and find one which is right for your particular use case?

Do you have a single machine at your disposal, or a collection of them? Do you want to keep things simple or is raw performance more of a concern? A web application needing to make the odd request to a micro-service api is going to have quite different requirements to a script constantly scraping data. Additionally, there's the concern whether the library you choose will still be around 6 months down the line.

In this article we're going to cover five of the best HTTP clients currently available for Python and detail why each of them might be one for you to consider.

Source: Comparison of Python HTTP clients, an article by Ian Wootten.

Liocheles australasiae Eating

In the evening I noticed that another scorpion had become quite active; Liocheles australasiae. So I dropped a mealworm close to it. At first it was not interested but later I checked upon the small scorpion and it was enjoying its meal.

Liocheles australasiae eating a mealworm
Liocheles australasiae eating a mealworm.

Creating a Self-Hosted Git Server

This article will walk you through the process of setting up a Git server which can be pushed to, cloned from, and browsed, using a static site generator called stagit as a front-end. You can see my stagit-made site at git.theohenson.com.

Requirements:

  • Some sort of Linux server (it could be as simple as a Raspberry Pi, or a VPS).
  • At least a basic understanding of Git and the shell.
  • A way to serve HTML files.

Source: Creating a Self-Hosted Git Server, an article by Theo Henson.

Execute Docker Containers as QEMU MicroVMs

This blog post compares the advantages and disadvantages of docker containers with VMs and describes why and how we execute docker images inside a QEMU MicroVM. The described approach makes it possible to combine the security of VMs with the existing ecosystem of docker (e.g. images and tools). Afterwards we take a look at ways how we can map features like bind mounts to solutions supported by QEMU and demonstrate this by running the NGINX docker image in QEMU.

Source: Execute Docker Containers as QEMU MicroVMs, an article by Michael Müller.

Modulinos In Bash

A modulino is a file which behaves like a library when it is imported, and like a script when executed. I first read about them in Mastering Perl, but you can create them in other languages too. Here’s how to do it in Bash.

Source: Modulinos In Bash.

md2tweets

In the morning I pushed md2tweets to GitHub. This program is a companion to tumblelog. It reads the Markdown input file of tumblelog and outputs tweets separated by a % character; the input format of tweetfile, a program to post to Twitter at random.

I run md2tweets each time after I run tumblelog via a Makefile. The tweetfile program is called several times a day via cron on MacOS.

Writing fast async HTTP requests in Python

I do a lot of web scraping in my spare time, and have been chasing down different formats and code snippets to make a large amount of network requests locally, with controls for rate limiting and error handling.

I’ve gone through a few generations - I’ll use this post to catalogue where I started and what I’m doing now.

Source: Writing fast async HTTP requests in Python, an article by JonLuca De Caro.

On Comments in Code

I used to think that I didn’t need comments if I wrote self-documenting code. However, I have realized that I do write comments, and that I find them really useful. To see how many comments I write, and what kind they are, I wrote a script to analyze my git commits from the last six years. In total, seven percent of my committed lines contained a comment. This blog post has details on what constitutes good and bad comments, as well as more statistics from my script.

Source: On Comments in Code, an article by Henrik Warne.

Rust meets the web - a clash of programming paradigms

Most code running on the web is event-based, garbage-collected, and dynamically typed. In stark contrast, Rust is a compiled language with static type- and memory-safety without a garbage-collector. What are the implications for a project that compiles Rust to WebAssembly? I try to answer this question with a fictive story and hands-on code examples.

Source: Rust meets the web - a clash of programming paradigms, an article by Jakob Meier.

Median Heaps in Haskell

Heaps are a fundamental data structure that implement the priority queue abstract data type. Essentially, a priority queue is one where the element at the front of line is always the one of highest priority, which is defined by the programmer for a specific implementation. A standard heap implementation provides fast access to the front element of the queue, in O(1) time, as well as insertion/deletion in O(log(n)) time.

Usually, the highest priority value is defined as either the minimum or maximum value in the data, as implemented in min and max heaps respectively. In this post, however, we will look at a more specialized heap that instead prioritizes the median value. Why would this be useful? I'm not sure of any practical applications, but assumedly it could be if it were ever performance critical to repeatedly calculate the median. Let's jump in.

Source: Median Heaps in Haskell, an article by Micah Cantor.