week 15, 2022

Shorefall: Good

In the afternoon I finished Shorefall, The Founders Trilogy Book 2 by Robert Jackson Bennett. I liked the first book more but still consider the second book in the Founders Trilogy a good one.

The Ultimate Guide to Optimizing JavaScript for Quick Page Loads

As website developers, your biggest challenge is ensuring that your website displays all the information it needs to show your users right away. Optimizing images is one way to improve page load speed, but that alone is not enough. You also have to dig into your code and optimize your JavaScript. In this guide, we show you how.

Source: The Ultimate Guide to Optimizing JavaScript for Quick Page Loads, an article by Steve Sewell.

Working Remotely? Pair SSH with Teleport

As companies have started to embrace working remote-first, we’ve quickly reached the limits of tools available. Sure, you can jump into a Slack Huddle or Screen Share over a Zoom Room, or if you’re running Linux – good luck. Sometimes you want to jam with your co-workers using the Terminal. In this post, I’ll show how you can use Teleport Community Edition to set up a Teleport and share an SSH session with a co-worker without them ever having to leave the terminal.

Source: Working Remotely? Pair SSH with Teleport., an article by Ben Arent.

The Final Twist

Just hours after the harrowing events of The Never Game and The Goodbye Man, Colter Shaw finds himself in San Francisco, where he has taken on the mission his father began years ago: finding a missing courier bag containing evidence that will bring down a corporate espionage firm responsible for hundreds, perhaps thousands, of deaths.

Following the enigmatic clues his father left behind, Shaw plays cat and mouse with the company's sadistic enforcers, as he speeds from one gritty neighborhood in the City by the Bay to another. Suddenly, the job takes on a frightening urgency: Only by finding the courier bag can he expose the company and stop the murder of an entire family--slated to die in forty-eight hours.

With the help of an unexpected figure from his past, and with the enforcers closing the net, Shaw narrows in on the truth--and learns that the courier bag contains something unexpected: a secret that could only be described as catastrophic.

Filled with dozens of twists and reversals, The Final Twist is a nonstop race against time to save the family.... and to keep the devastating secret Shaw has uncovered from falling into the wrong hands.

In the evening I started in The Final Twist by Jeffery Deaver.

Elliptic Curve Cryptography: A Basic Introduction

Elliptic Curve Cryptography (ECC) is a modern public-key encryption technique famous for being smaller, faster, and more efficient than incumbents. Bitcoin, for example, uses ECC as its asymmetric cryptosystem because it is so lightweight. The mathematical entity that makes all of this possible is the elliptic curve, so read on to learn how these curves enable some of the most advanced cryptography in the world.

Source: Elliptic Curve Cryptography: A Basic Introduction, an article by Lane Wagner.

Apple Readies Several New Macs With Next-Generation M2 Chips

Apple Inc. has started widespread internal testing of several new Mac models with next-generation M2 chips, according to developer logs, part of its push to make more powerful computers using homegrown processors.

The company is testing at least nine new Macs with four different M2-based chips -- the successors to the current M1 line -- with third-party apps in its App Store, according to the logs, which were corroborated by people familiar with the matter. The move is a key step in the development process, suggesting that the new machines may be nearing release in the coming months.

Source: Apple (AAPL) Testing New Macs With Next-Generation M2 Chips, an article by Mark Gurman.

Table partitioning in PostgreSQL databases

Partitioning involves splitting large tables into smaller ones according to some attribute (like time ranges, regions, or even user ID groups). This is a logical step, and it can significantly increase your performance. But a botched implementation can have unintended effects, thus losing potential benefits, and turning your work with the database into a complete nightmare (more on this later).

Source: A slice of life: table partitioning in PostgreSQL databases, an article by Ruslan Shakirov.

On env Shebangs

The /usr/bin/env shebang provides a means for system portability. It has many valid use cases. However, you don’t just magically gain portability by switching to an env shebang. There are many trade-offs to consider.

Source: On env Shebangs, an article by Armin Briegel.

CSS Parent Selector

Have you ever thought about a CSS selector where you check if a specific element exists within a parent? For example, if a card component has a thumbnail, we need to add display: flex to it. This hasn’t been possible in CSS but now we will have a new selector, the CSS :has which will help us to select the parent of a specific element and many other things.

Source: CSS Parent Selector, an article by Ahmad Shadeed.

When To Use Generics

The Go 1.18 release adds a major new language feature: support for generic programming. In this article I’m not going to describe what generics are nor how to use them. This article is about when to use generics in Go code, and when not to use them.

To be clear, I’ll provide general guidelines, not hard and fast rules. Use your own judgement. But if you aren’t sure, I recommend using the guidelines discussed here.

Source: When To Use Generics, an article by Ian Lance Taylor.

The smallest Docker image to serve static websites

Until recently, I used to think that serving static websites from Docker would be a waste of bandwith and storage. Bundling nginx or various other heavy runtimes inside a Docker image for the sole purpose of serving static files didn’t seem like the best idea - Netlify or Github Pages can handle this much better. But my hobby server was sad and cried digital tears.

A recent HackerNews post about redbean, a single-binary, super tiny, static file server got me thinking. So begins my journey to find the most time/storage efficient Docker image to serve a static website.

Source: The smallest Docker image to serve static websites, an article by Florin Lipan.

See also the related discussion on Hacker News for even smaller solutions.

How Postgres Chooses Which Index To Use For A Query

Using Postgres sometimes feels like magic. But sometimes the magic is too much, such as when you are trying to understand the reason behind a seemingly bad Postgres query plan.

I've often times found myself in a situation where I asked myself: "Postgres, what are you thinking?". Staring at an EXPLAIN plan, seeing a Sequential Scan, and being puzzled as to why Postgres isn't doing what I am expecting.

This has lead me down the path of reading the Postgres source, in search for answers. Why is Postgres choosing a particular index over another one, or not choosing an index altogether?

In this blog post I aim to give an introduction to how the Postgres planner analyzes your query, and how it decides which indexes to use. Additionally, we’ll look at a puzzling situation where the join type can impact which indexes are being used.

Source: How Postgres Chooses Which Index To Use For A Query, an article by Lukas Fittl.

Implementing a safe garbage collector in Rust

In my last post I introduced an Emacs Lisp VM I was writing in Rust. My stated goal at the time was to complete a garbage collector. I think Rust has some really interesting properties that will make building garbage collectors easier and safer. Many of the techniques used in my GC are not original and have been developed by other Rustaceans in previous projects.

Source: Implementing a safe garbage collector in Rust, an article by Troy Hinckley.

JavaScript function composition

To hear some people talk, you’d think function composition was some kind of sacred truth. A holy principle to meditate upon whilst genuflecting and lighting incense. But function composition is not complicated. You probably use it all the time, whether you realise it or not. Why, then, do functional programmers get all worked up about it? What’s the big deal?

Source: JavaScript function composition: What’s the big deal?, an article by James Sinclair.