Recent Posts

Techstack n - 1 is dead!

TL;DR TechStack n-1 is dead. It ended with the rise of the clouds and software release cycles going down to weeks due to containerized CIs.

Against ‘it’s stable and mature so let it run’

Death of Sophocles
The Death of Sophocles (Creative Commons)

Beeing OpenSource-based, Ubuntu already had the concept of point releases every 6 months when the Docker and K8s hit the world and gave automated CIs a big boost in making system containers. Some years after Docker itself switched to a 3-month release cycle. So did the Linux Kernel with 2-3 months. Firefox 4-weeks.

[more]

Download an LFS backed file from GitLab.com without `git` and `git-lfs` installed

It is possible to download a Git LFS-backed file from GitLab.com without having git or git-lfs installed by using the GitLab API directly. This article provides two shell scripts that demonstrate how to do this.

Well, the API is there and you can do it already!

Just dig into what git is doing by a test-clone with any LFS repo:

export GIT_CURL_VERBOSE=1
export GIT_TRACE_CURL=1
git clone <my-repo> 2>&1 | tee git-clone.log

From there you are able to figure out what is happening on SSH.

[more]

AWS CLI V2 is generally available since February 2020. BUT…

The AWS CLI V2 is distributed as a binary package, but this new distribution method comes with a few caveats.

It is distributed as a binary package (built on Python with PyInstaller that has bundled native libs) BUT…

  • Problem #1 this requires a decent GLIBC and probably won’t run on older Red Hat distributions.
  • Problem #2 as it turns out, many people use the official docker images to build their images and push to AWS ECR. And since these images are based on Alpine and therefore use MUSL and NOT GLIBC, it simply won’t run (but well, people have seen Alpine pipelines in AWS builds now, although they do NOT support any other Linux than their own; probably THEY HAVE TO).
  • Problem #3 you now have to download the application to update it (hey, the way to install software on Windows or Mac? But hey, an own updater with aws/install --update).
  • Problem #4 forget installing and updating from pip for now; well, you can directly pip from the repo, BUT it’s tricky. Although the …
[more]

#blacklivesmatter vs. a git master

Ich sehe es so: Systemischer Rassismus* führte dazu, dass eine heterogene, aber ethnische Gruppe von Menschen aufgrund ihrer Hautfarbe benachteiligt wurde. Im Laufe der Zeit wurde das Ungleichgewicht durch all diese kleinen Benachteiligungen so stark, dass nun, informell und formell, eine Ausbalancierung stattfindet – quasi als „The White Man’s Legacy“.

Leider wird dabei oft wieder gegen die falschen Ziele geschossen oder über das Ziel hinausgegangen: Gerade in unserer Zeit der Selbstradikalisierung ist es besonders einfach, sich mit dem Ziel, „ein Unrecht zu korrigieren“ (correct a wrong), zu profilieren. Wie oft in der Politik zählt ohnehin nur noch das „moralisch Korrekte“, da sich damit am einfachsten uninformierte Follower rekrutieren lassen. Ethisch gerechte und rationale Entscheidungen treten in den Hintergrund.

[more]

5¢ on YAML in the DevOps world

YAML Fatigue is Real: Are We Forgetting the “Why” Behind Declarative Config?

Lately, it feels like everywhere you look, there’s a YAML wrapper.

Often, a simple envsubst would suffice. I see many apps and frameworks that – let’s be honest – often just feel like a slightly polished YAML layer over a simple API call. And then there are the countless YAML-based Task Runner projects that are trying so hard to be the next-gen CI configuration (taskctl?… 😬).

[more]

CSV tools

Here are some CSV utilities that may come in handy since most teams deal with this format.

  • daff - part of my default toolset ;)
  • csvq - part of my default toolset ;)
  • tsv-utils - interesting read
  • xsv - yeah, the ripgrep guy
  • gron - now part of my default toolset (yeah, json but faster than jq with “flatten” filter; line grep is powerful)
  • coopy - patch/diff for CSV and spreadsheet data
  • rq - in trial
[more]

‘Ternary Operator’ with JQ: Checking for Empty Values

As you noticed I use JQ commonly like RegExp. I recently used select(.!=null) to filter for non-null values. Turns out I missed something in docs:

jq -nc '{a:1},[1,23],true,null,42|values'

OUTPUT

{"a":1}
[1,23]
true
42
jq -nc '{a:1},[1,23],true,null,42|iterables'

OUTPUT

{"a":1}
[1,23]
jq -nc '{a:1},[1,23],true,null,42|nulls'

OUTPUT

null

Now that can be used to set defaults:

jq -nc '.notset?|values // "default"'

OUTPUT

"default"
$ jq -nc '.notset|values // "default"'

OUTPUT

[more]

Pure BASH interactive CLI/TUI menu (single-/multi-select/checkboxes)

This post presents a first version of a pure bash script for creating interactive command-line menus with single-select, multi-select, and checkbox functionality.

First version. To be refactored.

Asciinema recording

Gist Link

Inspired by

Notes

  • This is a hacky first implementation for my shell tools/dotfiles (ZSH).
  • The intention is to use it for CLI wizards (my aim is NOT a full-blown curses TUI window interface).
  • I converted TPUT to ANSI-sequences to spare command executions (e.g. tput ed | xxd --plain).

Permission to copy and modify is granted under the Creative Commons Attribution 4.0 license.

[more]

Thought Experiment: Automation in Big Corporate

Thought Experiment: Automation in a Big Corporate Environment

Goal: We want to transition from owning our own fleet of cars to using a taxi service as a utility (service provider).

However, we don’t know enough about the taxi business and feel uncertain. Therefore, our first step is to hire drivers to operate our existing cars as makeshift taxis. These drivers, however, are not trained taxi drivers, they don’t know the routes, and the navigation system is a proprietary product with outdated maps. It comes from a reputable manufacturer, which is useless in practice. To keep them awake and encourage them to learn the routes, we also provide our drivers with coffee from a well-known, premium coffee chain.

[more]

PHP: just in case posix_isatty() is missing

This article provides a couple of PHP code snippets from StackOverflow that can be used to determine if a PHP script is running in an interactive terminal (TTY). These are useful workarounds for environments where the posix_isatty() function is not available.

Short function

function is_a_tty()
{
    static $result;
    if (is_null($result)) {
        $fp = fopen('php://stdin', 'r');
        $stat = fstat($fp);
        $mode = $stat['mode'] & 0170000; // S_IFMT
        $result = $mode == 0020000; // S_IFCHR
        fclose($fp);
    }
    return $result;
}

Info Class from StackOverflow by leigh

<?php

class IOMode
{
    public $stdin;
    public $stdout;
    public $stderr;

    private function getMode(&$dev, $fp)
    {
        $stat = fstat($fp);
        $mode = $stat['mode'] & 0170000; // S_IFMT

        $dev = new StdClass;

        $dev->isFifo = $mode == 0010000; // S_IFIFO
        $dev->isChr  = $mode == 0020000; // S_IFCHR …
[more]