From 66f005d0fd0c88a31b8c798243f090fe0090418c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 30 Dec 2024 00:06:04 +0200 Subject: Update content for html --- gemfeed/2008-06-26-perl-poetry.html | 153 +-- ...12-29-using-my-nokia-n95-for-fixing-my-mta.html | 5 +- gemfeed/2010-04-09-standard-ml-and-haskell.html | 171 +-- ...010-05-07-lazy-evaluation-with-standarn-ml.html | 5 +- .../2010-05-09-the-fype-programming-language.html | 83 +- .../2011-05-07-perl-daemon-service-framework.html | 125 +- .../2014-03-24-the-fibonacci.pl.c-polyglot.html | 193 +-- ...2-05-run-debian-on-your-phone-with-debroid.html | 189 +-- gemfeed/2016-04-03-offsite-backup-with-zfs.html | 5 +- ...04-09-jails-and-zfs-on-freebsd-with-puppet.html | 5 +- .../2016-04-16-offsite-backup-with-zfs-part2.html | 5 +- ...inning-up-my-own-authoritative-dns-servers.html | 5 +- ...20-object-oriented-programming-with-ansi-c.html | 71 +- ...alistic-load-testing-with-ioriot-for-linux.html | 5 +- ...-22-dtail-the-distributed-log-tail-program.html | 5 +- gemfeed/2021-04-24-welcome-to-the-geminispace.html | 5 +- ...021-05-16-personal-bash-coding-style-guide.html | 281 ++-- ...5-gemtexter-one-bash-script-to-rule-it-all.html | 41 +- gemfeed/2021-07-04-the-well-grounded-rubyist.html | 5 +- ...-08-01-on-being-pedantic-about-open-source.html | 5 +- gemfeed/2021-09-12-keep-it-simple-and-stupid.html | 5 +- gemfeed/2021-10-22-defensive-devops.html | 5 +- gemfeed/2021-11-29-bash-golf-part-1.html | 5 +- ...-12-26-how-to-stay-sane-as-a-devops-person.html | 5 +- gemfeed/2022-01-01-bash-golf-part-2.html | 5 +- gemfeed/2022-01-23-welcome-to-the-foo.zone.html | 5 +- ...022-02-04-computer-operating-systems-i-use.html | 5 +- gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html | 5 +- gemfeed/2022-04-10-creative-universe.html | 5 +- .../2022-05-27-perl-is-still-a-great-choice.html | 5 +- gemfeed/2022-06-15-sweating-the-small-stuff.html | 5 +- ...22-07-30-lets-encrypt-with-openbsd-and-rex.html | 5 +- ...2-08-27-gemtexter-1.1.0-lets-gemtext-again.html | 39 +- gemfeed/2022-09-30-after-a-bad-nights-sleep.html | 5 +- .../2022-10-30-installing-dtail-on-openbsd.html | 5 +- ...-tried-emacs-but-i-switched-back-to-neovim.html | 13 +- ...22-12-24-ultrarelearning-java-my-takeaways.html | 5 +- gemfeed/2023-01-23-why-grapheneos-rox.html | 5 +- .../2023-02-26-how-to-shut-down-after-work.html | 5 +- ...-03-16-the-pragmatic-programmer-book-notes.html | 5 +- ...03-25-gemtexter-2.0.0-lets-gemtext-again-2.html | 23 +- ...4-01-never-split-the-difference-book-notes.html | 5 +- ...iling-guprecords:-uptime-records-with-raku.html | 7 +- ...3-05-06-the-obstacle-is-the-way-book-notes.html | 5 +- ...3-06-01-kiss-server-monitoring-with-gogios.html | 107 +- ...17-career-guide-and-soft-skills-book-notes.html | 5 +- ...07-21-gemtexter-2.1.0-lets-gemtext-again-3.html | 15 +- ...-08-18-site-reliability-engineering-part-1.html | 5 +- gemfeed/2023-09-25-dtail-usage-examples.html | 111 +- ...static-web-photo-albums-with-photoalbum.sh.html | 123 +- gemfeed/2023-11-11-mind-management-book-notes.html | 5 +- ...-11-19-site-reliability-engineering-part-2.html | 5 +- gemfeed/2023-12-10-bash-golf-part-3.html | 243 ++-- ...-01-09-site-reliability-engineering-part-3.html | 5 +- .../2024-01-13-one-reason-why-i-love-openbsd.html | 15 +- ...4-02-04-from-babylon5.buetow.org-to-.cloud.html | 5 +- ...quickly-logging-ideas-programmed-in-golang.html | 5 +- ...-04-01-KISS-high-availability-with-OpenBSD.html | 205 +-- .../2024-05-01-slow-productivity-book-notes.html | 5 +- ...03-projects-i-currently-dont-have-time-for.html | 17 +- ...2024-06-23-terminal-multiplexing-with-tmux.html | 169 +-- gemfeed/2024-07-05-random-weird-things.html | 189 +-- .../2024-07-07-the-stoic-challenge-book-notes.html | 9 +- .../2024-08-05-typing-127.1-words-per-minute.html | 5 +- gemfeed/2024-09-07-projects-i-support.html | 5 +- ...-09-07-site-reliability-engineering-part-4.html | 5 +- ...10-02-gemtexter-3.0.0-lets-gemtext-again-4.html | 7 +- gemfeed/2024-10-24-staff-engineer-book-notes.html | 5 +- ...4-11-17-f3s-kubernetes-with-freebsd-part-1.html | 5 +- ...4-12-03-f3s-kubernetes-with-freebsd-part-2.html | 147 +- gemfeed/2024-12-15-random-helix-themes.html | 115 +- ...f3s-kubernetes-with-freebsd-hardware-setup.html | 5 +- gemfeed/DRAFT-site-reliability-engineering.html | 5 +- .../DRAFT-summary-for-202410-202411-202410.html | 332 +++++ gemfeed/atom.xml | 1400 ++++++++++---------- gemfeed/index.html | 5 +- 76 files changed, 2691 insertions(+), 2137 deletions(-) create mode 100644 gemfeed/DRAFT-summary-for-202410-202411-202410.html (limited to 'gemfeed') diff --git a/gemfeed/2008-06-26-perl-poetry.html b/gemfeed/2008-06-26-perl-poetry.html index 58815619..7108afdc 100644 --- a/gemfeed/2008-06-26-perl-poetry.html +++ b/gemfeed/2008-06-26-perl-poetry.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Perl Poetry



Published at 2008-06-26T21:43:51+01:00; Updated at 2021-05-04
@@ -56,44 +59,44 @@ _~~|~/_|_|__/|~~~~~~~ | / ~~~~~ | | ~~~~~~~~ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
#!/usr/bin/perl
+
#!/usr/bin/perl
 
-# (C) 2006 by Paul C. Buetow
+# (C) 2006 by Paul C. Buetow
 
-goto library for study $math;
-BEGIN { s/earching/ books/ 
-and read $them, $at, $the } library:
+goto library for study $math;
+BEGIN { s/earching/ books/ 
+and read $them, $at, $the } library:
 
-our $topics, cos and tan, 
-require strict; import { of, tied $patience };
+our $topics, cos and tan, 
+require strict; import { of, tied $patience };
 
-do { int'egrate'; sub trade; };
-do { exp'onentize' and abs'olutize' };
-study and study and study and study;
+do { int'egrate'; sub trade; };
+do { exp'onentize' and abs'olutize' };
+study and study and study and study;
 
-foreach $topic ({of, math}) {
-you, m/ay /go, to, limits }
+foreach $topic ({of, math}) {
+you, m/ay /go, to, limits }
 
-do { not qw/erk / unless $success 
-and m/ove /o;$n and study };
+do { not qw/erk / unless $success 
+and m/ove /o;$n and study };
 
-do { int'egrate'; sub trade; };
-do { exp'onentize' and abs'olutize' };
-study and study and study and study;
+do { int'egrate'; sub trade; };
+do { exp'onentize' and abs'olutize' };
+study and study and study and study;
 
-grep /all/, exp'onents' and cos'inuses';
-/seek results/ for @all, log'4rithms';
+grep /all/, exp'onents' and cos'inuses';
+/seek results/ for @all, log'4rithms';
 
-'you' =~ m/ay /go, not home 
-unless each %book ne#ars
-$completion;
+'you' =~ m/ay /go, not home 
+unless each %book ne#ars
+$completion;
 
-do { int'egrate'; sub trade; };
-do { exp'onentize' and abs'olutize' };
+do { int'egrate'; sub trade; };
+do { exp'onentize' and abs'olutize' };
 
-#at
-home: //ig,'nore', time and sleep $very =~ s/tr/on/g;
-__END__
+#at
+home: //ig,'nore', time and sleep $very =~ s/tr/on/g;
+__END__
 
 

@@ -103,47 +106,47 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
#!/usr/bin/perl
+
#!/usr/bin/perl
 
-# (C) 2006 by Paul C. Buetow
+# (C) 2006 by Paul C. Buetow
 
-Christmas:{time;#!!!
+Christmas:{time;#!!!
 
-Children: do tell $wishes;
+Children: do tell $wishes;
 
-Santa: for $each (@children) { 
-BEGIN { read $each, $their, wishes and study them; use Memoize#ing
+Santa: for $each (@children) { 
+BEGIN { read $each, $their, wishes and study them; use Memoize#ing
 
-} use constant gift, 'wrapping'; 
-package Gifts; pack $each, gift and bless $each and goto deliver
-or do import if not local $available,!!! HO, HO, HO;
+} use constant gift, 'wrapping'; 
+package Gifts; pack $each, gift and bless $each and goto deliver
+or do import if not local $available,!!! HO, HO, HO;
 
-redo Santa, pipe $gifts, to_childs;
-redo Santa and do return if last one, is, delivered; 
+redo Santa, pipe $gifts, to_childs;
+redo Santa and do return if last one, is, delivered; 
 
-deliver: gift and require diagnostics if our $gifts ,not break;
-do{ use NEXT; time; tied $gifts} if broken and dump the, broken, ones;
-The_children: sleep and wait for (each %gift) and try { to => untie $gifts };
+deliver: gift and require diagnostics if our $gifts ,not break;
+do{ use NEXT; time; tied $gifts} if broken and dump the, broken, ones;
+The_children: sleep and wait for (each %gift) and try { to => untie $gifts };
 
-redo Santa, pipe $gifts, to_childs;
-redo Santa and do return if last one, is, delivered; 
+redo Santa, pipe $gifts, to_childs;
+redo Santa and do return if last one, is, delivered; 
 
-The_christmas_tree: formline s/ /childrens/, $gifts;
-alarm and warn if not exists $Christmas{ tree}, @t, $ENV{HOME};  
-write <<EMail
- to the parents to buy a new christmas tree!!!!111
- and send the
-EMail
-;wait and redo deliver until defined local $tree;
+The_christmas_tree: formline s/ /childrens/, $gifts;
+alarm and warn if not exists $Christmas{ tree}, @t, $ENV{HOME};  
+write <<EMail
+ to the parents to buy a new christmas tree!!!!111
+ and send the
+EMail
+;wait and redo deliver until defined local $tree;
 
-redo Santa, pipe $gifts, to_childs;
-redo Santa and do return if last one, is, delivered ;}
+redo Santa, pipe $gifts, to_childs;
+redo Santa and do return if last one, is, delivered ;}
 
-END {} our $mission and do sleep until next Christmas ;}
+END {} our $mission and do sleep until next Christmas ;}
 
-__END__
+__END__
 
-This is perl, v5.8.8 built for i386-freebsd-64int
+This is perl, v5.8.8 built for i386-freebsd-64int
 

shopping.pl


@@ -152,35 +155,35 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
#!/usr/bin/perl
+
#!/usr/bin/perl
 
-# (C) 2007 by Paul C. Buetow
+# (C) 2007 by Paul C. Buetow
 
-BEGIN{} goto mall for $shopping; 
+BEGIN{} goto mall for $shopping; 
 
-m/y/; mall: seek$s, cool products(), { to => $sell };
-for $their (@business) { to:; earn:; a:; lot:; of:; money: }
+m/y/; mall: seek$s, cool products(), { to => $sell };
+for $their (@business) { to:; earn:; a:; lot:; of:; money: }
 
-do not goto home and exit mall if exists $new{product};
-foreach $of (q(uality rich products)){} package products; 
+do not goto home and exit mall if exists $new{product};
+foreach $of (q(uality rich products)){} package products; 
 
-our $news; do tell cool products() and do{ sub#tract
-cool{ $products and shift @the, @bad, @ones;
+our $news; do tell cool products() and do{ sub#tract
+cool{ $products and shift @the, @bad, @ones;
 
-do bless [q(uality)], $products 
-and return not undef $stuff if not (local $available) }};
+do bless [q(uality)], $products 
+and return not undef $stuff if not (local $available) }};
 
-do { study and study and study for cool products() }
-and do { seek $all, cool products(), { to => $buy } };
+do { study and study and study for cool products() }
+and do { seek $all, cool products(), { to => $buy } };
 
-do { write $them, $down } and do { order: foreach (@case) { package s } };
-goto home if not exists $more{money} or die q(uerying) ;for( @money){};
+do { write $them, $down } and do { order: foreach (@case) { package s } };
+goto home if not exists $more{money} or die q(uerying) ;for( @money){};
 
-at:;home: do { END{} and:; rest:; a:; bit: exit $shopping } 
-and sleep until unpack$ing, cool products();
+at:;home: do { END{} and:; rest:; a:; bit: exit $shopping } 
+and sleep until unpack$ing, cool products();
 
-__END__
-This is perl, v5.8.8 built for i386-freebsd-64int
+__END__
+This is perl, v5.8.8 built for i386-freebsd-64int
 

More...


@@ -199,7 +202,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2008-12-29-using-my-nokia-n95-for-fixing-my-mta.html b/gemfeed/2008-12-29-using-my-nokia-n95-for-fixing-my-mta.html index 5281b6e4..3f7f2f7e 100644 --- a/gemfeed/2008-12-29-using-my-nokia-n95-for-fixing-my-mta.html +++ b/gemfeed/2008-12-29-using-my-nokia-n95-for-fixing-my-mta.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Using my Nokia N95 for fixing my MTA



Published at 2008-12-29T09:10:41+00:00; Updated at 2021-12-01
@@ -50,7 +53,7 @@ _jgs_\|//_\\|///_\V/_\|//__
Back to the main site
diff --git a/gemfeed/2010-04-09-standard-ml-and-haskell.html b/gemfeed/2010-04-09-standard-ml-and-haskell.html index 0d465954..1e82c075 100644 --- a/gemfeed/2010-04-09-standard-ml-and-haskell.html +++ b/gemfeed/2010-04-09-standard-ml-and-haskell.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Standard ML and Haskell



Published at 2010-04-09T22:57:36+01:00
@@ -37,10 +40,10 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
datatype ’a multi
-	= EMPTY
-	| ELEM of ’a
-	| UNION of ’a multi * ’a multi
+
datatype ’a multi
+	= EMPTY
+	| ELEM of ’a
+	| UNION of ’a multi * ’a multi
 

Haskell:
@@ -49,11 +52,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
data (Eq a) => Multi a
-    = Empty
-    | Elem a
-    | Union (Multi a) (Multi a)
-    deriving Show
+
data (Eq a) => Multi a
+    = Empty
+    | Elem a
+    | Union (Multi a) (Multi a)
+    deriving Show
 

Processing a multi


@@ -64,12 +67,12 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
fun number (EMPTY) _ = 0
-	| number (ELEM x) w = if x = w then 1 else 0
-	| number (UNION (x,y)) w = (number x w) + (number y w)
-fun test_number w = number (UNION (EMPTY, \
-    UNION (ELEM 4, UNION (ELEM 6, \
-    UNION (UNION (ELEM 4, ELEM 4), EMPTY))))) w 
+
fun number (EMPTY) _ = 0
+	| number (ELEM x) w = if x = w then 1 else 0
+	| number (UNION (x,y)) w = (number x w) + (number y w)
+fun test_number w = number (UNION (EMPTY, \
+    UNION (ELEM 4, UNION (ELEM 6, \
+    UNION (UNION (ELEM 4, ELEM 4), EMPTY))))) w 
 

Haskell:
@@ -78,11 +81,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
number Empty _ = 0
-number (Elem x) w = if x == w then 1 else 0
-test_number w = number (Union Empty \
-    (Union (Elem 4) (Union (Elem 6) \
-    (Union (Union (Elem 4) (Elem 4)) Empty)))) w
+
number Empty _ = 0
+number (Elem x) w = if x == w then 1 else 0
+test_number w = number (Union Empty \
+    (Union (Elem 4) (Union (Elem 6) \
+    (Union (Union (Elem 4) (Elem 4)) Empty)))) w
 

Simplify function


@@ -93,19 +96,19 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
fun simplify (UNION (x,y)) =
-    let fun is_empty (EMPTY) = true | is_empty _ = false
-        val x’ = simplify x
-        val y’ = simplify y
-    in if (is_empty x’) andalso (is_empty y’)
-            then EMPTY
-       else if (is_empty x’)
-            then y’
-       else if (is_empty y’)
-            then x’
-       else UNION (x’, y’)
-    end
-  | simplify x = x
+
fun simplify (UNION (x,y)) =
+    let fun is_empty (EMPTY) = true | is_empty _ = false
+        val x’ = simplify x
+        val y’ = simplify y
+    in if (is_empty x’) andalso (is_empty y’)
+            then EMPTY
+       else if (is_empty x’)
+            then y’
+       else if (is_empty y’)
+            then x’
+       else UNION (x’, y’)
+    end
+  | simplify x = x
 

Haskell:
@@ -114,17 +117,17 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
simplify (Union x y)
-    | (isEmpty x’) && (isEmpty y’) = Empty
-    | isEmpty x’ = y’
-    | isEmpty y’ = x’
-    | otherwise = Union x’ y’
-    where
-        isEmpty Empty = True
-        isEmpty _ = False
-        x’ = simplify x
-        y’ = simplify y
-simplify x = x
+
simplify (Union x y)
+    | (isEmpty x’) && (isEmpty y’) = Empty
+    | isEmpty x’ = y’
+    | isEmpty y’ = x’
+    | otherwise = Union x’ y’
+    where
+        isEmpty Empty = True
+        isEmpty _ = False
+        x’ = simplify x
+        y’ = simplify y
+simplify x = x
 

Delete all


@@ -135,12 +138,12 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
fun delete_all m w =
-    let fun delete_all’ (ELEM x) = if x = w then EMPTY else ELEM x
-          | delete_all’ (UNION (x,y)) = UNION (delete_all’ x, delete_all’ y)
-          | delete_all’ x = x
-    in simplify (delete_all’ m)
-    end
+
fun delete_all m w =
+    let fun delete_all’ (ELEM x) = if x = w then EMPTY else ELEM x
+          | delete_all’ (UNION (x,y)) = UNION (delete_all’ x, delete_all’ y)
+          | delete_all’ x = x
+    in simplify (delete_all’ m)
+    end
 

Haskell:
@@ -149,11 +152,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
delete_all m w = simplify (delete_all’ m)
-    where
-        delete_all’ (Elem x) = if x == w then Empty else Elem x
-        delete_all’ (Union x y) = Union (delete_all’ x) (delete_all’ y)
-        delete_all’ x = x
+
delete_all m w = simplify (delete_all’ m)
+    where
+        delete_all’ (Elem x) = if x == w then Empty else Elem x
+        delete_all’ (Union x y) = Union (delete_all’ x) (delete_all’ y)
+        delete_all’ x = x
 

Delete one


@@ -164,21 +167,21 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
fun delete_one m w =
-    let fun delete_one’ (UNION (x,y)) =
-            let val (x’, deleted) = delete_one’ x
-                in if deleted
-                   then (UNION (x’, y), deleted)
-                   else let val (y’, deleted) = delete_one’ y
-                       in (UNION (x, y’), deleted)
-                   end
-                end
-          | delete_one’ (ELEM x) =
-            if x = w then (EMPTY, true) else (ELEM x, false)
-          | delete_one’ x = (x, false)
-            val (m’, _) = delete_one’ m
-        in simplify m’
-    end
+
fun delete_one m w =
+    let fun delete_one’ (UNION (x,y)) =
+            let val (x’, deleted) = delete_one’ x
+                in if deleted
+                   then (UNION (x’, y), deleted)
+                   else let val (y’, deleted) = delete_one’ y
+                       in (UNION (x, y’), deleted)
+                   end
+                end
+          | delete_one’ (ELEM x) =
+            if x = w then (EMPTY, true) else (ELEM x, false)
+          | delete_one’ x = (x, false)
+            val (m’, _) = delete_one’ m
+        in simplify m’
+    end
 

Haskell:
@@ -187,19 +190,19 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
delete_one m w = do
-    let (m’, _) = delete_one’ m
-    simplify m’
-    where
-        delete_one’ (Union x y) =
-            let (x’, deleted) = delete_one’ x
-            in if deleted
-                then (Union x’ y, deleted)
-                else let (y’, deleted) = delete_one’ y
-                    in (Union x y’, deleted)
-        delete_one’ (Elem x) =
-            if x == w then (Empty, True) else (Elem x, False)
-        delete_one’ x = (x, False)
+
delete_one m w = do
+    let (m’, _) = delete_one’ m
+    simplify m’
+    where
+        delete_one’ (Union x y) =
+            let (x’, deleted) = delete_one’ x
+            in if deleted
+                then (Union x’ y, deleted)
+                else let (y’, deleted) = delete_one’ y
+                    in (Union x y’, deleted)
+        delete_one’ (Elem x) =
+            if x == w then (Empty, True) else (Elem x, False)
+        delete_one’ x = (x, False)
 

Higher-order functions


@@ -224,7 +227,7 @@ my_filter f l = foldr (make_filter_fn f) [] l
Back to the main site
diff --git a/gemfeed/2010-05-07-lazy-evaluation-with-standarn-ml.html b/gemfeed/2010-05-07-lazy-evaluation-with-standarn-ml.html index 6429dc69..bc9756da 100644 --- a/gemfeed/2010-05-07-lazy-evaluation-with-standarn-ml.html +++ b/gemfeed/2010-05-07-lazy-evaluation-with-standarn-ml.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Lazy Evaluation with Standard ML



Published at 2010-05-07T08:17:59+01:00
@@ -110,7 +113,7 @@ first 10 nat_pairs_not_null
Back to the main site
diff --git a/gemfeed/2010-05-09-the-fype-programming-language.html b/gemfeed/2010-05-09-the-fype-programming-language.html index 353d522f..7370c5bb 100644 --- a/gemfeed/2010-05-09-the-fype-programming-language.html +++ b/gemfeed/2010-05-09-the-fype-programming-language.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

The Fype Programming Language



Published at 2010-05-09T12:48:29+01:00; Updated at 2021-05-05
@@ -66,12 +69,12 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
typedef struct {
-   Tupel *p_tupel_argv; // Contains command line options
-   List *p_list_token; // Initial list of token
-   Hash *p_hash_syms; // Symbol table
-   char *c_basename;
-} Fype;
+
typedef struct {
+   Tupel *p_tupel_argv; // Contains command line options
+   List *p_list_token; // Initial list of token
+   Hash *p_hash_syms; // Symbol table
+   char *c_basename;
+} Fype;
 

And here is a snippet from the primary Fype "class implementation":
@@ -80,53 +83,53 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
Fype*
-fype_new() {
-   Fype *p_fype = malloc(sizeof(Fype));
+
Fype*
+fype_new() {
+   Fype *p_fype = malloc(sizeof(Fype));
 
-   p_fype->p_hash_syms = hash_new(512);
-   p_fype->p_list_token = list_new();
-   p_fype->p_tupel_argv = tupel_new();
-   p_fype->c_basename = NULL;
+   p_fype->p_hash_syms = hash_new(512);
+   p_fype->p_list_token = list_new();
+   p_fype->p_tupel_argv = tupel_new();
+   p_fype->c_basename = NULL;
 
-   garbage_init();
+   garbage_init();
 
-   return (p_fype);
-}
+   return (p_fype);
+}
 
-void
-fype_delete(Fype *p_fype) {
-   argv_tupel_delete(p_fype->p_tupel_argv);
+void
+fype_delete(Fype *p_fype) {
+   argv_tupel_delete(p_fype->p_tupel_argv);
 
-   hash_iterate(p_fype->p_hash_syms, symbol_cleanup_hash_syms_cb);
-   hash_delete(p_fype->p_hash_syms);
+   hash_iterate(p_fype->p_hash_syms, symbol_cleanup_hash_syms_cb);
+   hash_delete(p_fype->p_hash_syms);
 
-   list_iterate(p_fype->p_list_token, token_ref_down_cb);
-   list_delete(p_fype->p_list_token);
+   list_iterate(p_fype->p_list_token, token_ref_down_cb);
+   list_delete(p_fype->p_list_token);
 
-   if (p_fype->c_basename)
-      free(p_fype->c_basename);
+   if (p_fype->c_basename)
+      free(p_fype->c_basename);
 
-   garbage_destroy();
-}
+   garbage_destroy();
+}
 
-int
-fype_run(int i_argc, char **pc_argv) {
-   Fype *p_fype = fype_new();
+int
+fype_run(int i_argc, char **pc_argv) {
+   Fype *p_fype = fype_new();
 
-   // argv: Maintains command line options
-   argv_run(p_fype, i_argc, pc_argv);
+   // argv: Maintains command line options
+   argv_run(p_fype, i_argc, pc_argv);
 
-   // scanner: Creates a list of token
-   scanner_run(p_fype);
+   // scanner: Creates a list of token
+   scanner_run(p_fype);
 
-   // interpret: Interpret the list of token
-   interpret_run(p_fype);
+   // interpret: Interpret the list of token
+   interpret_run(p_fype);
 
-   fype_delete(p_fype);
+   fype_delete(p_fype);
 
-   return (0);
-}
+   return (0);
+}
 

Data types


@@ -555,7 +558,7 @@ BB
Back to the main site
diff --git a/gemfeed/2011-05-07-perl-daemon-service-framework.html b/gemfeed/2011-05-07-perl-daemon-service-framework.html index 4a575867..50277893 100644 --- a/gemfeed/2011-05-07-perl-daemon-service-framework.html +++ b/gemfeed/2011-05-07-perl-daemon-service-framework.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Perl Daemon (Service Framework)



Published at 2011-05-07T22:26:02+01:00; Updated at 2021-05-07
@@ -55,14 +58,14 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
# Starting
- ./bin/perldaemon start (or shortcut ./control start)
+
# Starting
+ ./bin/perldaemon start (or shortcut ./control start)
 
-# Stopping
- ./bin/perldaemon stop (or shortcut ./control stop)
+# Stopping
+ ./bin/perldaemon stop (or shortcut ./control stop)
 
-# Alternatively: Starting in foreground 
-./bin/perldaemon start daemon.daemonize=no (or shortcut ./control foreground)
+# Alternatively: Starting in foreground 
+./bin/perldaemon start daemon.daemonize=no (or shortcut ./control foreground)
 

To stop a daemon from running in foreground mode, "Ctrl+C" must be hit. To see more available startup options run "./control" without any argument.
@@ -75,30 +78,30 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
pb@titania:~/svn/utils/perldaemon/trunk$ ./control keys
-# Path to the logfile
-daemon.logfile=./log/perldaemon.log
+
pb@titania:~/svn/utils/perldaemon/trunk$ ./control keys
+# Path to the logfile
+daemon.logfile=./log/perldaemon.log
 
-# The amount of seconds until the next event look takes place
-daemon.loopinterval=1
+# The amount of seconds until the next event look takes place
+daemon.loopinterval=1
 
-# Path to the modules dir
-daemon.modules.dir=./lib/PerlDaemonModules
+# Path to the modules dir
+daemon.modules.dir=./lib/PerlDaemonModules
 
-# Specifies either the daemon should run in daemon or foreground mode
-daemon.daemonize=yes
+# Specifies either the daemon should run in daemon or foreground mode
+daemon.daemonize=yes
 
-# Path to the pidfile
-daemon.pidfile=./run/perldaemon.pid
+# Path to the pidfile
+daemon.pidfile=./run/perldaemon.pid
 
-# Each module should run every run interval seconds
-daemon.modules.runinterval=3
+# Each module should run every run interval seconds
+daemon.modules.runinterval=3
 
-# Path to the alive file (is touched every loop interval seconds, usable for monitoring)
-daemon.alivefile=./run/perldaemon.alive
+# Path to the alive file (is touched every loop interval seconds, usable for monitoring)
+daemon.alivefile=./run/perldaemon.alive
 
-# Specifies the working directory
-daemon.wd=./
+# Specifies the working directory
+daemon.wd=./
 

Example


@@ -109,17 +112,17 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
$ ./control keys | grep daemon.loopinterval
-daemon.loopinterval=1
-$ ./control keys daemon.loopinterval=10 | grep daemon.loopinterval
-daemon.loopinterval=10
-$ ./control start daemon.loopinterval=10; sleep 10; tail -n 2 log/perldaemon.log
-Starting daemon now...
-Mon Jun 13 11:29:27 2011 (PID 2838): Triggering PerlDaemonModules::ExampleModule 
-(last triggered before 10.002106s; carry: 7.002106s; wanted interval: 3s)
-Mon Jun 13 11:29:27 2011 (PID 2838): ExampleModule Test 2
-$ ./control stop
-Stopping daemon now...
+
$ ./control keys | grep daemon.loopinterval
+daemon.loopinterval=1
+$ ./control keys daemon.loopinterval=10 | grep daemon.loopinterval
+daemon.loopinterval=10
+$ ./control start daemon.loopinterval=10; sleep 10; tail -n 2 log/perldaemon.log
+Starting daemon now...
+Mon Jun 13 11:29:27 2011 (PID 2838): Triggering PerlDaemonModules::ExampleModule 
+(last triggered before 10.002106s; carry: 7.002106s; wanted interval: 3s)
+Mon Jun 13 11:29:27 2011 (PID 2838): ExampleModule Test 2
+$ ./control stop
+Stopping daemon now...
 

If you want to change that property forever, either edit perldaemon.conf or do this:
@@ -128,7 +131,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
$ ./control keys daemon.loopinterval=10 > new.conf; mv new.conf conf/perldaemon.conf
+
$ ./control keys daemon.loopinterval=10 > new.conf; mv new.conf conf/perldaemon.conf
 

HiRes event loop


@@ -145,35 +148,35 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
package PerlDaemonModules::ExampleModule;
+
package PerlDaemonModules::ExampleModule;
 
-use strict;
-use warnings;
+use strict;
+use warnings;
 
-sub new ($$$) {
-  my ($class, $conf) = @_;
+sub new ($$$) {
+  my ($class, $conf) = @_;
 
-  my $self = bless { conf => $conf }, $class;
+  my $self = bless { conf => $conf }, $class;
 
-  # Store some private module stuff
-  $self->{counter} = 0;
+  # Store some private module stuff
+  $self->{counter} = 0;
 
-  return $self;
-}
+  return $self;
+}
 
