Plurrrr

week 14, 2023

shell-maker, a maker of Emacs shells

There was quite a bit of code duplication between the two Emacs shells I had just written. At the same time, I started hearing from folks about integrating other tools, some cloud-based, some local, proprietary, open source.. There's Cody, invoke-ai, llama.cpp, alpaca.cpp, and the list continues to grow.

With that in mind, I set out to reduce the code duplication and consolidate into a reusable package. And so shell-maker was born, a maker of Emacs shells.

Source: shell-maker, a maker of Emacs shells, an article by Álvaro Ramírez.

Closing a stale SSH connection

Suppose you’re connected to a remote host with SSH and after a while the SSH session goes stale. The terminal is unresponsive and no keypress seem to take effect. There might be something with the network, the remote host is restarting or maybe your machine has been in hibernation, there could be multiple reasons for a stale session.

The first solution that might come to mind is to just close the terminal emulator and create another one, but there is a better way.

Source: Closing a stale SSH connection, an article by David Isaksson.

How To Write Fast Rust Code

I did a line-for-line port of my eval library from Go to Rust, and right away it was 5x faster; I was pretty happy. But when I tried to further improve performance using techniques from other languages, it got slower... and the harder I tried, the slower it got! Rust performance was not intuitive to me.

Finally, after learning why my code was slow, I was able to boost performance 12000x, and my library was worthy of a new name: fasteval.

Source: How To Write Fast Rust Code, an article by Christopher Sebastian.

Cocaine Bear (2023)

An oddball group of cops, criminals, tourists and teens converge on a Georgia forest where a huge black bear goes on a murderous rampage after unintentionally ingesting cocaine.

In the evening Alice, Esme, and I watched Cocaine Bear. I liked the movie a lot and give it an 8 out of 10.

WebAssembly tail calls

We are shipping WebAssembly tail calls in V8 v11.2! In this post we give a brief overview of this proposal, demonstrate an interesting use case for C++ coroutines with Emscripten, and show how V8 handles tail calls internally.

Source: WebAssembly tail calls, an article by Thibaud Michaud and Thomas Lively.

ORMs considered harmful

