Process Groups, Sessions, and Controlling Terminals
A summary of UNIX’s process groups, sessions, & controlling terminals and how to work with them
John T. Wodder II (jwodder on GitHub and other places) is a computer programmer who currently works primarily in Python and Rust but has previously also done work in C, Perl, and Haskell, among other languages. He enjoys abstract & discrete mathematics, *nix-based operating systems, sum types, static type checking, asynchronous programming, data-driven testing, and large properly-formatted data files. He dislikes Windows, C++, and floating-point numbers.
A summary of UNIX’s process groups, sessions, & controlling terminals and how to work with them
When using ANSI escape sequences to style text on a terminal, you may need to know exactly what the default foreground & background colors — the ones set with \e[39m and \e[49m — are, as knowing whether the user’s terminal is light-on-dark or dark-on-light can help you pick an appropriate color theme. Fortunately, the escape sequences supported by xterm and compatible terminals include sequences for doing just that.
When using ANSI escape sequences to manipulate a compatible terminal, you may need to know where the text cursor is currently located on the screen, especially if its current location was set by the user or a previous program rather than your code. Fortunately, the ANSI escape sequence standard ECMA-48 provides a sequence for doing just that.
The encryption protocol used by the BitTorrent peer-to-peer file-sharing protocol — known variously as Message Stream Encryption (MSE), Protocol Encryption (PE), or MSE/PE, among other names — is what keeps you secure while you download massive amounts of … Linux ISOs. Here’s how it works.
If you have a file that’s just a list of items, one item per line, and you want to turn it into a simple table — one delimited just by whitespace without any border characters — how would you do that? Follow up question: If you have a simple table, and you want to convert it into a list of items, one per line, how would you do that? The answer to both questions is: with the rs command, and this article will show you how.
A guide to the basic syntax & commands of Unix man pages
How to use Rust’s clap library to implement boolean --foo and --no-foo flags that undo each other
Python introduced asynchronous programming capabilities in version 3.4 in 2014, with further notable improvements in almost every minor version since. However, to many Python programmers, this area of the language remains esoteric, misunderstood, and underutilized. This article aims to elucidate the fundamental concepts of asynchronous programming as part of the first step towards mastery.
How to create an enum in Python where each member has a “main” value and a set of “extra” constant attributes
When testing Python code with pytest, you may occasionally write tests that you only want to run under special circumstances, such as long-running tests that should only be run under continuous integration and not when invoking pytest locally. The naïve way to accomplish this is to decorate the tests in question with a pytest mark like @pytest.mark.slow and then specify -m "not slow" when running pytest locally, but then you have to remember to pass this option every time, and if you hardcode it into your tox.ini or pytest configuration, you’ll need something else to remove it when testing under CI. Fortunately, there are better ways to make pytest skip tests by default.
Notable features introduced in each major release of Python, from Python 3.0 forwards
A list of version control system-specific files that one may find in the working directories of common version control systems
auto by Intuit lets you set up automatic creation of tags & releases and population of changelogs in a GitHub project. It takes care of determining the version number for new releases, but, by default, it does not set the new version number in your code. This isn’t a problem if your project uses something like setuptools_scm or versioneer to fetch the version number from Git, but if your project’s version number is hardcoded in your code, you’ll need another solution. bump2version is that solution, and it can be integrated into auto as shown here.
When creating a Python project, you may want to include a number of non-Python files in the project that the code can then access at runtime, such as templates, images, and data. These files are called package data, and this article describes how to include them in & access them from your project.
Let’s say you’ve set up auto for your project via a GitHub Actions workflow, and now you want that workflow to carry out additional steps — such as building & uploading assets — whenever auto creates a new release. Let’s also say that none of the available plugins for auto covers your use-case and you’re not a JavaScript programmer, so you won’t be writing a new plugin to do what you want. How do you adjust your GitHub Actions workflow to run these extra steps at the right time? Read to find out.
An overview of common mistakes made in creating & building a Python package and how to avoid them
How to derive the closed-form expression for \(\sum_{i=1}^n i^m\) for a given \(m\) using the formulas for all lesser \(m\)’s
Writing the various hyperlink syntaxes in reStructuredText, along with internal hyperlinks and styling link text
How to configure LaTeX to accept UTF-8 input (or just use XeLaTeX/LuaLaTeX instead)
How to set up a Click program to read default option values from a config file