Plurrrr

a tumblelog
week 15, 2021

Building a 6kB Containerized HTTP Server!

I set out to build the smallest container image that I could that was still able to do something useful. By taking advantage of multistage builds, the scratch base image, and a tiny assembly based http server, I was able to get it down to 6.32kB!

Source: Tiny Container Challenge: Building a 6kB Containerized HTTP Server!, an article by Sid Palas.

Firebugs

In the afternoon my aunt messaged me that firebugs, Pyrrhocoris apterus, could be found close to her house. Later, Esme and I walked to her house and I took a photo of the colorfull insects.

Firebugs, Pyrrhocoris apterus
Firebugs, Pyrrhocoris apterus.

Onboarding with an M1

This is my first week at Authzed as a software engineer and I’ve been provided with a new M1-based MacBook Pro as my primary development machine. Apple’s new M1 chip has been receiving high praise for being quiet, battery efficient, and performant, so naturally I was excited to use my new laptop. Turns out, I wasn’t the only one excited to start using M1 MacBook Pros…

Source: Onboarding with an M1, an article by Sam Kim.

Content-aware image resizing in JavaScript

There are many great articles written about the Seam Carving algorithm already, but I couldn't resist the temptation to explore this elegant, powerful, and yet simple algorithm on my own, and to write about my personal experience with it. Another point that drew my attention (as a creator of javascript-algorithms repo) was the fact that Dynamic Programming (DP) approach might be smoothly applied to solve it. And, if you're like me and still on your "learning algorithms" journey, this algorithmic solution may enrich your personal DP arsenal.