-# Runs periodically in a loop (set interval in perldaemon.conf)
-sub do ($) {
-  my $self = shift;
-  my $conf = $self->{conf};
-  my $logger = $conf->{logger};
+# Runs periodically in a loop (set interval in perldaemon.conf)
+sub do ($) {
+  my $self = shift;
+  my $conf = $self->{conf};
+  my $logger = $conf->{logger};
 
-  # Calculate some private module stuff
-  my $count = ++$self->{counter};
+  # Calculate some private module stuff
+  my $count = ++$self->{counter};
 
-  $logger->logmsg("ExampleModule Test $count");
-}
+  $logger->logmsg("ExampleModule Test $count");
+}
 
-1;
+1;
 

Your own module


@@ -184,11 +187,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
 cd ./lib/PerlDaemonModules/
- cp ExampleModule.pm YourModule.pm
- vi YourModule.pm
- cd -
- ./bin/perldaemon restart (or shortcurt ./control restart)
+
 cd ./lib/PerlDaemonModules/
+ cp ExampleModule.pm YourModule.pm
+ vi YourModule.pm
+ cd -
+ ./bin/perldaemon restart (or shortcurt ./control restart)
 

Now watch ./log/perldaemon.log closely. It is a good practice to test your modules in 'foreground mode' (see above how to do that).
@@ -211,7 +214,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html b/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html index 8fc033cb..c609f408 100644 --- a/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html +++ b/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

The fibonacci.pl.raku.c Polyglot



Published at 2014-03-24T21:32:53+00:00; Updated at 2022-04-23
@@ -24,47 +27,47 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
#include <stdio.h>
+
#include <stdio.h>
 
-#define $arg function_argument
-#define my int
-#define sub int
-#define BEGIN int main(void)
+#define $arg function_argument
+#define my int
+#define sub int
+#define BEGIN int main(void)
 
-my $arg;
+my $arg;
 
-sub hello() {
-    printf("Hello, welcome to the Fibonacci Numbers!\n");
-    printf("This program is all, valid C and C++ and Perl and Raku code!\n");
-    printf("It calculates all fibonacci numbers from 0 to 9!\n\n");
-    return 0;
-}
+sub hello() {
+    printf("Hello, welcome to the Fibonacci Numbers!\n");
+    printf("This program is all, valid C and C++ and Perl and Raku code!\n");
+    printf("It calculates all fibonacci numbers from 0 to 9!\n\n");
+    return 0;
+}
 
-sub fibonacci() {
-    my $n = $arg;
+sub fibonacci() {
+    my $n = $arg;
 
-    if ($n < 2) {
-        return $n;
-    }
+    if ($n < 2) {
+        return $n;
+    }
 
-    $arg = $n - 1;
-    my $fib1 = fibonacci();
-    $arg = $n - 2;
-    my $fib2 = fibonacci();
+    $arg = $n - 1;
+    my $fib1 = fibonacci();
+    $arg = $n - 2;
+    my $fib2 = fibonacci();
 
-    return $fib1 + $fib2;
-}
+    return $fib1 + $fib2;
+}
 
-BEGIN {
-    hello();
-    my $i = 0;
+BEGIN {
+    hello();
+    my $i = 0;
 
-    while ($i <= 10) {
-        $arg = $i;
-        printf("fib(%d) = %d\n", $i, fibonacci());
-        $i++;
-    }
-}
+    while ($i <= 10) {
+        $arg = $i;
+        printf("fib(%d) = %d\n", $i, fibonacci());
+        $i++;
+    }
+}
 

You can find the full source code at GitHub:
@@ -77,41 +80,41 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
% gcc fibonacci.pl.raku.c -o fibonacci
-% ./fibonacci
-Hello, welcome to the Fibonacci Numbers!
-This program is all, valid C and C++ and Perl and Raku code!
-It calculates all fibonacci numbers from 0 to 9!
+
% gcc fibonacci.pl.raku.c -o fibonacci
+% ./fibonacci
+Hello, welcome to the Fibonacci Numbers!
+This program is all, valid C and C++ and Perl and Raku code!
+It calculates all fibonacci numbers from 0 to 9!
 
-fib(0) = 0
-fib(1) = 1
-fib(2) = 1
-fib(3) = 2
-fib(4) = 3
-fib(5) = 5
-fib(6) = 8
-fib(7) = 13
-fib(8) = 21
-fib(9) = 34
-fib(10) = 55
+fib(0) = 0
+fib(1) = 1
+fib(2) = 1
+fib(3) = 2
+fib(4) = 3
+fib(5) = 5
+fib(6) = 8
+fib(7) = 13
+fib(8) = 21
+fib(9) = 34
+fib(10) = 55
 
-% g++ fibonacci.pl.raku.c -o fibonacci
-% ./fibonacci
-Hello, welcome to the Fibonacci Numbers!
-This program is all, valid C and C++ and Perl and Raku code!
-It calculates all fibonacci numbers from 0 to 9!
+% g++ fibonacci.pl.raku.c -o fibonacci
+% ./fibonacci
+Hello, welcome to the Fibonacci Numbers!
+This program is all, valid C and C++ and Perl and Raku code!
+It calculates all fibonacci numbers from 0 to 9!
 
-fib(0) = 0
-fib(1) = 1
-fib(2) = 1
-fib(3) = 2
-fib(4) = 3
-fib(5) = 5
-fib(6) = 8
-fib(7) = 13
-fib(8) = 21
-fib(9) = 34
-fib(10) = 55
+fib(0) = 0
+fib(1) = 1
+fib(2) = 1
+fib(3) = 2
+fib(4) = 3
+fib(5) = 5
+fib(6) = 8
+fib(7) = 13
+fib(8) = 21
+fib(9) = 34
+fib(10) = 55
 

Let's run it with Perl and Raku


@@ -120,39 +123,39 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
% perl fibonacci.pl.raku.c
-Hello, welcome to the Fibonacci Numbers!
-This program is all, valid C and C++ and Perl and Raku code!
-It calculates all fibonacci numbers from 0 to 9!
+
% perl fibonacci.pl.raku.c
+Hello, welcome to the Fibonacci Numbers!
+This program is all, valid C and C++ and Perl and Raku code!
+It calculates all fibonacci numbers from 0 to 9!
 
-fib(0) = 0
-fib(1) = 1
-fib(2) = 1
-fib(3) = 2
-fib(4) = 3
-fib(5) = 5
-fib(6) = 8
-fib(7) = 13
-fib(8) = 21
-fib(9) = 34
-fib(10) = 55
+fib(0) = 0
+fib(1) = 1
+fib(2) = 1
+fib(3) = 2
+fib(4) = 3
+fib(5) = 5
+fib(6) = 8
+fib(7) = 13
+fib(8) = 21
+fib(9) = 34
+fib(10) = 55
 
-% raku fibonacci.pl.raku.c
-Hello, welcome to the Fibonacci Numbers!
-This program is all, valid C and C++ and Perl and Raku code!
-It calculates all fibonacci numbers from 0 to 9!
+% raku fibonacci.pl.raku.c
+Hello, welcome to the Fibonacci Numbers!
+This program is all, valid C and C++ and Perl and Raku code!
+It calculates all fibonacci numbers from 0 to 9!
 
-fib(0) = 0
-fib(1) = 1
-fib(2) = 1
-fib(3) = 2
-fib(4) = 3
-fib(5) = 5
-fib(6) = 8
-fib(7) = 13
-fib(8) = 21
-fib(9) = 34
-fib(10) = 55
+fib(0) = 0
+fib(1) = 1
+fib(2) = 1
+fib(3) = 2
+fib(4) = 3
+fib(5) = 5
+fib(6) = 8
+fib(7) = 13
+fib(8) = 21
+fib(9) = 34
+fib(10) = 55
 

It's entertaining to play with :-).
@@ -161,7 +164,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid.html b/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid.html index 503bb5c1..97ec6c54 100644 --- a/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid.html +++ b/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Run Debian on your phone with Debroid



Published at 2015-12-05T16:12:57+00:00; Updated at 2021-05-16
@@ -53,24 +56,24 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
sudo dnf install debootstrap
-# 5g
-dd if=/dev/zero of=jessie.img bs=$[ 1024 * 1024 ] \
-  count=$[ 1024 * 5 ]
+
sudo dnf install debootstrap
+# 5g
+dd if=/dev/zero of=jessie.img bs=$[ 1024 * 1024 ] \
+  count=$[ 1024 * 5 ]
 
-# Show used loop devices
-sudo losetup -f
-# Store the next free one to $loop
-loop=loopN
-sudo losetup /dev/$loop jessie.img
+# Show used loop devices
+sudo losetup -f
+# Store the next free one to $loop
+loop=loopN
+sudo losetup /dev/$loop jessie.img
 
-mkdir jessie
-sudo mkfs.ext4 /dev/$loop
-sudo mount /dev/$loop jessie
-sudo debootstrap --foreign --variant=minbase \
-  --arch armel jessie jessie/ \
-  http://http.debian.net/debian
-sudo umount jessie
+mkdir jessie
+sudo mkfs.ext4 /dev/$loop
+sudo mount /dev/$loop jessie
+sudo debootstrap --foreign --variant=minbase \
+  --arch armel jessie jessie/ \
+  http://http.debian.net/debian
+sudo umount jessie
 

Copy Debian image to the phone


@@ -81,42 +84,42 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
adb root && adb wait-for-device && adb shell
-mkdir -p /storage/sdcard1/Linux/jessie
-exit
+
adb root && adb wait-for-device && adb shell
+mkdir -p /storage/sdcard1/Linux/jessie
+exit
 
-# Sparse image problem, may be too big for copying otherwise
-gzip jessie.img
-# Copy over
-adb push jessie.img.gz /storage/sdcard1/Linux/jessie.img.gz
-adb shell
-cd /storage/sdcard1/Linux
-gunzip jessie.img.gz
+# Sparse image problem, may be too big for copying otherwise
+gzip jessie.img
+# Copy over
+adb push jessie.img.gz /storage/sdcard1/Linux/jessie.img.gz
+adb shell
+cd /storage/sdcard1/Linux
+gunzip jessie.img.gz
 
-# Show used loop devices
-losetup -f
-# Store the next free one to $loop
-loop=loopN
+# Show used loop devices
+losetup -f
+# Store the next free one to $loop
+loop=loopN
 
-# Use the next free one (replace the loop number)
-losetup /dev/block/$loop $(pwd)/jessie.img
-mount -t ext4 /dev/block/$loop $(pwd)/jessie
+# Use the next free one (replace the loop number)
+losetup /dev/block/$loop $(pwd)/jessie.img
+mount -t ext4 /dev/block/$loop $(pwd)/jessie
 
-# Bind-Mound proc, dev, sys`
-busybox mount --bind /proc $(pwd)/jessie/proc
-busybox mount --bind /dev $(pwd)/jessie/dev
-busybox mount --bind /dev/pts $(pwd)/jessie/dev/pts
-busybox mount --bind /sys $(pwd)/jessie/sys
+# Bind-Mound proc, dev, sys`
+busybox mount --bind /proc $(pwd)/jessie/proc
+busybox mount --bind /dev $(pwd)/jessie/dev
+busybox mount --bind /dev/pts $(pwd)/jessie/dev/pts
+busybox mount --bind /sys $(pwd)/jessie/sys
 
-# Bind-Mound the rest of Android
-mkdir -p $(pwd)/jessie/storage/sdcard{0,1}
-busybox mount --bind /storage/emulated \
-  $(pwd)/jessie/storage/sdcard0
-busybox mount --bind /storage/sdcard1 \
-  $(pwd)/jessie/storage/sdcard1
+# Bind-Mound the rest of Android
+mkdir -p $(pwd)/jessie/storage/sdcard{0,1}
+busybox mount --bind /storage/emulated \
+  $(pwd)/jessie/storage/sdcard0
+busybox mount --bind /storage/sdcard1 \
+  $(pwd)/jessie/storage/sdcard1
 
-# Check mounts
-mount | grep jessie
+# Check mounts
+mount | grep jessie
 

Second debootstrap stage


@@ -127,11 +130,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
chroot $(pwd)/jessie /bin/bash -l
-export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
-/debootstrap/debootstrap --second-stage
-exit # Leave chroot
-exit # Leave adb shell
+
chroot $(pwd)/jessie /bin/bash -l
+export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
+/debootstrap/debootstrap --second-stage
+exit # Leave chroot
+exit # Leave adb shell
 

Setup of various scripts


@@ -142,36 +145,36 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
# Install script jessie.sh
-adb push storage/sdcard1/Linux/jessie.sh /storage/sdcard/Linux/jessie.sh
-adb shell
-cd /storage/sdcard1/Linux
-sh jessie.sh enter
+
# Install script jessie.sh
+adb push storage/sdcard1/Linux/jessie.sh /storage/sdcard/Linux/jessie.sh
+adb shell
+cd /storage/sdcard1/Linux
+sh jessie.sh enter
 
-# Bashrc
-cat <<END >~/.bashrc
-export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
-export EDITOR=vim
-hostname $(cat /etc/hostname)
-END
+# Bashrc
+cat <<END >~/.bashrc
+export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
+export EDITOR=vim
+hostname $(cat /etc/hostname)
+END
 
-# Fixing an error message while loading the profile
-sed -i s#id#/usr/bin/id# /etc/profile
+# Fixing an error message while loading the profile
+sed -i s#id#/usr/bin/id# /etc/profile
 
-# Setting the hostname
-echo phobos > /etc/hostname
-echo 127.0.0.1 phobos > /etc/hosts
-hostname phobos
+# Setting the hostname
+echo phobos > /etc/hostname
+echo 127.0.0.1 phobos > /etc/hosts
+hostname phobos
 
-# Apt-sources
-cat <<END > sources.list
-deb http://ftp.uk.debian.org/debian/ jessie main contrib non-free
-deb-src http://ftp.uk.debian.org/debian/ jessie main contrib non-free
-END
-apt-get update
-apt-get upgrade
-apt-get dist-upgrade
-exit # Exit chroot
+# Apt-sources
+cat <<END > sources.list
+deb http://ftp.uk.debian.org/debian/ jessie main contrib non-free
+deb-src http://ftp.uk.debian.org/debian/ jessie main contrib non-free
+END
+apt-get update
+apt-get upgrade
+apt-get dist-upgrade
+exit # Exit chroot
 

Entering Debroid and enable a service


@@ -182,19 +185,19 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
sh jessie.sh enter
+
sh jessie.sh enter
 
-# Setup example serice uptimed
-apt-get install uptimed
-cat <<END > /etc/rc.debroid
-export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
-service uptimed status &>/dev/null || service uptimed start
-exit 0
-END
+# Setup example serice uptimed
+apt-get install uptimed
+cat <<END > /etc/rc.debroid
+export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
+service uptimed status &>/dev/null || service uptimed start
+exit 0
+END
 
-chmod 0755 /etc/rc.debroid
-exit # Exit chroot
-exit # Exit adb shell
+chmod 0755 /etc/rc.debroid
+exit # Exit chroot
+exit # Exit adb shell
 

Include to Android startup:


@@ -205,10 +208,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
adb push data/local/userinit.sh /data/local/userinit.sh
-adb shell
-chmod +x /data/local/userinit.sh
-exit
+
adb push data/local/userinit.sh /data/local/userinit.sh
+adb shell
+chmod +x /data/local/userinit.sh
+exit
 

Reboot & test! Enjoy!
@@ -217,7 +220,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2016-04-03-offsite-backup-with-zfs.html b/gemfeed/2016-04-03-offsite-backup-with-zfs.html index bace5800..1111f4c4 100644 --- a/gemfeed/2016-04-03-offsite-backup-with-zfs.html +++ b/gemfeed/2016-04-03-offsite-backup-with-zfs.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Offsite backup with ZFS



Published at 2016-04-03T22:43:42+01:00
@@ -54,7 +57,7 @@
Back to the main site
diff --git a/gemfeed/2016-04-09-jails-and-zfs-on-freebsd-with-puppet.html b/gemfeed/2016-04-09-jails-and-zfs-on-freebsd-with-puppet.html index 87f4d824..8ecc979a 100644 --- a/gemfeed/2016-04-09-jails-and-zfs-on-freebsd-with-puppet.html +++ b/gemfeed/2016-04-09-jails-and-zfs-on-freebsd-with-puppet.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Jails and ZFS with Puppet on FreeBSD



Published at 2016-04-09T18:29:47+01:00
@@ -420,7 +423,7 @@ Notice: Finished catalog run in 206.09 seconds
Back to the main site
diff --git a/gemfeed/2016-04-16-offsite-backup-with-zfs-part2.html b/gemfeed/2016-04-16-offsite-backup-with-zfs-part2.html index 1fa3c0be..21732abb 100644 --- a/gemfeed/2016-04-16-offsite-backup-with-zfs-part2.html +++ b/gemfeed/2016-04-16-offsite-backup-with-zfs-part2.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Offsite backup with ZFS (Part 2)



Published at 2016-04-16T22:43:42+01:00
@@ -40,7 +43,7 @@
Back to the main site
diff --git a/gemfeed/2016-05-22-spinning-up-my-own-authoritative-dns-servers.html b/gemfeed/2016-05-22-spinning-up-my-own-authoritative-dns-servers.html index 741adbb6..b048f0a9 100644 --- a/gemfeed/2016-05-22-spinning-up-my-own-authoritative-dns-servers.html +++ b/gemfeed/2016-05-22-spinning-up-my-own-authoritative-dns-servers.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Spinning up my own authoritative DNS servers



Published at 2016-05-22T18:59:01+01:00
@@ -258,7 +261,7 @@ apply Service "dig6" {
Back to the main site
diff --git a/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html b/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html index 790e9fff..82871d58 100644 --- a/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html +++ b/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Object oriented programming with ANSI C



Published at 2016-11-20T22:10:57+00:00; Updated at 2022-01-29
@@ -31,37 +34,37 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
#include <stdio.h>
+
#include <stdio.h>
 
-typedef struct {
-    double (*calculate)(const double, const double);
-    char *name;
-} something_s;
+typedef struct {
+    double (*calculate)(const double, const double);
+    char *name;
+} something_s;
 
-double multiplication(const double a, const double b) {
-    return a * b;
-}
+double multiplication(const double a, const double b) {
+    return a * b;
+}
 
-double division(const double a, const double b) {
-    return a / b;
-}
+double division(const double a, const double b) {
+    return a / b;
+}
 
-int main(void) {
-    something_s mult = (something_s) {
-        .calculate = multiplication,
-        .name = "Multiplication"
-    };
+int main(void) {
+    something_s mult = (something_s) {
+        .calculate = multiplication,
+        .name = "Multiplication"
+    };
 
-    something_s div = (something_s) {
-        .calculate = division,
-        .name = "Division"
-    };
+    something_s div = (something_s) {
+        .calculate = division,
+        .name = "Division"
+    };
 
-    const double a = 3, b = 2;
+    const double a = 3, b = 2;
 
-    printf("%s(%f, %f) => %f\n", mult.name, a, b, mult.calculate(a,b));
-    printf("%s(%f, %f) => %f\n", div.name, a, b, div.calculate(a,b));
-}
+    printf("%s(%f, %f) => %f\n", mult.name, a, b, mult.calculate(a,b));
+    printf("%s(%f, %f) => %f\n", div.name, a, b, div.calculate(a,b));
+}
 

As you can see, you can call the function (pointed by the function pointer) with the same syntax as in C++ or Java:
@@ -70,8 +73,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
printf("%s(%f, %f) => %f\n", mult.name, a, b, mult.calculate(a,b));
-printf("%s(%f, %f) => %f\n", div.name, a, b, div.calculate(a,b));
+
printf("%s(%f, %f) => %f\n", mult.name, a, b, mult.calculate(a,b));
+printf("%s(%f, %f) => %f\n", div.name, a, b, div.calculate(a,b));
 

However, that's just syntactic sugar for:
@@ -80,8 +83,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
printf("%s(%f, %f) => %f\n", mult.name, a, b, (*mult.calculate)(a,b));
-printf("%s(%f, %f) => %f\n", div.name, a, b, (*div.calculate)(a,b));
+
printf("%s(%f, %f) => %f\n", mult.name, a, b, (*mult.calculate)(a,b));
+printf("%s(%f, %f) => %f\n", div.name, a, b, (*div.calculate)(a,b));
 

Output:
@@ -90,10 +93,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
pbuetow ~/git/blog/source [38268]% gcc oop-c-example.c -o oop-c-example
-pbuetow ~/git/blog/source [38269]% ./oop-c-example
-Multiplication(3.000000, 2.000000) => 6.000000
-Division(3.000000, 2.000000) => 1.500000
+
pbuetow ~/git/blog/source [38268]% gcc oop-c-example.c -o oop-c-example
+pbuetow ~/git/blog/source [38269]% ./oop-c-example
+Multiplication(3.000000, 2.000000) => 6.000000
+Division(3.000000, 2.000000) => 1.500000
 

Not complicated at all, but nice to know and helps to make the code easier to read!
@@ -106,7 +109,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
mult.calculate(mult,a,b));
+
mult.calculate(mult,a,b));
 

Real object oriented programming with C


@@ -127,7 +130,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux.html b/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux.html index 5c30cf80..5c5cfab7 100644 --- a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux.html +++ b/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Realistic load testing with I/O Riot for Linux



Published at 2018-06-01T14:50:29+01:00; Updated at 2021-05-08
@@ -215,7 +218,7 @@ Total time: 1213.00s
Back to the main site
diff --git a/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program.html b/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program.html index 381ec040..e02f2c2b 100644 --- a/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program.html +++ b/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

DTail - The distributed log tail program



