From 36669b01d589c6a0fdab9dc3657c73e2bddaa93d Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 6 Nov 2025 15:45:27 +0200 Subject: Update content for html --- ...5-02-01-f3s-kubernetes-with-freebsd-part-3.html | 2 + gemfeed/atom.xml | 87 +++++++++++++++++++++- 2 files changed, 88 insertions(+), 1 deletion(-) (limited to 'gemfeed') diff --git a/gemfeed/2025-02-01-f3s-kubernetes-with-freebsd-part-3.html b/gemfeed/2025-02-01-f3s-kubernetes-with-freebsd-part-3.html index e141d0b3..2524110e 100644 --- a/gemfeed/2025-02-01-f3s-kubernetes-with-freebsd-part-3.html +++ b/gemfeed/2025-02-01-f3s-kubernetes-with-freebsd-part-3.html @@ -23,6 +23,7 @@ 2025-04-05 f3s: Kubernetes with FreeBSD - Part 4: Rocky Linux Bhyve VMs
2025-05-11 f3s: Kubernetes with FreeBSD - Part 5: WireGuard mesh network
2025-07-14 f3s: Kubernetes with FreeBSD - Part 6: Storage
+2025-10-02 f3s: Kubernetes with FreeBSD - Part 7: k3s and first pod deployments

f3s logo

@@ -418,6 +419,7 @@ Jan 26 17:36:32 f2 apcupsd[2159]: apcupsd shutdown succeeded
Other BSD related posts are:

+2025-10-02 f3s: Kubernetes with FreeBSD - Part 7: k3s and first pod deployments
2025-07-14 f3s: Kubernetes with FreeBSD - Part 6: Storage
2025-05-11 f3s: Kubernetes with FreeBSD - Part 5: WireGuard mesh network
2025-04-05 f3s: Kubernetes with FreeBSD - Part 4: Rocky Linux Bhyve VMs
diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 0ba74377..a821a957 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,6 +1,6 @@ - 2025-11-01T22:25:15+02:00 + 2025-11-06T15:43:19+02:00 foo.zone feed To be in the .zone! @@ -9544,6 +9544,12 @@ MBATTCHG : 5 Percent
I simulated a power outage by removing the power input from the APC. Immediately, the following message appeared on all the nodes:

+
+Broadcast Message from root@f0.lan.buetow.org
+        (no tty) at 15:03 EET...
+
+Power failure. Running on UPS batteries.                                              
+

I ran the following command to confirm the available battery time:

@@ -10184,14 +10190,93 @@ Jan 26 17:36:32 f2 apcupsd[2159]: apcupsd shutdown succeeded
So I put this into my zsh dotfiles (in some editor.zsh.source in my ~ directory):

+ +
export EDITOR=hx
+export VISUAL=$EDITOR
+export GIT_EDITOR=$EDITOR
+export HELIX_CONFIG_DIR=$HOME/.config/helix
+
+editor::helix::random_theme () {
+    # May add more theme search paths based on OS. This one is
+    # for Fedora Linux, but there is also MacOS, etc.
+    local -r theme_dir=/usr/share/helix/runtime/themes
+    if [ ! -d $theme_dir ]; then
+        echo "Helix theme dir $theme_dir doesnt exist"
+        return 1
+    fi
+
+    local -r config_file=$HELIX_CONFIG_DIR/config.toml
+    local -r random_theme="$(basename "$(ls $theme_dir \
+        | grep -v random.toml | grep .toml | sort -R \
+        | head -n 1)" | cut -d. -f1)"
+
+    sed "/^theme =/ { s/.*/theme = \"$random_theme\"/; }" \
+        $config_file > $config_file.tmp && 
+        mv $config_file.tmp $config_file
+}
+
+if [ -f $HELIX_CONFIG_DIR/config.toml ]; then
+    editor::helix::random_theme
+fi
+

So every time I open a new terminal or shell, editor::helix::random_theme gets called, which randomly selects a theme from all installed ones and updates the helix config accordingly.

+ +
[paul@earth] ~ % editor::helix::random_theme
+[paul@earth] ~ % head -n 1 ~/.config/helix/config.toml
+theme = "jellybeans"
+[paul@earth] ~ % editor::helix::random_theme
+[paul@earth] ~ % head -n 1 ~/.config/helix/config.toml
+theme = "rose_pine"
+[paul@earth] ~ % editor::helix::random_theme
+[paul@earth] ~ % head -n 1 ~/.config/helix/config.toml
+theme = "noctis"
+[paul@earth] ~ %
+

A better version



Update 2024-12-18: This is an improved version, which works cross platform (e.g., also on MacOS) and multiple theme directories:

+ +
export EDITOR=hx
+export VISUAL=$EDITOR
+export GIT_EDITOR=$EDITOR
+export HELIX_CONFIG_DIR=$HOME/.config/helix
+
+editor::helix::theme::get_random () {
+    for dir in $(hx --health \
+        | awk '/^Runtime directories/ { print $3 }' | tr ';' ' '); do
+        if [ -d $dir/themes ]; then
+            ls $dir/themes
+        fi
+    done | grep -F .toml | sort -R | head -n 1 | cut -d. -f1
+}
+
+editor::helix::theme::set () {
+    local -r theme="$1"; shift
+
+    local -r config_file=$HELIX_CONFIG_DIR/config.toml
+
+    sed "/^theme =/ { s/.*/theme = \"$theme\"/; }" \
+        $config_file > $config_file.tmp && 
+        mv $config_file.tmp $config_file
+}
+
+if [ -f $HELIX_CONFIG_DIR/config.toml ]; then
+    editor::helix::theme::set $(editor::helix::theme::get_random)
+fi
+

I hope you had some fun. E-Mail your comments to paul@nospam.buetow.org :-)

-- cgit v1.2.3