week 12, 2022

Process Scheduling In Linux

Scheduling is the action of assigning resources to perform tasks. We will mainly focus on scheduling where our resource is a processor or multiple processors, and the task will be a thread or a process that needs to be executed.

Source: Process Scheduling In Linux, an article by Eliran Turgeman.

Running GUI apps within Docker containers

However, what if we want to run desktop GUI apps within Docker containers to use them as components within larger systems? For example, if we run Firefox within Docker we can have an explicit separation of browser state between containers. This is beneficial for things like social media management, growth hacking (either via social media automation or manual labour done by VAs) or OSINT investigations. For example, one container would be configured with Firefox instance that uses a single dedicated mobile proxy for just one social media account. This would provide a degree of protection against social media platform cracking down on sock puppet accounts being used from single setup because traffic is kept separate for each account and cookie cross-contamination is being prevented.

Source: Running GUI apps within Docker containers.

Using the Dirty Pipe Vulnerability to Break Out from Containers

The Dirty Pipe vulnerability is a flaw in the Linux kernel that allows an unprivileged process to write to any file it can read, even if it does not have write permissions on this file. This primitive allows for privilege escalation, for instance by overwriting the /etc/passwd file with a new admin user.

Source: Using the Dirty Pipe Vulnerability to Break Out From Containers, an article by Christophe Tafani-Dereeper, Eric Mountain, Tommy McCormick, and Frederic Baguelin.

Java Development on an Apple M1 – A One Year Review

It's been almost a year since I've bought the MacBook Pro M1 (arm64 processor) for my daily Java development as a freelance consultant. I had my first contact with the Apple M1 when one of my course students raised an issue that the build doesn't pass on Apple's new flagship laptop. I was first shocked to encounter hardware incompatibilities in 2021. To solve those problems (not my main intent, but I told myself so) and experience if that processor is really that fast, I decided to buy the MacBook Pro.

This article will share my initial pitfalls when working with the Apple M1 and a collection of valuable tricks and workarounds for developing and testing Java applications.

Source: Java Development on an Apple M1 - A One Year Review, an article by Philip Riecks.

Bashing the Bash — Replacing Shell Scripts with Python

The point of bash-bashing is to reduce use of the shell. Without much real work, it’s easy to replace shell scripts with Python code. The revised code is easier to read and maintain, runs a little faster, and can have a proper unit test suite.

Because shell code is so common, I’ll provide some detailed examples of how to translate legacy shell scripts into Python. I’ll assume a little familiarity with Python.

Source: Bashing the Bash — Replacing Shell Scripts with Python, an article by Steven F. Lott.

Git crecord

git-crecord is a Git subcommand which allows users to interactively select changes to commit or stage using a ncurses-based text user interface. It is a port of the Mercurial crecord extension originally written by Mark Edgington

Source: Git crecord, an article by Andrej Shadura.

DIY javascript error logging

There are many SaaS products out there that help you with javascript error and event logging, but in this blog post I want to make the case for rolling your own solution.

We log 3 types of events: (1) javascript exceptions with stack traces, (2) failed assertions, and (3) general usage/diagnostics information.

Source: DIY javascript error logging, an article by Diederik van Houten.

Please stop writing shell scripts

That’s when you realize your mistake: bash, and shell scripting languages in general, are mostly broken by default. Unless you are very careful from day one, any shell script above a certain complexity level is almost guaranteed to be buggy… and retrofitting the correctness features is quite difficult.

Source: Please stop writing shell scripts, an article by Itamar Turner-Trauring.

An Introduction To Generics

The Go 1.18 release adds support for generics. Generics are the biggest change we’ve made to Go since the first open source release. In this article we’ll introduce the new language features. We won’t try to cover all the details, but we will hit all the important points.

Source: An Introduction To Generics, an article by Robert Griesemer and Ian Lance Taylor.

How to properly interpret a traceroute or mtr

When a packet travels across the Internet, it travels through multiple routers. The traceroute and mtr tools can be used to identify the routers a packet passes through between you and a given destination IP address. traceroute is a one-shot sort of tool whereas mtr runs and aggregates the results of a number of traceroutes. If you simply want to find the routers your packet passes through, traceroute is fine. If you want to diagnose a problem such as packet loss, mtr is the tool to use.

In this blog, we’ll talk in the context of the output of mtr given it is more versatile.

Source: How to properly interpret a traceroute or mtr, an article by Phil Lavin.

My key takeaways from The Pragmatic Programmer

In this post, I’d like to write a quick summary of key ideas presented in the book The Pragmatic Programmer written by David Thomas and Andrew Hunt. It will serve me (and you, hopefully) as a reference I can look up later to remind myself of these timeless concepts.

Obviously, it’s not possible to cover everything here. I highly recommend reading this book to get a full picture. Here, I focus on things that are in my opinion most important in regards to our everyday work and advancing our careers as programmers.

Source: My key takeaways from The Pragmatic Programmer, an article by Arkadiusz Chmura.

CSS !important

!important was added for one reason only: laws in the US that require certain text to be in a given font-size. !important stops the cascade from changing it.

Anything else is probably misuse, and a sign you may not understand the cascade properly.

Source: a Tweet by CSS co-designer Steven Pemberton.