So, with this article I want to do three things:

  • Provide you with an interactive content-aware resizer so that you could play around with resizing your own images
  • Explain the idea behind the Seam Carving algorithm
  • Explain the dynamic programming approach to implement the algorithm (we'll be using TypeScript for it)

Source: Content-aware image resizing in JavaScript, an article by Oleksii Trekhleb.

Opting your Website out of Google's FLoC Network

Google recently announced the rollout of their Federated Learning of Cohorts (FLoC), a new advertising-surveillance initiative that seeks to replace third-party cookies with a new user profiling technique that garners data generated by the browser itself.

The EFF has written an overview of FLoC and it’s threats and has also developed a useful tool to test if a user’s browser is being used for data collection and fingerprinting.

Plausible Analytics has also chimed in with an article explaining FLoC as in relation to users and developers — which was the inspiration for this short guide.

Source: Opting your Website out of Google's FLoC Network, an article by Paramdeo Singh.

A zero-overhead linked list in Rust

Let’s implement an immutable, singly-linked list. Singly-linked means that each node contains a reference to the next node, but not vice versa. To make this data structure really performant, let’s use plain references instead of heap-allocated types. This would be dangerous in memory-unsafe languages like C, because it could easily cause vulnerabilities because of dangling pointers, but Rust’s lifetimes protect us from this. We’ll see what this means in a moment.

Source: A zero-overhead linked list in Rust, an article by Ludwig Stecher.

How I get work done with Emacs and org-mode

I've been a freelance developer for 12 years, and Emacs has been at the center of my working environment for 10 of those. I use it for a lot of things - including writing this post - but today I'm concentrating on my workflow.

Here's how I use Emacs and org-mode during a regular day.

Source: How I get work done with Emacs and org-mode, an article by Phil Newton.

Org-Mode Is One of the Most Reasonable Markup Languages to Use

Disclaimer: this is a very nerdy blog entry. It is about lightweight markup languages and why I think that Org mode is the best lightweight markup language for many use-cases. And with lightweight markup language, I do mean the syntax, the way you express headings, lists, font variations such as bold face or italic, and such things.

Source: Org-Mode Is One of the Most Reasonable Markup Languages to Use for Text an article by Karl Voit.

Functorio

You might have heard people say that functional programming is more academic, and real engineering is done in imperative style. I’m going to show you that real engineering is functional, and I’m going to illustrate it using a computer game that is designed by engineers for engineers. It’s a simulation game called Factorio, in which you are given resources that you have to explore, build factories that process them, create more and more complex systems, until you are finally able to launch a spaceship that may take you away from an inhospitable planet. If this is not engineering at its purest then I don’t know what is. And yet almost all you do when playing this game has its functional programming counterparts and it can be used to teach basic concepts of not only programming but also, to some extent, category theory. So, without further ado, let’s jump in.

Source: Functorio, an article by Bartosz Milewski.

Say Hello To CSS Container Queries

I haven’t been more excited for a CSS feature like I’m now in the past six years I spent as a front-end developer. The prototype of container queries is now available behind a flag in Chrome Canary. Thanks to efforts from smart people like Miriam Suzanne and other folks.

I remember seeing a lot of jokes about the support for CSS container queries, but they are finally there. In this article, I will walk you through why we need container queries, how they will make your life easier, and most importantly, you will achieve more powerful components and layouts.

Source: Say Hello To CSS Container Queries, an article by Ahmad Shadeed.

Debugging random slow writes in PostgreSQL

n this post I’ll showcase a real-life example of debugging a seemingly weird database performance degradation. While I obviously intend to share the solution and what to avoid, I’d also like to take you through the journey and show you some tools & processes that can help you dig into SQL performance.

Source: Debugging random slow writes in PostgreSQL, an article by Sergios Aftsidis.

How Python dictionaries work

The goal of this post is to learn how CPython implements hash tables. But understanding all the aspects of hash table design can be hard, and CPython's implementation is especially sophisticated, so we'll approach this topic gradually. In the first part of this post, we'll design a simple fully-functional hash table, discuss its capabilities and limitations and outline a general approach to design a hash table that works well in practice. In the second part, we'll focus on the specifics of CPython's implementation and finally see how Python dictionaries work behind the scenes.

Source: Python behind the scenes #10: how Python dictionaries work, an article by Victor Skvortsov.

Rust shenanigans: return type polymorphism

In this article, I will describe Rust return type polymorphism (a.k.a. generic returns), a feature that I recently discovered and that I have been pretty intrigued about.

Source: Rust shenanigans: return type polymorphism, an article by Luciano Mammino.

Rust in Production: MeiliSearch

In this interview, I talk with Thomas Payet, the co-founder and COO of MeiliSearch. MeiliSearch is an open-source search engine that is among the top 20 most starred Rust projects on GitHub at the time of writing. We talk about MeiliSearch and how Rust and its ecosystem have helped them create it.

Read further to learn about their experience with Rust and discover tips for starting your own open-source project.

Source: Rust in Production: MeiliSearch, an article by Gints Dreimanis.

The k-Nearest Neighbors (kNN) Algorithm in Python

In this tutorial, you’ll get a thorough introduction to the k-Nearest Neighbors (kNN) algorithm in Python. The kNN algorithm is one of the most famous machine learning algorithms and an absolute must-have in your machine learning toolbox. Python is the go-to programming language for machine learning, so what better way to discover kNN than with Python’s famous packages NumPy and scikit-learn!

Source: The k-Nearest Neighbors (kNN) Algorithm in Python, an article by Joos Korstanje.

Build a Raspberry Pi Linux System the Hard Way

The instructions below will explain how to build a Linux environment for a Raspberry Pi 3B from scratch, focusing on extreme minimalism. I will build most components from source code and use BusyBox as the only user application on the target. The focus is on minimalism for the sake of learning. Optimizations like network boot, secondary bootloaders, compressed filesystems, etc.. will not be covered.

Source: Build a Raspberry Pi Linux System the Hard Way, an article by Rick Carlino.

The Beauty of Bresenham's Algorithm

This page introduces a compact and efficient implementation of Bresenham's algorithm to plot lines, circles, ellipses and Bézier curves.

Source: The Beauty of Bresenham's Algorithm, an article by Alois Zingl.

Use console.log() like a pro

Using console.log() for JavaScript debugging is the most common practice among developers. But, there is more…

The console object provides access to the browser’s debugging console. The specifics of how it works vary from browser to browser, but there is a de facto set of features that are typically provided.

Source: Use console.log() like a pro, an article by Marko Denic.

Using the Switch(true) Pattern in JavaScript

The fundamental principle of the switch true pattern is that you can match against expressions as well as values. An expression in a case will be evaluated before matching. If the expression in your case evaluates to true - it will be matched.

Source: Using the Switch(true) Pattern in JavaScript, an article by Seán Barry.