Published at 2021-04-22T19:28:41+01:00; Updated at 2021-04-26
@@ -141,7 +144,7 @@ dtail –servers serverlist.txt –files ‘/var/log/*.log’ –regex ‘(?i:er
Back to the main site
diff --git a/gemfeed/2021-04-24-welcome-to-the-geminispace.html b/gemfeed/2021-04-24-welcome-to-the-geminispace.html index 6f573463..8efc1f55 100644 --- a/gemfeed/2021-04-24-welcome-to-the-geminispace.html +++ b/gemfeed/2021-04-24-welcome-to-the-geminispace.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Welcome to the Geminispace



Published at 2021-04-24T19:28:41+01:00; Updated at 2021-06-18
@@ -114,7 +117,7 @@
Back to the main site
diff --git a/gemfeed/2021-05-16-personal-bash-coding-style-guide.html b/gemfeed/2021-05-16-personal-bash-coding-style-guide.html index 4cb9071b..548a6ee2 100644 --- a/gemfeed/2021-05-16-personal-bash-coding-style-guide.html +++ b/gemfeed/2021-05-16-personal-bash-coding-style-guide.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Personal Bash coding style guide



Published at 2021-05-16T14:51:57+01:00
@@ -63,7 +66,7 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
#!/bin/bash 
+
#!/bin/bash 
 

... as the shebang line, but that does not work on all Unix and Unix-like operating systems (e.g., the *BSDs don't have Bash installed to /bin/bash). Better is:
@@ -72,7 +75,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
#!/usr/bin/env bash
+
#!/usr/bin/env bash
 

Two space soft-tabs indentation


@@ -93,14 +96,14 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
# All fits on one line
-command1 | command2
+
# All fits on one line
+command1 | command2
 
-# Long commands
-command1 \
-  | command2 \
-  | command3 \
-  | command4
+# Long commands
+command1 \
+  | command2 \
+  | command3 \
+  | command4
 

I think there is a better way like the following, which is less noisy. The pipe | already indicates the Bash that another command is expected, thus making the explicit line breaks with \ obsolete:
@@ -109,11 +112,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
# Long commands
-command1 |
-    command2 |
-    command3 |
-    command4
+
# Long commands
+command1 |
+    command2 |
+    command3 |
+    command4
 

Update: It's 2023 now, and I have changed my mind. I think Google's way is the better one. It may be a bit more to type, but the leading | are a nice eye catcher, so you know immediately what is going on!
@@ -126,11 +129,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
greet () {
-    local -r greeting="${1}"
-    local -r name="${2}"
-    echo "${greeting} ${name}!"
-}
+
greet () {
+    local -r greeting="${1}"
+    local -r name="${2}"
+    echo "${greeting} ${name}!"
+}
 

In this particular example, I agree that you should quote them as you don't know the input (are there, for example, whitespace characters?). But if you are sure that you are only using simple bare words, then I think that the code looks much cleaner when you do this instead:
@@ -139,11 +142,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
say_hello_to_paul () {
-    local -r greeting=Hello
-    local -r name=Paul
-    echo "$greeting $name!"
-}
+
say_hello_to_paul () {
+    local -r greeting=Hello
+    local -r name=Paul
+    echo "$greeting $name!"
+}
 

You see, I also omitted the curly braces { } around the variables. I only use the curly braces around variables when it makes the code either easier/clearer to read or if it is necessary to use them:
@@ -152,9 +155,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
declare FOO=bar
-# Curly braces around FOO are necessary
-echo "foo${FOO}baz"
+
declare FOO=bar
+# Curly braces around FOO are necessary
+echo "foo${FOO}baz"
 

A few more words on always quoting the variables: For the sake of consistency (and for making ShellCheck happy), I am not against quoting everything I encounter. I also think that the larger the Bash script becomes, the more critical it becomes always to quote variables. That's because it will be more likely that you might not remember that some of the functions don't work on values with spaces in them, for example. It's just that I won't quote everything in every small script I write.
@@ -167,13 +170,13 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
# Prefer this:
-addition=$(( X + Y ))
-substitution="${string/#foo/bar}"
+
# Prefer this:
+addition=$(( X + Y ))
+substitution="${string/#foo/bar}"
 
-# Instead of this:
-addition="$(expr "${X}" + "${Y}")"
-substitution="$(echo "${string}" | sed -e 's/^foo/bar/')"
+# Instead of this:
+addition="$(expr "${X}" + "${Y}")"
+substitution="$(echo "${string}" | sed -e 's/^foo/bar/')"
 

I can't entirely agree here. The external commands (especially sed) are much more sophisticated and powerful than the built-in Bash versions. Sed can do much more than the Bash can ever do by itself when it comes to text manipulation (the name "sed" stands for streaming editor, after all).
@@ -194,20 +197,20 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
declare -r SUGAR_FREE=yes
-declare -r I_NEED_THE_BUZZ=no
+
declare -r SUGAR_FREE=yes
+declare -r I_NEED_THE_BUZZ=no
 
-buy_soda () {
-    local -r sugar_free=$1
+buy_soda () {
+    local -r sugar_free=$1
 
-    if [[ $sugar_free == yes ]]; then
-        echo 'Diet Dr. Pepper'
-    else
-        echo 'Pepsi Coke'
-    fi
-}
+    if [[ $sugar_free == yes ]]; then
+        echo 'Diet Dr. Pepper'
+    else
+        echo 'Pepsi Coke'
+    fi
+}
 
-buy_soda $I_NEED_THE_BUZZ
+buy_soda $I_NEED_THE_BUZZ
 

Non-evil alternative to variable assignments via eval


@@ -218,12 +221,12 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
# What does this set?
-# Did it succeed? In part or whole?
-eval $(set_my_variables)
+
# What does this set?
+# Did it succeed? In part or whole?
+eval $(set_my_variables)
 
-# What happens if one of the returned values has a space in it?
-variable="$(eval some_function)"
+# What happens if one of the returned values has a space in it?
+variable="$(eval some_function)"
 

However, if I want to read variables from another file, I don't have to use eval here. I only have to source the file:
@@ -262,39 +265,39 @@ Hello paul, it is Sat 15 May 19:21:12 BST 2021 by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
filter_lines () {
-    echo 'Start filtering lines in a fancy way!' >&2
-    grep ... | sed ....
-}
+
filter_lines () {
+    echo 'Start filtering lines in a fancy way!' >&2
+    grep ... | sed ....
+}
 
-process_lines () {
-    echo 'Start processing line by line!' >&2
-    while read -r line; do
-        ... do something and produce a result...
-        echo "$result"
-    done 
-}
+process_lines () {
+    echo 'Start processing line by line!' >&2
+    while read -r line; do
+        ... do something and produce a result...
+        echo "$result"
+    done 
+}
 
-# Do some post-processing of the data
-postprocess_lines () {
-    echo 'Start removing duplicates!' >&2
-    sort -u
-}
+# Do some post-processing of the data
+postprocess_lines () {
+    echo 'Start removing duplicates!' >&2
+    sort -u
+}
 
-genreate_report () {
-    echo 'My boss wants to have a report!' >&2
-    tee outfile.txt
-    wc -l outfile.txt
-}
+genreate_report () {
+    echo 'My boss wants to have a report!' >&2
+    tee outfile.txt
+    wc -l outfile.txt
+}
 
-main () {
-    filter_lines |
-        process_lines |
-        postprocess_lines |
-        generate_report
-}
+main () {
+    filter_lines |
+        process_lines |
+        postprocess_lines |
+        generate_report
+}
 
-main
+main
 

The stdout is always passed as a pipe to the next following stage. The stderr is used for info logging.
@@ -309,13 +312,13 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
some_function () {
-    local -r param_foo="$1"; shift
-    local -r param_baz="$1"; shift
-    local -r param_bay="$1"; shift
+
some_function () {
+    local -r param_foo="$1"; shift
+    local -r param_baz="$1"; shift
+    local -r param_bay="$1"; shift
 
-    # ...
-}
+    # ...
+}
 

Want to add a param_baz? Just do this:
@@ -324,14 +327,14 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
some_function () {
-    local -r param_foo="$1"; shift
-    local -r param_bar="$1"; shift
-    local -r param_baz="$1"; shift
-    local -r param_bay="$1"; shift
+
some_function () {
+    local -r param_foo="$1"; shift
+    local -r param_bar="$1"; shift
+    local -r param_baz="$1"; shift
+    local -r param_bay="$1"; shift
 
-    # ...
-}
+    # ...
+}
 

Want to remove param_foo? Nothing easier than that:
@@ -340,13 +343,13 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
some_function () {
-    local -r param_bar="$1"; shift
-    local -r param_baz="$1"; shift
-    local -r param_bay="$1"; shift
-    
-    # ...
-}
+
some_function () {
+    local -r param_bar="$1"; shift
+    local -r param_baz="$1"; shift
+    local -r param_bay="$1"; shift
+    
+    # ...
+}
 

As you can see, I didn't need to change any other assignments within the function. Of course, you would also need to change the function argument lists at every occasion where the function is invoked - you would do that within the same refactoring session.
@@ -359,9 +362,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
set -e
-grep -q foo <<< bar
-echo Jo
+
set -e
+grep -q foo <<< bar
+echo Jo
 

Here 'Jo' will never be printed out as the grep didn't find any match. It's unrealistic for most scripts to run in paranoid mode purely, so there must be a way to add exceptions. Critical Bash scripts of mine tend to look like this:
@@ -370,26 +373,26 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
#!/usr/bin/env bash
+
#!/usr/bin/env bash
 
-set -e
+set -e
 
-some_function () {
-    # .. some critical code
-    # ...
+some_function () {
+    # .. some critical code
+    # ...
 
-    set +e
-    # Grep might fail, but that's OK now
-    grep ....
-    local -i ec=$?
-    set -e
+    set +e
+    # Grep might fail, but that's OK now
+    grep ....
+    local -i ec=$?
+    set -e
 
-    # .. critical code continues ...
-    if [[ $ec -ne 0 ]]; then
-        : # ...
-    fi
-    # ...
-}
+    # .. critical code continues ...
+    if [[ $ec -ne 0 ]]; then
+        : # ...
+    fi
+    # ...
+}
 

Learned


@@ -404,10 +407,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
if [[ "${my_var}" > 3 ]]; then
-    # True for 4, false for 22.
-    do_something
-fi
+
if [[ "${my_var}" > 3 ]]; then
+    # True for 4, false for 22.
+    do_something
+fi
 

... but it is probably an unintended lexicographical comparison. A correct way would be:
@@ -416,9 +419,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
if (( my_var > 3 )); then
-    do_something
-fi
+
if (( my_var > 3 )); then
+    do_something
+fi
 

or
@@ -427,9 +430,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
if [[ "${my_var}" -gt 3 ]]; then
-    do_something
-fi
+
if [[ "${my_var}" -gt 3 ]]; then
+    do_something
+fi
 

PIPESTATUS


@@ -442,10 +445,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
tar -cf - ./* | ( cd "${dir}" && tar -xf - )
-if (( PIPESTATUS[0] != 0 || PIPESTATUS[1] != 0 )); then
-    echo "Unable to tar files to ${dir}" >&2
-fi
+
tar -cf - ./* | ( cd "${dir}" && tar -xf - )
+if (( PIPESTATUS[0] != 0 || PIPESTATUS[1] != 0 )); then
+    echo "Unable to tar files to ${dir}" >&2
+fi
 

However, as PIPESTATUS will be overwritten as soon as you do any other command, if you need to act differently on errors based on where it happened in the pipe, you'll need to assign PIPESTATUS to another variable immediately after running the command (don't forget that [ is a command and will wipe out PIPESTATUS).
@@ -454,14 +457,14 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
tar -cf - ./* | ( cd "${DIR}" && tar -xf - )
-return_codes=( "${PIPESTATUS[@]}" )
-if (( return_codes[0] != 0 )); then
-    do_something
-fi
-if (( return_codes[1] != 0 )); then
-    do_something_else
-fi
+
tar -cf - ./* | ( cd "${DIR}" && tar -xf - )
+return_codes=( "${PIPESTATUS[@]}" )
+if (( return_codes[0] != 0 )); then
+    do_something
+fi
+if (( return_codes[1] != 0 )); then
+    do_something_else
+fi
 

Use common sense and BE CONSISTENT.


@@ -491,7 +494,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html b/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html index 74021510..9d1bc660 100644 --- a/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html +++ b/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Gemtexter - One Bash script to rule it all



Published at 2021-06-05T19:03:32+01:00
@@ -111,18 +114,18 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
paul in uranus in gemtexter on 🌱 main
-❯ wc -l gemtexter lib/*
-    117 gemtexter
-     59 lib/assert.source.sh
-    128 lib/atomfeed.source.sh
-     64 lib/gemfeed.source.sh
-    161 lib/generate.source.sh
-     50 lib/git.source.sh
-    162 lib/html.source.sh
-     30 lib/log.source.sh
-     63 lib/md.source.sh
-     834 total
+
paul in uranus in gemtexter on 🌱 main
+❯ wc -l gemtexter lib/*
+    117 gemtexter
+     59 lib/assert.source.sh
+    128 lib/atomfeed.source.sh
+     64 lib/gemfeed.source.sh
+    161 lib/generate.source.sh
+     50 lib/git.source.sh
+    162 lib/html.source.sh
+     30 lib/log.source.sh
+     63 lib/md.source.sh
+     834 total
 

This way, the script could grow far beyond 1000 lines of code and still be maintainable. With more features, execution speed may slowly become a problem, though. I already notice that Gemtexter doesn't produce results instantly but requires few seconds of runtime already. That's not a problem yet, though.
@@ -157,9 +160,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
gemtext='=> http://example.org Description of the link'
-assert::equals "$(generate::make_link html "$gemtext")" \
-    '<a class="textlink" href="http://example.org">Description of the link</a><br />'
+
gemtext='=> http://example.org Description of the link'
+assert::equals "$(generate::make_link html "$gemtext")" \
+    '<a class="textlink" href="http://example.org">Description of the link</a><br />'
 

Markdown unit test example


@@ -168,9 +171,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
gemtext='=> http://example.org Description of the link'
-assert::equals "$(generate::make_link md "$gemtext")" \
-    '[Description of the link](http://example.org)  '
+
gemtext='=> http://example.org Description of the link'
+assert::equals "$(generate::make_link md "$gemtext")" \
+    '[Description of the link](http://example.org)  '
 

Handcrafted HTML styles


@@ -218,7 +221,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2021-07-04-the-well-grounded-rubyist.html b/gemfeed/2021-07-04-the-well-grounded-rubyist.html index 8770f079..cdadc104 100644 --- a/gemfeed/2021-07-04-the-well-grounded-rubyist.html +++ b/gemfeed/2021-07-04-the-well-grounded-rubyist.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

The Well-Grounded Rubyist



Published at 2021-07-04T10:51:23+01:00
@@ -132,7 +135,7 @@ Hello World
Back to the main site
diff --git a/gemfeed/2021-08-01-on-being-pedantic-about-open-source.html b/gemfeed/2021-08-01-on-being-pedantic-about-open-source.html index c6df05d1..5b1e1ff7 100644 --- a/gemfeed/2021-08-01-on-being-pedantic-about-open-source.html +++ b/gemfeed/2021-08-01-on-being-pedantic-about-open-source.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

On being Pedantic about Open-Source



Published at 2021-08-01T10:37:58+03:00; Updated at 2023-01-23
@@ -148,7 +151,7 @@
Back to the main site
diff --git a/gemfeed/2021-09-12-keep-it-simple-and-stupid.html b/gemfeed/2021-09-12-keep-it-simple-and-stupid.html index e41b81a9..7a64cff0 100644 --- a/gemfeed/2021-09-12-keep-it-simple-and-stupid.html +++ b/gemfeed/2021-09-12-keep-it-simple-and-stupid.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Keep it simple and stupid



Published at 2021-09-12T09:39:20+03:00; Updated at 2023-03-23
@@ -135,7 +138,7 @@
Back to the main site
diff --git a/gemfeed/2021-10-22-defensive-devops.html b/gemfeed/2021-10-22-defensive-devops.html index 2f8eac19..eeee37aa 100644 --- a/gemfeed/2021-10-22-defensive-devops.html +++ b/gemfeed/2021-10-22-defensive-devops.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Defensive DevOps



Published at 2021-10-22T10:02:46+03:00
@@ -128,7 +131,7 @@
Back to the main site
diff --git a/gemfeed/2021-11-29-bash-golf-part-1.html b/gemfeed/2021-11-29-bash-golf-part-1.html index 0eed4ba7..dbdc2670 100644 --- a/gemfeed/2021-11-29-bash-golf-part-1.html +++ b/gemfeed/2021-11-29-bash-golf-part-1.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Bash Golf Part 1



Published at 2021-11-29T14:06:14+00:00; Updated at 2022-01-05
@@ -499,7 +502,7 @@ bash: line 1: 1/10.0 : syntax error: invalid arithmetic operator (error token is
Back to the main site
diff --git a/gemfeed/2021-12-26-how-to-stay-sane-as-a-devops-person.html b/gemfeed/2021-12-26-how-to-stay-sane-as-a-devops-person.html index f3982efa..cb6d7940 100644 --- a/gemfeed/2021-12-26-how-to-stay-sane-as-a-devops-person.html +++ b/gemfeed/2021-12-26-how-to-stay-sane-as-a-devops-person.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

How to stay sane as a DevOps person



Published at 2021-12-26T12:02:02+00:00; Updated at 2022-01-12
@@ -157,7 +160,7 @@
Back to the main site
diff --git a/gemfeed/2022-01-01-bash-golf-part-2.html b/gemfeed/2022-01-01-bash-golf-part-2.html index 20856d40..3b66d2b8 100644 --- a/gemfeed/2022-01-01-bash-golf-part-2.html +++ b/gemfeed/2022-01-01-bash-golf-part-2.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Bash Golf Part 2



Published at 2022-01-01T23:36:15+00:00; Updated at 2022-01-05
@@ -518,7 +521,7 @@ PAUL:X:1000:1000:PAUL BUETOW:/HOME/PAUL:/BIN/BASH
Back to the main site
diff --git a/gemfeed/2022-01-23-welcome-to-the-foo.zone.html b/gemfeed/2022-01-23-welcome-to-the-foo.zone.html index dcca2e70..46cc9ade 100644 --- a/gemfeed/2022-01-23-welcome-to-the-foo.zone.html +++ b/gemfeed/2022-01-23-welcome-to-the-foo.zone.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Welcome to the foo.zone



Published at 2022-01-23T16:42:04+00:00
@@ -59,7 +62,7 @@
Back to the main site
diff --git a/gemfeed/2022-02-04-computer-operating-systems-i-use.html b/gemfeed/2022-02-04-computer-operating-systems-i-use.html index b18747a4..dea2363d 100644 --- a/gemfeed/2022-02-04-computer-operating-systems-i-use.html +++ b/gemfeed/2022-02-04-computer-operating-systems-i-use.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Computer operating systems I use(d)



Published at 2022-02-04T09:58:22+00:00; Updated at 2022-02-18
@@ -266,7 +269,7 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2
Back to the main site
diff --git a/gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html b/gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html index f1e08c60..548c5d17 100644 --- a/gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html +++ b/gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

The release of DTail 4.0.0



Published at 2022-03-06T18:11:39+00:00
@@ -333,7 +336,7 @@ exec /usr/local/bin/dtailhealth --server localhost:2222
Back to the main site
diff --git a/gemfeed/2022-04-10-creative-universe.html b/gemfeed/2022-04-10-creative-universe.html index 764c7fa9..275c2929 100644 --- a/gemfeed/2022-04-10-creative-universe.html +++ b/gemfeed/2022-04-10-creative-universe.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Creative universe



Published at 2022-04-10T10:09:11+01:00; Updated at 2022-04-18
@@ -165,7 +168,7 @@ learn () {
Back to the main site
diff --git a/gemfeed/2022-05-27-perl-is-still-a-great-choice.html b/gemfeed/2022-05-27-perl-is-still-a-great-choice.html index 220a3575..b8b871c1 100644 --- a/gemfeed/2022-05-27-perl-is-still-a-great-choice.html +++ b/gemfeed/2022-05-27-perl-is-still-a-great-choice.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Perl is still a great choice



Published at 2022-05-27T07:50:12+01:00; Updated at 2023-01-28
@@ -170,7 +173,7 @@
Back to the main site
diff --git a/gemfeed/2022-06-15-sweating-the-small-stuff.html b/gemfeed/2022-06-15-sweating-the-small-stuff.html index 3e014683..eb4f1dba 100644 --- a/gemfeed/2022-06-15-sweating-the-small-stuff.html +++ b/gemfeed/2022-06-15-sweating-the-small-stuff.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Sweating the small stuff - Tiny projects of mine



Published at 2022-06-15T08:47:44+01:00; Updated at 2022-06-18
@@ -364,7 +367,7 @@ v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs
Back to the main site
diff --git a/gemfeed/2022-07-30-lets-encrypt-with-openbsd-and-rex.html b/gemfeed/2022-07-30-lets-encrypt-with-openbsd-and-rex.html index aa1280b6..29074c4a 100644 --- a/gemfeed/2022-07-30-lets-encrypt-with-openbsd-and-rex.html +++ b/gemfeed/2022-07-30-lets-encrypt-with-openbsd-and-rex.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Let's Encrypt with OpenBSD and Rex



Published at 2022-07-30T12:14:31+01:00
@@ -699,7 +702,7 @@ rex commons
Back to the main site
diff --git a/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html b/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html index d6150170..9087dbec 100644 --- a/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html +++ b/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Gemtexter 1.1.0 - Let's Gemtext again



Published at 2022-08-27T18:25:57+01:00
@@ -54,23 +57,23 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
check_dependencies () {
-    # At least, Bash 5 is required
-    local -i required_version=5
-    IFS=. read -ra version <<< "$BASH_VERSION"
-    if [ "${version[0]}" -lt $required_version ]; then
-        log ERROR "ERROR, \"bash\" must be at least at major version $required_version!"
-        exit 2
-    fi
+
check_dependencies () {
+    # At least, Bash 5 is required
+    local -i required_version=5
+    IFS=. read -ra version <<< "$BASH_VERSION"
+    if [ "${version[0]}" -lt $required_version ]; then
+        log ERROR "ERROR, \"bash\" must be at least at major version $required_version!"
+        exit 2
+    fi
 
-    # These must be the GNU versions of the commands
-    for tool in $DATE $SED $GREP; do
-        if ! $tool --version | grep -q GNU; then
-            log ERROR "ERROR, \"$tool\" command is not the GNU version, please install!"
-            exit 2
-        fi
-    done
-}
+    # These must be the GNU versions of the commands
+    for tool in $DATE $SED $GREP; do
+        if ! $tool --version | grep -q GNU; then
+            log ERROR "ERROR, \"$tool\" command is not the GNU version, please install!"
+            exit 2
+        fi
+    done
+}
 

Especially macOS users didn't read the README carefully enough to install GNU Grep, GNU Sed and GNU Date before using Gemtexter.
@@ -91,7 +94,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
./gemtexter --generate '.*hello.*'
+
./gemtexter --generate '.*hello.*'
 

Revamped git support


@@ -128,7 +131,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2022-09-30-after-a-bad-nights-sleep.html b/gemfeed/2022-09-30-after-a-bad-nights-sleep.html index 6248eb06..4370abd5 100644 --- a/gemfeed/2022-09-30-after-a-bad-nights-sleep.html +++ b/gemfeed/2022-09-30-after-a-bad-nights-sleep.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

After a bad night's sleep



Published at 2022-09-30T09:53:23+03:00; Updated at 2022-10-12
@@ -128,7 +131,7 @@ jgs (________\ \
Back to the main site
diff --git a/gemfeed/2022-10-30-installing-dtail-on-openbsd.html b/gemfeed/2022-10-30-installing-dtail-on-openbsd.html index e55abea9..59e1b57b 100644 --- a/gemfeed/2022-10-30-installing-dtail-on-openbsd.html +++ b/gemfeed/2022-10-30-installing-dtail-on-openbsd.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Installing DTail on OpenBSD



Published at 2022-10-30T11:03:19+02:00
@@ -375,7 +378,7 @@ REMOTE|fishfinger|100|7|fstab|093f510ec5c0f512.h /usr/local ffs rw,wxallowed,nod
Back to the main site
diff --git a/gemfeed/2022-11-24-i-tried-emacs-but-i-switched-back-to-neovim.html b/gemfeed/2022-11-24-i-tried-emacs-but-i-switched-back-to-neovim.html index b322bfa8..71fb253f 100644 --- a/gemfeed/2022-11-24-i-tried-emacs-but-i-switched-back-to-neovim.html +++ b/gemfeed/2022-11-24-i-tried-emacs-but-i-switched-back-to-neovim.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

I tried (Doom) Emacs, but I switched back to (Neo)Vim



Published at 2022-11-24T11:17:15+02:00; Updated at 2022-11-26
@@ -91,10 +94,10 @@ Art by \ \_! / __! by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
" Clipboard
-vnoremap ,y !pbcopy<CR>ugv
-vnoremap ,i !pbpaste<CR>
-nmap ,i !wpbpaste<CR>
+
" Clipboard
+vnoremap ,y !pbcopy<CR>ugv
+vnoremap ,i !pbpaste<CR>
+nmap ,i !wpbpaste<CR>
 

That's only a very few lines and does precisely what I want. It's quick and dirty but get's the job done! If VimScript becomes too cumbersome, I can use Lua for NeoVim scripting.
@@ -139,7 +142,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways.html b/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways.html index 86a56785..1e968e63 100644 --- a/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways.html +++ b/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

(Re)learning Java - My takeaways



Published at 2022-12-24T23:18:40+02:00
@@ -134,7 +137,7 @@
Back to the main site
diff --git a/gemfeed/2023-01-23-why-grapheneos-rox.html b/gemfeed/2023-01-23-why-grapheneos-rox.html index 4b8c8c01..be597159 100644 --- a/gemfeed/2023-01-23-why-grapheneos-rox.html +++ b/gemfeed/2023-01-23-why-grapheneos-rox.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Why GrapheneOS rox



Published at 2023-01-23T15:31:52+02:00
@@ -164,7 +167,7 @@ Art by Joan Stark
Back to the main site
diff --git a/gemfeed/2023-02-26-how-to-shut-down-after-work.html b/gemfeed/2023-02-26-how-to-shut-down-after-work.html index 94604065..c0e35389 100644 --- a/gemfeed/2023-02-26-how-to-shut-down-after-work.html +++ b/gemfeed/2023-02-26-how-to-shut-down-after-work.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

How to shut down after work



Published at 2023-02-26T23:48:01+02:00
@@ -100,7 +103,7 @@
Back to the main site
diff --git a/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html b/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html index 36e5b2f0..5e7e4e72 100644 --- a/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html +++ b/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

"The Pragmatic Programmer" book notes



Published at 2023-03-16T00:55:20+02:00
@@ -106,7 +109,7 @@
Back to the main site
diff --git a/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html b/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html index b778825c..d84eea88 100644 --- a/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html +++ b/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Gemtexter 2.0.0 - Let's Gemtext again²



Published at 2023-03-25T17:50:32+02:00
@@ -120,8 +123,8 @@ Blablabla... by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
declare -xr PRE_GENERATE_HOOK=./pre_generate_hook.sh
-declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh
+
declare -xr PRE_GENERATE_HOOK=./pre_generate_hook.sh
+declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh
 

Use of safer Bash options


@@ -138,10 +141,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
% cat gemfeed/2023-02-26-title-here.gmi
-# Title here
+
% cat gemfeed/2023-02-26-title-here.gmi
+# Title here
 
-The remaining content of the Gemtext file...
+The remaining content of the Gemtext file...
 

Gemtexter will add a line starting with > Published at ... now. Any subsequent Atom feed generation will then use that date.
@@ -150,12 +153,12 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
% cat gemfeed/2023-02-26-title-here.gmi
-# Title here
+
% cat gemfeed/2023-02-26-title-here.gmi
+# Title here
 
-> Published at 2023-02-26T21:43:51+01:00
+> Published at 2023-02-26T21:43:51+01:00
 
-The remaining content of the Gemtext file...
+The remaining content of the Gemtext file...
 

XMLLint support


@@ -179,7 +182,7 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
diff --git a/gemfeed/2023-04-01-never-split-the-difference-book-notes.html b/gemfeed/2023-04-01-never-split-the-difference-book-notes.html index fd09e4ad..ba22edfb 100644 --- a/gemfeed/2023-04-01-never-split-the-difference-book-notes.html +++ b/gemfeed/2023-04-01-never-split-the-difference-book-notes.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

"Never split the difference" book notes



Published at 2023-04-01T20:00:17+03:00
@@ -169,7 +172,7 @@
Back to the main site
diff --git a/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html b/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html index 5a68b133..0bfe2bb9 100644 --- a/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html +++ b/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

Unveiling guprecords.raku: Global Uptime Records with Raku



Published at 2023-04-30T13:10:26+03:00
@@ -74,7 +77,7 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
$ raku guprecords.raku --stats=dir=$HOME/git/uprecords/stats --all
+
$ raku guprecords.raku --stats=dir=$HOME/git/uprecords/stats --all
 

This command will generate a comprehensive uptime report from the collected statistics, making it easy to review and enjoy the data.
@@ -185,7 +188,7 @@ no1 in 455 days, 18:52:44 | at Sun Jul 21 07:37:51 2024
Back to the main site
diff --git a/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html b/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html index 3ee7dec8..91b05819 100644 --- a/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html +++ b/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

"The Obstacle is the Way" book notes



Published at 2023-05-06T17:23:16+03:00
@@ -122,7 +125,7 @@
Back to the main site
diff --git a/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios.html b/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios.html index b99e41fd..46eaf3f3 100644 --- a/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios.html +++ b/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios.html @@ -8,6 +8,9 @@ +

+View this page as Markdown | Gemtext +

KISS server monitoring with Gogios



Published at 2023-06-01T21:10:17+03:00
@@ -114,11 +117,11 @@ Have a nice day! by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
git clone https://codeberg.org/snonux/gogios.git
-cd gogios
-go build -o gogios cmd/gogios/main.go
-doas cp gogios /usr/local/bin/gogios
-doas chmod 755 /usr/local/bin/gogios
+
git clone https://codeberg.org/snonux/gogios.git
+cd gogios
+go build -o gogios cmd/gogios/main.go
+doas cp gogios /usr/local/bin/gogios
+doas chmod 755 /usr/local/bin/gogios
 

You can use cross-compilation if you want to compile Gogios for OpenBSD on a Linux system without installing the Go compiler on OpenBSD. Follow these steps:
@@ -127,9 +130,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
export GOOS=openbsd
-export GOARCH=amd64
-go build -o gogios cmd/gogios/main.go
+
export GOOS=openbsd
+export GOARCH=amd64
+go build -o gogios cmd/gogios/main.go
 

On your OpenBSD system, copy the binary to /usr/local/bin/gogios and set the correct permissions as described in the previous section. All steps described here you could automate with your configuration management system of choice. I use Rexify, the friendly configuration management system, to automate the installation, but that is out of the scope of this document.
@@ -144,11 +147,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
doas adduser -group _gogios -batch _gogios
-doas usermod -d /var/run/gogios _gogios
-doas mkdir -p /var/run/gogios
-doas chown _gogios:_gogios /var/run/gogios
-doas chmod 750 /var/run/gogios
+
doas adduser -group _gogios -batch _gogios
+doas usermod -d /var/run/gogios _gogios
+doas mkdir -p /var/run/gogios
+doas chown _gogios:_gogios /var/run/gogios
+doas chmod 750 /var/run/gogios
 

Please note that creating a user and group might differ depending on your operating system. For other operating systems, consult their documentation for creating system users and groups.
@@ -161,8 +164,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
doas pkg_add monitoring-plugins
-doas pkg_add nrpe # If you want to execute checks remotely via NRPE.
+
doas pkg_add monitoring-plugins
+doas pkg_add nrpe # If you want to execute checks remotely via NRPE.
 

Once the installation is complete, you can find the monitoring plugins in the /usr/local/libexec/nagios directory, which then can be configured to be used in gogios.json.
@@ -189,41 +192,41 @@ echo 'This is a test email from OpenBSD.' | mail -s 'Test Email' by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
{
-  "EmailTo": "paul@dev.buetow.org",
-  "EmailFrom": "gogios@buetow.org",
-  "CheckTimeoutS": 10,
-  "CheckConcurrency": 2,
-  "StateDir": "/var/run/gogios",
-  "Checks": {
-    "Check ICMP4 www.foo.zone": {
-      "Plugin": "/usr/local/libexec/nagios/check_ping",
-      "Args": [ "-H", "www.foo.zone", "-4", "-w", "50,10%", "-c", "100,15%" ],
-      "Retries": 3,
-      "RetryInterval": 10
-    },
-    "Check ICMP6 www.foo.zone": {
-      "Plugin": "/usr/local/libexec/nagios/check_ping",
-      "Args": [ "-H", "www.foo.zone", "-6", "-w", "50,10%", "-c", "100,15%" ],
-      "Retries": 3,
-      "RetryInterval": 10
-    },
-    "www.foo.zone HTTP IPv4": {
-      "Plugin": "/usr/local/libexec/nagios/check_http",
-      "Args": ["www.foo.zone", "-4"],
-      "DependsOn": ["Check ICMP4 www.foo.zone"]
-    },
-    "www.foo.zone HTTP IPv6": {
-      "Plugin": "/usr/local/libexec/nagios/check_http",
-      "Args": ["www.foo.zone", "-6"],
-      "DependsOn": ["Check ICMP6 www.foo.zone"]
-    }
-    "Check NRPE Disk Usage foo.zone": {
-      "Plugin": "/usr/local/libexec/nagios/check_nrpe",
-      "Args": ["-H", "foo.zone", "-c", "check_disk", "-p", "5666", "-4"]
-    }
-  }
-}
+
{
+  "EmailTo": "paul@dev.buetow.org",
+  "EmailFrom": "gogios@buetow.org",
+  "CheckTimeoutS": 10,
+  "CheckConcurrency": 2,
+  "StateDir": "/var/run/gogios",
+  "Checks": {
+    "Check ICMP4 www.foo.zone": {
+      "Plugin": "/usr/local/libexec/nagios/check_ping",
+      "Args": [ "-H", "www.foo.zone", "-4", "-w", "50,10%", "-c", "100,15%" ],
+      "Retries": 3,
+      "RetryInterval": 10
+    },
+    "Check ICMP6 www.foo.zone": {
+      "Plugin": "/usr/local/libexec/nagios/check_ping",
+      "Args": [ "-H", "www.foo.zone", "-6", "-w", "50,10%", "-c", "100,15%" ],
+      "Retries": 3,
+      "RetryInterval": 10
+    },
+    "www.foo.zone HTTP IPv4": {
+      "Plugin": "/usr/local/libexec/nagios/check_http",
+      "Args": ["www.foo.zone", "-4"],
+      "DependsOn": ["Check ICMP4 www.foo.zone"]
+    },
+    "www.foo.zone HTTP IPv6": {
+      "Plugin": "/usr/local/libexec/nagios/check_http",
+      "Args": ["www.foo.zone", "-6"],
+      "DependsOn": ["Check ICMP6 www.foo.zone"]
+    }
+    "Check NRPE Disk Usage foo.zone": {
+      "Plugin": "/usr/local/libexec/nagios/check_nrpe",
+      "Args": ["-H", "foo.zone", "-c", "check_disk", "-p", "5666", "-4"]
+    }
+  }
+}
 

    @@ -252,7 +255,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    doas -u _gogios /usr/local/bin/gogios -cfg /etc/gogios.json
    +
    doas -u _gogios /usr/local/bin/gogios -cfg /etc/gogios.json
     

    To run Gogios via CRON on OpenBSD as the gogios user and check all services once per minute, follow these steps:
    @@ -294,7 +297,7 @@ http://www.gnu.org/software/src-highlite -->
    Back to the main site
    diff --git a/gemfeed/2023-07-17-career-guide-and-soft-skills-book-notes.html b/gemfeed/2023-07-17-career-guide-and-soft-skills-book-notes.html index 55e8b720..5efea299 100644 --- a/gemfeed/2023-07-17-career-guide-and-soft-skills-book-notes.html +++ b/gemfeed/2023-07-17-career-guide-and-soft-skills-book-notes.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    "Software Developmers Career Guide and Soft Skills" book notes



    Published at 2023-07-17T04:56:20+03:00
    @@ -354,7 +357,7 @@
    Back to the main site
    diff --git a/gemfeed/2023-07-21-gemtexter-2.1.0-lets-gemtext-again-3.html b/gemfeed/2023-07-21-gemtexter-2.1.0-lets-gemtext-again-3.html index ae5ca1aa..f1530b18 100644 --- a/gemfeed/2023-07-21-gemtexter-2.1.0-lets-gemtext-again-3.html +++ b/gemfeed/2023-07-21-gemtexter-2.1.0-lets-gemtext-again-3.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Gemtexter 2.1.0 - Let's Gemtext again³



    Published at 2023-07-21T10:19:31+03:00
    @@ -69,9 +72,9 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    if [ -n "$foo" ]; then
    -  echo "$foo"
    -fi
    +
    if [ -n "$foo" ]; then
    +  echo "$foo"
    +fi
     

    Please run source-highlight --lang-list for a list of all supported languages.
    @@ -100,7 +103,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    declare -xr MASTODON_URI='https://fosstodon.org/@snonux'
    +
    declare -xr MASTODON_URI='https://fosstodon.org/@snonux'
     

    and add the following into your index.gmi:
    @@ -115,7 +118,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    <a href='https://fosstodon.org/@snonux' rel='me'>Me at Mastodon</a>
    +
    <a href='https://fosstodon.org/@snonux' rel='me'>Me at Mastodon</a>
     

    More


    @@ -135,7 +138,7 @@ http://www.gnu.org/software/src-highlite -->
    Back to the main site
    diff --git a/gemfeed/2023-08-18-site-reliability-engineering-part-1.html b/gemfeed/2023-08-18-site-reliability-engineering-part-1.html index c1ecb384..c0a52ecd 100644 --- a/gemfeed/2023-08-18-site-reliability-engineering-part-1.html +++ b/gemfeed/2023-08-18-site-reliability-engineering-part-1.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Site Reliability Engineering - Part 1: SRE and Organizational Culture



    Published at 2023-08-18T22:43:47+03:00
    @@ -69,7 +72,7 @@ DC on fire:
    Back to the main site
    diff --git a/gemfeed/2023-09-25-dtail-usage-examples.html b/gemfeed/2023-09-25-dtail-usage-examples.html index 8392bcfe..c3d31b71 100644 --- a/gemfeed/2023-09-25-dtail-usage-examples.html +++ b/gemfeed/2023-09-25-dtail-usage-examples.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    DTail usage examples



    Published at 2023-09-25T14:57:42+03:00
    @@ -67,7 +70,7 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt --grep INFO --files "/var/log/dserver/*.log"
    +
    % dtail --servers serverlist.txt --grep INFO --files "/var/log/dserver/*.log"
     

    Hint: you can also provide a comma separated server list, e.g.: servers server1.example.org,server2.example.org:PORT,...
    @@ -80,7 +83,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt --grep INFO "/var/log/dserver/*.log"
    +
    % dtail --servers serverlist.txt --grep INFO "/var/log/dserver/*.log"
     

    Aggregating logs


    @@ -93,10 +96,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    --query 'from STATS select sum($goroutines),sum($cgocalls),
    -             last($time),max(lifetimeConnections)'
    +
    % dtail --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    --query 'from STATS select sum($goroutines),sum($cgocalls),
    +             last($time),max(lifetimeConnections)'
     

    Beware: For map-reduce queries to work, you have to ensure that DTail supports your log format. Check out the documentaiton of the DTail query language and the DTail log formats on the DTail homepage for more information.
    @@ -109,10 +112,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    'from STATS select sum($goroutines),sum($cgocalls),
    -     last($time),max(lifetimeConnections)'
    +
    % dtail --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    'from STATS select sum($goroutines),sum($cgocalls),
    +     last($time),max(lifetimeConnections)'
     

    Here is another example:
    @@ -121,10 +124,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -             lifetimeConnections group by $hostname order by max($cgocalls)'
    +
    % dtail --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +             lifetimeConnections group by $hostname order by max($cgocalls)'
     

    Tail map-reduce example 2
    @@ -135,9 +138,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    --query 'from STATS select ... outfile append result.csv'
    +
    % dtail --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    --query 'from STATS select ... outfile append result.csv'
     

    How to use dcat


    @@ -150,7 +153,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dcat --servers serverlist.txt --files /etc/hostname
    +
    % dcat --servers serverlist.txt --files /etc/hostname
     

    Cat example
    @@ -161,7 +164,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dcat --servers serverlist.txt /etc/hostname
    +
    % dcat --servers serverlist.txt /etc/hostname
     

    How to use dgrep


    @@ -172,9 +175,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dgrep --servers server1.example.org:2223 \
    -    --files /etc/passwd \
    -    --regex nologin
    +
    % dgrep --servers server1.example.org:2223 \
    +    --files /etc/passwd \
    +    --regex nologin
     

    Generally, dgrep is also a very useful way to search historic application logs for certain content.
    @@ -191,10 +194,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dmap --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -             lifetimeConnections group by $hostname order by max($cgocalls)'
    +
    % dmap --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +             lifetimeConnections group by $hostname order by max($cgocalls)'
     

    Remember: For that to work, you have to make sure that DTail supports your log format. You can either use the ones already defined in internal/mapr/logformat or add an extension to support a custom log format. The example here works out of the box though, as DTail understands its own log format already.
    @@ -217,9 +220,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dmap --files /var/log/dserver/dserver.log
    -    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -              lifetimeConnections group by $hostname order by max($cgocalls)'
    +
    % dmap --files /var/log/dserver/dserver.log
    +    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +              lifetimeConnections group by $hostname order by max($cgocalls)'
     

    As a shorthand version the following command can be used:
    @@ -228,9 +231,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -        lifetimeConnections group by $hostname order by max($cgocalls)' \
    -        /var/log/dsever/dserver.log
    +
    % dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +        lifetimeConnections group by $hostname order by max($cgocalls)' \
    +        /var/log/dsever/dserver.log
     

    You can also use a file input pipe as follows:
    @@ -239,9 +242,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % cat /var/log/dserver/dserver.log | \
    -    dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -          lifetimeConnections group by $hostname order by max($cgocalls)'
    +
    % cat /var/log/dserver/dserver.log | \
    +    dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +          lifetimeConnections group by $hostname order by max($cgocalls)'
     

    Aggregating CSV files


    @@ -252,16 +255,16 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % cat example.csv
    -name,lastname,age,profession
    -Michael,Jordan,40,Basketball player
    -Michael,Jackson,100,Singer
    -Albert,Einstein,200,Physician
    -% dmap --query 'select lastname,name where age > 40 logformat csv outfile result.csv' example.csv
    -% cat result.csv
    -lastname,name
    -Jackson,Michael
    -Einstein,Albert
    +
    % cat example.csv
    +name,lastname,age,profession
    +Michael,Jordan,40,Basketball player
    +Michael,Jackson,100,Singer
    +Albert,Einstein,200,Physician
    +% dmap --query 'select lastname,name where age > 40 logformat csv outfile result.csv' example.csv
    +% cat result.csv
    +lastname,name
    +Jackson,Michael
    +Einstein,Albert
     

    DMap can also be used to query and aggregate CSV files from remote servers.
    @@ -274,44 +277,44 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail /var/log/dserver/dserver.log
    +
    % dtail /var/log/dserver/dserver.log
     

    -
    % dtail --logLevel trace /var/log/dserver/dserver.log
    +
    % dtail --logLevel trace /var/log/dserver/dserver.log
     

    -
    % dcat /etc/passwd
    +
    % dcat /etc/passwd
     

    -
    % dcat --plain /etc/passwd > /etc/test
    -# Should show no differences.
    -diff /etc/test /etc/passwd 
    +
    % dcat --plain /etc/passwd > /etc/test
    +# Should show no differences.
    +diff /etc/test /etc/passwd 
     

    -
    % dgrep --regex ERROR --files /var/log/dserver/dsever.log
    +
    % dgrep --regex ERROR --files /var/log/dserver/dsever.log
     

    -
    % dgrep --before 10 --after 10 --max 10 --grep ERROR /var/log/dserver/dsever.log
    +
    % dgrep --before 10 --after 10 --max 10 --grep ERROR /var/log/dserver/dsever.log
     

    Use --help for more available options. Or go to the DTail page for more information! Hope you find DTail useful!
    @@ -331,7 +334,7 @@ http://www.gnu.org/software/src-highlite -->
    Back to the main site
    diff --git a/gemfeed/2023-10-29-kiss-static-web-photo-albums-with-photoalbum.sh.html b/gemfeed/2023-10-29-kiss-static-web-photo-albums-with-photoalbum.sh.html index b0433fcd..9bf239df 100644 --- a/gemfeed/2023-10-29-kiss-static-web-photo-albums-with-photoalbum.sh.html +++ b/gemfeed/2023-10-29-kiss-static-web-photo-albums-with-photoalbum.sh.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    KISS static web photo albums with photoalbum.sh



    Published at 2023-10-29T22:25:04+02:00
    @@ -127,42 +130,42 @@ photoalbum makemake by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % photoalbum makemake
    -You may now customize ./photoalbumrc and run make
    +
    % photoalbum makemake
    +You may now customize ./photoalbumrc and run make
     
    -% cat Makefile
    -all:
    -	photoalbum generate photoalbumrc
    -clean:
    -	photoalbum clean photoalbumrc
    +% cat Makefile
    +all:
    +	photoalbum generate photoalbumrc
    +clean:
    +	photoalbum clean photoalbumrc
     
    -% cat photoalbumrc
    -# The title of the photoalbum
    -TITLE='A simple Photoalbum'
    +% cat photoalbumrc
    +# The title of the photoalbum
    +TITLE='A simple Photoalbum'
     
    -# Thumbnail height geometry
    -THUMBHEIGHT=300
    -# Normal geometry height (when viewing photo). Uncomment, to keep original size.
    -HEIGHT=1200
    -# Max previews per page.
    -MAXPREVIEWS=40
    -# Randomly shuffle all previews.
    -# SHUFFLE=yes
    +# Thumbnail height geometry
    +THUMBHEIGHT=300
    +# Normal geometry height (when viewing photo). Uncomment, to keep original size.
    +HEIGHT=1200
    +# Max previews per page.
    +MAXPREVIEWS=40
    +# Randomly shuffle all previews.
    +# SHUFFLE=yes
     
    -# Diverse directories, need to be full paths, not relative!
    -INCOMING_DIR=$(pwd)/incoming
    -DIST_DIR=$(pwd)/dist
    -TEMPLATE_DIR=/usr/share/photoalbum/templates/default
    -#TEMPLATE_DIR=/usr/share/photoalbum/templates/minimal
    +# Diverse directories, need to be full paths, not relative!
    +INCOMING_DIR=$(pwd)/incoming
    +DIST_DIR=$(pwd)/dist
    +TEMPLATE_DIR=/usr/share/photoalbum/templates/default
    +#TEMPLATE_DIR=/usr/share/photoalbum/templates/minimal
     
    -# Includes a .tar of the incoming dir in the dist, can be yes or no
    -TARBALL_INCLUDE=yes
    -TARBALL_SUFFIX=.tar
    -TAR_OPTS='-c'
    +# Includes a .tar of the incoming dir in the dist, can be yes or no
    +TARBALL_INCLUDE=yes
    +TARBALL_SUFFIX=.tar
    +TAR_OPTS='-c'
     
    -# Some debugging options
    -#set -e
    -#set -x
    +# Some debugging options
    +#set -e
    +#set -x
     

    In the case for irregular.ninja, I changed the defaults to the following:
    @@ -171,38 +174,38 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    --- photoalbumrc        2023-10-29 21:42:00.894202045 +0200
    -+++ photoalbumrc.new 2023-06-04 10:40:08.030994440 +0300
    -@@ -1,23 +1,24 @@
    - # The title of the photoalbum
    --TITLE='A simple Photoalbum'
    -+TITLE='Irregular.Ninja'
    +
    --- photoalbumrc        2023-10-29 21:42:00.894202045 +0200
    ++++ photoalbumrc.new 2023-06-04 10:40:08.030994440 +0300
    +@@ -1,23 +1,24 @@
    + # The title of the photoalbum
    +-TITLE='A simple Photoalbum'
    ++TITLE='Irregular.Ninja'
     
    - # Thumbnail height geometry
    --THUMBHEIGHT=300
    -+THUMBHEIGHT=400
    - # Normal geometry height (when viewing photo). Uncomment, to keep original size.
    --HEIGHT=1200
    -+HEIGHT=1800
    - # Max previews per page.
    - MAXPREVIEWS=40
    --# Randomly shuffle all previews.
    --# SHUFFLE=yes
    -+# Randomly shuffle
    -+SHUFFLE=yes
    + # Thumbnail height geometry
    +-THUMBHEIGHT=300
    ++THUMBHEIGHT=400
    + # Normal geometry height (when viewing photo). Uncomment, to keep original size.
    +-HEIGHT=1200
    ++HEIGHT=1800
    + # Max previews per page.
    + MAXPREVIEWS=40
    +-# Randomly shuffle all previews.
    +-# SHUFFLE=yes
    ++# Randomly shuffle
    ++SHUFFLE=yes
     
    - # Diverse directories, need to be full paths, not relative!
    --INCOMING_DIR=$(pwd)/incoming
    -+INCOMING_DIR=~/Nextcloud/Photos/irregular.ninja
    - DIST_DIR=$(pwd)/dist
    - TEMPLATE_DIR=/usr/share/photoalbum/templates/default
    - #TEMPLATE_DIR=/usr/share/photoalbum/templates/minimal
    + # Diverse directories, need to be full paths, not relative!
    +-INCOMING_DIR=$(pwd)/incoming
    ++INCOMING_DIR=~/Nextcloud/Photos/irregular.ninja
    + DIST_DIR=$(pwd)/dist
    + TEMPLATE_DIR=/usr/share/photoalbum/templates/default
    + #TEMPLATE_DIR=/usr/share/photoalbum/templates/minimal
     
    - # Includes a .tar of the incoming dir in the dist, can be yes or no
    --TARBALL_INCLUDE=yes
    -+TARBALL_INCLUDE=no
    - TARBALL_SUFFIX=.tar
    - TAR_OPTS='-c'
    + # Includes a .tar of the incoming dir in the dist, can be yes or no
    +-TARBALL_INCLUDE=yes
    ++TARBALL_INCLUDE=no
    + TARBALL_SUFFIX=.tar
    + TAR_OPTS='-c'
     

    So I changed the album title, adjusted some image and thumbnail dimensions, and I want all images to be randomly shuffled every time the album is generated! I also have all my photos in my Nextcloud Photo directory and don't want to copy them to the local incoming directory. Also, a tarball containing the whole album as a download isn't provided.
    @@ -302,7 +305,7 @@ blurs html index.html photos thumbs
    Back to the main site
    diff --git a/gemfeed/2023-11-11-mind-management-book-notes.html b/gemfeed/2023-11-11-mind-management-book-notes.html index 6cf8305b..485ed367 100644 --- a/gemfeed/2023-11-11-mind-management-book-notes.html +++ b/gemfeed/2023-11-11-mind-management-book-notes.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    "Mind Management" book notes



    Published at 2023-11-11T22:21:47+02:00
    @@ -139,7 +142,7 @@
    Back to the main site
    diff --git a/gemfeed/2023-11-19-site-reliability-engineering-part-2.html b/gemfeed/2023-11-19-site-reliability-engineering-part-2.html index fc50e5c6..360e7284 100644 --- a/gemfeed/2023-11-19-site-reliability-engineering-part-2.html +++ b/gemfeed/2023-11-19-site-reliability-engineering-part-2.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Site Reliability Engineering - Part 2: Operational Balance



    Published at 2023-11-19T00:18:18+03:00
    @@ -59,7 +62,7 @@
    Back to the main site
    diff --git a/gemfeed/2023-12-10-bash-golf-part-3.html b/gemfeed/2023-12-10-bash-golf-part-3.html index 47b507a4..afd2f951 100644 --- a/gemfeed/2023-12-10-bash-golf-part-3.html +++ b/gemfeed/2023-12-10-bash-golf-part-3.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Bash Golf Part 3



    Published at 2023-12-10T11:35:54+02:00
    @@ -52,24 +55,24 @@ jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -log () {
    -    local -r level="$1"; shift
    -    local -r message="$1"; shift
    -    local -i pid="$$"
    +log () {
    +    local -r level="$1"; shift
    +    local -r message="$1"; shift
    +    local -i pid="$$"
     
    -    local -r callee=${FUNCNAME[1]}
    -    local -r stamp=$(date +%Y%m%d-%H%M%S)
    +    local -r callee=${FUNCNAME[1]}
    +    local -r stamp=$(date +%Y%m%d-%H%M%S)
     
    -    echo "$level|$stamp|$pid|$callee|$message" >&2
    -}
    +    echo "$level|$stamp|$pid|$callee|$message" >&2
    +}
     
    -at_home_friday_evening () {
    -    log INFO 'One Peperoni Pizza, please'
    -}
    +at_home_friday_evening () {
    +    log INFO 'One Peperoni Pizza, please'
    +}
     
    -at_home_friday_evening
    +at_home_friday_evening
     

    The output is as follows:
    @@ -78,8 +81,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    ./logexample.sh
    -INFO|20231210-082732|123002|at_home_friday_evening|One Peperoni Pizza, please
    +
    ❯ ./logexample.sh
    +INFO|20231210-082732|123002|at_home_friday_evening|One Peperoni Pizza, please
     

    :(){ :|:& };:


    @@ -113,18 +116,18 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    -
    -outer() {
    -  inner() {
    -    echo 'Intel inside!'
    -  }
    -  inner
    -}
    -
    -inner
    -outer
    -inner
    +
    #!/usr/bin/env bash
    +
    +outer() {
    +  inner() {
    +    echo 'Intel inside!'
    +  }
    +  inner
    +}
    +
    +inner
    +outer
    +inner
     

    And let's execute it:
    @@ -142,26 +145,26 @@ Intel inside! by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    -
    -outer1() {
    -  inner() {
    -    echo 'Intel inside!'
    -  }
    -  inner
    -}
    -
    -outer2() {
    -  inner() {
    -    echo 'Wintel inside!'
    -  }
    -  inner
    -}
    -
    -outer1
    -inner
    -outer2
    -inner
    +
    #!/usr/bin/env bash
    +
    +outer1() {
    +  inner() {
    +    echo 'Intel inside!'
    +  }
    +  inner
    +}
    +
    +outer2() {
    +  inner() {
    +    echo 'Wintel inside!'
    +  }
    +  inner
    +}
    +
    +outer1
    +inner
    +outer2
    +inner
     

    And let's run it:
    @@ -182,14 +185,14 @@ Wintel inside! by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -some_expensive_operations() {
    -  echo "Doing expensive operations with '$1' from pid $$"
    -}
    +some_expensive_operations() {
    +  echo "Doing expensive operations with '$1' from pid $$"
    +}
     
    -for i in {0..9}; do echo $i; done \
    -  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
    +for i in {0..9}; do echo $i; done \
    +  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
     

    We try here to run ten parallel processes; each of them should run the some_expensive_operations function with a different argument. The arguments are provided to xargs through STDIN one per line. When executed, we get this:
    @@ -214,15 +217,15 @@ bash: line 1: some_expensive_operations: command not found by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -some_expensive_operations() {
    -  echo "Doing expensive operations with '$1' from pid $$"
    -}
    -export -f some_expensive_operations
    +some_expensive_operations() {
    +  echo "Doing expensive operations with '$1' from pid $$"
    +}
    +export -f some_expensive_operations
     
    -for i in {0..9}; do echo $i; done \
    -  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
    +for i in {0..9}; do echo $i; done \
    +  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
     

    When we run this now, we get:
    @@ -247,19 +250,19 @@ Doing expensive operations with '9' from pid 132840 by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -some_other_function() {
    -  echo "$1"
    -}
    +some_other_function() {
    +  echo "$1"
    +}
     
    -some_expensive_operations() {
    -  some_other_function "Doing expensive operations with '$1' from pid $$"
    -}
    -export -f some_expensive_operations
    +some_expensive_operations() {
    +  some_other_function "Doing expensive operations with '$1' from pid $$"
    +}
    +export -f some_expensive_operations
     
    -for i in {0..9}; do echo $i; done \
    -  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
    +for i in {0..9}; do echo $i; done \
    +  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
     

    ... because some_other_function isn't exported! You will also need to add an export -f some_other_function!
    @@ -272,22 +275,22 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    -
    -foo() {
    -  local foo=bar # Declare local/dynamic variable
    -  bar
    -  echo "$foo"
    -}
    -
    -bar() {
    -  echo "$foo"
    -  foo=baz
    -}
    -
    -foo=foo # Declare global variable
    -foo # Call function foo
    -echo "$foo"
    +
    #!/usr/bin/env bash
    +
    +foo() {
    +  local foo=bar # Declare local/dynamic variable
    +  bar
    +  echo "$foo"
    +}
    +
    +bar() {
    +  echo "$foo"
    +  foo=baz
    +}
    +
    +foo=foo # Declare global variable
    +foo # Call function foo
    +echo "$foo"
     

    Let's pause a minute. What do you think the output would be?
    @@ -312,34 +315,34 @@ foo by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -declare -r foo=foo
    -declare -r bar=bar
    +declare -r foo=foo
    +declare -r bar=bar
     
    -if [ "$foo" = foo ]; then
    -  if [ "$bar" = bar ]; then
    -    echo ok1
    -  fi
    -fi
    +if [ "$foo" = foo ]; then
    +  if [ "$bar" = bar ]; then
    +    echo ok1
    +  fi
    +fi
     
    -if [ "$foo" = foo ] && [ "$bar" == bar ]; then
    -  echo ok2a
    -fi
    +if [ "$foo" = foo ] && [ "$bar" == bar ]; then
    +  echo ok2a
    +fi
     
    -[ "$foo" = foo ] && [ "$bar" == bar ] && echo ok2b
    +[ "$foo" = foo ] && [ "$bar" == bar ] && echo ok2b
     
    -if [[ "$foo" = foo && "$bar" == bar ]]; then
    -  echo ok3a
    -fi
    +if [[ "$foo" = foo && "$bar" == bar ]]; then
    +  echo ok3a
    +fi
     
    - [[ "$foo" = foo && "$bar" == bar ]] && echo ok3b
    + [[ "$foo" = foo && "$bar" == bar ]] && echo ok3b
     
    -if test "$foo" = foo && test "$bar" = bar; then
    -  echo ok4a
    -fi
    +if test "$foo" = foo && test "$bar" = bar; then
    +  echo ok4a
    +fi
     
    -test "$foo" = foo && test "$bar" = bar && echo ok4b
    +test "$foo" = foo && test "$bar" = bar && echo ok4b
     

    The output we get is:
    @@ -363,18 +366,18 @@ ok4b by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -# Single line comment
    +# Single line comment
     
    -# These are two single line
    -# comments one after another
    +# These are two single line
    +# comments one after another
     
    -: <<COMMENT
    -This is another way a
    -multi line comment
    -could be written!
    -COMMENT
    +: <<COMMENT
    +This is another way a
    +multi line comment
    +could be written!
    +COMMENT
     

    I will not demonstrate the execution of this script, as it won't print anything! It's obviously not the most pretty way of commenting on your code, but it could sometimes be handy!
    @@ -387,11 +390,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -echo foo
    -echo echo baz >> $0
    -echo bar
    +echo foo
    +echo echo baz >> $0
    +echo bar
     

    When it is run, it will do:
    @@ -424,7 +427,7 @@ echo baz
    Back to the main site
    diff --git a/gemfeed/2024-01-09-site-reliability-engineering-part-3.html b/gemfeed/2024-01-09-site-reliability-engineering-part-3.html index 04c490e9..8862c371 100644 --- a/gemfeed/2024-01-09-site-reliability-engineering-part-3.html +++ b/gemfeed/2024-01-09-site-reliability-engineering-part-3.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Site Reliability Engineering - Part 3: On-Call Culture



    Published at 2024-01-09T18:35:48+02:00
    @@ -73,7 +76,7 @@
    Back to the main site
    diff --git a/gemfeed/2024-01-13-one-reason-why-i-love-openbsd.html b/gemfeed/2024-01-13-one-reason-why-i-love-openbsd.html index 72dfdfac..78dbbd63 100644 --- a/gemfeed/2024-01-13-one-reason-why-i-love-openbsd.html +++ b/gemfeed/2024-01-13-one-reason-why-i-love-openbsd.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    One reason why I love OpenBSD



    Published at 2024-01-13T22:55:33+02:00
    @@ -36,8 +39,8 @@ SSFISHKISSFISHKISSFISHKISSFISHKIS SFIS by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    $ doas installboot sd0 # Update the bootloader (not for every upgrade required)
    -$ doas sysupgrade # Update all binaries (including Kernel)
    +
    $ doas installboot sd0 # Update the bootloader (not for every upgrade required)
    +$ doas sysupgrade # Update all binaries (including Kernel)
     

    sysupgrade downloaded and upgraded to the next release and rebooted the system. After the reboot, I run:
    @@ -46,9 +49,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    $ doas sysmerge # Update system configuration files
    -$ doas pkg_add -u # Update all packages
    -$ doas reboot # Just in case, reboot one more time
    +
    $ doas sysmerge # Update system configuration files
    +$ doas pkg_add -u # Update all packages
    +$ doas reboot # Just in case, reboot one more time
     

    That's it! Took me around 5 minutes in total! No issues, only these few comands, only 5 minutes! It just works! No problems, no conflicts, no tons (actually none) config file merge conflicts.
    @@ -77,7 +80,7 @@ http://www.gnu.org/software/src-highlite -->
    Back to the main site
    diff --git a/gemfeed/2024-02-04-from-babylon5.buetow.org-to-.cloud.html b/gemfeed/2024-02-04-from-babylon5.buetow.org-to-.cloud.html index de587117..0524c87d 100644 --- a/gemfeed/2024-02-04-from-babylon5.buetow.org-to-.cloud.html +++ b/gemfeed/2024-02-04-from-babylon5.buetow.org-to-.cloud.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    From babylon5.buetow.org to *.buetow.cloud



    Published at 2024-02-04T00:50:50+02:00
    @@ -194,7 +197,7 @@
    Back to the main site
    diff --git a/gemfeed/2024-03-03-a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang.html b/gemfeed/2024-03-03-a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang.html index 359f19a6..a9f1cae7 100644 --- a/gemfeed/2024-03-03-a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang.html +++ b/gemfeed/2024-03-03-a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    A fine Fyne Android app for quickly logging ideas programmed in Go



    Published at 2024-03-03T00:07:21+02:00
    @@ -69,7 +72,7 @@
    Back to the main site
    diff --git a/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html b/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html index 7f59200c..0c17ce74 100644 --- a/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html +++ b/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    KISS high-availability with OpenBSD



    Published at 2024-03-30T22:12:56+02:00
    @@ -95,38 +98,38 @@ _____|_:_:_| (o)-(o) |_:_:_|--'`-. ,--. ksh under-water (((\'/ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/bin/ksh
    +
    #!/bin/ksh
     
    -ZONES_DIR=/var/nsd/zones/master/
    -DEFAULT_MASTER=fishfinger.buetow.org
    -DEFAULT_STANDBY=blowfish.buetow.org
    +ZONES_DIR=/var/nsd/zones/master/
    +DEFAULT_MASTER=fishfinger.buetow.org
    +DEFAULT_STANDBY=blowfish.buetow.org
     
    -determine_master_and_standby () {
    -    local master=$DEFAULT_MASTER
    -    local standby=$DEFAULT_STANDBY
    +determine_master_and_standby () {
    +    local master=$DEFAULT_MASTER
    +    local standby=$DEFAULT_STANDBY
     
    -    .
    -    .
    -    .
    -    
    -    local -i health_ok=1
    -    if ! ftp -4 -o - https://$master/index.txt | grep -q "Welcome to $master"; then
    -        echo "https://$master/index.txt IPv4 health check failed"
    -        health_ok=0
    -    elif ! ftp -6 -o - https://$master/index.txt | grep -q "Welcome to $master"; then
    -        echo "https://$master/index.txt IPv6 health check failed"
    -        health_ok=0
    -    fi
    -    if [ $health_ok -eq 0 ]; then
    -        local tmp=$master
    -        master=$standby
    -        standby=$tmp
    -    fi
    +    .
    +    .
    +    .
    +    
    +    local -i health_ok=1
    +    if ! ftp -4 -o - https://$master/index.txt | grep -q "Welcome to $master"; then
    +        echo "https://$master/index.txt IPv4 health check failed"
    +        health_ok=0
    +    elif ! ftp -6 -o - https://$master/index.txt | grep -q "Welcome to $master"; then
    +        echo "https://$master/index.txt IPv6 health check failed"
    +        health_ok=0
    +    fi
    +    if [ $health_ok -eq 0 ]; then
    +        local tmp=$master
    +        master=$standby
    +        standby=$tmp
    +    fi
     
    -    .
    -    .
    -    .
    -}
    +    .
    +    .
    +    .
    +}
     

    The failover scripts looks for the ; Enable failover string in the DNS zone files and swaps the A and AAAA records of the DNS entries accordingly:
    @@ -135,42 +138,42 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    fishfinger$ grep failover /var/nsd/zones/master/foo.zone.zone
    -        300 IN A 46.23.94.99 ; Enable failover
    -        300 IN AAAA 2a03:6000:6f67:624::99 ; Enable failover
    -www     300 IN A 46.23.94.99 ; Enable failover
    -www     300 IN AAAA 2a03:6000:6f67:624::99 ; Enable failover
    -standby  300 IN A 23.88.35.144 ; Enable failover
    -standby  300 IN AAAA 2a01:4f8:c17:20f1::42 ; Enable failover
    +
    fishfinger$ grep failover /var/nsd/zones/master/foo.zone.zone
    +        300 IN A 46.23.94.99 ; Enable failover
    +        300 IN AAAA 2a03:6000:6f67:624::99 ; Enable failover
    +www     300 IN A 46.23.94.99 ; Enable failover
    +www     300 IN AAAA 2a03:6000:6f67:624::99 ; Enable failover
    +standby  300 IN A 23.88.35.144 ; Enable failover
    +standby  300 IN AAAA 2a01:4f8:c17:20f1::42 ; Enable failover
     

    -
    transform () {
    -  sed -E '
    -	/IN A .*; Enable failover/ {
    -	    /^standby/! {
    -	        s/^(.*) 300 IN A (.*) ; (.*)/\1 300 IN A '$(cat /var/nsd/run/master_a)' ; \3/;
    -	    }
    -	    /^standby/ {
    -	        s/^(.*) 300 IN A (.*) ; (.*)/\1 300 IN A '$(cat /var/nsd/run/standby_a)' ; \3/;
    -	    }
    -	}
    -	/IN AAAA .*; Enable failover/ {
    -	    /^standby/! {
    -	        s/^(.*) 300 IN AAAA (.*) ; (.*)/\1 300 IN AAAA '$(cat /var/nsd/run/master_aaaa)' ; \3/;
    -	    }
    -	    /^standby/ {
    -	        s/^(.*) 300 IN AAAA (.*) ; (.*)/\1 300 IN AAAA '$(cat /var/nsd/run/standby_aaaa)' ; \3/;
    -	    }
    -	}
    -	/ ; serial/ {
    -	    s/^( +) ([0-9]+) .*; (.*)/\1 '$(date +%s)' ; \3/;
    -	}
    -  '
    -}
    +
    transform () {
    +  sed -E '
    +	/IN A .*; Enable failover/ {
    +	    /^standby/! {
    +	        s/^(.*) 300 IN A (.*) ; (.*)/\1 300 IN A '$(cat /var/nsd/run/master_a)' ; \3/;
    +	    }
    +	    /^standby/ {
    +	        s/^(.*) 300 IN A (.*) ; (.*)/\1 300 IN A '$(cat /var/nsd/run/standby_a)' ; \3/;
    +	    }
    +	}
    +	/IN AAAA .*; Enable failover/ {
    +	    /^standby/! {
    +	        s/^(.*) 300 IN AAAA (.*) ; (.*)/\1 300 IN AAAA '$(cat /var/nsd/run/master_aaaa)' ; \3/;
    +	    }
    +	    /^standby/ {
    +	        s/^(.*) 300 IN AAAA (.*) ; (.*)/\1 300 IN AAAA '$(cat /var/nsd/run/standby_aaaa)' ; \3/;
    +	    }
    +	}
    +	/ ; serial/ {
    +	    s/^( +) ([0-9]+) .*; (.*)/\1 '$(date +%s)' ; \3/;
    +	}
    +  '
    +}
     

    After the failover, the script reloads nsd and performs a sanity check to see if DNS still works. If not, a rollback will be performed:
    @@ -179,48 +182,48 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #! Race condition !#
    -   
    -if [ -f $zone_file.bak ]; then
    -    mv $zone_file.bak $zone_file
    -fi
    +
    #! Race condition !#
    +   
    +if [ -f $zone_file.bak ]; then
    +    mv $zone_file.bak $zone_file
    +fi
     
    -cat $zone_file | transform > $zone_file.new.tmp 
    +cat $zone_file | transform > $zone_file.new.tmp 
     
    -grep -v ' ; serial' $zone_file.new.tmp > $zone_file.new.noserial.tmp
    -grep -v ' ; serial' $zone_file > $zone_file.old.noserial.tmp
    +grep -v ' ; serial' $zone_file.new.tmp > $zone_file.new.noserial.tmp
    +grep -v ' ; serial' $zone_file > $zone_file.old.noserial.tmp
     
    -echo "Has zone $zone_file changed?"
    -if diff -u $zone_file.old.noserial.tmp $zone_file.new.noserial.tmp; then
    -    echo "The zone $zone_file hasn't changed"
    -    rm $zone_file.*.tmp
    -    return 0
    -fi
    +echo "Has zone $zone_file changed?"
    +if diff -u $zone_file.old.noserial.tmp $zone_file.new.noserial.tmp; then
    +    echo "The zone $zone_file hasn't changed"
    +    rm $zone_file.*.tmp
    +    return 0
    +fi
     
    -cp $zone_file $zone_file.bak
    -mv $zone_file.new.tmp $zone_file
    -rm $zone_file.*.tmp
    -echo "Reloading nsd"
    -nsd-control reload
    +cp $zone_file $zone_file.bak
    +mv $zone_file.new.tmp $zone_file
    +rm $zone_file.*.tmp
    +echo "Reloading nsd"
    +nsd-control reload
     
    -if ! zone_is_ok $zone; then
    -    echo "Rolling back $zone_file changes"
    -    cp $zone_file $zone_file.invalid
    -    mv $zone_file.bak $zone_file
    -    echo "Reloading nsd"
    -    nsd-control reload
    -    zone_is_ok $zone
    -    return 3
    -fi
    +if ! zone_is_ok $zone; then
    +    echo "Rolling back $zone_file changes"
    +    cp $zone_file $zone_file.invalid
    +    mv $zone_file.bak $zone_file
    +    echo "Reloading nsd"
    +    nsd-control reload
    +    zone_is_ok $zone
    +    return 3
    +fi
     
    -for cleanup in invalid bak; do
    -    if [ -f $zone_file.$cleanup ]; then
    -        rm $zone_file.$cleanup
    -    fi
    -done
    +for cleanup in invalid bak; do
    +    if [ -f $zone_file.$cleanup ]; then
    +        rm $zone_file.$cleanup
    +    fi
    +done
     
    -echo "Failover of zone $zone to $MASTER completed"
    -return 1
    +echo "Failover of zone $zone to $MASTER completed"
    +return 1
     

    A non-zero return code (here, 3 when a rollback and 1 when a DNS failover was performed) will cause CRON to send an E-Mail with the whole script output.
    @@ -277,13 +280,13 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    # Weekly auto-failover for Let's Encrypt automation
    -local -i -r week_of_the_year=$(date +%U)
    -if [ $(( week_of_the_year % 2 )) -eq 0 ]; then
    -    local tmp=$master
    -    master=$standby
    -    standby=$tmp
    -fi
    +
    # Weekly auto-failover for Let's Encrypt automation
    +local -i -r week_of_the_year=$(date +%U)
    +if [ $(( week_of_the_year % 2 )) -eq 0 ]; then
    +    local tmp=$master
    +    master=$standby
    +    standby=$tmp
    +fi
     

    This way, a DNS failover is performed weekly so that the ACME automation can update the Let's Encrypt certificates (for master and standby) before they expire on each VM.
    @@ -340,7 +343,7 @@ http://www.gnu.org/software/src-highlite -->
    Back to the main site
    diff --git a/gemfeed/2024-05-01-slow-productivity-book-notes.html b/gemfeed/2024-05-01-slow-productivity-book-notes.html index d7a7e854..fd485faf 100644 --- a/gemfeed/2024-05-01-slow-productivity-book-notes.html +++ b/gemfeed/2024-05-01-slow-productivity-book-notes.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    "Slow Productivity" book notes



    Published at 2024-04-27T14:18:51+03:00
    @@ -165,7 +168,7 @@
    Back to the main site
    diff --git a/gemfeed/2024-05-03-projects-i-currently-dont-have-time-for.html b/gemfeed/2024-05-03-projects-i-currently-dont-have-time-for.html index 0d6af9d6..2dafe38a 100644 --- a/gemfeed/2024-05-03-projects-i-currently-dont-have-time-for.html +++ b/gemfeed/2024-05-03-projects-i-currently-dont-have-time-for.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Projects I currently don't have time for



    Published at 2024-05-03T16:23:03+03:00
    @@ -217,12 +220,12 @@ Art by Laura Brown by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    Cluster :UK, :uk01 do
    -  Customer.C1A1.segments.volumes.each do |volume|
    -    puts volume.usage_stats
    -    volume.move_off! if volume.over_subscribed?
    -  end
    -end
    +
    Cluster :UK, :uk01 do
    +  Customer.C1A1.segments.volumes.each do |volume|
    +    puts volume.usage_stats
    +    volume.move_off! if volume.over_subscribed?
    +  end
    +end
     

    I am abandoning this project because my workplace has stopped the annual pet project competition, and I have other more important projects to work on at the moment.
    @@ -324,7 +327,7 @@ http://www.gnu.org/software/src-highlite -->
    Back to the main site
    diff --git a/gemfeed/2024-06-23-terminal-multiplexing-with-tmux.html b/gemfeed/2024-06-23-terminal-multiplexing-with-tmux.html index de746573..68052256 100644 --- a/gemfeed/2024-06-23-terminal-multiplexing-with-tmux.html +++ b/gemfeed/2024-06-23-terminal-multiplexing-with-tmux.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Terminal multiplexing with tmux



    Published at 2024-06-23T22:41:59+03:00
    @@ -83,13 +86,13 @@ jgs `-=========-`() by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    alias tm=tmux
    -alias tl='tmux list-sessions'
    -alias tn=tmux::new
    -alias ta=tmux::attach
    -alias tx=tmux::remote
    -alias ts=tmux::search
    -alias tssh=tmux::cluster_ssh
    +
    alias tm=tmux
    +alias tl='tmux list-sessions'
    +alias tn=tmux::new
    +alias ta=tmux::attach
    +alias tx=tmux::remote
    +alias ts=tmux::search
    +alias tssh=tmux::cluster_ssh
     

    Note all tmux::...; those are custom shell functions doing certain things, and they aren't part of the Tmux distribution. But let's run through every aliases one by one.
    @@ -104,23 +107,23 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    # Create new session and if alread exists attach to it
    -tmux::new () {
    -    readonly session=$1
    -    local date=date
    -    if where gdate &>/dev/null; then
    -        date=gdate
    -    fi
    +
    # Create new session and if alread exists attach to it
    +tmux::new () {
    +    readonly session=$1
    +    local date=date
    +    if where gdate &>/dev/null; then
    +        date=gdate
    +    fi
     
    -    tmux::cleanup_default
    -    if [ -z "$session" ]; then
    -        tmux::new T$($date +%s)
    -    else
    -        tmux new-session -d -s $session
    -        tmux -2 attach-session -t $session || tmux -2 switch-client -t $session
    -    fi
    -}
    -alias tn=tmux::new
    +    tmux::cleanup_default
    +    if [ -z "$session" ]; then
    +        tmux::new T$($date +%s)
    +    else
    +        tmux new-session -d -s $session
    +        tmux -2 attach-session -t $session || tmux -2 switch-client -t $session
    +    fi
    +}
    +alias tn=tmux::new
     

    There is a lot going on here. Let's have a detailed look at what it is doing. As a note, the function relies on GNU Date, so MacOS is looking for the gdate commands to be available. Otherwise, it will fall back to date. You need to install GNU Date for Mac, as it isn't installed by default there. As I use Fedora Linux on my personal Laptop and a MacBook for work, I have to make it work for both.
    @@ -135,14 +138,14 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::cleanup_default () {
    -    local s
    -    tmux list-sessions | grep '^T.*: ' | grep -F -v attached |
    -    cut -d: -f1 | while read -r s; do
    -        echo "Killing $s"
    -        tmux kill-session -t "$s"
    -    done
    -}
    +
    tmux::cleanup_default () {
    +    local s
    +    tmux list-sessions | grep '^T.*: ' | grep -F -v attached |
    +    cut -d: -f1 | while read -r s; do
    +        echo "Killing $s"
    +        tmux kill-session -t "$s"
    +    done
    +}
     

    The cleanup function kills all open Tmux sessions that haven't been renamed properly yet—but only if they aren't attached (e.g., don't run in the foreground in any terminal). Cleaning them up automatically keeps my Tmux sessions as neat and tidy as possible.
    @@ -159,16 +162,16 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::attach () {
    -    readonly session=$1
    +
    tmux::attach () {
    +    readonly session=$1
     
    -    if [ -z "$session" ]; then
    -        tmux attach-session || tmux::new
    -    else
    -        tmux attach-session -t $session || tmux::new $session
    -    fi
    -}
    -alias ta=tmux::attach
    +    if [ -z "$session" ]; then
    +        tmux attach-session || tmux::new
    +    else
    +        tmux attach-session -t $session || tmux::new $session
    +    fi
    +}
    +alias ta=tmux::attach
     

    If no session is specified (as the argument of the function), it will try to attach to the first open session. If no Tmux server is running, it will create a new one with tmux::new. Otherwise, with a session name given as the argument, it will attach to it. If unsuccessful (e.g., the session doesn't exist), it will be created and attached to.
    @@ -181,12 +184,12 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::remote () {
    -    readonly server=$1
    -    tmux new -s $server "ssh -t $server 'tmux attach-session || tmux'" || \
    -        tmux attach-session -d -t $server
    -}
    -alias tr=tmux::remote
    +
    tmux::remote () {
    +    readonly server=$1
    +    tmux new -s $server "ssh -t $server 'tmux attach-session || tmux'" || \
    +        tmux attach-session -d -t $server
    +}
    +alias tr=tmux::remote
     

    Change of the Tmux prefix for better nesting


    @@ -209,15 +212,15 @@ set-option -g prefix C-g by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::search () {
    -    local -r session=$(tmux list-sessions | fzf | cut -d: -f1)
    -    if [ -z "$TMUX" ]; then
    -        tmux attach-session -t $session
    -    else
    -        tmux switch -t $session
    -    fi
    -}
    -alias ts=tmux::search
    +
    tmux::search () {
    +    local -r session=$(tmux list-sessions | fzf | cut -d: -f1)
    +    if [ -z "$TMUX" ]; then
    +        tmux attach-session -t $session
    +    else
    +        tmux switch -t $session
    +    fi
    +}
    +alias ts=tmux::search
     

    All it does is list all currently open sessions in fzf, where one of them can be searched and selected through fuzzy find, and then either switch (if already inside a session) to the other session or attach to the other session (if not yet in Tmux).
    @@ -244,15 +247,15 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::cluster_ssh () {
    -    if [ -f "$1" ]; then
    -        tmux::tssh_from_file $1
    -        return
    -    fi
    +
    tmux::cluster_ssh () {
    +    if [ -f "$1" ]; then
    +        tmux::tssh_from_file $1
    +        return
    +    fi
     
    -    tmux::tssh_from_argument $@
    -}
    -alias tssh=tmux::cluster_ssh
    +    tmux::tssh_from_argument $@
    +}
    +alias tssh=tmux::cluster_ssh
     

    This function is just a wrapper around the more complex tmux::tssh_from_file and tmux::tssh_from_argument functions, as you have learned already. Most of the magic happens there.
    @@ -265,23 +268,23 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::tssh_from_argument () {
    -    local -r session=$1; shift
    -    local first_server=$1; shift
    +
    tmux::tssh_from_argument () {
    +    local -r session=$1; shift
    +    local first_server=$1; shift
     
    -    tmux new-session -d -s $session "ssh -t $first_server"
    -    if ! tmux list-session | grep "^$session:"; then
    -        echo "Could not create session $session"
    -        return 2
    -    fi
    +    tmux new-session -d -s $session "ssh -t $first_server"
    +    if ! tmux list-session | grep "^$session:"; then
    +        echo "Could not create session $session"
    +        return 2
    +    fi
     
    -    for server in "${@[@]}"; do
    -        tmux split-window -t $session "tmux select-layout tiled; ssh -t $server"
    -    done
    +    for server in "${@[@]}"; do
    +        tmux split-window -t $session "tmux select-layout tiled; ssh -t $server"
    +    done
     
    -    tmux setw -t $session synchronize-panes on
    -    tmux -2 attach-session -t $session | tmux -2 switch-client -t $session
    -}
    +    tmux setw -t $session synchronize-panes on
    +    tmux -2 attach-session -t $session | tmux -2 switch-client -t $session
    +}
     

    It expects at least two arguments. The first argument is the session name to create for the clustered SSH session. All other arguments are server hostnames or FQDNs to which to connect. The first one is used to make the initial session. All remaining ones are added to that session with tmux split-window -t $session.... At the end, we enable synchronized panes by default, so whenever you type, the commands will be sent to every SSH connection, thus allowing the neat ClusterSSH feature to run commands on multiple servers simultaneously. Once done, we attach (or switch, if already in Tmux) to it.
    @@ -301,12 +304,12 @@ bind-key P setw synchronize-panes on by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::tssh_from_file () {
    -    local -r serverlist=$1; shift
    -    local -r session=$(basename $serverlist | cut -d. -f1)
    +
    tmux::tssh_from_file () {
    +    local -r serverlist=$1; shift
    +    local -r session=$(basename $serverlist | cut -d. -f1)
     
    -    tmux::tssh_from_argument $session $(awk '{ print $1} ' $serverlist | sed 's/.lan./.lan/g')
    -}
    +    tmux::tssh_from_argument $session $(awk '{ print $1} ' $serverlist | sed 's/.lan./.lan/g')
    +}
     

    tssh examples


    @@ -431,7 +434,7 @@ bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "tmux.conf re
    Back to the main site
    diff --git a/gemfeed/2024-07-05-random-weird-things.html b/gemfeed/2024-07-05-random-weird-things.html index 429d5f69..1ea722f1 100644 --- a/gemfeed/2024-07-05-random-weird-things.html +++ b/gemfeed/2024-07-05-random-weird-things.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Random Weird Things



    Published at 2024-07-05T10:59:59+03:00
    @@ -47,38 +50,38 @@ WHOA!! ( o.o ) by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % traceroute bad.horse
    -traceroute to bad.horse (162.252.205.157), 30 hops max, 60 byte packets
    - 1  dsldevice.lan (192.168.1.1)  5.712 ms  5.800 ms  6.466 ms
    - 2  87-243-116-2.ip.btc-net.bg (87.243.116.2)  8.017 ms  7.506 ms  8.432 ms
    - 3  * * *
    - 4  * * *
    - 5  xe-1-2-0.mpr1.fra4.de.above.net (80.81.194.26)  39.952 ms  40.155 ms  40.139 ms
    - 6  ae12.cs1.fra6.de.eth.zayo.com (64.125.26.172)  128.014 ms * *
    - 7  * * *
    - 8  * * *
    - 9  ae10.cs1.lhr15.uk.eth.zayo.com (64.125.29.17)  120.625 ms  121.117 ms  121.050 ms
    -10  * * *
    -11  * * *
    -12  * * *
    -13  ae5.mpr1.tor3.ca.zip.zayo.com (64.125.23.118)  192.605 ms  205.741 ms  203.607 ms
    -14  64.124.217.237.IDIA-265104-ZYO.zip.zayo.com (64.124.217.237)  204.673 ms  134.674 ms  131.442 ms
    -15  * * *
    -16  67.223.96.90 (67.223.96.90)  128.245 ms  127.844 ms  127.843 ms
    -17  bad.horse (162.252.205.130)  128.194 ms  122.854 ms  121.786 ms
    -18  bad.horse (162.252.205.131)  128.831 ms  128.341 ms  186.559 ms
    -19  bad.horse (162.252.205.132)  185.716 ms  180.121 ms  180.042 ms
    -20  bad.horse (162.252.205.133)  203.170 ms  203.076 ms  203.168 ms
    -21  he.rides.across.the.nation (162.252.205.134)  203.115 ms  141.830 ms  141.799 ms
    -22  the.thoroughbred.of.sin (162.252.205.135)  147.965 ms  148.230 ms  170.478 ms
    -23  he.got.the.application (162.252.205.136)  165.161 ms  164.939 ms  159.085 ms
    -24  that.you.just.sent.in (162.252.205.137)  162.310 ms  158.569 ms  158.896 ms
    -25  it.needs.evaluation (162.252.205.138)  162.927 ms  163.046 ms  163.085 ms
    -26  so.let.the.games.begin (162.252.205.139)  233.363 ms  233.545 ms  233.317 ms
    -27  a.heinous.crime (162.252.205.140)  237.745 ms  233.614 ms  233.740 ms
    -28  a.show.of.force (162.252.205.141)  237.974 ms  176.085 ms  175.927 ms
    -29  a.murder.would.be.nice.of.course (162.252.205.142)  181.838 ms  181.858 ms  182.059 ms
    -30  bad.horse (162.252.205.143)  187.731 ms  187.416 ms  187.532 ms
    +
    % traceroute bad.horse
    +traceroute to bad.horse (162.252.205.157), 30 hops max, 60 byte packets
    + 1  dsldevice.lan (192.168.1.1)  5.712 ms  5.800 ms  6.466 ms
    + 2  87-243-116-2.ip.btc-net.bg (87.243.116.2)  8.017 ms  7.506 ms  8.432 ms
    + 3  * * *
    + 4  * * *
    + 5  xe-1-2-0.mpr1.fra4.de.above.net (80.81.194.26)  39.952 ms  40.155 ms  40.139 ms
    + 6  ae12.cs1.fra6.de.eth.zayo.com (64.125.26.172)  128.014 ms * *
    + 7  * * *
    + 8  * * *
    + 9  ae10.cs1.lhr15.uk.eth.zayo.com (64.125.29.17)  120.625 ms  121.117 ms  121.050 ms
    +10  * * *
    +11  * * *
    +12  * * *
    +13  ae5.mpr1.tor3.ca.zip.zayo.com (64.125.23.118)  192.605 ms  205.741 ms  203.607 ms
    +14  64.124.217.237.IDIA-265104-ZYO.zip.zayo.com (64.124.217.237)  204.673 ms  134.674 ms  131.442 ms
    +15  * * *
    +16  67.223.96.90 (67.223.96.90)  128.245 ms  127.844 ms  127.843 ms
    +17  bad.horse (162.252.205.130)  128.194 ms  122.854 ms  121.786 ms
    +18  bad.horse (162.252.205.131)  128.831 ms  128.341 ms  186.559 ms
    +19  bad.horse (162.252.205.132)  185.716 ms  180.121 ms  180.042 ms
    +20  bad.horse (162.252.205.133)  203.170 ms  203.076 ms  203.168 ms
    +21  he.rides.across.the.nation (162.252.205.134)  203.115 ms  141.830 ms  141.799 ms
    +22  the.thoroughbred.of.sin (162.252.205.135)  147.965 ms  148.230 ms  170.478 ms
    +23  he.got.the.application (162.252.205.136)  165.161 ms  164.939 ms  159.085 ms
    +24  that.you.just.sent.in (162.252.205.137)  162.310 ms  158.569 ms  158.896 ms
    +25  it.needs.evaluation (162.252.205.138)  162.927 ms  163.046 ms  163.085 ms
    +26  so.let.the.games.begin (162.252.205.139)  233.363 ms  233.545 ms  233.317 ms
    +27  a.heinous.crime (162.252.205.140)  237.745 ms  233.614 ms  233.740 ms
    +28  a.show.of.force (162.252.205.141)  237.974 ms  176.085 ms  175.927 ms
    +29  a.murder.would.be.nice.of.course (162.252.205.142)  181.838 ms  181.858 ms  182.059 ms
    +30  bad.horse (162.252.205.143)  187.731 ms  187.416 ms  187.532 ms
     

    2. ASCII cinema


    @@ -106,20 +109,20 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #include <stdio.h>
    +
    #include <stdio.h>
     
    -int main(void) {
    -  int array[5] = { 1, 2, 3, 4, 5 };
    +int main(void) {
    +  int array[5] = { 1, 2, 3, 4, 5 };
     
    -  for (int i = 0; i < 5; i++)
    -    printf("%d\n", array[i]);
    +  for (int i = 0; i < 5; i++)
    +    printf("%d\n", array[i]);
     
    -  for (int i = 0; i < 5; i++)
    -    printf("%d\n", i[array]);
    +  for (int i = 0; i < 5; i++)
    +    printf("%d\n", i[array]);
     
    -  for (int i = 0; i < 5; i++)
    -    printf("%d\n", *(i + array));
    -}
    +  for (int i = 0; i < 5; i++)
    +    printf("%d\n", *(i + array));
    +}
     

    5. Variables with prefix $


    @@ -130,20 +133,20 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #include <stdio.h>
    +
    #include <stdio.h>
     
    -int main(void) {
    -  int $array[5] = { 1, 2, 3, 4, 5 };
    +int main(void) {
    +  int $array[5] = { 1, 2, 3, 4, 5 };
     
    -  for (int $i = 0; $i < 5; $i++)
    -    printf("%d\n", $array[$i]);
    +  for (int $i = 0; $i < 5; $i++)
    +    printf("%d\n", $array[$i]);
     
    -  for (int $i = 0; $i < 5; $i++)
    -    printf("%d\n", $i[$array]);
    +  for (int $i = 0; $i < 5; $i++)
    +    printf("%d\n", $i[$array]);
     
    -  for (int $i = 0; $i < 5; $i++)
    -    printf("%d\n", *($i + $array));
    -}
    +  for (int $i = 0; $i < 5; $i++)
    +    printf("%d\n", *($i + $array));
    +}
     

    6. Object oriented shell scripts using ksh


    @@ -154,40 +157,40 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/ksh93
    - 
    -typeset -T Point_t=(
    -    integer -h 'x coordinate' x=0
    -    integer -h 'y coordinate' y=0
    -    typeset -h 'point color'  color="red"
    +
    #!/usr/bin/ksh93
    + 
    +typeset -T Point_t=(
    +    integer -h 'x coordinate' x=0
    +    integer -h 'y coordinate' y=0
    +    typeset -h 'point color'  color="red"
     
    -    function getcolor {
    -        print -r ${_.color}
    -    }
    +    function getcolor {
    +        print -r ${_.color}
    +    }
     
    -    function setcolor {
    -        _.color=$1
    -    }
    +    function setcolor {
    +        _.color=$1
    +    }
     
    -    setxy() {
    -        _.x=$1; _.y=$2
    -    }
    +    setxy() {
    +        _.x=$1; _.y=$2
    +    }
     
    -    getxy() {
    -        print -r "(${_.x},${_.y})"
    -    }
    -)
    - 
    -Point_t point
    - 
    -echo "Initial coordinates are (${point.x},${point.y}). Color is ${point.color}"
    - 
    -point.setxy 5 6
    -point.setcolor blue
    - 
    -echo "New coordinates are ${point.getxy}. Color is ${point.getcolor}"
    - 
    -exit 0
    +    getxy() {
    +        print -r "(${_.x},${_.y})"
    +    }
    +)
    + 
    +Point_t point
    + 
    +echo "Initial coordinates are (${point.x},${point.y}). Color is ${point.color}"
    + 
    +point.setxy 5 6
    +point.setcolor blue
    + 
    +echo "New coordinates are ${point.getxy}. Color is ${point.getcolor}"
    + 
    +exit 0
     

    Using types to create object oriented Korn shell 93 scripts
    @@ -200,18 +203,18 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    package main
    +
    package main
     
    -import "fmt"
    +import "fmt"
     
    -func main() {
    -	var i int
    -	f := func() *int {
    -		return &i
    -	}
    -	*f()++
    -	fmt.Println(i)
    -}
    +func main() {
    +	var i int
    +	f := func() *int {
    +		return &i
    +	}
    +	*f()++
    +	fmt.Println(i)
    +}
     

    Go playground
    @@ -373,7 +376,7 @@ r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\
    Back to the main site
    diff --git a/gemfeed/2024-07-07-the-stoic-challenge-book-notes.html b/gemfeed/2024-07-07-the-stoic-challenge-book-notes.html index 1853b829..4e3c510e 100644 --- a/gemfeed/2024-07-07-the-stoic-challenge-book-notes.html +++ b/gemfeed/2024-07-07-the-stoic-challenge-book-notes.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    "The Stoic Challenge" book notes



    Published at 2024-07-07T12:46:55+03:00
    @@ -30,11 +33,11 @@

    -

    Got sets you up for a challenge


    +

    God sets you up for a challenge



    Gods set you up for a challenge to see how resilient you are. Is getting angry worth the price? If you stay calm then you can find the optimal workaround for the obstacle. Stay calm even with big setbacks. Practice minimalism of negative emotions.

    @@ -81,7 +84,7 @@
    Back to the main site
    diff --git a/gemfeed/2024-08-05-typing-127.1-words-per-minute.html b/gemfeed/2024-08-05-typing-127.1-words-per-minute.html index f33bf6c3..65e36711 100644 --- a/gemfeed/2024-08-05-typing-127.1-words-per-minute.html +++ b/gemfeed/2024-08-05-typing-127.1-words-per-minute.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Typing 127.1 words per minute (>100wpm average)



    Published at 2024-08-05T17:39:30+03:00
    @@ -243,7 +246,7 @@
    Back to the main site
    diff --git a/gemfeed/2024-09-07-projects-i-support.html b/gemfeed/2024-09-07-projects-i-support.html index ffd77a9d..9debc622 100644 --- a/gemfeed/2024-09-07-projects-i-support.html +++ b/gemfeed/2024-09-07-projects-i-support.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Projects I financially support



    Published at 2024-09-07T16:04:19+03:00
    @@ -116,7 +119,7 @@
    Back to the main site
    diff --git a/gemfeed/2024-09-07-site-reliability-engineering-part-4.html b/gemfeed/2024-09-07-site-reliability-engineering-part-4.html index e4c749a5..aa29420e 100644 --- a/gemfeed/2024-09-07-site-reliability-engineering-part-4.html +++ b/gemfeed/2024-09-07-site-reliability-engineering-part-4.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers



    Published at 2024-09-07T16:27:58+03:00
    @@ -82,7 +85,7 @@ jgs \\`_..---.Y.---.._`//
    Back to the main site
    diff --git a/gemfeed/2024-10-02-gemtexter-3.0.0-lets-gemtext-again-4.html b/gemfeed/2024-10-02-gemtexter-3.0.0-lets-gemtext-again-4.html index f317b466..f40018ba 100644 --- a/gemfeed/2024-10-02-gemtexter-3.0.0-lets-gemtext-again-4.html +++ b/gemfeed/2024-10-02-gemtexter-3.0.0-lets-gemtext-again-4.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Gemtexter 3.0.0 - Let's Gemtext again⁴



    Published at 2024-10-01T21:46:26+03:00
    @@ -73,7 +76,7 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    declare -xr HTML_THEME_DIR=./extras/html/themes/simple
    +
    declare -xr HTML_THEME_DIR=./extras/html/themes/simple
     

    To customize the theme or create your own, simply copy the theme directory and modify it as needed. This makes it also much easier to switch between layouts.
    @@ -99,7 +102,7 @@ http://www.gnu.org/software/src-highlite -->
    Back to the main site
    diff --git a/gemfeed/2024-10-24-staff-engineer-book-notes.html b/gemfeed/2024-10-24-staff-engineer-book-notes.html index f8758090..b17bd25a 100644 --- a/gemfeed/2024-10-24-staff-engineer-book-notes.html +++ b/gemfeed/2024-10-24-staff-engineer-book-notes.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    "Staff Engineer" book notes



    Published at 2024-10-24T20:57:44+03:00
    @@ -146,7 +149,7 @@
    Back to the main site
    diff --git a/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html b/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html index 83d1c489..3620410f 100644 --- a/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html +++ b/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    f3s: Kubernetes with FreeBSD - Part 1: Setting the stage



    Published at 2024-11-16T23:20:14+02:00
    @@ -183,7 +186,7 @@
    Back to the main site
    diff --git a/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html b/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html index 8b5f1979..6ea80fc3 100644 --- a/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html +++ b/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation



    Published at 2024-12-02T23:48:21+02:00
    @@ -117,9 +120,9 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    [paul@earth]~/Downloads% sudo dd \
    -  if=FreeBSD-14.1-RELEASE-amd64-bootonly.iso \
    -  of=/dev/sda conv=sync
    +
    [paul@earth]~/Downloads% sudo dd \
    +  if=FreeBSD-14.1-RELEASE-amd64-bootonly.iso \
    +  of=/dev/sda conv=sync
     

    Next, I plugged the Beelinks (one after another) into my monitor via HDMI (the resolution of the FreeBSD text console seems strangely stretched, as I am using the LG Dual Up monitor), connected Ethernet, an external USB keyboard, and the FreeBSD USB stick, and booted the devices up. With F7, I entered the boot menu and selected the USB stick for the FreeBSD installation.
    @@ -145,9 +148,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # freebsd-update fetch
    -root@f0:~ # freebsd-update install
    -root@f0:~ # freebsd-update reboot
    +
    root@f0:~ # freebsd-update fetch
    +root@f0:~ # freebsd-update install
    +root@f0:~ # freebsd-update reboot
     

    I also added the following entries for the three FreeBSD boxes to the /etc/hosts file:
    @@ -155,11 +158,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # cat <<END >>/etc/hosts
    -192.168.1.130 f0 f0.lan f0.lan.buetow.org
    -192.168.1.131 f1 f1.lan f1.lan.buetow.org
    -192.168.1.132 f2 f2.lan f2.lan.buetow.org
    -END
    +
    root@f0:~ # cat <<END >>/etc/hosts
    +192.168.1.130 f0 f0.lan f0.lan.buetow.org
    +192.168.1.131 f1 f1.lan f1.lan.buetow.org
    +192.168.1.132 f2 f2.lan f2.lan.buetow.org
    +END
     

    After install


    @@ -170,7 +173,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # pkg install helix doas zfs-periodic uptimed
    +
    root@f0:~ # pkg install helix doas zfs-periodic uptimed
     

    Helix editor


    @@ -187,7 +190,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # cp /usr/local/etc/doas.conf.sample /usr/local/etc/doas.conf
    +
    root@f0:~ # cp /usr/local/etc/doas.conf.sample /usr/local/etc/doas.conf
     

    https://man.openbsd.org/doas
    @@ -200,24 +203,24 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # sysrc daily_zfs_snapshot_enable=YES
    -daily_zfs_snapshot_enable:  -> YES
    -root@f0:~ # sysrc daily_zfs_snapshot_pools=zroot
    -daily_zfs_snapshot_pools:  -> zroot
    -root@f0:~ # sysrc daily_zfs_snapshot_keep=7
    -daily_zfs_snapshot_keep:  -> 7
    -root@f0:~ # sysrc weekly_zfs_snapshot_enable=YES
    -weekly_zfs_snapshot_enable:  -> YES
    -root@f0:~ # sysrc weekly_zfs_snapshot_pools=zroot
    -weekly_zfs_snapshot_pools:  -> zroot
    -root@f0:~ # sysrc weekly_zfs_snapshot_keep=5
    -weekly_zfs_snapshot_keep:  -> 5
    -root@f0:~ # sysrc monthly_zfs_snapshot_enable=YES
    -monthly_zfs_snapshot_enable:  -> YES
    -root@f0:~ # sysrc monthly_zfs_snapshot_pools=zroot
    -monthly_zfs_snapshot_pools:  -> zroot
    -root@f0:~ # sysrc monthly_zfs_snapshot_keep=6
    -monthly_zfs_snapshot_keep: 2 -> 6
    +
    root@f0:~ # sysrc daily_zfs_snapshot_enable=YES
    +daily_zfs_snapshot_enable:  -> YES
    +root@f0:~ # sysrc daily_zfs_snapshot_pools=zroot
    +daily_zfs_snapshot_pools:  -> zroot
    +root@f0:~ # sysrc daily_zfs_snapshot_keep=7
    +daily_zfs_snapshot_keep:  -> 7
    +root@f0:~ # sysrc weekly_zfs_snapshot_enable=YES
    +weekly_zfs_snapshot_enable:  -> YES
    +root@f0:~ # sysrc weekly_zfs_snapshot_pools=zroot
    +weekly_zfs_snapshot_pools:  -> zroot
    +root@f0:~ # sysrc weekly_zfs_snapshot_keep=5
    +weekly_zfs_snapshot_keep:  -> 5
    +root@f0:~ # sysrc monthly_zfs_snapshot_enable=YES
    +monthly_zfs_snapshot_enable:  -> YES
    +root@f0:~ # sysrc monthly_zfs_snapshot_pools=zroot
    +monthly_zfs_snapshot_pools:  -> zroot
    +root@f0:~ # sysrc monthly_zfs_snapshot_keep=6
    +monthly_zfs_snapshot_keep: 2 -> 6
     

    https://github.com/ross/zfs-periodic
    @@ -230,9 +233,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # cp /usr/local/mimecast/etc/uptimed.conf-dist \
    -  /usr/local/mimecast/etc/uptimed.conf 
    -root@f0:~ # hx /usr/local/mimecast/etc/uptimed.conf
    +
    root@f0:~ # cp /usr/local/mimecast/etc/uptimed.conf-dist \
    +  /usr/local/mimecast/etc/uptimed.conf 
    +root@f0:~ # hx /usr/local/mimecast/etc/uptimed.conf
     

    In the Helix editor session, I changed LOG_MAXIMUM_ENTRIES to 0 to keep all uptime entries forever and not cut off at 50 (the default config). After that, I enabled and started uptimed:
    @@ -241,8 +244,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # service uptimed enable
    -root@f0:~ # service uptimed start
    +
    root@f0:~ # service uptimed enable
    +root@f0:~ # service uptimed start
     

    To check the current uptime stats, I can now run uprecords:
    @@ -251,15 +254,15 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
     root@f0:~ # uprecords
    -     #               Uptime | System                                     Boot up
    -----------------------------+---------------------------------------------------
    -->   1     0 days, 00:07:34 | FreeBSD 14.1-RELEASE      Mon Dec  2 12:21:44 2024
    -----------------------------+---------------------------------------------------
    -NewRec     0 days, 00:07:33 | since                     Mon Dec  2 12:21:44 2024
    -    up     0 days, 00:07:34 | since                     Mon Dec  2 12:21:44 2024
    -  down     0 days, 00:00:00 | since                     Mon Dec  2 12:21:44 2024
    -   %up              100.000 | since                     Mon Dec  2 12:21:44 2024
    +
     root@f0:~ # uprecords
    +     #               Uptime | System                                     Boot up
    +----------------------------+---------------------------------------------------
    +->   1     0 days, 00:07:34 | FreeBSD 14.1-RELEASE      Mon Dec  2 12:21:44 2024
    +----------------------------+---------------------------------------------------
    +NewRec     0 days, 00:07:33 | since                     Mon Dec  2 12:21:44 2024
    +    up     0 days, 00:07:34 | since                     Mon Dec  2 12:21:44 2024
    +  down     0 days, 00:00:00 | since                     Mon Dec  2 12:21:44 2024
    +   %up              100.000 | since                     Mon Dec  2 12:21:44 2024
     

    This is how I track the uptimes for all of my host:
    @@ -277,17 +280,17 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    paul@f0:~ % ifconfig re0
    -re0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    -        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    -        ether e8:ff:1e:d7:1c:ac
    -        inet 192.168.1.130 netmask 0xffffff00 broadcast 192.168.1.255
    -        inet6 fe80::eaff:1eff:fed7:1cac%re0 prefixlen 64 scopeid 0x1
    -        inet6 fd22:c702:acb7:0:eaff:1eff:fed7:1cac prefixlen 64 detached autoconf
    -        inet6 2a01:5a8:304:1d5c:eaff:1eff:fed7:1cac prefixlen 64 autoconf pltime 10800 vltime 14400
    -        media: Ethernet autoselect (1000baseT <full-duplex>)
    -        status: active
    -        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
    +
    paul@f0:~ % ifconfig re0
    +re0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    +        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    +        ether e8:ff:1e:d7:1c:ac
    +        inet 192.168.1.130 netmask 0xffffff00 broadcast 192.168.1.255
    +        inet6 fe80::eaff:1eff:fed7:1cac%re0 prefixlen 64 scopeid 0x1
    +        inet6 fd22:c702:acb7:0:eaff:1eff:fed7:1cac prefixlen 64 detached autoconf
    +        inet6 2a01:5a8:304:1d5c:eaff:1eff:fed7:1cac prefixlen 64 autoconf pltime 10800 vltime 14400
    +        media: Ethernet autoselect (1000baseT <full-duplex>)
    +        status: active
    +        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
     

    RAM


    @@ -298,8 +301,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    paul@f0:~ % sysctl hw.physmem
    -hw.physmem: 16902905856
    +
    paul@f0:~ % sysctl hw.physmem
    +hw.physmem: 16902905856
     
     

    @@ -311,11 +314,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    paul@f0:~ % sysctl dev.cpu | grep freq:
    -dev.cpu.3.freq: 705
    -dev.cpu.2.freq: 705
    -dev.cpu.1.freq: 604
    -dev.cpu.0.freq: 604
    +
    paul@f0:~ % sysctl dev.cpu | grep freq:
    +dev.cpu.3.freq: 705
    +dev.cpu.2.freq: 705
    +dev.cpu.1.freq: 604
    +dev.cpu.0.freq: 604
     

    CPU throttling


    @@ -326,14 +329,14 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    paul@f0:~ % doas pkg install ubench
    -paul@f0:~ % rehash # For tcsh to find the newly installed command
    -paul@f0:~ % ubench &
    -paul@f0:~ % sysctl dev.cpu | grep freq:
    -dev.cpu.3.freq: 2922
    -dev.cpu.2.freq: 2922
    -dev.cpu.1.freq: 2923
    -dev.cpu.0.freq: 2922
    +
    paul@f0:~ % doas pkg install ubench
    +paul@f0:~ % rehash # For tcsh to find the newly installed command
    +paul@f0:~ % ubench &
    +paul@f0:~ % sysctl dev.cpu | grep freq:
    +dev.cpu.3.freq: 2922
    +dev.cpu.2.freq: 2922
    +dev.cpu.1.freq: 2923
    +dev.cpu.0.freq: 2922
     

    Idle, all three Beelinks plus the switch consumed 26.2W. But with ubench stressing all the CPUs, it went up to 38.8W.
    @@ -364,7 +367,7 @@ http://www.gnu.org/software/src-highlite -->
    Back to the main site
    diff --git a/gemfeed/2024-12-15-random-helix-themes.html b/gemfeed/2024-12-15-random-helix-themes.html index 21d15604..6c97bfe6 100644 --- a/gemfeed/2024-12-15-random-helix-themes.html +++ b/gemfeed/2024-12-15-random-helix-themes.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    Random Helix Themes



    Published at 2024-12-15T13:55:05+02:00; Last updated 2024-12-18
    @@ -22,33 +25,33 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    export EDITOR=hx
    -export VISUAL=$EDITOR
    -export GIT_EDITOR=$EDITOR
    -export HELIX_CONFIG_DIR=$HOME/.config/helix
    +
    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
    +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)"
    +    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
    -}
    +    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
    +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.
    @@ -57,16 +60,16 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    [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] ~ %
    +
    [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


    @@ -77,40 +80,40 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    export EDITOR=hx
    -export VISUAL=$EDITOR
    -export GIT_EDITOR=$EDITOR
    -export HELIX_CONFIG_DIR=$HOME/.config/helix
    +
    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::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
    +editor::helix::theme::set () {
    +    local -r theme="$1"; shift
     
    -    local -r config_file=$HELIX_CONFIG_DIR/config.toml
    +    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
    -}
    +    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
    +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 :-)

    Back to the main site
    diff --git a/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-hardware-setup.html b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-hardware-setup.html index d3fd396a..220c617e 100644 --- a/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-hardware-setup.html +++ b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-hardware-setup.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    f3s: Kubernetes with FreeBSD - Setting the stage - Part 1



    Published at 2024-11-16T23:20:14+02:00
    @@ -52,7 +55,7 @@
    Back to the main site
    diff --git a/gemfeed/DRAFT-site-reliability-engineering.html b/gemfeed/DRAFT-site-reliability-engineering.html index 5447a3a2..94f8b742 100644 --- a/gemfeed/DRAFT-site-reliability-engineering.html +++ b/gemfeed/DRAFT-site-reliability-engineering.html @@ -8,6 +8,9 @@ +

    +View this page as Markdown | Gemtext +

    System Design and Incident Analysis: Building Resilience in the SRE Landscape



    A significant portion of the work revolves around system design and incident analysis.
    @@ -162,7 +165,7 @@
    Back to the main site
    diff --git a/gemfeed/DRAFT-summary-for-202410-202411-202410.html b/gemfeed/DRAFT-summary-for-202410-202411-202410.html new file mode 100644 index 00000000..33ccdc6c --- /dev/null +++ b/gemfeed/DRAFT-summary-for-202410-202411-202410.html @@ -0,0 +1,332 @@ + + + + +Summary for 202410 202411 202412 + + + + + +

    +View this page as Markdown | Gemtext +

    +

    Summary for 202410 202411 202412


    +
    +

    Table of Contents


    +
    +
    +

    October 2024


    +
    +

    First on-call experience in a startup. Doesn't ...


    +
    +First on-call experience in a startup. Doesn't sound a lot of fun! But the lessons were learned! #sre
    +
    +https://ntietz.com/blog/lessons-from-my-first-on-call/
    +
    +

    Reviewing your own PR or MR before asking ...


    +
    +Reviewing your own PR or MR before asking others to review it makes a lot of sense. Have seen so many silly mistakes which would have been avoided. Saving time for the real reviewer.
    +
    +https://www.jvt.me/posts/2019/01/12/self-code-review/
    +
    +

    Fun with defer in #golang, I did't know, that ...


    +
    +Fun with defer in #golang, I did't know, that a defer object can either be heap or stack allocated. And there are some rules for inlining, too.
    +
    +https://victoriametrics.com/blog/defer-in-go/
    +
    +

    I have been in incidents. Understandably, ...


    +
    +I have been in incidents. Understandably, everyone wants the issue to be resolved as quickly and others want to know how long TTR will be. IMHO, providing no estimates at all is no solution either. So maybe give a rough estimate but clearly communicate that the estimate is rough and that X, Y, and Z can interfere, meaning there is a chance it will take longer to resolve the incident. Just my thought. What's yours?
    +
    +https://firehydrant.com/blog/hot-...de-incident-resolution-estimates/
    +
    +

    Little tips using strings in #golang and I ...


    +
    +Little tips using strings in #golang and I personally think one must look more into the std lib (not just for strings, also for slices, maps,...), there are tons of useful helper functions.
    +
    +https://www.calhoun.io/6-tips-for-using-strings-in-go/
    +
    +

    Reading this post about #rust (especially the ...


    +
    +Reading this post about #rust (especially the first part), I think I made a good choice in deciding to dive into #golang instead. There was a point where I wanted to learn a new programming language, and Rust was on my list of choices. I think the Go project does a much better job of deciding what goes into the language and how. What are your thoughts?
    +
    +https://josephg.com/blog/rewriting-rust/
    +
    +

    The opposite of #ChaosMonkey ... ...


    +
    +The opposite of #ChaosMonkey ... automatically repairing and healing services helping to reduce manual toil work. Runbooks and scripts are only the first step, followed by a fully blown service written in Go. Could be useful, but IMHO why not rather address the root causes of the manual toil work? #sre
    +
    +https://blog.cloudflare.com/nl-nl...latform-resilience-at-cloudflare/
    +
    +

    November 2024


    +
    +

    I just became a Silver Patreon for OSnews. What ...


    +
    +I just became a Silver Patreon for OSnews. What is OSnews? It is an independent news site about IT. It is slightly independent and, at times, alternative. I have enjoyed it since my early student days. This one and other projects I financially support are listed here:
    +
    +https://foo.zone/gemfeed/2024-09-07-projects-i-support.html
    +
    +

    Until now, I wasn't aware, that Go is under a ...


    +
    +Until now, I wasn't aware, that Go is under a BSD-style license (3-clause as it seems). Neat. I don't know why, but I always was under the impression it would be MIT. #bsd #golang
    +
    +https://go.dev/LICENSE
    +
    +

    These are some book notes from "Staff Engineer" ...


    +
    +These are some book notes from "Staff Engineer" – there is some really good insight into what is expected from a Staff Engineer and beyond in the industry. I wish I had read the book earlier.
    +
    +https://foo.zone/gemfeed/2024-10-24-staff-engineer-book-notes.html
    +
    +

    Looking at #Kubernetes, it's pretty much ...


    +
    +Looking at #Kubernetes, it's pretty much following the Unix way of doing things. It has many tools, but each tool has its own single purpose: DNS, scheduling, container runtime, various controllers, networking, observability, alerting, and more services in the control plane. Everything is managed by different services or plugins, mostly running in their dedicated pods. They don't communicate through pipes, but network sockets, though. #k8s
    +
    +

    There has been an outage at the upstream ...


    +
    +There has been an outage at the upstream network provider for OpenBSD.Amsterdam (hoster, I am using). This was the first real-world test for my KISS HA setup, and it worked flawlessly! All my sites and services failed over automatically to my other #OpenBSD VM!
    +
    +https://foo.zone/gemfeed/2024-04-...gh-availability-with-OpenBSD.html
    +https://openbsd.amsterdam/
    +
    +

    One of the more confusing parts in Go, nil ...


    +
    +One of the more confusing parts in Go, nil values vs nil errors: #golang
    +
    +https://unexpected-go.com/nil-errors-that-are-non-nil-errors.html
    +
    +

    Agreeably, writing down with Diagrams helps you ...


    +
    +Agreeably, writing down with Diagrams helps you to think things more through. And keeps others on the same page. Only worth for projects from a certain size, IMHO.
    +
    +https://ntietz.com/blog/reasons-to-write-design-docs/
    +
    +

    I like the idea of types in Ruby. Raku is ...


    +
    +I like the idea of types in Ruby. Raku is supports that already, but in Ruby, you must specify the types in a separate .rbs file, which is, in my opinion, cumbersome and is a reason not to use it extensively for now. I believe there are efforts to embed the type information in the standard .rb files, and that the .rbs is just an experiment to see how types could work out without introducing changes into the core Ruby language itself right now? #Ruby #RakuLang
    +
    +https://github.com/ruby/rbs
    +
    +

    So, #Haskell is better suited for general ...


    +
    +So, #Haskell is better suited for general purpose than #Rust? I thought deploying something in Haskell means publishing an academic paper :-) Interesting rant about Rust, though:
    +
    +https://chrisdone.com/posts/rust/
    +
    +

    At first, functional options add a bit of ...


    +
    +At first, functional options add a bit of boilerplate, but they turn out to be quite neat, especially when you have very long parameter lists that need to be made neat and tidy. #golang
    +
    +https://www.calhoun.io/using-func...instead-of-method-chaining-in-go/
    +
    +

    Revamping my home lab a little bit. #freebsd ...


    +
    +Revamping my home lab a little bit. #freebsd #bhyve #rocky #linux #vm #k3s #kuberbetes #wireguard #zfs #nfs #ha #relayd #k8s #selfhosting #self-hosting #homelab #home-lab
    +
    +https://foo.zone/gemfeed/2024-11-...bernetes-with-freebsd-part-1.html
    +
    +

    Revamping my home lab a little bit. #freebsd ...


    +
    +Revamping my home lab a little bit. #freebsd #bhyve #rocky #linux #vm #k3s #kubernetes #wireguard #zfs #nfs #ha #relayd #k8s #selfhosting #homelab
    +
    +https://foo.zone/gemfeed/2024-11-...bernetes-with-freebsd-part-1.html
    +
    +

    Wondering to which #web #browser I should ...


    +
    +Wondering to which #web #browser I should switch now personally ...
    +
    +https://www.osnews.com/story/1411...cy-for-open-web-privacy-and-more/
    +
    +

    eks-node-viewer is a nifty tool, showing the ...


    +
    +eks-node-viewer is a nifty tool, showing the compute nodes currently in use in the #EKS cluster. especially useful when dynamically allocating nodes with #karpenter or auto scaling groups.
    +
    +https://github.com/awslabs/eks-node-viewer
    +
    +

    Have put more Photos on - On my static photo ...


    +
    +Have put more Photos on - On my static photo sites - Generated with a #bash script
    +
    +https://irregular.ninja
    +
    +

    In Go, passing pointers are not automatically ...


    +
    +In Go, passing pointers are not automatically faster than values. Pointers often force the memory to be allocated on the heap, adding GC overhad. With values, Go can determine whether to put the memory on the stack instead. But with large structs/objects (how you want to call them) or if you want to modify state, then pointers are the semantic to use. #golang
    +
    +https://blog.boot.dev/golang/pointers-faster-than-values/
    +
    +

    Myself being part of an on-call rotations over ...


    +
    +Myself being part of an on-call rotations over my whole professional life, just have learned this lesson "Tell people who are new to on-call: Just have fun" :-) This is a neat blog post to read:
    +
    +https://ntietz.com/blog/what-i-tell-people-new-to-oncall/
    +
    +

    Feels good to code in my old love #Perl again ...


    +
    +Feels good to code in my old love #Perl again after a while. I am implementing a log parser for generating site stats of my personal homepage! :-) @Perl
    +
    +

    This is an interactive summary of the Go ...


    +
    +This is an interactive summary of the Go release, with a lot of examples utilising iterators in the slices and map packages. Love it! #golang
    +
    +https://antonz.org/go-1-23/
    +
    +

    December 2024


    +
    +

    Thats unexpected, you cant remove a NaN key ...


    +
    +Thats unexpected, you cant remove a NaN key from a map without clearing it! #golang
    +
    +https://unexpected-go.com/you-can...om-a-map-without-clearing-it.html
    +
    +

    My second blog post about revamping my home lab ...


    +
    +My second blog post about revamping my home lab a little bit just hit the net. #FreeBSD #ZFS #n100 #k8s #k3s #kubernetes
    +
    +https://foo.zone/gemfeed/2024-12-...bernetes-with-freebsd-part-2.html
    +
    +

    Very insightful article about tech hiring in ...


    +
    +Very insightful article about tech hiring in the age of LLMs. As an interviewer, I have experienced some of the scrnarios already first hand...
    +
    +https://newsletter.pragmaticengin...m/p/how-genai-changes-tech-hiring
    +
    +

    for #bpf #ebpf performance debugging, have ...


    +
    +for #bpf #ebpf performance debugging, have a look at bpftop from Netflix. A neat tool showing you the estimated CPU time and other performance statistics for all the BPF programs currently loaded into the #linux kernel. Highly recommend!
    +
    +https://github.com/Netflix/bpftop
    +
    +

    89 things he/she knows about Git commits is a ...


    +
    +89 things he/she knows about Git commits is a neat list of #Git wisdoms
    +
    +https://www.jvt.me/posts/2024/07/12/things-know-commits/
    +
    +

    I found that working on multiple side projects ...


    +
    +I found that working on multiple side projects concurrently is better than concentrating on just one. This seems inefficient at first, but whenever you tend to lose motivation, you can temporarily switch to another one with full élan. However, remember to stop starting and start finishing. This doesn't mean you should be working on 10+ (and a growing list of) side projects concurrently! Select your projects and commit to finishing them before starting the next thing. For example, my current limit of concurrent side projects is around five.
    +
    +

    Agreed? Agreed. Besides #Ruby, I would also ...


    +
    +Agreed? Agreed. Besides #Ruby, I would also add #RakuLang and #Perl @Perl to the list of languages that are great for shell scripts - "Making Easy Things Easy and Hard Things Possible"
    +
    +https://lucasoshiro.github.io/posts-en/2024-06-17-ruby-shellscript/
    +
    +

    Plan9 assembly format in Go, but wait, it's not ...


    +
    +Plan9 assembly format in Go, but wait, it's not the Operating System Plan9! #golang #rabbithole
    +
    +https://www.osnews.com/story/1409...emo-speeding-up-calculations-450/
    +
    +

    This is a neat blog post about the Helix text ...


    +
    +This is a neat blog post about the Helix text editor, to which I personally switched around a year ago (from NeoVim). I should blog about my experience as well. To summarize: I am using it together with the terminal multiplexer #tmux. It doesn't bother me that Helix is purely terminal-based and therefore everything has to be in the same font. #HelixEditor
    +
    +https://jonathan-frere.com/posts/helix/
    +
    +

    This blog post is basically a rant against ...


    +
    +This blog post is basically a rant against DataDog... Personally, I don't have much experience with DataDog (actually, I have never used it), but one reason to work with logs at my day job (with over 2,000 physical server machines) and to be cost-effective is by using dtail! #dtail #logs #logmanagement
    +
    +https://crys.site/blog/2024/reinventint-the-weel/
    +https://dtail.dev
    +
    +

    Quick trick to get Helix themes selected ...


    +
    +Quick trick to get Helix themes selected randomly #HelixEditor
    +
    +https://foo.zone/gemfeed/2024-12-15-random-helix-themes.html
    +
    +

    Example where complexity attacks you from ...


    +
    +Example where complexity attacks you from behind #k8s #kubernetes #OpenAI
    +
    +https://surfingcomplexity.blog/20...-openai-public-incident-write-up/
    +
    +

    LLMs for Ops? Summaries of logs, probabilities ...


    +
    +LLMs for Ops? Summaries of logs, probabilities about correctness, auto-generating Ansible, some uses cases are there. Wouldn't trust it fully, though.
    +
    +https://youtu.be/WodaffxVq-E?si=noY0egrfl5izCSQI
    +
    +

    Excellent article about your dream Product ...


    +
    +Excellent article about your dream Product Manager: Why every software team needs a product manager to thrive via @wallabagapp
    +
    +https://testdouble.com/insights/w...elerate-improve-software-delivery
    +
    +

    I just finished reading all chapters of CPU ...


    +
    +I just finished reading all chapters of CPU land: ... not claiming to remember every detail, but it is a great refresher how CPUs and operating systems actually work under the hood when you execute a program, which we tend to forget in our higher abstraction world. I liked the "story" and some of the jokes along the way! Size wise, it is pretty digestable (not talking about books, but only 7 web articles/chapters)! #cpu #linux #unix #kernel #macOS
    +
    +https://cpu.land/
    +
    +

    Indeed, useful to know this stuff! #sre ...


    +
    +Indeed, useful to know this stuff! #sre
    +
    +https://biriukov.dev/docs/resolve...vers-and-dual-stack-applications/
    +
    +

    It's the small things, which make Unix like ...


    +
    +It's the small things, which make Unix like systems, like GNU/Linux, interesting. Didn't know about this #GNU #Tar behaviour yet:
    +
    +https://xeiaso.net/notes/2024/pop-quiz-tar/15110
    + + + diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 05bc3df2..ea39a1f6 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,6 +1,6 @@ - 2024-12-18T23:28:38+02:00 + 2024-12-29T23:48:55+02:00 foo.zone feed To be in the .zone! @@ -243,9 +243,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    [paul@earth]~/Downloads% sudo dd \
    -  if=FreeBSD-14.1-RELEASE-amd64-bootonly.iso \
    -  of=/dev/sda conv=sync
    +
    [paul@earth]~/Downloads% sudo dd \
    +  if=FreeBSD-14.1-RELEASE-amd64-bootonly.iso \
    +  of=/dev/sda conv=sync
     

    Next, I plugged the Beelinks (one after another) into my monitor via HDMI (the resolution of the FreeBSD text console seems strangely stretched, as I am using the LG Dual Up monitor), connected Ethernet, an external USB keyboard, and the FreeBSD USB stick, and booted the devices up. With F7, I entered the boot menu and selected the USB stick for the FreeBSD installation.
    @@ -271,9 +271,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # freebsd-update fetch
    -root@f0:~ # freebsd-update install
    -root@f0:~ # freebsd-update reboot
    +
    root@f0:~ # freebsd-update fetch
    +root@f0:~ # freebsd-update install
    +root@f0:~ # freebsd-update reboot
     

    I also added the following entries for the three FreeBSD boxes to the /etc/hosts file:
    @@ -281,11 +281,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # cat <<END >>/etc/hosts
    -192.168.1.130 f0 f0.lan f0.lan.buetow.org
    -192.168.1.131 f1 f1.lan f1.lan.buetow.org
    -192.168.1.132 f2 f2.lan f2.lan.buetow.org
    -END
    +
    root@f0:~ # cat <<END >>/etc/hosts
    +192.168.1.130 f0 f0.lan f0.lan.buetow.org
    +192.168.1.131 f1 f1.lan f1.lan.buetow.org
    +192.168.1.132 f2 f2.lan f2.lan.buetow.org
    +END
     

    After install


    @@ -296,7 +296,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # pkg install helix doas zfs-periodic uptimed
    +
    root@f0:~ # pkg install helix doas zfs-periodic uptimed
     

    Helix editor


    @@ -313,7 +313,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # cp /usr/local/etc/doas.conf.sample /usr/local/etc/doas.conf
    +
    root@f0:~ # cp /usr/local/etc/doas.conf.sample /usr/local/etc/doas.conf
     

    https://man.openbsd.org/doas
    @@ -326,24 +326,24 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # sysrc daily_zfs_snapshot_enable=YES
    -daily_zfs_snapshot_enable:  -> YES
    -root@f0:~ # sysrc daily_zfs_snapshot_pools=zroot
    -daily_zfs_snapshot_pools:  -> zroot
    -root@f0:~ # sysrc daily_zfs_snapshot_keep=7
    -daily_zfs_snapshot_keep:  -> 7
    -root@f0:~ # sysrc weekly_zfs_snapshot_enable=YES
    -weekly_zfs_snapshot_enable:  -> YES
    -root@f0:~ # sysrc weekly_zfs_snapshot_pools=zroot
    -weekly_zfs_snapshot_pools:  -> zroot
    -root@f0:~ # sysrc weekly_zfs_snapshot_keep=5
    -weekly_zfs_snapshot_keep:  -> 5
    -root@f0:~ # sysrc monthly_zfs_snapshot_enable=YES
    -monthly_zfs_snapshot_enable:  -> YES
    -root@f0:~ # sysrc monthly_zfs_snapshot_pools=zroot
    -monthly_zfs_snapshot_pools:  -> zroot
    -root@f0:~ # sysrc monthly_zfs_snapshot_keep=6
    -monthly_zfs_snapshot_keep: 2 -> 6
    +
    root@f0:~ # sysrc daily_zfs_snapshot_enable=YES
    +daily_zfs_snapshot_enable:  -> YES
    +root@f0:~ # sysrc daily_zfs_snapshot_pools=zroot
    +daily_zfs_snapshot_pools:  -> zroot
    +root@f0:~ # sysrc daily_zfs_snapshot_keep=7
    +daily_zfs_snapshot_keep:  -> 7
    +root@f0:~ # sysrc weekly_zfs_snapshot_enable=YES
    +weekly_zfs_snapshot_enable:  -> YES
    +root@f0:~ # sysrc weekly_zfs_snapshot_pools=zroot
    +weekly_zfs_snapshot_pools:  -> zroot
    +root@f0:~ # sysrc weekly_zfs_snapshot_keep=5
    +weekly_zfs_snapshot_keep:  -> 5
    +root@f0:~ # sysrc monthly_zfs_snapshot_enable=YES
    +monthly_zfs_snapshot_enable:  -> YES
    +root@f0:~ # sysrc monthly_zfs_snapshot_pools=zroot
    +monthly_zfs_snapshot_pools:  -> zroot
    +root@f0:~ # sysrc monthly_zfs_snapshot_keep=6
    +monthly_zfs_snapshot_keep: 2 -> 6
     

    https://github.com/ross/zfs-periodic
    @@ -356,9 +356,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # cp /usr/local/mimecast/etc/uptimed.conf-dist \
    -  /usr/local/mimecast/etc/uptimed.conf 
    -root@f0:~ # hx /usr/local/mimecast/etc/uptimed.conf
    +
    root@f0:~ # cp /usr/local/mimecast/etc/uptimed.conf-dist \
    +  /usr/local/mimecast/etc/uptimed.conf 
    +root@f0:~ # hx /usr/local/mimecast/etc/uptimed.conf
     

    In the Helix editor session, I changed LOG_MAXIMUM_ENTRIES to 0 to keep all uptime entries forever and not cut off at 50 (the default config). After that, I enabled and started uptimed:
    @@ -367,8 +367,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    root@f0:~ # service uptimed enable
    -root@f0:~ # service uptimed start
    +
    root@f0:~ # service uptimed enable
    +root@f0:~ # service uptimed start
     

    To check the current uptime stats, I can now run uprecords:
    @@ -377,15 +377,15 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
     root@f0:~ # uprecords
    -     #               Uptime | System                                     Boot up
    -----------------------------+---------------------------------------------------
    -->   1     0 days, 00:07:34 | FreeBSD 14.1-RELEASE      Mon Dec  2 12:21:44 2024
    -----------------------------+---------------------------------------------------
    -NewRec     0 days, 00:07:33 | since                     Mon Dec  2 12:21:44 2024
    -    up     0 days, 00:07:34 | since                     Mon Dec  2 12:21:44 2024
    -  down     0 days, 00:00:00 | since                     Mon Dec  2 12:21:44 2024
    -   %up              100.000 | since                     Mon Dec  2 12:21:44 2024
    +
     root@f0:~ # uprecords
    +     #               Uptime | System                                     Boot up
    +----------------------------+---------------------------------------------------
    +->   1     0 days, 00:07:34 | FreeBSD 14.1-RELEASE      Mon Dec  2 12:21:44 2024
    +----------------------------+---------------------------------------------------
    +NewRec     0 days, 00:07:33 | since                     Mon Dec  2 12:21:44 2024
    +    up     0 days, 00:07:34 | since                     Mon Dec  2 12:21:44 2024
    +  down     0 days, 00:00:00 | since                     Mon Dec  2 12:21:44 2024
    +   %up              100.000 | since                     Mon Dec  2 12:21:44 2024
     

    This is how I track the uptimes for all of my host:
    @@ -403,17 +403,17 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    paul@f0:~ % ifconfig re0
    -re0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    -        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    -        ether e8:ff:1e:d7:1c:ac
    -        inet 192.168.1.130 netmask 0xffffff00 broadcast 192.168.1.255
    -        inet6 fe80::eaff:1eff:fed7:1cac%re0 prefixlen 64 scopeid 0x1
    -        inet6 fd22:c702:acb7:0:eaff:1eff:fed7:1cac prefixlen 64 detached autoconf
    -        inet6 2a01:5a8:304:1d5c:eaff:1eff:fed7:1cac prefixlen 64 autoconf pltime 10800 vltime 14400
    -        media: Ethernet autoselect (1000baseT <full-duplex>)
    -        status: active
    -        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
    +
    paul@f0:~ % ifconfig re0
    +re0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    +        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    +        ether e8:ff:1e:d7:1c:ac
    +        inet 192.168.1.130 netmask 0xffffff00 broadcast 192.168.1.255
    +        inet6 fe80::eaff:1eff:fed7:1cac%re0 prefixlen 64 scopeid 0x1
    +        inet6 fd22:c702:acb7:0:eaff:1eff:fed7:1cac prefixlen 64 detached autoconf
    +        inet6 2a01:5a8:304:1d5c:eaff:1eff:fed7:1cac prefixlen 64 autoconf pltime 10800 vltime 14400
    +        media: Ethernet autoselect (1000baseT <full-duplex>)
    +        status: active
    +        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
     

    RAM


    @@ -424,8 +424,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    paul@f0:~ % sysctl hw.physmem
    -hw.physmem: 16902905856
    +
    paul@f0:~ % sysctl hw.physmem
    +hw.physmem: 16902905856
     
     

    @@ -437,11 +437,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    paul@f0:~ % sysctl dev.cpu | grep freq:
    -dev.cpu.3.freq: 705
    -dev.cpu.2.freq: 705
    -dev.cpu.1.freq: 604
    -dev.cpu.0.freq: 604
    +
    paul@f0:~ % sysctl dev.cpu | grep freq:
    +dev.cpu.3.freq: 705
    +dev.cpu.2.freq: 705
    +dev.cpu.1.freq: 604
    +dev.cpu.0.freq: 604
     

    CPU throttling


    @@ -452,14 +452,14 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    paul@f0:~ % doas pkg install ubench
    -paul@f0:~ % rehash # For tcsh to find the newly installed command
    -paul@f0:~ % ubench &
    -paul@f0:~ % sysctl dev.cpu | grep freq:
    -dev.cpu.3.freq: 2922
    -dev.cpu.2.freq: 2922
    -dev.cpu.1.freq: 2923
    -dev.cpu.0.freq: 2922
    +
    paul@f0:~ % doas pkg install ubench
    +paul@f0:~ % rehash # For tcsh to find the newly installed command
    +paul@f0:~ % ubench &
    +paul@f0:~ % sysctl dev.cpu | grep freq:
    +dev.cpu.3.freq: 2922
    +dev.cpu.2.freq: 2922
    +dev.cpu.1.freq: 2923
    +dev.cpu.0.freq: 2922
     

    Idle, all three Beelinks plus the switch consumed 26.2W. But with ubench stressing all the CPUs, it went up to 38.8W.
    @@ -910,7 +910,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    declare -xr HTML_THEME_DIR=./extras/html/themes/simple
    +
    declare -xr HTML_THEME_DIR=./extras/html/themes/simple
     

    To customize the theme or create your own, simply copy the theme directory and modify it as needed. This makes it also much easier to switch between layouts.
    @@ -1431,11 +1431,11 @@ jgs \\`_..---.Y.---.._`//

    -

    Got sets you up for a challenge


    +

    God sets you up for a challenge



    Gods set you up for a challenge to see how resilient you are. Is getting angry worth the price? If you stay calm then you can find the optimal workaround for the obstacle. Stay calm even with big setbacks. Practice minimalism of negative emotions.

    @@ -1535,38 +1535,38 @@ WHOA!! ( o.o ) by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % traceroute bad.horse
    -traceroute to bad.horse (162.252.205.157), 30 hops max, 60 byte packets
    - 1  dsldevice.lan (192.168.1.1)  5.712 ms  5.800 ms  6.466 ms
    - 2  87-243-116-2.ip.btc-net.bg (87.243.116.2)  8.017 ms  7.506 ms  8.432 ms
    - 3  * * *
    - 4  * * *
    - 5  xe-1-2-0.mpr1.fra4.de.above.net (80.81.194.26)  39.952 ms  40.155 ms  40.139 ms
    - 6  ae12.cs1.fra6.de.eth.zayo.com (64.125.26.172)  128.014 ms * *
    - 7  * * *
    - 8  * * *
    - 9  ae10.cs1.lhr15.uk.eth.zayo.com (64.125.29.17)  120.625 ms  121.117 ms  121.050 ms
    -10  * * *
    -11  * * *
    -12  * * *
    -13  ae5.mpr1.tor3.ca.zip.zayo.com (64.125.23.118)  192.605 ms  205.741 ms  203.607 ms
    -14  64.124.217.237.IDIA-265104-ZYO.zip.zayo.com (64.124.217.237)  204.673 ms  134.674 ms  131.442 ms
    -15  * * *
    -16  67.223.96.90 (67.223.96.90)  128.245 ms  127.844 ms  127.843 ms
    -17  bad.horse (162.252.205.130)  128.194 ms  122.854 ms  121.786 ms
    -18  bad.horse (162.252.205.131)  128.831 ms  128.341 ms  186.559 ms
    -19  bad.horse (162.252.205.132)  185.716 ms  180.121 ms  180.042 ms
    -20  bad.horse (162.252.205.133)  203.170 ms  203.076 ms  203.168 ms
    -21  he.rides.across.the.nation (162.252.205.134)  203.115 ms  141.830 ms  141.799 ms
    -22  the.thoroughbred.of.sin (162.252.205.135)  147.965 ms  148.230 ms  170.478 ms
    -23  he.got.the.application (162.252.205.136)  165.161 ms  164.939 ms  159.085 ms
    -24  that.you.just.sent.in (162.252.205.137)  162.310 ms  158.569 ms  158.896 ms
    -25  it.needs.evaluation (162.252.205.138)  162.927 ms  163.046 ms  163.085 ms
    -26  so.let.the.games.begin (162.252.205.139)  233.363 ms  233.545 ms  233.317 ms
    -27  a.heinous.crime (162.252.205.140)  237.745 ms  233.614 ms  233.740 ms
    -28  a.show.of.force (162.252.205.141)  237.974 ms  176.085 ms  175.927 ms
    -29  a.murder.would.be.nice.of.course (162.252.205.142)  181.838 ms  181.858 ms  182.059 ms
    -30  bad.horse (162.252.205.143)  187.731 ms  187.416 ms  187.532 ms
    +
    % traceroute bad.horse
    +traceroute to bad.horse (162.252.205.157), 30 hops max, 60 byte packets
    + 1  dsldevice.lan (192.168.1.1)  5.712 ms  5.800 ms  6.466 ms
    + 2  87-243-116-2.ip.btc-net.bg (87.243.116.2)  8.017 ms  7.506 ms  8.432 ms
    + 3  * * *
    + 4  * * *
    + 5  xe-1-2-0.mpr1.fra4.de.above.net (80.81.194.26)  39.952 ms  40.155 ms  40.139 ms
    + 6  ae12.cs1.fra6.de.eth.zayo.com (64.125.26.172)  128.014 ms * *
    + 7  * * *
    + 8  * * *
    + 9  ae10.cs1.lhr15.uk.eth.zayo.com (64.125.29.17)  120.625 ms  121.117 ms  121.050 ms
    +10  * * *
    +11  * * *
    +12  * * *
    +13  ae5.mpr1.tor3.ca.zip.zayo.com (64.125.23.118)  192.605 ms  205.741 ms  203.607 ms
    +14  64.124.217.237.IDIA-265104-ZYO.zip.zayo.com (64.124.217.237)  204.673 ms  134.674 ms  131.442 ms
    +15  * * *
    +16  67.223.96.90 (67.223.96.90)  128.245 ms  127.844 ms  127.843 ms
    +17  bad.horse (162.252.205.130)  128.194 ms  122.854 ms  121.786 ms
    +18  bad.horse (162.252.205.131)  128.831 ms  128.341 ms  186.559 ms
    +19  bad.horse (162.252.205.132)  185.716 ms  180.121 ms  180.042 ms
    +20  bad.horse (162.252.205.133)  203.170 ms  203.076 ms  203.168 ms
    +21  he.rides.across.the.nation (162.252.205.134)  203.115 ms  141.830 ms  141.799 ms
    +22  the.thoroughbred.of.sin (162.252.205.135)  147.965 ms  148.230 ms  170.478 ms
    +23  he.got.the.application (162.252.205.136)  165.161 ms  164.939 ms  159.085 ms
    +24  that.you.just.sent.in (162.252.205.137)  162.310 ms  158.569 ms  158.896 ms
    +25  it.needs.evaluation (162.252.205.138)  162.927 ms  163.046 ms  163.085 ms
    +26  so.let.the.games.begin (162.252.205.139)  233.363 ms  233.545 ms  233.317 ms
    +27  a.heinous.crime (162.252.205.140)  237.745 ms  233.614 ms  233.740 ms
    +28  a.show.of.force (162.252.205.141)  237.974 ms  176.085 ms  175.927 ms
    +29  a.murder.would.be.nice.of.course (162.252.205.142)  181.838 ms  181.858 ms  182.059 ms
    +30  bad.horse (162.252.205.143)  187.731 ms  187.416 ms  187.532 ms
     

    2. ASCII cinema


    @@ -1594,20 +1594,20 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #include <stdio.h>
    +
    #include <stdio.h>
     
    -int main(void) {
    -  int array[5] = { 1, 2, 3, 4, 5 };
    +int main(void) {
    +  int array[5] = { 1, 2, 3, 4, 5 };
     
    -  for (int i = 0; i < 5; i++)
    -    printf("%d\n", array[i]);
    +  for (int i = 0; i < 5; i++)
    +    printf("%d\n", array[i]);
     
    -  for (int i = 0; i < 5; i++)
    -    printf("%d\n", i[array]);
    +  for (int i = 0; i < 5; i++)
    +    printf("%d\n", i[array]);
     
    -  for (int i = 0; i < 5; i++)
    -    printf("%d\n", *(i + array));
    -}
    +  for (int i = 0; i < 5; i++)
    +    printf("%d\n", *(i + array));
    +}
     

    5. Variables with prefix $


    @@ -1618,20 +1618,20 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #include <stdio.h>
    +
    #include <stdio.h>
     
    -int main(void) {
    -  int $array[5] = { 1, 2, 3, 4, 5 };
    +int main(void) {
    +  int $array[5] = { 1, 2, 3, 4, 5 };
     
    -  for (int $i = 0; $i < 5; $i++)
    -    printf("%d\n", $array[$i]);
    +  for (int $i = 0; $i < 5; $i++)
    +    printf("%d\n", $array[$i]);
     
    -  for (int $i = 0; $i < 5; $i++)
    -    printf("%d\n", $i[$array]);
    +  for (int $i = 0; $i < 5; $i++)
    +    printf("%d\n", $i[$array]);
     
    -  for (int $i = 0; $i < 5; $i++)
    -    printf("%d\n", *($i + $array));
    -}
    +  for (int $i = 0; $i < 5; $i++)
    +    printf("%d\n", *($i + $array));
    +}
     

    6. Object oriented shell scripts using ksh


    @@ -1642,40 +1642,40 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/ksh93
    - 
    -typeset -T Point_t=(
    -    integer -h 'x coordinate' x=0
    -    integer -h 'y coordinate' y=0
    -    typeset -h 'point color'  color="red"
    -
    -    function getcolor {
    -        print -r ${_.color}
    -    }
    -
    -    function setcolor {
    -        _.color=$1
    -    }
    -
    -    setxy() {
    -        _.x=$1; _.y=$2
    -    }
    -
    -    getxy() {
    -        print -r "(${_.x},${_.y})"
    -    }
    -)
    - 
    -Point_t point
    - 
    -echo "Initial coordinates are (${point.x},${point.y}). Color is ${point.color}"
    - 
    -point.setxy 5 6
    -point.setcolor blue
    - 
    -echo "New coordinates are ${point.getxy}. Color is ${point.getcolor}"
    - 
    -exit 0
    +
    #!/usr/bin/ksh93
    + 
    +typeset -T Point_t=(
    +    integer -h 'x coordinate' x=0
    +    integer -h 'y coordinate' y=0
    +    typeset -h 'point color'  color="red"
    +
    +    function getcolor {
    +        print -r ${_.color}
    +    }
    +
    +    function setcolor {
    +        _.color=$1
    +    }
    +
    +    setxy() {
    +        _.x=$1; _.y=$2
    +    }
    +
    +    getxy() {
    +        print -r "(${_.x},${_.y})"
    +    }
    +)
    + 
    +Point_t point
    + 
    +echo "Initial coordinates are (${point.x},${point.y}). Color is ${point.color}"
    + 
    +point.setxy 5 6
    +point.setcolor blue
    + 
    +echo "New coordinates are ${point.getxy}. Color is ${point.getcolor}"
    + 
    +exit 0
     

    Using types to create object oriented Korn shell 93 scripts
    @@ -1688,18 +1688,18 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    package main
    +
    package main
     
    -import "fmt"
    +import "fmt"
     
    -func main() {
    -	var i int
    -	f := func() *int {
    -		return &i
    -	}
    -	*f()++
    -	fmt.Println(i)
    -}
    +func main() {
    +	var i int
    +	f := func() *int {
    +		return &i
    +	}
    +	*f()++
    +	fmt.Println(i)
    +}
     

    Go playground
    @@ -1950,13 +1950,13 @@ jgs `-=========-`() by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    alias tm=tmux
    -alias tl='tmux list-sessions'
    -alias tn=tmux::new
    -alias ta=tmux::attach
    -alias tx=tmux::remote
    -alias ts=tmux::search
    -alias tssh=tmux::cluster_ssh
    +
    alias tm=tmux
    +alias tl='tmux list-sessions'
    +alias tn=tmux::new
    +alias ta=tmux::attach
    +alias tx=tmux::remote
    +alias ts=tmux::search
    +alias tssh=tmux::cluster_ssh
     

    Note all tmux::...; those are custom shell functions doing certain things, and they aren't part of the Tmux distribution. But let's run through every aliases one by one.
    @@ -1971,23 +1971,23 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    # Create new session and if alread exists attach to it
    -tmux::new () {
    -    readonly session=$1
    -    local date=date
    -    if where gdate &>/dev/null; then
    -        date=gdate
    -    fi
    -
    -    tmux::cleanup_default
    -    if [ -z "$session" ]; then
    -        tmux::new T$($date +%s)
    -    else
    -        tmux new-session -d -s $session
    -        tmux -2 attach-session -t $session || tmux -2 switch-client -t $session
    -    fi
    -}
    -alias tn=tmux::new
    +
    # Create new session and if alread exists attach to it
    +tmux::new () {
    +    readonly session=$1
    +    local date=date
    +    if where gdate &>/dev/null; then
    +        date=gdate
    +    fi
    +
    +    tmux::cleanup_default
    +    if [ -z "$session" ]; then
    +        tmux::new T$($date +%s)
    +    else
    +        tmux new-session -d -s $session
    +        tmux -2 attach-session -t $session || tmux -2 switch-client -t $session
    +    fi
    +}
    +alias tn=tmux::new
     

    There is a lot going on here. Let's have a detailed look at what it is doing. As a note, the function relies on GNU Date, so MacOS is looking for the gdate commands to be available. Otherwise, it will fall back to date. You need to install GNU Date for Mac, as it isn't installed by default there. As I use Fedora Linux on my personal Laptop and a MacBook for work, I have to make it work for both.
    @@ -2002,14 +2002,14 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::cleanup_default () {
    -    local s
    -    tmux list-sessions | grep '^T.*: ' | grep -F -v attached |
    -    cut -d: -f1 | while read -r s; do
    -        echo "Killing $s"
    -        tmux kill-session -t "$s"
    -    done
    -}
    +
    tmux::cleanup_default () {
    +    local s
    +    tmux list-sessions | grep '^T.*: ' | grep -F -v attached |
    +    cut -d: -f1 | while read -r s; do
    +        echo "Killing $s"
    +        tmux kill-session -t "$s"
    +    done
    +}
     

    The cleanup function kills all open Tmux sessions that haven't been renamed properly yet—but only if they aren't attached (e.g., don't run in the foreground in any terminal). Cleaning them up automatically keeps my Tmux sessions as neat and tidy as possible.
    @@ -2026,16 +2026,16 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::attach () {
    -    readonly session=$1
    -
    -    if [ -z "$session" ]; then
    -        tmux attach-session || tmux::new
    -    else
    -        tmux attach-session -t $session || tmux::new $session
    -    fi
    -}
    -alias ta=tmux::attach
    +
    tmux::attach () {
    +    readonly session=$1
    +
    +    if [ -z "$session" ]; then
    +        tmux attach-session || tmux::new
    +    else
    +        tmux attach-session -t $session || tmux::new $session
    +    fi
    +}
    +alias ta=tmux::attach
     

    If no session is specified (as the argument of the function), it will try to attach to the first open session. If no Tmux server is running, it will create a new one with tmux::new. Otherwise, with a session name given as the argument, it will attach to it. If unsuccessful (e.g., the session doesn't exist), it will be created and attached to.
    @@ -2048,12 +2048,12 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::remote () {
    -    readonly server=$1
    -    tmux new -s $server "ssh -t $server 'tmux attach-session || tmux'" || \
    -        tmux attach-session -d -t $server
    -}
    -alias tr=tmux::remote
    +
    tmux::remote () {
    +    readonly server=$1
    +    tmux new -s $server "ssh -t $server 'tmux attach-session || tmux'" || \
    +        tmux attach-session -d -t $server
    +}
    +alias tr=tmux::remote
     

    Change of the Tmux prefix for better nesting


    @@ -2076,15 +2076,15 @@ set-option -g prefix C-g by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::search () {
    -    local -r session=$(tmux list-sessions | fzf | cut -d: -f1)
    -    if [ -z "$TMUX" ]; then
    -        tmux attach-session -t $session
    -    else
    -        tmux switch -t $session
    -    fi
    -}
    -alias ts=tmux::search
    +
    tmux::search () {
    +    local -r session=$(tmux list-sessions | fzf | cut -d: -f1)
    +    if [ -z "$TMUX" ]; then
    +        tmux attach-session -t $session
    +    else
    +        tmux switch -t $session
    +    fi
    +}
    +alias ts=tmux::search
     

    All it does is list all currently open sessions in fzf, where one of them can be searched and selected through fuzzy find, and then either switch (if already inside a session) to the other session or attach to the other session (if not yet in Tmux).
    @@ -2111,15 +2111,15 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::cluster_ssh () {
    -    if [ -f "$1" ]; then
    -        tmux::tssh_from_file $1
    -        return
    -    fi
    +
    tmux::cluster_ssh () {
    +    if [ -f "$1" ]; then
    +        tmux::tssh_from_file $1
    +        return
    +    fi
     
    -    tmux::tssh_from_argument $@
    -}
    -alias tssh=tmux::cluster_ssh
    +    tmux::tssh_from_argument $@
    +}
    +alias tssh=tmux::cluster_ssh
     

    This function is just a wrapper around the more complex tmux::tssh_from_file and tmux::tssh_from_argument functions, as you have learned already. Most of the magic happens there.
    @@ -2132,23 +2132,23 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::tssh_from_argument () {
    -    local -r session=$1; shift
    -    local first_server=$1; shift
    -
    -    tmux new-session -d -s $session "ssh -t $first_server"
    -    if ! tmux list-session | grep "^$session:"; then
    -        echo "Could not create session $session"
    -        return 2
    -    fi
    -
    -    for server in "${@[@]}"; do
    -        tmux split-window -t $session "tmux select-layout tiled; ssh -t $server"
    -    done
    -
    -    tmux setw -t $session synchronize-panes on
    -    tmux -2 attach-session -t $session | tmux -2 switch-client -t $session
    -}
    +
    tmux::tssh_from_argument () {
    +    local -r session=$1; shift
    +    local first_server=$1; shift
    +
    +    tmux new-session -d -s $session "ssh -t $first_server"
    +    if ! tmux list-session | grep "^$session:"; then
    +        echo "Could not create session $session"
    +        return 2
    +    fi
    +
    +    for server in "${@[@]}"; do
    +        tmux split-window -t $session "tmux select-layout tiled; ssh -t $server"
    +    done
    +
    +    tmux setw -t $session synchronize-panes on
    +    tmux -2 attach-session -t $session | tmux -2 switch-client -t $session
    +}
     

    It expects at least two arguments. The first argument is the session name to create for the clustered SSH session. All other arguments are server hostnames or FQDNs to which to connect. The first one is used to make the initial session. All remaining ones are added to that session with tmux split-window -t $session.... At the end, we enable synchronized panes by default, so whenever you type, the commands will be sent to every SSH connection, thus allowing the neat ClusterSSH feature to run commands on multiple servers simultaneously. Once done, we attach (or switch, if already in Tmux) to it.
    @@ -2168,12 +2168,12 @@ bind-key P setw synchronize-panes on by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    tmux::tssh_from_file () {
    -    local -r serverlist=$1; shift
    -    local -r session=$(basename $serverlist | cut -d. -f1)
    +
    tmux::tssh_from_file () {
    +    local -r serverlist=$1; shift
    +    local -r session=$(basename $serverlist | cut -d. -f1)
     
    -    tmux::tssh_from_argument $session $(awk '{ print $1} ' $serverlist | sed 's/.lan./.lan/g')
    -}
    +    tmux::tssh_from_argument $session $(awk '{ print $1} ' $serverlist | sed 's/.lan./.lan/g')
    +}
     

    tssh examples


    @@ -2521,12 +2521,12 @@ Art by Laura Brown by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    Cluster :UK, :uk01 do
    -  Customer.C1A1.segments.volumes.each do |volume|
    -    puts volume.usage_stats
    -    volume.move_off! if volume.over_subscribed?
    -  end
    -end
    +
    Cluster :UK, :uk01 do
    +  Customer.C1A1.segments.volumes.each do |volume|
    +    puts volume.usage_stats
    +    volume.move_off! if volume.over_subscribed?
    +  end
    +end
     

    I am abandoning this project because my workplace has stopped the annual pet project competition, and I have other more important projects to work on at the moment.
    @@ -2900,38 +2900,38 @@ _____|_:_:_| (o)-(o) |_:_:_|--'`-. ,--. ksh under-water (((\'/ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/bin/ksh
    -
    -ZONES_DIR=/var/nsd/zones/master/
    -DEFAULT_MASTER=fishfinger.buetow.org
    -DEFAULT_STANDBY=blowfish.buetow.org
    -
    -determine_master_and_standby () {
    -    local master=$DEFAULT_MASTER
    -    local standby=$DEFAULT_STANDBY
    -
    -    .
    -    .
    -    .
    -    
    -    local -i health_ok=1
    -    if ! ftp -4 -o - https://$master/index.txt | grep -q "Welcome to $master"; then
    -        echo "https://$master/index.txt IPv4 health check failed"
    -        health_ok=0
    -    elif ! ftp -6 -o - https://$master/index.txt | grep -q "Welcome to $master"; then
    -        echo "https://$master/index.txt IPv6 health check failed"
    -        health_ok=0
    -    fi
    -    if [ $health_ok -eq 0 ]; then
    -        local tmp=$master
    -        master=$standby
    -        standby=$tmp
    -    fi
    -
    -    .
    -    .
    -    .
    -}
    +
    #!/bin/ksh
    +
    +ZONES_DIR=/var/nsd/zones/master/
    +DEFAULT_MASTER=fishfinger.buetow.org
    +DEFAULT_STANDBY=blowfish.buetow.org
    +
    +determine_master_and_standby () {
    +    local master=$DEFAULT_MASTER
    +    local standby=$DEFAULT_STANDBY
    +
    +    .
    +    .
    +    .
    +    
    +    local -i health_ok=1
    +    if ! ftp -4 -o - https://$master/index.txt | grep -q "Welcome to $master"; then
    +        echo "https://$master/index.txt IPv4 health check failed"
    +        health_ok=0
    +    elif ! ftp -6 -o - https://$master/index.txt | grep -q "Welcome to $master"; then
    +        echo "https://$master/index.txt IPv6 health check failed"
    +        health_ok=0
    +    fi
    +    if [ $health_ok -eq 0 ]; then
    +        local tmp=$master
    +        master=$standby
    +        standby=$tmp
    +    fi
    +
    +    .
    +    .
    +    .
    +}
     

    The failover scripts looks for the ; Enable failover string in the DNS zone files and swaps the A and AAAA records of the DNS entries accordingly:
    @@ -2940,42 +2940,42 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    fishfinger$ grep failover /var/nsd/zones/master/foo.zone.zone
    -        300 IN A 46.23.94.99 ; Enable failover
    -        300 IN AAAA 2a03:6000:6f67:624::99 ; Enable failover
    -www     300 IN A 46.23.94.99 ; Enable failover
    -www     300 IN AAAA 2a03:6000:6f67:624::99 ; Enable failover
    -standby  300 IN A 23.88.35.144 ; Enable failover
    -standby  300 IN AAAA 2a01:4f8:c17:20f1::42 ; Enable failover
    +
    fishfinger$ grep failover /var/nsd/zones/master/foo.zone.zone
    +        300 IN A 46.23.94.99 ; Enable failover
    +        300 IN AAAA 2a03:6000:6f67:624::99 ; Enable failover
    +www     300 IN A 46.23.94.99 ; Enable failover
    +www     300 IN AAAA 2a03:6000:6f67:624::99 ; Enable failover
    +standby  300 IN A 23.88.35.144 ; Enable failover
    +standby  300 IN AAAA 2a01:4f8:c17:20f1::42 ; Enable failover
     

    -
    transform () {
    -  sed -E '
    -	/IN A .*; Enable failover/ {
    -	    /^standby/! {
    -	        s/^(.*) 300 IN A (.*) ; (.*)/\1 300 IN A '$(cat /var/nsd/run/master_a)' ; \3/;
    -	    }
    -	    /^standby/ {
    -	        s/^(.*) 300 IN A (.*) ; (.*)/\1 300 IN A '$(cat /var/nsd/run/standby_a)' ; \3/;
    -	    }
    -	}
    -	/IN AAAA .*; Enable failover/ {
    -	    /^standby/! {
    -	        s/^(.*) 300 IN AAAA (.*) ; (.*)/\1 300 IN AAAA '$(cat /var/nsd/run/master_aaaa)' ; \3/;
    -	    }
    -	    /^standby/ {
    -	        s/^(.*) 300 IN AAAA (.*) ; (.*)/\1 300 IN AAAA '$(cat /var/nsd/run/standby_aaaa)' ; \3/;
    -	    }
    -	}
    -	/ ; serial/ {
    -	    s/^( +) ([0-9]+) .*; (.*)/\1 '$(date +%s)' ; \3/;
    -	}
    -  '
    -}
    +
    transform () {
    +  sed -E '
    +	/IN A .*; Enable failover/ {
    +	    /^standby/! {
    +	        s/^(.*) 300 IN A (.*) ; (.*)/\1 300 IN A '$(cat /var/nsd/run/master_a)' ; \3/;
    +	    }
    +	    /^standby/ {
    +	        s/^(.*) 300 IN A (.*) ; (.*)/\1 300 IN A '$(cat /var/nsd/run/standby_a)' ; \3/;
    +	    }
    +	}
    +	/IN AAAA .*; Enable failover/ {
    +	    /^standby/! {
    +	        s/^(.*) 300 IN AAAA (.*) ; (.*)/\1 300 IN AAAA '$(cat /var/nsd/run/master_aaaa)' ; \3/;
    +	    }
    +	    /^standby/ {
    +	        s/^(.*) 300 IN AAAA (.*) ; (.*)/\1 300 IN AAAA '$(cat /var/nsd/run/standby_aaaa)' ; \3/;
    +	    }
    +	}
    +	/ ; serial/ {
    +	    s/^( +) ([0-9]+) .*; (.*)/\1 '$(date +%s)' ; \3/;
    +	}
    +  '
    +}
     

    After the failover, the script reloads nsd and performs a sanity check to see if DNS still works. If not, a rollback will be performed:
    @@ -2984,48 +2984,48 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #! Race condition !#
    -   
    -if [ -f $zone_file.bak ]; then
    -    mv $zone_file.bak $zone_file
    -fi
    -
    -cat $zone_file | transform > $zone_file.new.tmp 
    -
    -grep -v ' ; serial' $zone_file.new.tmp > $zone_file.new.noserial.tmp
    -grep -v ' ; serial' $zone_file > $zone_file.old.noserial.tmp
    -
    -echo "Has zone $zone_file changed?"
    -if diff -u $zone_file.old.noserial.tmp $zone_file.new.noserial.tmp; then
    -    echo "The zone $zone_file hasn't changed"
    -    rm $zone_file.*.tmp
    -    return 0
    -fi
    -
    -cp $zone_file $zone_file.bak
    -mv $zone_file.new.tmp $zone_file
    -rm $zone_file.*.tmp
    -echo "Reloading nsd"
    -nsd-control reload
    -
    -if ! zone_is_ok $zone; then
    -    echo "Rolling back $zone_file changes"
    -    cp $zone_file $zone_file.invalid
    -    mv $zone_file.bak $zone_file
    -    echo "Reloading nsd"
    -    nsd-control reload
    -    zone_is_ok $zone
    -    return 3
    -fi
    -
    -for cleanup in invalid bak; do
    -    if [ -f $zone_file.$cleanup ]; then
    -        rm $zone_file.$cleanup
    -    fi
    -done
    -
    -echo "Failover of zone $zone to $MASTER completed"
    -return 1
    +
    #! Race condition !#
    +   
    +if [ -f $zone_file.bak ]; then
    +    mv $zone_file.bak $zone_file
    +fi
    +
    +cat $zone_file | transform > $zone_file.new.tmp 
    +
    +grep -v ' ; serial' $zone_file.new.tmp > $zone_file.new.noserial.tmp
    +grep -v ' ; serial' $zone_file > $zone_file.old.noserial.tmp
    +
    +echo "Has zone $zone_file changed?"
    +if diff -u $zone_file.old.noserial.tmp $zone_file.new.noserial.tmp; then
    +    echo "The zone $zone_file hasn't changed"
    +    rm $zone_file.*.tmp
    +    return 0
    +fi
    +
    +cp $zone_file $zone_file.bak
    +mv $zone_file.new.tmp $zone_file
    +rm $zone_file.*.tmp
    +echo "Reloading nsd"
    +nsd-control reload
    +
    +if ! zone_is_ok $zone; then
    +    echo "Rolling back $zone_file changes"
    +    cp $zone_file $zone_file.invalid
    +    mv $zone_file.bak $zone_file
    +    echo "Reloading nsd"
    +    nsd-control reload
    +    zone_is_ok $zone
    +    return 3
    +fi
    +
    +for cleanup in invalid bak; do
    +    if [ -f $zone_file.$cleanup ]; then
    +        rm $zone_file.$cleanup
    +    fi
    +done
    +
    +echo "Failover of zone $zone to $MASTER completed"
    +return 1
     

    A non-zero return code (here, 3 when a rollback and 1 when a DNS failover was performed) will cause CRON to send an E-Mail with the whole script output.
    @@ -3082,13 +3082,13 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    # Weekly auto-failover for Let's Encrypt automation
    -local -i -r week_of_the_year=$(date +%U)
    -if [ $(( week_of_the_year % 2 )) -eq 0 ]; then
    -    local tmp=$master
    -    master=$standby
    -    standby=$tmp
    -fi
    +
    # Weekly auto-failover for Let's Encrypt automation
    +local -i -r week_of_the_year=$(date +%U)
    +if [ $(( week_of_the_year % 2 )) -eq 0 ]; then
    +    local tmp=$master
    +    master=$standby
    +    standby=$tmp
    +fi
     

    This way, a DNS failover is performed weekly so that the ACME automation can update the Let's Encrypt certificates (for master and standby) before they expire on each VM.
    @@ -3462,8 +3462,8 @@ SSFISHKISSFISHKISSFISHKISSFISHKIS SFIS by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    $ doas installboot sd0 # Update the bootloader (not for every upgrade required)
    -$ doas sysupgrade # Update all binaries (including Kernel)
    +
    $ doas installboot sd0 # Update the bootloader (not for every upgrade required)
    +$ doas sysupgrade # Update all binaries (including Kernel)
     

    sysupgrade downloaded and upgraded to the next release and rebooted the system. After the reboot, I run:
    @@ -3472,9 +3472,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    $ doas sysmerge # Update system configuration files
    -$ doas pkg_add -u # Update all packages
    -$ doas reboot # Just in case, reboot one more time
    +
    $ doas sysmerge # Update system configuration files
    +$ doas pkg_add -u # Update all packages
    +$ doas reboot # Just in case, reboot one more time
     

    That's it! Took me around 5 minutes in total! No issues, only these few comands, only 5 minutes! It just works! No problems, no conflicts, no tons (actually none) config file merge conflicts.
    @@ -3640,24 +3640,24 @@ jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -log () {
    -    local -r level="$1"; shift
    -    local -r message="$1"; shift
    -    local -i pid="$$"
    +log () {
    +    local -r level="$1"; shift
    +    local -r message="$1"; shift
    +    local -i pid="$$"
     
    -    local -r callee=${FUNCNAME[1]}
    -    local -r stamp=$(date +%Y%m%d-%H%M%S)
    +    local -r callee=${FUNCNAME[1]}
    +    local -r stamp=$(date +%Y%m%d-%H%M%S)
     
    -    echo "$level|$stamp|$pid|$callee|$message" >&2
    -}
    +    echo "$level|$stamp|$pid|$callee|$message" >&2
    +}
     
    -at_home_friday_evening () {
    -    log INFO 'One Peperoni Pizza, please'
    -}
    +at_home_friday_evening () {
    +    log INFO 'One Peperoni Pizza, please'
    +}
     
    -at_home_friday_evening
    +at_home_friday_evening
     

    The output is as follows:
    @@ -3666,8 +3666,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    ./logexample.sh
    -INFO|20231210-082732|123002|at_home_friday_evening|One Peperoni Pizza, please
    +
    ❯ ./logexample.sh
    +INFO|20231210-082732|123002|at_home_friday_evening|One Peperoni Pizza, please
     

    :(){ :|:& };:


    @@ -3701,18 +3701,18 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -outer() {
    -  inner() {
    -    echo 'Intel inside!'
    -  }
    -  inner
    -}
    +outer() {
    +  inner() {
    +    echo 'Intel inside!'
    +  }
    +  inner
    +}
     
    -inner
    -outer
    -inner
    +inner
    +outer
    +inner
     

    And let's execute it:
    @@ -3730,26 +3730,26 @@ Intel inside! by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -outer1() {
    -  inner() {
    -    echo 'Intel inside!'
    -  }
    -  inner
    -}
    +outer1() {
    +  inner() {
    +    echo 'Intel inside!'
    +  }
    +  inner
    +}
     
    -outer2() {
    -  inner() {
    -    echo 'Wintel inside!'
    -  }
    -  inner
    -}
    +outer2() {
    +  inner() {
    +    echo 'Wintel inside!'
    +  }
    +  inner
    +}
     
    -outer1
    -inner
    -outer2
    -inner
    +outer1
    +inner
    +outer2
    +inner
     

    And let's run it:
    @@ -3770,14 +3770,14 @@ Wintel inside! by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -some_expensive_operations() {
    -  echo "Doing expensive operations with '$1' from pid $$"
    -}
    +some_expensive_operations() {
    +  echo "Doing expensive operations with '$1' from pid $$"
    +}
     
    -for i in {0..9}; do echo $i; done \
    -  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
    +for i in {0..9}; do echo $i; done \
    +  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
     

    We try here to run ten parallel processes; each of them should run the some_expensive_operations function with a different argument. The arguments are provided to xargs through STDIN one per line. When executed, we get this:
    @@ -3802,15 +3802,15 @@ bash: line 1: some_expensive_operations: command not found by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -some_expensive_operations() {
    -  echo "Doing expensive operations with '$1' from pid $$"
    -}
    -export -f some_expensive_operations
    +some_expensive_operations() {
    +  echo "Doing expensive operations with '$1' from pid $$"
    +}
    +export -f some_expensive_operations
     
    -for i in {0..9}; do echo $i; done \
    -  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
    +for i in {0..9}; do echo $i; done \
    +  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
     

    When we run this now, we get:
    @@ -3835,19 +3835,19 @@ Doing expensive operations with '9' from pid 132840 by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -some_other_function() {
    -  echo "$1"
    -}
    +some_other_function() {
    +  echo "$1"
    +}
     
    -some_expensive_operations() {
    -  some_other_function "Doing expensive operations with '$1' from pid $$"
    -}
    -export -f some_expensive_operations
    +some_expensive_operations() {
    +  some_other_function "Doing expensive operations with '$1' from pid $$"
    +}
    +export -f some_expensive_operations
     
    -for i in {0..9}; do echo $i; done \
    -  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
    +for i in {0..9}; do echo $i; done \
    +  | xargs -P10 -I{} bash -c 'some_expensive_operations "{}"'
     

    ... because some_other_function isn't exported! You will also need to add an export -f some_other_function!
    @@ -3860,22 +3860,22 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -foo() {
    -  local foo=bar # Declare local/dynamic variable
    -  bar
    -  echo "$foo"
    -}
    +foo() {
    +  local foo=bar # Declare local/dynamic variable
    +  bar
    +  echo "$foo"
    +}
     
    -bar() {
    -  echo "$foo"
    -  foo=baz
    -}
    +bar() {
    +  echo "$foo"
    +  foo=baz
    +}
     
    -foo=foo # Declare global variable
    -foo # Call function foo
    -echo "$foo"
    +foo=foo # Declare global variable
    +foo # Call function foo
    +echo "$foo"
     

    Let's pause a minute. What do you think the output would be?
    @@ -3900,34 +3900,34 @@ foo by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -declare -r foo=foo
    -declare -r bar=bar
    +declare -r foo=foo
    +declare -r bar=bar
     
    -if [ "$foo" = foo ]; then
    -  if [ "$bar" = bar ]; then
    -    echo ok1
    -  fi
    -fi
    +if [ "$foo" = foo ]; then
    +  if [ "$bar" = bar ]; then
    +    echo ok1
    +  fi
    +fi
     
    -if [ "$foo" = foo ] && [ "$bar" == bar ]; then
    -  echo ok2a
    -fi
    +if [ "$foo" = foo ] && [ "$bar" == bar ]; then
    +  echo ok2a
    +fi
     
    -[ "$foo" = foo ] && [ "$bar" == bar ] && echo ok2b
    +[ "$foo" = foo ] && [ "$bar" == bar ] && echo ok2b
     
    -if [[ "$foo" = foo && "$bar" == bar ]]; then
    -  echo ok3a
    -fi
    +if [[ "$foo" = foo && "$bar" == bar ]]; then
    +  echo ok3a
    +fi
     
    - [[ "$foo" = foo && "$bar" == bar ]] && echo ok3b
    + [[ "$foo" = foo && "$bar" == bar ]] && echo ok3b
     
    -if test "$foo" = foo && test "$bar" = bar; then
    -  echo ok4a
    -fi
    +if test "$foo" = foo && test "$bar" = bar; then
    +  echo ok4a
    +fi
     
    -test "$foo" = foo && test "$bar" = bar && echo ok4b
    +test "$foo" = foo && test "$bar" = bar && echo ok4b
     

    The output we get is:
    @@ -3951,18 +3951,18 @@ ok4b by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -# Single line comment
    +# Single line comment
     
    -# These are two single line
    -# comments one after another
    +# These are two single line
    +# comments one after another
     
    -: <<COMMENT
    -This is another way a
    -multi line comment
    -could be written!
    -COMMENT
    +: <<COMMENT
    +This is another way a
    +multi line comment
    +could be written!
    +COMMENT
     

    I will not demonstrate the execution of this script, as it won't print anything! It's obviously not the most pretty way of commenting on your code, but it could sometimes be handy!
    @@ -3975,11 +3975,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    #!/usr/bin/env bash
    +
    #!/usr/bin/env bash
     
    -echo foo
    -echo echo baz >> $0
    -echo bar
    +echo foo
    +echo echo baz >> $0
    +echo bar
     

    When it is run, it will do:
    @@ -4355,42 +4355,42 @@ photoalbum makemake by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % photoalbum makemake
    -You may now customize ./photoalbumrc and run make
    -
    -% cat Makefile
    -all:
    -	photoalbum generate photoalbumrc
    -clean:
    -	photoalbum clean photoalbumrc
    -
    -% cat photoalbumrc
    -# The title of the photoalbum
    -TITLE='A simple Photoalbum'
    -
    -# Thumbnail height geometry
    -THUMBHEIGHT=300
    -# Normal geometry height (when viewing photo). Uncomment, to keep original size.
    -HEIGHT=1200
    -# Max previews per page.
    -MAXPREVIEWS=40
    -# Randomly shuffle all previews.
    -# SHUFFLE=yes
    -
    -# Diverse directories, need to be full paths, not relative!
    -INCOMING_DIR=$(pwd)/incoming
    -DIST_DIR=$(pwd)/dist
    -TEMPLATE_DIR=/usr/share/photoalbum/templates/default
    -#TEMPLATE_DIR=/usr/share/photoalbum/templates/minimal
    -
    -# Includes a .tar of the incoming dir in the dist, can be yes or no
    -TARBALL_INCLUDE=yes
    -TARBALL_SUFFIX=.tar
    -TAR_OPTS='-c'
    -
    -# Some debugging options
    -#set -e
    -#set -x
    +
    % photoalbum makemake
    +You may now customize ./photoalbumrc and run make
    +
    +% cat Makefile
    +all:
    +	photoalbum generate photoalbumrc
    +clean:
    +	photoalbum clean photoalbumrc
    +
    +% cat photoalbumrc
    +# The title of the photoalbum
    +TITLE='A simple Photoalbum'
    +
    +# Thumbnail height geometry
    +THUMBHEIGHT=300
    +# Normal geometry height (when viewing photo). Uncomment, to keep original size.
    +HEIGHT=1200
    +# Max previews per page.
    +MAXPREVIEWS=40
    +# Randomly shuffle all previews.
    +# SHUFFLE=yes
    +
    +# Diverse directories, need to be full paths, not relative!
    +INCOMING_DIR=$(pwd)/incoming
    +DIST_DIR=$(pwd)/dist
    +TEMPLATE_DIR=/usr/share/photoalbum/templates/default
    +#TEMPLATE_DIR=/usr/share/photoalbum/templates/minimal
    +
    +# Includes a .tar of the incoming dir in the dist, can be yes or no
    +TARBALL_INCLUDE=yes
    +TARBALL_SUFFIX=.tar
    +TAR_OPTS='-c'
    +
    +# Some debugging options
    +#set -e
    +#set -x
     

    In the case for irregular.ninja, I changed the defaults to the following:
    @@ -4399,38 +4399,38 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    --- photoalbumrc        2023-10-29 21:42:00.894202045 +0200
    -+++ photoalbumrc.new 2023-06-04 10:40:08.030994440 +0300
    -@@ -1,23 +1,24 @@
    - # The title of the photoalbum
    --TITLE='A simple Photoalbum'
    -+TITLE='Irregular.Ninja'
    -
    - # Thumbnail height geometry
    --THUMBHEIGHT=300
    -+THUMBHEIGHT=400
    - # Normal geometry height (when viewing photo). Uncomment, to keep original size.
    --HEIGHT=1200
    -+HEIGHT=1800
    - # Max previews per page.
    - MAXPREVIEWS=40
    --# Randomly shuffle all previews.
    --# SHUFFLE=yes
    -+# Randomly shuffle
    -+SHUFFLE=yes
    -
    - # Diverse directories, need to be full paths, not relative!
    --INCOMING_DIR=$(pwd)/incoming
    -+INCOMING_DIR=~/Nextcloud/Photos/irregular.ninja
    - DIST_DIR=$(pwd)/dist
    - TEMPLATE_DIR=/usr/share/photoalbum/templates/default
    - #TEMPLATE_DIR=/usr/share/photoalbum/templates/minimal
    -
    - # Includes a .tar of the incoming dir in the dist, can be yes or no
    --TARBALL_INCLUDE=yes
    -+TARBALL_INCLUDE=no
    - TARBALL_SUFFIX=.tar
    - TAR_OPTS='-c'
    +
    --- photoalbumrc        2023-10-29 21:42:00.894202045 +0200
    ++++ photoalbumrc.new 2023-06-04 10:40:08.030994440 +0300
    +@@ -1,23 +1,24 @@
    + # The title of the photoalbum
    +-TITLE='A simple Photoalbum'
    ++TITLE='Irregular.Ninja'
    +
    + # Thumbnail height geometry
    +-THUMBHEIGHT=300
    ++THUMBHEIGHT=400
    + # Normal geometry height (when viewing photo). Uncomment, to keep original size.
    +-HEIGHT=1200
    ++HEIGHT=1800
    + # Max previews per page.
    + MAXPREVIEWS=40
    +-# Randomly shuffle all previews.
    +-# SHUFFLE=yes
    ++# Randomly shuffle
    ++SHUFFLE=yes
    +
    + # Diverse directories, need to be full paths, not relative!
    +-INCOMING_DIR=$(pwd)/incoming
    ++INCOMING_DIR=~/Nextcloud/Photos/irregular.ninja
    + DIST_DIR=$(pwd)/dist
    + TEMPLATE_DIR=/usr/share/photoalbum/templates/default
    + #TEMPLATE_DIR=/usr/share/photoalbum/templates/minimal
    +
    + # Includes a .tar of the incoming dir in the dist, can be yes or no
    +-TARBALL_INCLUDE=yes
    ++TARBALL_INCLUDE=no
    + TARBALL_SUFFIX=.tar
    + TAR_OPTS='-c'
     

    So I changed the album title, adjusted some image and thumbnail dimensions, and I want all images to be randomly shuffled every time the album is generated! I also have all my photos in my Nextcloud Photo directory and don't want to copy them to the local incoming directory. Also, a tarball containing the whole album as a download isn't provided.
    @@ -4603,7 +4603,7 @@ blurs html index.html photos thumbs by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt --grep INFO --files "/var/log/dserver/*.log"
    +
    % dtail --servers serverlist.txt --grep INFO --files "/var/log/dserver/*.log"
     

    Hint: you can also provide a comma separated server list, e.g.: servers server1.example.org,server2.example.org:PORT,...
    @@ -4616,7 +4616,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt --grep INFO "/var/log/dserver/*.log"
    +
    % dtail --servers serverlist.txt --grep INFO "/var/log/dserver/*.log"
     

    Aggregating logs


    @@ -4629,10 +4629,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    --query 'from STATS select sum($goroutines),sum($cgocalls),
    -             last($time),max(lifetimeConnections)'
    +
    % dtail --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    --query 'from STATS select sum($goroutines),sum($cgocalls),
    +             last($time),max(lifetimeConnections)'
     

    Beware: For map-reduce queries to work, you have to ensure that DTail supports your log format. Check out the documentaiton of the DTail query language and the DTail log formats on the DTail homepage for more information.
    @@ -4645,10 +4645,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    'from STATS select sum($goroutines),sum($cgocalls),
    -     last($time),max(lifetimeConnections)'
    +
    % dtail --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    'from STATS select sum($goroutines),sum($cgocalls),
    +     last($time),max(lifetimeConnections)'
     

    Here is another example:
    @@ -4657,10 +4657,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -             lifetimeConnections group by $hostname order by max($cgocalls)'
    +
    % dtail --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +             lifetimeConnections group by $hostname order by max($cgocalls)'
     

    Tail map-reduce example 2
    @@ -4671,9 +4671,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    --query 'from STATS select ... outfile append result.csv'
    +
    % dtail --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    --query 'from STATS select ... outfile append result.csv'
     

    How to use dcat


    @@ -4686,7 +4686,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dcat --servers serverlist.txt --files /etc/hostname
    +
    % dcat --servers serverlist.txt --files /etc/hostname
     

    Cat example
    @@ -4697,7 +4697,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dcat --servers serverlist.txt /etc/hostname
    +
    % dcat --servers serverlist.txt /etc/hostname
     

    How to use dgrep


    @@ -4708,9 +4708,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dgrep --servers server1.example.org:2223 \
    -    --files /etc/passwd \
    -    --regex nologin
    +
    % dgrep --servers server1.example.org:2223 \
    +    --files /etc/passwd \
    +    --regex nologin
     

    Generally, dgrep is also a very useful way to search historic application logs for certain content.
    @@ -4727,10 +4727,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dmap --servers serverlist.txt \
    -    --files '/var/log/dserver/*.log' \
    -    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -             lifetimeConnections group by $hostname order by max($cgocalls)'
    +
    % dmap --servers serverlist.txt \
    +    --files '/var/log/dserver/*.log' \
    +    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +             lifetimeConnections group by $hostname order by max($cgocalls)'
     

    Remember: For that to work, you have to make sure that DTail supports your log format. You can either use the ones already defined in internal/mapr/logformat or add an extension to support a custom log format. The example here works out of the box though, as DTail understands its own log format already.
    @@ -4753,9 +4753,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dmap --files /var/log/dserver/dserver.log
    -    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -              lifetimeConnections group by $hostname order by max($cgocalls)'
    +
    % dmap --files /var/log/dserver/dserver.log
    +    --query 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +              lifetimeConnections group by $hostname order by max($cgocalls)'
     

    As a shorthand version the following command can be used:
    @@ -4764,9 +4764,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -        lifetimeConnections group by $hostname order by max($cgocalls)' \
    -        /var/log/dsever/dserver.log
    +
    % dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +        lifetimeConnections group by $hostname order by max($cgocalls)' \
    +        /var/log/dsever/dserver.log
     

    You can also use a file input pipe as follows:
    @@ -4775,9 +4775,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % cat /var/log/dserver/dserver.log | \
    -    dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    -          lifetimeConnections group by $hostname order by max($cgocalls)'
    +
    % cat /var/log/dserver/dserver.log | \
    +    dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
    +          lifetimeConnections group by $hostname order by max($cgocalls)'
     

    Aggregating CSV files


    @@ -4788,16 +4788,16 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % cat example.csv
    -name,lastname,age,profession
    -Michael,Jordan,40,Basketball player
    -Michael,Jackson,100,Singer
    -Albert,Einstein,200,Physician
    -% dmap --query 'select lastname,name where age > 40 logformat csv outfile result.csv' example.csv
    -% cat result.csv
    -lastname,name
    -Jackson,Michael
    -Einstein,Albert
    +
    % cat example.csv
    +name,lastname,age,profession
    +Michael,Jordan,40,Basketball player
    +Michael,Jackson,100,Singer
    +Albert,Einstein,200,Physician
    +% dmap --query 'select lastname,name where age > 40 logformat csv outfile result.csv' example.csv
    +% cat result.csv
    +lastname,name
    +Jackson,Michael
    +Einstein,Albert
     

    DMap can also be used to query and aggregate CSV files from remote servers.
    @@ -4810,44 +4810,44 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    % dtail /var/log/dserver/dserver.log
    +
    % dtail /var/log/dserver/dserver.log
     

    -
    % dtail --logLevel trace /var/log/dserver/dserver.log
    +
    % dtail --logLevel trace /var/log/dserver/dserver.log
     

    -
    % dcat /etc/passwd
    +
    % dcat /etc/passwd
     

    -
    % dcat --plain /etc/passwd > /etc/test
    -# Should show no differences.
    -diff /etc/test /etc/passwd 
    +
    % dcat --plain /etc/passwd > /etc/test
    +# Should show no differences.
    +diff /etc/test /etc/passwd 
     

    -
    % dgrep --regex ERROR --files /var/log/dserver/dsever.log
    +
    % dgrep --regex ERROR --files /var/log/dserver/dsever.log
     

    -
    % dgrep --before 10 --after 10 --max 10 --grep ERROR /var/log/dserver/dsever.log
    +
    % dgrep --before 10 --after 10 --max 10 --grep ERROR /var/log/dserver/dsever.log
     

    Use --help for more available options. Or go to the DTail page for more information! Hope you find DTail useful!
    @@ -5017,9 +5017,9 @@ DC on fire: by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    if [ -n "$foo" ]; then
    -  echo "$foo"
    -fi
    +
    if [ -n "$foo" ]; then
    +  echo "$foo"
    +fi
     

    Please run source-highlight --lang-list for a list of all supported languages.
    @@ -5048,7 +5048,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    declare -xr MASTODON_URI='https://fosstodon.org/@snonux'
    +
    declare -xr MASTODON_URI='https://fosstodon.org/@snonux'
     

    and add the following into your index.gmi:
    @@ -5063,7 +5063,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    <a href='https://fosstodon.org/@snonux' rel='me'>Me at Mastodon</a>
    +
    <a href='https://fosstodon.org/@snonux' rel='me'>Me at Mastodon</a>
     

    More


    @@ -5563,11 +5563,11 @@ Have a nice day! by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    git clone https://codeberg.org/snonux/gogios.git
    -cd gogios
    -go build -o gogios cmd/gogios/main.go
    -doas cp gogios /usr/local/bin/gogios
    -doas chmod 755 /usr/local/bin/gogios
    +
    git clone https://codeberg.org/snonux/gogios.git
    +cd gogios
    +go build -o gogios cmd/gogios/main.go
    +doas cp gogios /usr/local/bin/gogios
    +doas chmod 755 /usr/local/bin/gogios
     

    You can use cross-compilation if you want to compile Gogios for OpenBSD on a Linux system without installing the Go compiler on OpenBSD. Follow these steps:
    @@ -5576,9 +5576,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    export GOOS=openbsd
    -export GOARCH=amd64
    -go build -o gogios cmd/gogios/main.go
    +
    export GOOS=openbsd
    +export GOARCH=amd64
    +go build -o gogios cmd/gogios/main.go
     

    On your OpenBSD system, copy the binary to /usr/local/bin/gogios and set the correct permissions as described in the previous section. All steps described here you could automate with your configuration management system of choice. I use Rexify, the friendly configuration management system, to automate the installation, but that is out of the scope of this document.
    @@ -5593,11 +5593,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    doas adduser -group _gogios -batch _gogios
    -doas usermod -d /var/run/gogios _gogios
    -doas mkdir -p /var/run/gogios
    -doas chown _gogios:_gogios /var/run/gogios
    -doas chmod 750 /var/run/gogios
    +
    doas adduser -group _gogios -batch _gogios
    +doas usermod -d /var/run/gogios _gogios
    +doas mkdir -p /var/run/gogios
    +doas chown _gogios:_gogios /var/run/gogios
    +doas chmod 750 /var/run/gogios
     

    Please note that creating a user and group might differ depending on your operating system. For other operating systems, consult their documentation for creating system users and groups.
    @@ -5610,8 +5610,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    doas pkg_add monitoring-plugins
    -doas pkg_add nrpe # If you want to execute checks remotely via NRPE.
    +
    doas pkg_add monitoring-plugins
    +doas pkg_add nrpe # If you want to execute checks remotely via NRPE.
     

    Once the installation is complete, you can find the monitoring plugins in the /usr/local/libexec/nagios directory, which then can be configured to be used in gogios.json.
    @@ -5638,41 +5638,41 @@ echo 'This is a test email from OpenBSD.' | mail -s 'Test Email' by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
    {
    -  "EmailTo": "paul@dev.buetow.org",
    -  "EmailFrom": "gogios@buetow.org",
    -  "CheckTimeoutS": 10,
    -  "CheckConcurrency": 2,
    -  "StateDir": "/var/run/gogios",
    -  "Checks": {
    -    "Check ICMP4 www.foo.zone": {
    -      "Plugin": "/usr/local/libexec/nagios/check_ping",
    -      "Args": [ "-H", "www.foo.zone", "-4", "-w", "50,10%", "-c", "100,15%" ],
    -      "Retries": 3,
    -      "RetryInterval": 10
    -    },
    -    "Check ICMP6 www.foo.zone": {
    -      "Plugin": "/usr/local/libexec/nagios/check_ping",
    -      "Args": [ "-H", "www.foo.zone", "-6", "-w", "50,10%", "-c", "100,15%" ],
    -      "Retries": 3,
    -      "RetryInterval": 10
    -    },
    -    "www.foo.zone HTTP IPv4": {
    -      "Plugin": "/usr/local/libexec/nagios/check_http",
    -      "Args": ["www.foo.zone", "-4"],
    -      "DependsOn": ["Check ICMP4 www.foo.zone"]
    -    },
    -    "www.foo.zone HTTP IPv6": {
    -      "Plugin": "/usr/local/libexec/nagios/check_http",
    -      "Args": ["www.foo.zone", "-6"],
    -      "DependsOn": ["Check ICMP6 www.foo.zone"]
    -    }
    -    "Check NRPE Disk Usage foo.zone": {
    -      "Plugin": "/usr/local/libexec/nagios/check_nrpe",
    -      "Args": ["-H", "foo.zone", "-c", "check_disk", "-p", "5666", "-4"]
    -    }
    -  }
    -}
    +
    {
    +  "EmailTo": "paul@dev.buetow.org",
    +  "EmailFrom": "gogios@buetow.org",
    +  "CheckTimeoutS": 10,
    +  "CheckConcurrency": 2,
    +  "StateDir": "/var/run/gogios",
    +  "Checks": {
    +    "Check ICMP4 www.foo.zone": {
    +      "Plugin": "/usr/local/libexec/nagios/check_ping",
    +      "Args": [ "-H", "www.foo.zone", "-4", "-w", "50,10%", "-c", "100,15%" ],
    +      "Retries": 3,
    +      "RetryInterval": 10
    +    },
    +    "Check ICMP6 www.foo.zone": {
    +      "Plugin": "/usr/local/libexec/nagios/check_ping",
    +      "Args": [ "-H", "www.foo.zone", "-6", "-w", "50,10%", "-c", "100,15%" ],
    +      "Retries": 3,
    +      "RetryInterval": 10
    +    },
    +    "www.foo.zone HTTP IPv4": {
    +      "Plugin": "/usr/local/libexec/nagios/check_http",
    +      "Args": ["www.foo.zone", "-4"],
    +      "DependsOn": ["Check ICMP4 www.foo.zone"]
    +    },
    +    "www.foo.zone HTTP IPv6": {
    +      "Plugin": "/usr/local/libexec/nagios/check_http",
    +      "Args": ["www.foo.zone", "-6"],
    +      "DependsOn": ["Check ICMP6 www.foo.zone"]
    +    }
    +    "Check NRPE Disk Usage foo.zone": {
    +      "Plugin": "/usr/local/libexec/nagios/check_nrpe",
    +      "Args": ["-H", "foo.zone", "-c", "check_disk", "-p", "5666", "-4"]
    +    }
    +  }
    +}
     

      @@ -5701,7 +5701,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
      doas -u _gogios /usr/local/bin/gogios -cfg /etc/gogios.json
      +
      doas -u _gogios /usr/local/bin/gogios -cfg /etc/gogios.json
       

      To run Gogios via CRON on OpenBSD as the gogios user and check all services once per minute, follow these steps:
      @@ -5951,7 +5951,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
      $ raku guprecords.raku --stats=dir=$HOME/git/uprecords/stats --all
      +
      $ raku guprecords.raku --stats=dir=$HOME/git/uprecords/stats --all
       

      This command will generate a comprehensive uptime report from the collected statistics, making it easy to review and enjoy the data.
      @@ -6363,8 +6363,8 @@ Blablabla... by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
      declare -xr PRE_GENERATE_HOOK=./pre_generate_hook.sh
      -declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh
      +
      declare -xr PRE_GENERATE_HOOK=./pre_generate_hook.sh
      +declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh
       

      Use of safer Bash options


      @@ -6381,10 +6381,10 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
      % cat gemfeed/2023-02-26-title-here.gmi
      -# Title here
      +
      % cat gemfeed/2023-02-26-title-here.gmi
      +# Title here
       
      -The remaining content of the Gemtext file...
      +The remaining content of the Gemtext file...
       

      Gemtexter will add a line starting with > Published at ... now. Any subsequent Atom feed generation will then use that date.
      @@ -6393,12 +6393,12 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
      % cat gemfeed/2023-02-26-title-here.gmi
      -# Title here
      +
      % cat gemfeed/2023-02-26-title-here.gmi
      +# Title here
       
      -> Published at 2023-02-26T21:43:51+01:00
      +> Published at 2023-02-26T21:43:51+01:00
       
      -The remaining content of the Gemtext file...
      +The remaining content of the Gemtext file...
       

      XMLLint support


      @@ -7047,10 +7047,10 @@ Art by \ \_! / __! by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
      " Clipboard
      -vnoremap ,y !pbcopy<CR>ugv
      -vnoremap ,i !pbpaste<CR>
      -nmap ,i !wpbpaste<CR>
      +
      " Clipboard
      +vnoremap ,y !pbcopy<CR>ugv
      +vnoremap ,i !pbpaste<CR>
      +nmap ,i !wpbpaste<CR>
       

      That's only a very few lines and does precisely what I want. It's quick and dirty but get's the job done! If VimScript becomes too cumbersome, I can use Lua for NeoVim scripting.
      @@ -7670,23 +7670,23 @@ jgs (________\ \ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
      check_dependencies () {
      -    # At least, Bash 5 is required
      -    local -i required_version=5
      -    IFS=. read -ra version <<< "$BASH_VERSION"
      -    if [ "${version[0]}" -lt $required_version ]; then
      -        log ERROR "ERROR, \"bash\" must be at least at major version $required_version!"
      -        exit 2
      -    fi
      -
      -    # These must be the GNU versions of the commands
      -    for tool in $DATE $SED $GREP; do
      -        if ! $tool --version | grep -q GNU; then
      -            log ERROR "ERROR, \"$tool\" command is not the GNU version, please install!"
      -            exit 2
      -        fi
      -    done
      -}
      +
      check_dependencies () {
      +    # At least, Bash 5 is required
      +    local -i required_version=5
      +    IFS=. read -ra version <<< "$BASH_VERSION"
      +    if [ "${version[0]}" -lt $required_version ]; then
      +        log ERROR "ERROR, \"bash\" must be at least at major version $required_version!"
      +        exit 2
      +    fi
      +
      +    # These must be the GNU versions of the commands
      +    for tool in $DATE $SED $GREP; do
      +        if ! $tool --version | grep -q GNU; then
      +            log ERROR "ERROR, \"$tool\" command is not the GNU version, please install!"
      +            exit 2
      +        fi
      +    done
      +}
       

      Especially macOS users didn't read the README carefully enough to install GNU Grep, GNU Sed and GNU Date before using Gemtexter.
      @@ -7707,7 +7707,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
      ./gemtexter --generate '.*hello.*'
      +
      ./gemtexter --generate '.*hello.*'
       

      Revamped git support


      diff --git a/gemfeed/index.html b/gemfeed/index.html index 3a7cfd48..8eded312 100644 --- a/gemfeed/index.html +++ b/gemfeed/index.html @@ -8,6 +8,9 @@ +

      +View this page as Markdown | Gemtext +

      Gemfeed of foo.zone



      To be in the .zone!


      @@ -84,7 +87,7 @@ 2008-12-29 - Using my Nokia N95 for fixing my MTA
      2008-06-26 - Perl Poetry
      -- cgit v1.2.3