week 35, 2022

Downgrading binary packages with pkg on FreeBSD

I had recently upgraded my NAS from FreeBSD 13.0 to FreeBSD 13.1. Unfortunately, I found out that the Deluge package was faulting on startup. It turns out that when FreeBSD updated the libtorrent-rasterbar package, it had broken the Python bindings, and thus Deluge. However, the old Deluge and Python binding package were still installed – they just didn’t work anymore due to libtorrent ABI.

While it’d be ideal if this were fixed upstream, I didn’t have the patience for this right now. So, I decided to downgrade the libtorrent-rasterbar package to be compatible with the Python bindings. There were no other dependent packages, so I figured this was safe. Unfortunately, I had to deal with a few curveballs along the way…

Source: Downgrading binary packages with pkg on FreeBSD.

Unit Test Your Nix Code

At Tweag, we write a lot of code using the Nix language. Most of that code produces derivations or packages but occasionally we write small helper functions that are algorithmic in nature. As diligent developers and when appropriate, we should write unit tests to ensure the correctness and maintainability of our code. This post will demonstrate and compare various ways available in the Nix ecosystem to add unit testing to your Nix code — specifically Nix functions.

Source: Unit Test Your Nix Code, an article by Daniel Baker.

Frog in the garden

In the afternoon Esme spotted a large frog in our garden. We tried to catch it so we could release it near water, which is on the other side of a busy road, but the frog was too fast for us. After a while we couldn't find it back.

Common frog Rana temporaria
Common frog Rana temporaria.

I guess it is the Common frog; Rana temporaria.

curl’s TLS fingerprint

There are numerous different ways and variations a client can perform a TLS handshake and still be standards compliant. There is a long list of extensions that can vary in content, the order of the list of extensions, the ciphers to accept, the allowed TLS versions, steps performed, the order and sequence of those steps and more.

When a network client connects to a remote site and makes a TLS handshake with the server, the server can basically add up all those details and make an educated guess exactly which client that connects to it.

Source: curl’s TLS fingerprint, an article by Daniel Stenberg.

Top Gun: Maverick (2022)

After more than thirty years of service as one of the Navy's top aviators, Pete Mitchell is where he belongs, pushing the envelope as a courageous test pilot and dodging the advancement in rank that would ground him.

Set 30 years after its predecessor, it follows Maverick's return to the United States Navy Strike Fighter Tactics Instructor program (also known as U.S. Navy-Fighter Weapons School - "TOPGUN"), where he must confront his past as he trains a group of younger pilots, among them the son of Maverick's deceased best friend Lieutenant Nick "Goose" Bradshaw, USN.

In the evening Esme, her mother, and I watched Top Gun: Maverick. I liked the movie a lot and give it a solid 9 out of 10.

You Should Be Using Python's Walrus Operator - Here's Why

The assignment operator - or walrus operator as we all know it - is a feature that's been in Python for a while now (since 3.8), yet it's still somewhat controversial and many people have unfounded hate for it.

In this article I will try to convince you that the walrus operator really is a good addition to the language and that if you use it properly, then it can help you make your code more concise and readable.

Source: You Should Be Using Python's Walrus Operator, an article by Martin Heinz.

Dijkstra's Algorithm in Haskell

In some of my recent streaming sessions (some of which you can see on my YouTube chanel), I spent some time playing around with Dijkstra’s algorithm. I wrote my own version of it in Haskell, tried to generalize it to work in different settings, and then used it in some examples. So for the next couple weeks I’ll be writing about those results. Today I’ll start though with a quick overview of a basic Haskell approach to the problem.

Source: Dijkstra's Algorithm in Haskell.

Cram; a new dotfile manager

Cram is a single-file Python 3.6+ zip app, designed to be something you can just check in with your dotfiles and run anywhere using a system python interpreter. Cram provides a package abstraction like Stow with the addition of packages which can exec. Most importantly, Cram hews to immutable infrastructure principles with an execution log, dry-run/diff capabilities and supports automatic removal of installed resources.

Source: Cram; a new dotfile manager, an article by Reid D. McKenzie.

Demystifying Emacs’s Window Manager

Learn how to take control of Emacs's roundabout window placement. There's method to its madness, but that does not mean you have to put up with it! In this article I'll demystify how Emacs's window manager works and how you -- with a bunch of templates and examples -- can build IDE-like paneling; prevent annoying popup windows; or promote tab-based workflows.

Source: Demystifying Emacs's Window Manager, an article by Mickey Petersen.

Haskell in Production: Mercury

In our Haskell in Production series, we interview developers and technical leaders from companies that use Haskell for real-world tasks. We cover benefits, downsides, common pitfalls, and tips for building useful Haskell products.

Our today’s guest is Max Tagher. He’s the co-founder and CTO of Mercury, a company that provides banking products to startups. Read further to learn where Mercury uses Haskell, why they chose it, and what they like about it.

Source: Haskell in Production: Mercury, an article by Gints Dreimanis.

Best practices for managing Java dependencies

Creating Java applications is great, and many resources are available. To speed up development, many folks use frameworks and libraries that do some of the heavy lifting. When looking at modern Java applications, almost all of them contain dependencies from libraries developed by someone else.

Dependencies take up about 80 to 90 percent of the binary — so, we should take good care of them when creating a Java project. In this article, I’ll give you some advice and best practices for dealing with Java dependencies in your project.

Source: Best practices for managing Java dependencies, an article by Brian Vermeer.