week 18, 2022

Scapy: low level packet hacking toolkit for Python

Scapy is a Python module and interactive program for low-level network programming that attempts to make it easier without abstracting away the technical details. This project is fairly prominent in cybersecurity space and used for things like exploit development, data exfiltration, network recon, intrusion detection and analysing captured traffic. Scapy integrates with data visualisation and report generation tooling for presenting the results of your research to bug bounty program or during the meeting with customer or management. The foundational idea for Scapy is proposing a Python-based domain specific language for easy and quick wire format management.

Source: Scapy: low level packet hacking toolkit for Python.

Multiple assignment and tuple unpacking

Whether I’m teaching new Pythonistas or long-time Python programmers, I frequently find that Python programmers underutilize multiple assignment.

Multiple assignment (also known as tuple unpacking or iterable unpacking) allows you to assign multiple variables at the same time in one line of code. This feature often seems simple after you’ve learned about it, but it can be tricky to recall multiple assignment when you need it most.

Source: Multiple assignment and tuple unpacking improve Python code readability, an article by Trey Hunner.

The Emacs Guru Guide to Key Bindings

Emacs shortcuts (known as ‘key bindings’) can seem ridiculous to beginners. Some Emacs users even argue you should change them as soon as you start using Emacs.

They are wrong. In this post, I’ll describe the logic behind the Emacs key bindings. Not only will you be closer to passing the guru test, but you might even find you like some of the defaults!

Source: The Emacs Guru Guide to Key Bindings, an article by Wilfred Hughes.

Converting strings to objects with jq

In preparing some data for another upcoming blog post, I needed to convert a list of fully qualified GitHub repository names into a JSON array of single-property objects (to reflect the style of JSON output from GitHub's gh CLI). I achieved this with a short jq filter. Here's how, recorded here, with my working thoughts, mostly for my outboard memory.

Source: Converting strings to objects with jq, an article by DJ Adams.

Unix command line conventions over time

This blog post documents my understanding of how the conventions for Unix command line syntax have evolved over time. It’s not properly sourced, and may well be quite wrong. I’ve not been using Unix until 1989, so I wasn’t there for the early years. Maybe someone has written a proper essay on this, with citations. I’m too lazy to dig them up.

Source: Unix command line conventions over time, an article by Lars Wirzenius.

RSS Feed Best Practises

These are some technical tips for publishing a blog. These have nothing to do with good content, just how to share that content. The recommendations are roughly in order of importance and have rationale for why they are that important.

Source: RSS Feed Best Practises, an article by Kevin Cox.

Pig (2021)

A truffle hunter who lives alone in the Oregon wilderness must return to his past in Portland in search of his beloved foraging pig after she is kidnapped.

In the evening we watched Pig. The movie was OK and I give it a 6 out of 10.

Rust is hard, yes, but does it matter?

Rust is infamous for having a steep learning curve. The borrow checker is the first boss you must defeat, but with a good mental model of how memory works, how objects move, and the rules that the borrow checker enforces, it becomes second nature rather quickly. These rules may sound complicated, but really, they are about understanding the fundamentals of how a computer works.

Source: Rust is hard, yes, but does it matter?, an article by Julio Merino.

Making type-safe internet bots with Haskell

There are basically two types of client applications on the internet:

  • Clients that use the request-response model. One request will generally result in one response. Some examples would be web browsers and many API clients.
  • Clients that receive a continuous stream of data from a server and may or may not send data back at any time. Examples of this type would include chatbots, automated trading applications and multiplayer video games.

In this article, I will describe a fairly general way to use Haskell for constructing a specific kind of clients of the second type: clients that listen to a single network socket and send replies to that same socket, possibly while maintaining state. This article assumes basic proficiency with Haskell and networking.

Source: Making type-safe internet bots with Haskell, an article by Wander Hillen.

Finch (2021)

On a post-apocalyptic Earth, a robot, built to protect the life of his creator's beloved dog learns about life, love, friendship and what it means to be human.

In the evening we watched Finch. I liked the movie and give it a 7 out of 10.

Sheba the Maine Coon

After work I went to a nearby Burger King to join Esme, Adam, Alice, and Esme's coworker. The latter had brought her Maine Coon with her to show him to us.

Adam holding Sheba the Maine Coon
Adam holding Sheba the Maine Coon.

The cat was fine with being held as we took turns holding and petting it. After dinner at Burger King we walked to Starbucks to have a coffee.

USB Cheat Sheet

I spend time investigating a non-existing bug today because I misunderstood a USB term. So I made myself a cheat sheet. Maybe it will save time to someone.

Source: USB Cheat Sheet, an article by Fabien Sanglard.

PEP 690 – Lazy Imports

This PEP proposes a feature to transparently defer the execution of imported modules until the moment when an imported object is used. Since Python programs commonly import many more modules than a single invocation of the program is likely to use in practice, lazy imports can greatly reduce the overall number of modules loaded, improving startup time and memory usage. Lazy imports also mostly eliminate the risk of import cycles.

Source: PEP 690 – Lazy Imports, an article by Germán Méndez Bravo and Carl Meyer.


This blog will focus on simple bash commands for parsing data and Linux system maintenance that i acquired from work and LPIC exam. I apologize that there are no detailed citation for all the commands, but they are probably from dear Google and Stackoverflow.

Source: Bash-Oneliner, an article by Bonnie I-Man Ng.

See also the related Hacker News discussion.

Mastering kitty terminal

I've been using kitty for quite a long time now. Before it was iTerm and it was slow as my grand-mom's computer. Opening a new tab literally takes forever, I am always starting to type before it is loaded.

My life was desperate and wasteful before I found kitty.

Source: Mastering kitty terminal.

Emacs for Professionals

This is a series of brief articles aimed at teaching Emacs to computer professionals who are unfamiliar with it. I do not dwell on the basics of the user interface, which can be learned from the built-in tutorial. Instead, each article in this series will distill one very specific command line (CLI) tool or technique that Linux/UNIX users often use, and describe an equivalent function or technique in Emacs. The tool or technique discussed will be specific enough that the whole article can explain the concept in around 1000 words, and will provide examples, or specific actions to be taken. The goal is to have a list of recipes that Linux users can search and find quickly, and read through in just a few minutes, to learn the most useful ways of using Emacs to solve day-to-day problems.

Source: Emacs for Professionals, an article by Ramin Honary.

Running tasks on E cores can use a third of the energy of P cores

Following my article yesterday demonstrating with synthetic tests that Activity Monitor’s CPU % and Energy measurements are misleading, today I show how you can get accurate estimates of power and energy use, and how the E cores in M1 chips can be far more efficient than the P cores. Today’s compression task required less than a third of the energy when run on the E cores, than on the P cores.

Source: Running tasks on E cores can use a third of the energy of P cores, an article by Howard Oakley.

Introductory resources to type theory for language implementers

This post briefly tours resources that helped introduce me to type theory, because I’m frequently asked by others for resources on this subject (even though I never had a formal education in type theory). Specifically, these resources will focus more on how to implement a type checker or type inference algorithm.

Source: Introductory resources to type theory for language implementers, an article by Gabriella Gonzalez.