week 09, 2023

Sleepy cat

While having a drink inside Brasserie Mirell Esme spotted a cat in one of the planters. When we left the restaurant I checked if the cat was still there, and it was. When I petted it, it woke up just a little.

Sleepy cat
Sleepy cat.

M3GAN (2022)

A robotics engineer at a toy company builds a life-like doll that begins to take on a life of its own.

In the evening Adam, Alice, Esme, and I watched M3GAN. I liked the movie and give it a 7 out of 10.

Unnatural History

Los Angeles is a city of stark contrast, the palaces of the affluent coexisting uneasily with the hellholes of the mad and the needy. That shadow world and the violence it breeds draw brilliant psychologist Dr. Alex Delaware and Detective Milo Sturgis into an unsettling case of altruism gone wrong.

On a superficially lovely morning, a woman shows up for work with her usual enthusiasm. She’s the newly hired personal assistant to a handsome, wealthy photographer and is ready to greet her boss with coffee and good cheer. Instead, she finds him slumped in bed, shot to death.

The victim had recently received rave media attention for his latest project: images of homeless people in their personal “dream” situations, elaborately costumed and enacting unfulfilled fantasies. There are some, however, who view the whole thing as nothing more than crass exploitation, citing token payments and the victim’s avoidance of any long-term relationships with his subjects.

Has disgruntlement blossomed into homicidal rage? Or do the roots of violence reach down to the victim’s family—a clan, sired by an elusive billionaire, that is bizarre in its own right?

Then new murders arise, and Alex and Milo begin peeling back layer after layer of intrigue and complexity, culminating in one of the deadliest threats they’ve ever faced.

In the evening I started in Unnatural History, an Alex Delaware novel by Jonathan Kellerman.

How do Nix builds work?

Hello! For some reason after the last nix post I got nerdsniped by trying to understand how Nix builds work under the hood, so here’s a quick exploration I did today. There are probably some mistakes in here.

Source: How do Nix builds work?, an article by Julia Evans.

Paradise Highway (2022)

A truck driver has been forced to smuggle illicit cargo to save her brother from a deadly prison gang. With FBI operatives hot on her trail, Sally's conscience is challenged when the final package turns out to be a teenage girl.

In the evening Esme and I watched Paradise Highway. I liked the movie and give it a 7 out of 10.

Long time no see! While I have a few other, longer blog posts still cooking, I figured I’d post about a cool bit of CSS I came across on eli_oat’s site which adds a marker to every link on a site that points to an external domain.

Source: Styling External Links, an article by Jake Bauer.

Demystifying bitwise operations, a gentle C tutorial

Bitwise operations are a fundamental part of Computer Science. They help Software Engineers to have a deeper understanding of how computers represent and manipulate data, and they are crucial when writing performance-critical code. Truth being said, nowadays, they are rarely used in the business code we write, and they stay hidden in libraries, frameworks, or low-level system programming codebases. The reason is simple: writing code that operates on bits can be tedious, less readable, not always portable, and, most importantly, error-prone. Modern programming languages nowadays have higher-level abstractions that replace the need for bitwise operations and “constructs”, and trading (potential) small performance and memory gains for readability is not such a bad deal. Plus, compilers are more intelligent nowadays and can optimise your code in ways you (and I) cannot even imagine.

Source: Demystifying bitwise operations, a gentle C tutorial, an article by Andrei Ciobanu.

Rust's BufRead, And When To Use It

Rust is a low-level language, and its standard library is careful to give the programmer lots of control over how things will behave and avoid implicit behavior, especially when that behavior impacts performance. But at the same time, it doesn't want to make the programmer's life harder than it needs to be. As a result, Rust's language features and standard library often give you access to really low-level concepts with no assumptions baked in, but then also give you abstractions you can optionally layer on top.

