Plurrrr

a tumblelog
week 04, 2021

Emacs: from catching up to getting ahead

Many have created their Emacs wishlists. This is mine:

  1. Improved single-core efficiency
  2. Improved display efficiency and rendering engine
  3. Leveraging preemptive parallelism
  4. Emacs Lisp improvements
  5. Enhanced stability
  6. Dealing with non-text
  7. Improved contribution and development process

Let’s get into it.

Source: Emacs: from catching up to getting ahead, an article by Murilo Pereira.

My 2020 Apple Report Card

Jason Snell has published his annual Six Colors Apple Report Card for 2020. This year 55 voters (hand-selected by Snell) graded Apple in 12 areas. I was one of them, and, once again, thought it only fair to publish my grades and remarks here at Daring Fireball. Comments in [brackets] are additional commentary I wrote now, and were not included in what I submitted to Snell.

Source: My 2020 Apple Report Card, an article by John Gruber.

fzf - a terminal fuzzy finder

fzf is a terminal fuzzy finder tool that integrates nicely with many tools. These are a few of my favorite features.

Source: fzf - a terminal fuzzy finder, an article by Brian Sunter.

Configuring PostgreSQL for Observability

PostgreSQL comes with a plethora of configuration options, but changing the default settings of some of these options drastically improves the observability of your PostgreSQL server. You’ll want to set and configure these options before issues crop up in production, as they can provide information essential to understanding and resolving those issues.

Read on to learn more about the settings and extensions that expose metrics and information about the inner workings of your PostgreSQL server.

Source: Configuring PostgreSQL for Observability.

Demo on creating worker pool in GoLang

A worker pool is a pool where a specified number of workers(usually goroutine) created and run to pick up tasks. This can allow multiple tasks to be ran at the same time while keeping the number of workers a fixed number to avoid overuse of resource in the program.

There are usually two approaches of creating worker pool.

  • One is with fixed number of workers pre-created
  • One is creating worker when needed until the max number of workers created

In this post, we will cover the demonstration of creating fixed number of workers pre-ahead. This approach is usually used when one knows there are lots of tasks to be ran at the same time and the chance of reaching to max allowed worker would be high.

Source: Demo on creating worker pool in GoLang

Mocks Aren't Stubs

The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing. Most language environments now have frameworks that make it easy to create mock objects. What's often not realized, however, is that mock objects are but one form of special case test object, one that enables a different style of testing. In this article I'll explain how mock objects work, how they encourage testing based on behavior verification, and how the community around them uses them to develop a different style of testing.

Source: Mocks Aren't Stubs, an article by Martin Fowler.

A Primer on JSON Web Tokens

JSON Web Token (JWT) is a data exchange format that can be used to ensure the authenticity of a message. JWTs are widely used in the industry — they were first proposed in 2010 and then standardized in RFC 7519, and they’re used in the OpenID Connect specification. In this blog post, I’ll explain what they are and why they’re useful, along with how we use them at PSPDFKit.

Source: A Primer on JSON Web Tokens, an article by Arkadiusz Gil.

Rewriting your git history, removing files permanently

You know that adding secrets to your git repository (even a private one) is a bad idea, because doing so risks exposing confidential information to the world. But mistakes were made, and now you need to figure out how to excise confidential information from your repo. Because git keeps a history of everything, it’s not often enough to simply remove the secret, commit, and push: we might need to do a bit of deep cleaning.

Source: Rewriting git history, removing files permanently. Cheatsheet & guide, an article by Don Goodman-Wilson.

What am I running inside my bash?

I desperately needed to extract the complete (and very lengthy) command line I had written 6 months ago in a bash shell - which was still running under screen. Read on to see how I eventually made it...

What am I running inside my bash?, an article by Thanassis Tsiodras.

Reverse Engineering iMessage

iMessage is a widely used secure messaging app and protocol across the Apple ecosystem. Curious about what it would be like to run iMessage on other platforms, we took a reverse engineering approach to understand how iMessage operates and examine possibilities to extend it to other platforms.

The goal of this article is to show how Apple leverages the fact that it produces the hardware to protect its software. To explore this, we will try to connect via Apple Push Notification (APN) directly on the network level, and see what challenges we face. Along the way, we’ll reverse engineer small parts of the apsd daemon on macOS and the APN protocol itself using popular open-source tools.

Source: Reverse Engineering iMessage to Help Improve Security, an article by Abdelrahman Eid.