I think people reach for ORMs because they are afraid of making mistakes, they do not want to learn SQL, or both. People assume that their ORM of choice will generate correct (i.e. does what they intended), valid (i.e. running it won't produce an error, such as a syntax error), and performant SQL for the queries they need to make, and that they can do this without learning SQL itself. I think wanting to avoid mistakes is a very noble goal, but I do not think ORMs are the right way to acheive it. I also think learning SQL is unavoidable, and reliance on ORMs are a net hinderance for yourself and other maintainers. Allow me to explain why I think these things, and perhaps convince you as well.

Source: ORMs considered harmful.

PKI for busy people

Public-key infrastructure (PKI) is an umbrella term for everything that has to do with keys and certificates.

This is a quick overview of the important stuff.

Source: PKI for busy people, an article by Christoffer Rehn.

Explaining why the Python installation process such a mess

Python installation experience is lacking. This is not because nobody wants to fix it. A lot of work has been done to improve it already. But the age and popularity of the language make the task extremely complicated.

Nevertheless, providing a cross-platform installer shipping self-contained binaries and normalizing how you run the executable would help a lot. Several projects are experimenting with those ideas.

Source: Explaining why the Python installation process such a mess.

Inlining SVGs for Dark Mode

Recent browsers use the prefers-color-scheme option to automatically choose light or dark mode CSS styles, if the website supports it. And my website did support it, not that I knew it until people started commenting that my syntax-highlighted code blocks were unreadable! I figured out how to toggle light/dark mode in Firefox (ctrl+shift+I to open the inspector pane then click the sun/moon icons), perused my website, and found an even greater problem: my treasured vector diagrams that I put so much time & effort into were completely invisible against a dark background! Here’s a quick post about supporting dark mode on my blog by inlining SVGs and setting their color with the currentColor CSS variable.

Source: Inlining SVGs for Dark Mode, an article by Andrew Helwer.

Packaging a python library

I think the packaging best practices should be revisited, there are lots of good tools now-days that are either unused or underused. It's generally a good thing to re-evaluate best practices all the time.

I assume here that your package is to be tested on multiple Python versions, with different combinations of dependency versions, settings etc.

And few principles that I like to follow when packaging:

  • If there's a tool that can help with testing use it. Don't waste time building a custom test runner if you can just use py.test or nose. They come with a large ecosystem of plugins that can improve your testing.
  • When possible, prevent issues early. This is mostly a matter of strictness and exhaustive testing. Design things to prevent common mistakes.
  • Collect all the coverage data. Record it. Identify regressions.
  • Test all the possible configurations.

Source: Packaging a python library, an article by Ionel Cristian Mărieș.

PostgreSQL Logical Replication Gotchas

PostgreSQL 10 came with the welcome addition of the logical replication feature. This provides a more flexible and easier means to replicate your tables than the regular streaming replication mechanism. However, it does have some limitations that may or may not prevent you from employing it for replication. Read on to learn more.

Source: PostgreSQL Logical Replication Gotchas

Avatar: The Way of Water (2022)

Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.

In the evening Alice, Esme, and I watched Avatar: The Way of Water. A beautifully made movie. I liked it a lot and give it a solid 9 out of 10.

Polars for initial data analysis, Polars for production

Polars has two fundamental APIs, each of which is useful in different situations:

  • “Eager” mode, which is similar to how Pandas works, is well-suited for initial and exploratory data analysis.
  • For production use, “lazy” mode often execute much faster, with lower memory usage, at the cost of not giving you access to intermediate result.

In this article we’ll use both two APIs and see how Polars lets you transition from looking at the data to something we can run even more efficiently in production.

Source: Polars for initial data analysis, Polars for production, an article by Itamar Turner-Trauring.

Single-Command Server Bootstrapping

When you spin up a new VM or bare metal server at some cloud provider, what is the fastest and easiest way to get the server to run a certain configuration? In this article, I show how to do the partitioning, formatting, and installing a fully configured NixOS, starting from a random rescue system, in 5 minutes and with literally a single command: nixos-anywhere.

Source: Single-Command Server Bootstrapping, an article by Jacek Galowicz.

Datapane

Datapane is an app development platform which gives you everything you need to build internal data analytics products using Python.

Source: Datapane.

Pydantic V2 Pre Release

Pydantic is an open-source Python library that provides powerful data parsing and validation — including type coercion and useful error messages when typing issues arise — and settings management capabilities.

Source: Pydantic V2 Pre Release, an article by Terrence Dorsey and Samuel Colvin.

Modeling Git Internals in Alloy, Part 1: Blobs and Trees

Git stores all the code and commits in your repo in a content-addressable store. That means that if you know the hash of something, you can retrieve it from the store. This allows Git to do cool things like syncing and deduplication, but it's also the source of some of the weirder parts of Git's behavior from a beginner's perspective. Once I learned about the internals, I found it a lot easier to reason about what it was doing. If you're learning about them for the first time now, I hope you have a similar experience!

Source: Modeling Git Internals in Alloy, Part 1: Blobs and Trees, an article by Brian Hicks.

trurl manipulates URLs

trurl is a small command line tool that parses and manipulates URLs, designed to help shell script authors everywhere.

URLs are tricky to parse and there are numerous security problems in software because of this. trurl wants to help soften this problem by taking away the need for script and command line authors everywhere to re-invent the wheel over and over.

trurl uses libcurl’s URL parser and will thus parse and understand URLs exactly the same as curl the command line tool does – making it the perfect companion tool.

Source: trurl manipulates URLs, an article by Daniel Stenberg.

SSH authorization keys experiments

Last week, while brainstorming with a colleague, I discovered a few interesting options with regard to OpenSSH public key authentication mechanisms, specifically how OpenSSH resolves which public keys are allowed for a particular user.

Source: SSH authorization keys experiments, an article by Ciprian Dorin Craciun.

Django 4.2 released

The Django team is happy to announce the release of Django 4.2.

This version has been designated as a long-term support (LTS) release, which means that security and data loss fixes will be applied for at least the next three years. It will also receive fixes for crashing bugs, major functionality bugs in newly-introduced features, and regressions from older versions of Django for the next eight months until December 2023.

Source: Django 4.2 released, an article by Mariusz Felisiak.