One example of this is the Read and BufRead traits. Read is a low-level and unopinionated abstraction for ingesting data from things like files, network sockets, and process input, while BufRead represents a specific kind of layer you can choose to put on top of Read to make it slightly higher-level.

Source: Rust's BufRead, And When To Use It, an article by Brandon Smith.

Beware microbenchmarks bearing gifts

Benchmarks are only a tool for debugging efficiency: Production is ultimately what matters. Benchmarks analyze the performance of code under the specific circumstances created and maintained by the benchmark. They cannot perfectly predict the performance of code in the real world. In this episode, we discuss some of the pitfalls of microbenchmarks and mitigation strategies.

Source: Performance Tip of the Week #39: Beware microbenchmarks bearing gifts, an article by Chris Kennelly and Alkis Evlogimenos.

Some notes on using nix

Recently I started using a Mac for the first time. The biggest downside I’ve noticed so far is that the package management is much worse than on Linux. At some point I got frustrated with homebrew because I felt like it was spending too much time upgrading when I installed new packages, and so I thought – maybe I’ll try the nix package manager!

nix has a reputation for being confusing (it has its whole own programming language!), so I’ve been trying to figure out how to use nix in a way that’s as simple as possible and does not involve managing any configuration files or learning a new programming language. Here’s what I’ve figured out so far! We’ll talk about how to:

  1. install packages with nix
  2. build a custom nix package for a C++ program called paperjam
  3. install a 5-year-old version of hugo with nix

Source: Some notes on using nix, an article by Julia Evans.

Stop insisting that Git branches are nothing but refs

Git users think about branches and talk about branches. The Git documentation talks about branches and many of the commands mention branches. Pay attention to what experienced users say about branches while using Git, and it will be clear that they do not think of branches simply as just refs. In that sense, branches do exist: they are part of our mental model of how the repository works.

Source: I wish people would stop insisting that Git branches are nothing but refs, an article by Mark Dominus.

Use GNU Emacs

This document was originally written around 1997 for GNU Emacs version 19.29 and published under the title A Tutorial Introduction to GNU Emacs. It has subsequently been updated for version 28.2, and thoroughly revised and expanded. This is document version 28.2.43 and is an unfinished work-in-progress.

Source: Use GNU Emacs, an article by Keith Waclena.

The Most Useful Command Line Tools (2023 edition)

In the last few years, there has been a renaissance in command-line utilities. If you are still using utilities written 30 years ago (groan) you will be in for a surprise. The functionality might be the same but the UX(or is it developer experience) is a million times better.

These are some of the best command line utilities I've come across, ones I highly recommend.

Source: The Most Useful Command Line Tools (2023 edition), an article by Shantnu Tiwari.

Nix journey part 0: Learning and reference

I've been following the Nix project for a while but now that I'm done with my PhD I finally have some free time and energy to try using it in earnest. This series is going to be me learning Nix by showing you how things work and how to put the pieces together.

For those of you unaware, Nix takes reproducible builds to their logical conclusion by making package builds (mostly) pure functions of their dependencies. The binary artifacts of builds are stored in a content-addressed store (the Nix store) so you can be sure that you're always getting the same package if you have its name and hash. Not only can you build programs this way, but you can also build development environments ("I want these libraries available in my build environment and nothing else", for example), run commands in throw-away environments with specific packages installed without polluting your global environment. There's even an operating system, NixOS, based on this packaging system that allows you to configure your whole system (installed packages, system settings, etc) from a single file.

Source: Nix journey part 0: Learning and reference materials, an article by Zach Mitchell.

Python is two languages now, and that's actually great

I am of the belief that currently, Python is actually two very similar programming languages sharing the same name. This certainly isn't a surprise to anyone who's been using Python for a while. What might be a surprise, though, is that I think this is actually a good thing. The languages, let's call them untyped Python and typed Python, even though sharing a very large common base are fundamentally different in how they enable the developers using them to solve problems.

Source: Python is two languages now, and that's actually great, an article by Tin Tvrtković.