week 27, 2022

LXD virtual machines: an overview

While LXD is mostly known for providing system containers, since the 4.0 LTS, it also natively supports virtual machines. With the recent 5.0 LTS, LXD virtual machines are at feature parity with containers. In this blog, we’ll explore some of the main LXD virtual machine features and how you can use them to run your infrastructure.

Source: LXD virtual machines: an overview, an article by Miona Aleksic.

What’s new in Go 1.19?

Go 1.18 was a big release with huge features like generics, fuzzing, and workspaces. There was plenty of excitement around its minor or even ultra-minor features. Go 1.19 is not a release on that scale. But it does pack in a lot of small improvements that can help the average Go developer. Let’s take a look at what some of them are.

Source: What’s new in Go 1.19?, an article by Carl M. Johnson.

Self-hosting a static site with OpenBSD, httpd, and relayd

My blog gets generated with Hugo, which I’m generally happy with. Until recently, I hosted the static files on Netlify but now decided to get my own little server again. There are two main reasons for this:

  1. I actually missed doing some sysadmin work.
  2. The Internet was supposed to be a federated system and I don’t want to outsource everything to a few tech giants.

Source: Self-hosting a static site with OpenBSD, httpd, and relayd, an article by Michael Kohl.

Go generics are not bad

When programming, we often need to write ‘generic’ functions where the exact data type is not important. For example, you might want to write a simple function that sums up numbers.

Go lacked this notion until recently, but it was recently added (as of version 1.18). So I took it out for a spin.

Source: Go generics are not bad, an article by Daniel Lemire.

A Simple Favor (2018)

Stephanie is a single mother with a parenting vlog who befriends Emily, a secretive upper-class woman who has a child at the same elementary school. When Emily goes missing, Stephanie takes it upon herself to investigate.

In the evening Esme and I watched A Simple Favor. I liked the movie and give it a 7 out of 10.

Why DRY is the most over-rated programming principle

I suspect any developer reading this is aware of the DRY principle because it is just so ubiquitous. If not though, you just need to know that it stands for "Don't Repeat Yourself" and is generally invoked when advising people to not copy and paste snippets of code all over the place and instead consolidate logic into a central place.

DRY was the first programming principle I encountered and probably the only one I was aware of for the first year that I was a developer. It's also probably one of the simplest principles to understand. If you see two things in your code that are the same, maybe they should just be one thing. Hard to argue with that. But, I think that DRY is just like every other principle out there - it has its place, but it's best taken in moderation. And I think that, due to its ubiquity and simplicity, we tend to take DRY too far, far too often.

Source: Why DRY is the most over-rated programming principle, an article by Gordon Cassie.

Painlessly developing Python on NixOS with pipenv

For a long time, I’ve wanted to develop Python code on NixOS, but using Nix to manage dependencies was a major pain. If the dependencies you want are already in Nixpkgs, then you’re good, but otherwise you need to use things like pypi2nix to turn Pypi packages into nix derivations. This never quite worked out for me, so I ended up writing the nix derivations myself… which sucked.

I’ve been aware of pipenv for a while now, and it seemed like the ideal solution. It gives Nix/Stack/Yarn-like reproducibility, while still being actively maintained, unlike some of these Nix-specific Python package tools. I had never managed to get this to work for me, but I’ve finally got a configuration working on Nix.

Source: Painlessly developing Python on NixOS with pipenv, an article by Sidharth Kapur.

How to Achieve Dynamic Dispatch Using Generic Protocols

As easy as it seems to achieve dynamic dispatch in OOP, it is not the case when it comes to Protocol-Oriented Programming (POP). Trying to accomplish dynamic dispatch using protocols always comes with unpredicted difficulties due to various limitations in the Swift compiler.

With the release of Swift 5.7, all these have become history! Achieving dynamic dispatch in the realm of POP has never been easier. In this article, let’s explore what kind of improvements we get from Swift 5.7 and what it takes to accomplish dynamic dispatch using protocol with associated types.

Source: How to Achieve Dynamic Dispatch Using Generic Protocols in Swift 5.7, an article by Lee Kah Seng.

Encanto (2021)

A Colombian teenage girl has to face the frustration of being the only member of her family without magical powers.

In the evening Adam, Esme, and I watched Encanto. I liked the movie a lot; beautifully made, and give it an 8 out of 10.

A Scheme Primer

The following is a primer for the Scheme family of programming languages. It was originally written to aid newcomers to technology being developed at The Spritely Institute but is designed to be general enough to be readable by anyone who is interested in Scheme.

Source: A Scheme Primer.

Is it time to look past Git?

At the time of this writing, Git's been with us for over a decade and a half. During that time the ecosystem has absolutely exploded. From the rise of GitHub and GitLab to the myriad of new subcommands (just look at all this cool stuff), clearly Git has seen widespread adoption and success.

Source: Is it time to look past Git?, an article by Jonathan E. Magen.

Nix packaging, the heretic way

One difficulty when using Nix is that it’s possible to hit a purity wall. A dependency is not in nixpkgs (yet), and you have to package it yourself. But the project does some impure things during the build. It’s using some esoteric language that doesn’t have a <lang>2nix tool yet.

And sometimes it’s hard to go to your customer/boss and tell them you have to spend the next 3 weeks doing “things right”(tm).

Luckily there is a workaround available, and this is why I’m writing this article. To show a quick but impure alternative that can be used in a pinch.

Source: Nix packaging, the heretic way, an article by Jonas Chevalier.

Index Recommendations

For most non-trivial SQL databases, the key to performance is creating the right SQL indexes. In this context "the right SQL indexes" means those that cause the queries that an application needs to optimize run fast. The ".expert" command can assist with this by proposing indexes that might assist with specific queries, were they present in the database.

Source: Index Recommendations (SQLite Expert).

Unit and Integration Tests

In this post I argue that integration-vs-unit is a confused, and harmful, distinction. I provide a more useful two-dimensional mental model instead. The model is descriptive (it allows to think more clearly about any test), but I also include my personal prescriptions (the model shows metrics which are and aren’t worth optimizing).

Source: Unit and Integration Tests, an article by Aleksey Kladov.

Managing Kubernetes without losing your cool

This post is based on a webinar i've previously given where I go through some of my favourite tips for working with Kubernetes clusters all day long. The goal of all of these techniques is to make my life easier and (hopefully) less error prone. I start off with the first 5 tips being applicable to anyone working with Kubernetes and can be picked up right away. From there I move on to a couple that would benefit from having some old-skool Linux sys-admin experience. Finally I finish of with some more advanced techniques that require some previous programming experience.

Source: Managing Kubernetes without losing your cool, an article by Marcus Noble.