A Python project checklist

When building a new project, it's a smart move to be very strict right from the start. It is much harder to add more linting/typing checks once you have 1000+ lines of code.

That's why I'm providing an opinionated list of libraries for your new Python project. I might write a more in-depth article on the best practices when building a web app with Python. For now, this is mostly a checklist with some obvious recommendations.

Source: A Python project checklist, an article by Charles-Axel Dein.

Plurrrr Tweeting with Tags

Tags are coming to tumblelog but it's a slow process. All articles on my blog now have tags but the software doesn't show them yet. In the evening I wrote a small Perl script that uses those tags to create tweets in a format that can be used by tweetfile.pl. And it works very neat.

Plurrrr tweeting with tags
Plurrrr tweeting with tags.

A little later I noticed that Twitter cut off a significant part of the date, as can be seen in the above screenshot. So I added a rewrite rule with a permanent redirect to the NGINX configuration file:

rewrite 
  ^/(\d\d\d\d)-(\d\d)-(\d\d)/$
  /archive/$1/$2/$3.html
  permanent;

This redirects, for example, the short URL https://plurrrr.com/2019-07-12/ to https://plurrrr.com/archive/2019/07/12.html.

Next step is to make the tags also visible on Plurrrr itself, but that will take probably a week or two more as I am quite busy with work.

Become a git stash pro

git stash is a very useful feature in git allowing you to 'stash' away changes for later.

Key points for git stash:

  • Stashes are a last-in-first-out list. You can push and pop to it
  • Stashes have an index (the latest is 0), and optionally a message (like commits)
  • Stashing requires a commit. You can't stash if you haven't created a commit yet (for example - right after git init)

Stashing is useful in a few cases:

  • When you want to pull or rebase, and have a dirty working directory
  • When you want to move changes between HEADs
  • When you want to keep changes for later
  • And a few more

Source: Become a git stash pro, an article by Charles Crete.

How LZ4 works

LZ4 is a really fast compression algorithm with a reasonable compression ratio, but unfortunately there is limited documentation on how it works. The only explanation (not spec, explanation) can be found on the author's blog, but I think it is less of an explanation and more of an informal specification.

This blog post tries to explain it such that anybody (even new beginners) can understand and implement it.

Source: How LZ4 works.

See also: LZ4 - Extremely fast compression.

Dying of the Light

A whisperjewel has summoned Dirk t’Larien to Worlorn, and a love he thinks he lost. But Worlorn isn’t the world Dirk imagined, and Gwen Delvano is no longer the woman he once knew. She is bound to another man, and to a dying planet that is trapped in twilight. Gwen needs Dirk’s protection, and he will do anything to keep her safe, even if it means challenging the barbaric man who has claimed her. But an impenetrable veil of secrecy surrounds them all, and it’s becoming impossible for Dirk to distinguish between his allies and his enemies. In this dangerous triangle, one is hurtling toward escape, another toward revenge, and the last toward a brutal, untimely demise.

In the evening I started in Dying of the Light, a novel by George R. R. Martin.

Extracting the list of O'Reilly Animals

O’Reilly lists almost all of the animals from their covers, even if “animals” is a bit of a loose term that encompasses “Catholic Priests” (Ethics of Big Data) or “Soldiers or rangers, with rifles” (SELinux). You can page through that list 20 results at a time, or search it. But, as with most lists I see online, I want to grab the entire list at once. Show me a paginated resources and I’ll show you the program I automated to unpaginate it.

Source: Extracting the list of O'Reilly Animals, an article by brian d foy.

When to use HTTPS for local development

Using http://localhost for local development is fine most of the time, except in some special cases. This post explains when you need to run your local development site with HTTPS.

Source: When to use HTTPS for local development, an article by Maud Nalpas.

The Kingdom: very good

In the evening I finished The Kingdom by Jo Nesbø; what a read. While very slow (to me) it is also very good. Recommended.

Changing the color of an SVG icon

Today, for work, I had to change the color of an SVG icon from black to red (#ff0000) when a certain event occurred. I used the img element to display the SVG icon. Just adding a class with color set to the aforementioned hexadecimal color code didn't work. So I Googled and found an article called Change Color of SVG on Hover by Chris Coyier.

I decided to give the filter trick mentioned in this article a try and used the recommended online tool created by Barrett Sonntag which calculates the correct filter settings. When the class got added to the img element it indeed changed to red.