Plurrrr

week 08, 2022

Failing in Haskell

Recently I encountered some dubious error handling code. Not only was it failing, it was failing WRONG1. This frustrates me because doing failing correctly in Haskell is quite easy, so why was it implemented wrongly? I believe no-one has addressed failing with an opinion. Plenty people describe the various ways you can fail. But none give opinions on why certain ways are better then others. Therefore I shall share my failing expertise, and describe the correct way to fail in Haskell.

Source: Failing in Haskell, an article by Jappie Klooster.

What I Learned After Using an SSH Honeypot for 7 Days

The idea of using a honeypot to learn about potential attackers came to me while chatting with a friend that had exposed his SSH port to log into while away from home. He had mentioned that Chinese IPs had been attempting to gain access. These attacks reminded me of when broadband internet was introduced and there was quite a few firewall software apps protecting internet users. In these apps, when specific incoming traffic took place a popup dialog would alert you to a possible attack. Today's internet is a lot more advanced with several new attack vectors and running an SSH honeypot would be a great opportunity to get up to speed about the attacks and attackers affecting the internet.

Source: What I Learned After Using an SSH Honeypot for 7 Days, an article by Torrey Betts.

Building a Static Site Generator in Rust

At a high level this is how our static site generator will work.

  • Static site generator will watch content directory that will have a list of markdown files with content
  • It will read all the markdown files and create html file corresponding to them in the public directory. Names of html files will be same as markdown file names.
  • Next, it will generate index.html that will list all the content specific HTML files
  • Finally, it will watch for any changes in the content directory. If content changes then it will generate the content HTML and reload the changes.

Source: Static Site Generator in Rust.

A almost perfect rsync over ssh backup script

Creating backups is a basic necessity for anyone who stores data. With the help of a dedicated server, the Linux operating system and the rsync software, you can securely and efficiently retrieve data from any computer via an SSH connection and store it in a backup. It doesn’t matter if there is another Linux server, a Mac or a Windows computer on the other side. But as soon as you have more than a few text files, you have to control the process precisely. This script contains some important elements, which are essential when dealing with large amounts of data and slow internet lines.

Source: A almost perfect rsync over ssh backup script, an article by Thomas Hezel.

Understanding Decorators in Python

Decorators are wrappers around Python functions (or classes) that change how these classes work. A decorator abstracts its own functioning as far away as possible. The Decorator notation is designed to be as minimally invasive as possible. A developer can develop his code within his domain as he is used to and only use the decorator to extend the functionality. Because this sounds very abstract, let’s look at some examples.

Source: Understanding Decorators in Python, an article by Bas Steins.

NFS Shares With ZFS

FreeBSD provides a built-in NFS server and client which understand the NFSv3 and NFSv4 protocols. If you’re new to NFS, this section of the FreeBSD Handbook provides a good overview of NFS and its components.

Source: NFS Shares with ZFS.

Optimizing Postgres Text Search with Trigrams

In this post, we’ll implement and optimize a text search system based on Postgres Trigrams.

We’ll start with some fundamental concepts, then define a test environment based on a dataset of 8.9 million Amazon reviews, then cover three possible optimizations.

Our search will start very slow, about 360 seconds. With some thoughtful optimization we’ll end up at just over 100 milliseconds – a ~3600x speedup! These optimizations won’t apply perfectly to every text search use-case, but they should at the very least spark some ideas.

Source: Optimizing Postgres Text Search with Trigrams, an article by Alex Klibisz.

Podman Release v4.0.0

Podman v4.0.0, a brand-new major release, is now available. Podman 4.0 is one of our most significant releases ever, featuring over 60 new features. Headlining this release is a complete rewrite of the network stack for improved functionality and performance, but there are numerous other changes, including improvements to Podman’s Mac and Windows support, improvements to pods, over 50 bug fixes, and much, much more!

Source: Podman v4.0.0 Released.

The Midnight Lock

A woman awakes in the morning to find that someone has picked her apartment’s supposedly impregnable door lock and rearranged personal items, even sitting beside her while she slept. The intrusion, the police learn, is a message to the entire city of carnage to come. Lincoln Rhyme and Amelia Sachs are brought in to investigate and soon learn that the sociopathic intruder, who calls himself "the Locksmith,” can break through any lock or security system ever devised. With more victims on the horizon, Rhyme, Sachs and their stable of associates must follow the evidence to the man’s lair… and discover his true mission.

Their hunt is interrupted when an internal investigation in the police force uncovers what seems to be a crucial mistake in one of Rhyme's previous cases. He’s fired as a consultant for the NYPD and must risk jail if he investigates the Locksmith case in secret.

In the evening I started in The Midnight Lock Lincoln Rhyme book 15 by Jeffery Deaver.

Two Books on Java

In the evening the two books I ordered from Amazon last Friday evening arrived:

Two books on Java I bought
The two books on Java I bought.

I want to learn more about writing microservices in Java using Spring Boot. As my knowledge of Java is severely outdated I decided to buy the Complete reference by Herbert Schildt. And for the microservices part, after reading several reviews, I decided on Spring Boot Up & Running by Mark Heckler.

Nix Flakes: an Introduction

Nix is a package manager that lets you have a more deterministic view of your software dependencies and build processes. One if its biggest weaknesses out of the box is that there are very few conventions on how projects using Nix should work together. It's like having a build system but also having to configure systems to run software yourself. This could mean copying a NixOS module out of the project's git repo, writing your own or more. In contrast to this, Nix flakes define a set of conventions for how software can be build, run, integrated and deployed without having to rely on external tools such as Niv or Lorri to help you do basic tasks in a timely manner.

Source: Nix Flakes: an Introduction, an article by Christine Dodrill.

Learn Makefiles With the tastiest examples

I built this guide because I could never quite wrap my head around Makefiles. They seemed awash with hidden rules and esoteric symbols, and asking simple questions didn’t yield simple answers. To solve this, I sat down for several weekends and read everything I could about Makefiles. I've condensed the most critical knowledge into this guide. Each topic has a brief description and a self contained example that you can run yourself.

Source: Makefile Tutorial By Example, an article by Chase Lambert.