Artikel in Kategorie "Technik"

Finding Files that have a Size between two Values given in Bytes

Save this as file /usr/local/bin/find-by-size and mark it executable: #!/usr/bin/env perl use strict; use File::Find; our $min = $ARGV[0]; our $max = $ARGV[1]; our $dir = $ARGV[2]; do { print STDERR „Usage: $0 MIN MAX DIR\n“; exit(1); } unless defined $min && defined $max && defined $dir && -d $dir; sub w { -f && […]

Print XDG Desktop Definition for Application

For an application given by „application name“ or „executable name“, output the corresponding .desktop file, if any: find_desktop() { local IFS=“:“ local xdg_data_dirs=${XDG_DATA_DIRS:-/usr/local/share:/usr/share} local 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:“ […]

Transforming Sets of Strings to their Common Prefix Notation

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, s2 have no such common characters, cp is the empty string. Let s̅1, s̅2 be the remainders or suffixes of s1 and s2 if cp is […]

Pi-KVM Hat v3

Ich freue mich, zu den Glücklichen zu gehören, die den Pi-KVM Hat v3 mit passendem Stahlgehäuse ergattert haben ( Das Warten hat sich gelohnt.

CentOS/8 Stream on libvirt/KVM with Kickstart and virt-install

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

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=““ project_id=43 max=3 author=“none“ releases=“latest“​] Output:

Interactive nftables Ruleset Editor

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).

GRE Setup for Bacula on a Mobile Client

The way Bacula works is: A backup client runs a TCP server process bacula-fd, waiting for a backup server process bacula-dir to connect and perform backup and restore jobs. There is a simple authentication mechanism, where bacula-dir presents a shared secret to bacula-fd to be granted access. Opening the bacula-fd TCP server on an exposed […]