This is an update to my previous article on determining the common prefixes of a set of strings (passed a sequence of lines) and printing them in common prefix notation (CPN). The problem of reconstructing strings from the original input that are complete prefixes of other input strings is addressed. The code is now in […]
Artikel in Kategorie "Technik"
Find Files by Size given in Bytes
20. August 2023 in Administration, GNU/Linux, Programmierung.
Some examples: Find files in current directory that have a size of 400 bytes or more: sfind -min 400 Find files in /etc that have a size of 50 kilobytes (1 kilobyte = 1024 bytes) or more: sfind -dir /etc -min 50k Find files in /var with size between 100 and 500 megabytes, suppress warnings, […]
Print XDG Desktop Definition for Application
20. August 2023 in Administration, GNU/Linux.
For an application given by „application name“ or „executable name“, output the corresponding .desktop file, if any: #!/bin/sh IFS=“:“ xdg_data_dirs=${XDG_DATA_DIRS:-/usr/local/share:/usr/share} search=$1 for i in $xdg_data_dirs ; do a=“$i/applications“ [ -d $a ] && for d in „$a“/*.desktop ; do grep -q -e „^Name=.*$search“ -e „^Exec=.*$search“ „$d“ && { echo „# $d:“ grep -Ev ‚^(Comment|GenericName|Keywords|Name\[)‘ „$d“ […]
Transforming Sets of Strings to their Common Prefix Notation
2. Februar 2024 in Programmierung.
Update Aug 20 2022: There is an update to this article that fixes a known issue. There is also a Git repository containing a reference implementation. Any two strings s1, s2 have a common prefix cp, which is the string of characters that s1 and s2 have in common up from the start. If s1, […]
Pi-KVM Hat v3
20. August 2023 in Administration, GNU/Linux, Technik.
Ich freue mich, zu den Glücklichen zu gehören, die den Pi-KVM Hat v3 mit passendem Stahlgehäuse ergattert haben (https://pikvm.org/). Das Warten hat sich gelohnt.
CentOS/8 Stream on libvirt/KVM with Kickstart and virt-install
22. Januar 2023 in Administration, GNU/Linux, Technik.
This article describes using Kickstart to automate the CentOS installer and virt-install to automate the creation of a VM. The following setup is assumed: There is a libvirt hypervisor called virthost. ssh to virthost as „root“ is possible.
WordPress-Plugin to Embed Gitlab Project Information
1. Januar 2022 in Programmierung, Technik.
For my personal use, i wrote a small WordPress plugin that allows me to embed a link to a Gitlab repository, a list of commits and a link to the releases of that project in a WP post. Example (linebreaks added to shortcode for readability): [gitlab-show-project url=“https://tk-sls.de/gitlab“ project_id=43 max=3 author=“none“ releases=“latest“] Output:
Interactive nftables Ruleset Editor
11. Januar 2024 in Administration, GNU/Linux, Technik.
I wrote a simple shell tool to interactively edit the current nftables ruleset using a terminal-based text editor (respecting environment variable EDITOR and defaulting to vim). For testing purposes, it can optionally revert the changes after a timeout specified in seconds (option –timeout SECONDS, requires systemd-run).