WordPress Plugin to embed Gitea Repositories

I ported the WordPress plugin providing shortcodes for embedding Gitlab projects into posts and pages to a Gitea version.

Below is a usage example, displaying the latest 3 commits and the latest release (if any) from repository „linuxfoo-gitea“ on my Gitea instance:

[gitea-show-project url="https://tk-sls.de/git" project_owner=tk-sls.de project_repo=linuxfoo-gitea max=3 releases=latest]
Gitea project linuxfoo-giteaLast 3 commits: by root: 35962433 correct json pat to commit message by root: fccb7dd5 correct message formatting by root: 19f52bfb correct class namesLatest release: v1.0.0

Lesen Sie mehr »

PiKVM on an OrangePi Zero 2

The OrangePi Zero 2 H616/1GByte is capable of running PiKVM. I find this an interesting development, because if i only want the KVM functionality, a full-blown Raspberry Pi 4 with all its CPU resources, multiple Gigabytes of RAM and peripheral devices seems somewhat of an overkill. I am aware that the latest official PiKVM, the V4Plus uses a Raspberry Pi Compute Module with 2 GB RAM, but mine is still smaller. 🙂

Lesen Sie mehr »

Print all indented Lines following a non-indented Line

Some configuration and output text formats contain sections like the following:

foo:
   value1
   value2
bar:
   value 3

In this article, two scripts are presented that print all consecutive indented lines that follow a non-indented line that matches a search pattern given by a regular expression.

This means, given the single argument foo and the standard input above, the scripts should

  • determine the line that matches foo and
  • print the following two lines, but no other lines.

Also, the indentation of the printed lines should be removed.

Lesen Sie mehr »

Urlaubsbilder aus der Ostschweiz

Ein paar Fotos aus der Ostschweiz, Kantone St. Gallen und Appenzell Innerrhoden:

Blick aus dem Hotelfenster auf St. Gallen Hauptbahnhof

 

Donnerstag morgens in St. Gallen Altstadt

 

St. Gallen Altstadt spät abends

 

Ein Laden in Appenzell

 

Blick das Rheintal hinauf (links des Rheins ist Liechtenstein)

 

Bergblumen

 

Bergblumen am Gipfel des Hohen Kastens, vor den Fenstern des Drehrestaurants

 

Panorama West-Süd-Südost vom Hohen Kasten

 

Blick aufs Appenzeller Land, aufgenommen von der Terrasse des Restaurants Waldegg in Teufen

 

Blick auf den Bodensee aus einem Fenster des Rohrschacher Museums im Kornhaus

 

Hauptstraße in Rohrschach

Maintaining Multi-Line „stat“ Formats using Bourne Again Shell

The stat command from GNU core utilities features not only a --format FORMAT option but also a --printf FORMAT one, the difference being that the latter allows for backslash escapes such as \n.

This allows for custom per-file report formats containing newlines, for example:

stat --printf 'Name: %n\nSize: %s Bytes\n' /etc/passwd

If the format string becomes more complex, the command line soon becomes unwieldy, such as:

stat --printf 'Name: %n\nOwner ID: %u\nSize: %s Bytes\nLast accessed: %x\n' /etc/passwd

Lesen Sie mehr »

Make a Bourne Again Shell Script Log its Output to a File

The Bourne Again Shell script presented in this article demonstrates techniques related to capturing and logging output (standard output and standard error stream) of a script into a log file while also delivering it to the regular output destinations (for example the terminal or whatever the caller has chosen to redirect to).

If you are just interested in the Bourne Again Shell code example, click here.

In the following, some questions are addressed:

  • How to „clone“ standard output and standard error stream of a shell script to a single log file?
  • Are the messages from both streams interleaved into a single file in the appropriate order?
  • Can a script perform output cloning for some portions of its procedure while skipping it for others?
  • Are there specific requirements for output that is to be cloned to a file?
  • Are there best practices when a script modifies its own output redirections?

The example provided below has been tested on GNU/Linux using GNU „bash“ version 5 and „tee“ version 8.32 from GNU coreutils. It uses the Bash-only feature of process substitution. An implementation in POSIX Shell (possibly using only POSIX tools) would be more difficult.

Lesen Sie mehr »

Using sed or awk to ensure a specific last Line in a Text

Given a file containing bytes of text with lines separated by the newline character (\n), one of these lines can be said to be „the last line of the file“; it is a sequence of bytes occurring in the file, for which holds:

  • The sequence contains no newline character, and
  • the sequence is followed by at most one newline character and no other bytes.

The task at hand is, using shell utilities, to write a procedure that makes sure that a given file contains a last line that contains a desired sequence of text characters.

Lesen Sie mehr »

Fotos von Palma de Mallorca und Umgebung