From 76f252524871b203ac11279511ea0adcf8b1386c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 21 Feb 2025 11:09:28 +0200 Subject: Update content for html --- gemfeed/2008-06-26-perl-poetry.html | 186 +- ...12-29-using-my-nokia-n95-for-fixing-my-mta.html | 13 +- .../nokia-n95.jpg | Bin 379578 -> 0 bytes gemfeed/2009-02-13-sgi-onyx-3200.html | 89 + gemfeed/2010-04-09-standard-ml-and-haskell.html | 198 +- ...010-05-07-lazy-evaluation-with-standarn-ml.html | 15 +- .../2010-05-09-the-fype-programming-language.html | 176 +- .../2011-05-07-perl-daemon-service-framework.html | 171 +- .../2014-03-24-the-fibonacci.pl.c-polyglot.html | 205 +- ...2-05-run-debian-on-your-phone-with-debroid.html | 199 +- .../Deboroid.png | Bin 576510 -> 0 bytes gemfeed/2016-04-03-offsite-backup-with-zfs.html | 19 +- ...04-09-jails-and-zfs-on-freebsd-with-puppet.html | 41 +- .../2016-04-16-offsite-backup-with-zfs-part2.html | 11 +- ...inning-up-my-own-authoritative-dns-servers.html | 36 +- ...20-object-oriented-programming-with-ansi-c.html | 85 +- ...alistic-load-testing-with-ioriot-for-linux.html | 86 +- .../figure1-ioriot-io-recording.png | Bin 220247 -> 0 bytes .../figure2-ioriot-test-preparation.png | Bin 208235 -> 0 bytes .../figure3-ioriot-replay.png | Bin 417034 -> 0 bytes .../figure4-ioriot-read-latency.png | Bin 39552 -> 0 bytes .../figure5-ioriot-write-latency.png | Bin 26547 -> 0 bytes .../figure6-iostat.png | Bin 294346 -> 0 bytes ...-22-dtail-the-distributed-log-tail-program.html | 61 +- .../dgrep.gif | Bin 142329 -> 0 bytes .../dtail.gif | Bin 1984520 -> 0 bytes .../title.png | Bin 84933 -> 0 bytes gemfeed/2021-04-24-welcome-to-the-geminispace.html | 75 +- .../amfora-screenshot.png | Bin 154951 -> 0 bytes .../lagrange-screenshot.png | Bin 104677 -> 0 bytes ...021-05-16-personal-bash-coding-style-guide.html | 379 +- ...5-gemtexter-one-bash-script-to-rule-it-all.html | 116 +- .../blog-engine.jpg | Bin 41291 -> 0 bytes gemfeed/2021-07-04-the-well-grounded-rubyist.html | 50 +- .../book-backside.jpg | Bin 179996 -> 0 bytes .../book-cover.jpg | Bin 140259 -> 0 bytes ...-08-01-on-being-pedantic-about-open-source.html | 60 +- gemfeed/2021-09-12-keep-it-simple-and-stupid.html | 68 +- gemfeed/2021-10-22-defensive-devops.html | 58 +- gemfeed/2021-11-29-bash-golf-part-1.html | 60 +- ...-12-26-how-to-stay-sane-as-a-devops-person.html | 68 +- gemfeed/2022-01-01-bash-golf-part-2.html | 59 +- gemfeed/2022-01-23-welcome-to-the-foo.zone.html | 17 +- ...022-02-04-computer-operating-systems-i-use.html | 78 +- gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html | 71 +- gemfeed/2022-04-10-creative-universe.html | 75 +- .../2022-05-27-perl-is-still-a-great-choice.html | 47 +- .../googletrendsperl.jpg | Bin 18537 -> 0 bytes .../regular_expressions.png | Bin 107151 -> 0 bytes gemfeed/2022-06-15-sweating-the-small-stuff.html | 99 +- .../jsmstrade.png | Bin 13636 -> 0 bytes .../2022-06-15-sweating-the-small-stuff/ninja.jpg | Bin 302772 -> 0 bytes ...22-07-30-lets-encrypt-with-openbsd-and-rex.html | 65 +- ...2-08-27-gemtexter-1.1.0-lets-gemtext-again.html | 98 +- gemfeed/2022-09-30-after-a-bad-nights-sleep.html | 63 +- .../2022-10-30-installing-dtail-on-openbsd.html | 80 +- ...-tried-emacs-but-i-switched-back-to-neovim.html | 67 +- ...22-12-24-ultrarelearning-java-my-takeaways.html | 55 +- .../effective-java.jpg | Bin 187342 -> 0 bytes .../learnjava.jpg | Bin 69628 -> 0 bytes gemfeed/2023-01-23-why-grapheneos-rox.html | 64 +- .../2023-02-26-how-to-shut-down-after-work.html | 39 +- ...-03-16-the-pragmatic-programmer-book-notes.html | 33 +- ...03-25-gemtexter-2.0.0-lets-gemtext-again-2.html | 81 +- ...4-01-never-split-the-difference-book-notes.html | 64 +- ...ithms-and-data-structures-in-golang-part-1.html | 275 - gemfeed/2023-05-01-unveiling-guprecords | 1 + ...iling-guprecords:-uptime-records-with-raku.html | 42 +- ...3-05-06-the-obstacle-is-the-way-book-notes.html | 70 +- ...3-06-01-kiss-server-monitoring-with-gogios.html | 160 +- .../gogios-small.png | Bin 56698 -> 0 bytes ...17-career-guide-and-soft-skills-book-notes.html | 116 +- ...07-21-gemtexter-2.1.0-lets-gemtext-again-3.html | 66 +- ...-08-18-site-reliability-engineering-part-1.html | 40 +- ...-08-19-site-reliability-engineering-part-2.html | 67 - ...-08-20-site-reliability-engineering-part-3.html | 76 - gemfeed/2023-09-25-dtail-usage-examples.html | 158 +- ...static-web-photo-albums-with-photoalbum.sh.html | 157 +- gemfeed/2023-11-11-mind-management-book-notes.html | 59 +- ...-11-19-site-reliability-engineering-part-2.html | 70 + gemfeed/2023-12-10-bash-golf-part-3.html | 435 + ...-01-09-site-reliability-engineering-part-3.html | 84 + .../2024-01-13-one-reason-why-i-love-openbsd.html | 89 + ...4-02-04-from-babylon5.buetow.org-to-.cloud.html | 205 + ...quickly-logging-ideas-programmed-in-golang.html | 80 + ...-04-01-KISS-high-availability-with-OpenBSD.html | 352 + .../2024-05-01-slow-productivity-book-notes.html | 176 + ...03-projects-i-currently-dont-have-time-for.html | 335 + ...2024-06-23-terminal-multiplexing-with-tmux.html | 442 + gemfeed/2024-07-05-random-weird-things.html | 403 + .../2024-07-07-the-stoic-challenge-book-notes.html | 92 + .../2024-08-05-typing-127.1-words-per-minute.html | 254 + gemfeed/2024-09-07-projects-i-support.html | 127 + ...-09-07-site-reliability-engineering-part-4.html | 93 + ...10-02-gemtexter-3.0.0-lets-gemtext-again-4.html | 110 + gemfeed/2024-10-24-staff-engineer-book-notes.html | 157 + ...4-11-17-f3s-kubernetes-with-freebsd-part-1.html | 196 + ...4-12-03-f3s-kubernetes-with-freebsd-part-2.html | 375 + gemfeed/2024-12-15-random-helix-themes.html | 121 + ...-01-01-posts-from-october-to-december-2024.html | 358 + .../2025-01-15-working-with-an-sre-interview.html | 201 + ...5-02-01-f3s-kubernetes-with-freebsd-part-3.html | 427 + gemfeed/2025-02-08-random-weird-things-ii.html | 291 + gemfeed/4 | 239 + .../DRAFT-f3s-kubernetes-with-freebsd-part-4.html | 345 + gemfeed/DRAFT-site-reliability-engineering.html | 27 +- .../logo-small.png | Bin 0 -> 63314 bytes .../screenshot-android.png | Bin 0 -> 45089 bytes gemfeed/atom.xml | 12751 ++++++++++--------- gemfeed/bash-golf-part-3/bash-fork-bomb.jpg | Bin 0 -> 209399 bytes .../dgrep.gif | Bin 0 -> 142329 bytes .../dtail.gif | Bin 0 -> 1984520 bytes .../title.png | Bin 0 -> 84933 bytes .../f3s-kubernetes-with-freebsd-part-1/diagram.png | Bin 0 -> 479024 bytes .../f3s-kubernetes-with-freebsd-part-1/f3slogo.png | Bin 0 -> 185496 bytes .../3beelinks.jpg | Bin 0 -> 244333 bytes .../f3s-collage1.jpg | Bin 0 -> 76514 bytes .../f3s-collage2.jpg | Bin 0 -> 105206 bytes .../f3s-kubernetes-with-freebsd-part-2/switch.jpg | Bin 0 -> 73109 bytes .../f3s-kubernetes-with-freebsd-part-2/watt.jpg | Bin 0 -> 208816 bytes .../apc-back-ups.jpg | Bin 0 -> 295558 bytes .../f3s-changes.jpg | Bin 0 -> 54543 bytes .../from-.org-to-.cloud/old-man-yells-at-cloud.jpg | Bin 0 -> 48052 bytes .../blog-engine.jpg | Bin 0 -> 41291 bytes gemfeed/index.html | 41 +- .../gogios-small.png | Bin 0 -> 56698 bytes .../googletrendsperl.jpg | Bin 0 -> 18537 bytes .../regular_expressions.png | Bin 0 -> 107151 bytes gemfeed/random-weird-things-ii/css-conway.png | Bin 0 -> 150862 bytes gemfeed/random-weird-things-ii/go-font-code.png | Bin 0 -> 88459 bytes gemfeed/random-weird-things-ii/sqlite-gem.png | Bin 0 -> 121177 bytes .../figure1-ioriot-io-recording.png | Bin 0 -> 220247 bytes .../figure2-ioriot-test-preparation.png | Bin 0 -> 208235 bytes .../figure3-ioriot-replay.png | Bin 0 -> 417034 bytes .../figure4-ioriot-read-latency.png | Bin 0 -> 39552 bytes .../figure5-ioriot-write-latency.png | Bin 0 -> 26547 bytes .../figure6-iostat.png | Bin 0 -> 294346 bytes .../Deboroid.png | Bin 0 -> 576510 bytes gemfeed/sgi-onyx-3200/collage.webp | Bin 0 -> 63022 bytes gemfeed/sgi-onyx-3200/collage2.webp | Bin 0 -> 55770 bytes gemfeed/sgi-onyx-3200/desk.webp | Bin 0 -> 254420 bytes gemfeed/sweating-the-small-stuff/jsmstrade.png | Bin 0 -> 13636 bytes gemfeed/sweating-the-small-stuff/ninja.jpg | Bin 0 -> 302772 bytes .../tmux-session-fzf.png | Bin 0 -> 34897 bytes .../tmux-tree-view.png | Bin 0 -> 56847 bytes .../the-well-grounded-rubyist/book-backside.jpg | Bin 0 -> 179996 bytes gemfeed/the-well-grounded-rubyist/book-cover.jpg | Bin 0 -> 140259 bytes .../all-time-stats.png | Bin 0 -> 39542 bytes gemfeed/typing-127.1-words-per-minute/glove80.jpg | Bin 0 -> 226313 bytes gemfeed/typing-127.1-words-per-minute/kinesis1.jpg | Bin 0 -> 179598 bytes gemfeed/typing-127.1-words-per-minute/kinesis2.jpg | Bin 0 -> 164451 bytes .../typing-speed-over-lessons.png | Bin 0 -> 107464 bytes .../effective-java.jpg | Bin 0 -> 187342 bytes .../learnjava.jpg | Bin 0 -> 69628 bytes .../nokia-n95.jpg | Bin 0 -> 379578 bytes .../amfora-screenshot.png | Bin 0 -> 154951 bytes .../lagrange-screenshot.png | Bin 0 -> 104677 bytes 157 files changed, 15393 insertions(+), 8450 deletions(-) delete mode 100644 gemfeed/2008-12-29-using-my-nokia-n95-for-fixing-my-mta/nokia-n95.jpg create mode 100644 gemfeed/2009-02-13-sgi-onyx-3200.html delete mode 100644 gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid/Deboroid.png delete mode 100644 gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure1-ioriot-io-recording.png delete mode 100644 gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure2-ioriot-test-preparation.png delete mode 100644 gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure3-ioriot-replay.png delete mode 100644 gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure4-ioriot-read-latency.png delete mode 100644 gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure5-ioriot-write-latency.png delete mode 100644 gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure6-iostat.png delete mode 100644 gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dgrep.gif delete mode 100644 gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dtail.gif delete mode 100644 gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/title.png delete mode 100644 gemfeed/2021-04-24-welcome-to-the-geminispace/amfora-screenshot.png delete mode 100644 gemfeed/2021-04-24-welcome-to-the-geminispace/lagrange-screenshot.png delete mode 100644 gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg delete mode 100644 gemfeed/2021-07-04-the-well-grounded-rubyist/book-backside.jpg delete mode 100644 gemfeed/2021-07-04-the-well-grounded-rubyist/book-cover.jpg delete mode 100644 gemfeed/2022-05-27-perl-is-still-a-great-choice/googletrendsperl.jpg delete mode 100644 gemfeed/2022-05-27-perl-is-still-a-great-choice/regular_expressions.png delete mode 100644 gemfeed/2022-06-15-sweating-the-small-stuff/jsmstrade.png delete mode 100644 gemfeed/2022-06-15-sweating-the-small-stuff/ninja.jpg delete mode 100644 gemfeed/2022-12-24-ultrarelearning-java-my-takeaways/effective-java.jpg delete mode 100644 gemfeed/2022-12-24-ultrarelearning-java-my-takeaways/learnjava.jpg delete mode 100644 gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.html create mode 100644 gemfeed/2023-05-01-unveiling-guprecords delete mode 100644 gemfeed/2023-06-01-kiss-server-monitoring-with-gogios/gogios-small.png delete mode 100644 gemfeed/2023-08-19-site-reliability-engineering-part-2.html delete mode 100644 gemfeed/2023-08-20-site-reliability-engineering-part-3.html create mode 100644 gemfeed/2023-11-19-site-reliability-engineering-part-2.html create mode 100644 gemfeed/2023-12-10-bash-golf-part-3.html create mode 100644 gemfeed/2024-01-09-site-reliability-engineering-part-3.html create mode 100644 gemfeed/2024-01-13-one-reason-why-i-love-openbsd.html create mode 100644 gemfeed/2024-02-04-from-babylon5.buetow.org-to-.cloud.html create mode 100644 gemfeed/2024-03-03-a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang.html create mode 100644 gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html create mode 100644 gemfeed/2024-05-01-slow-productivity-book-notes.html create mode 100644 gemfeed/2024-05-03-projects-i-currently-dont-have-time-for.html create mode 100644 gemfeed/2024-06-23-terminal-multiplexing-with-tmux.html create mode 100644 gemfeed/2024-07-05-random-weird-things.html create mode 100644 gemfeed/2024-07-07-the-stoic-challenge-book-notes.html create mode 100644 gemfeed/2024-08-05-typing-127.1-words-per-minute.html create mode 100644 gemfeed/2024-09-07-projects-i-support.html create mode 100644 gemfeed/2024-09-07-site-reliability-engineering-part-4.html create mode 100644 gemfeed/2024-10-02-gemtexter-3.0.0-lets-gemtext-again-4.html create mode 100644 gemfeed/2024-10-24-staff-engineer-book-notes.html create mode 100644 gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html create mode 100644 gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html create mode 100644 gemfeed/2024-12-15-random-helix-themes.html create mode 100644 gemfeed/2025-01-01-posts-from-october-to-december-2024.html create mode 100644 gemfeed/2025-01-15-working-with-an-sre-interview.html create mode 100644 gemfeed/2025-02-01-f3s-kubernetes-with-freebsd-part-3.html create mode 100644 gemfeed/2025-02-08-random-weird-things-ii.html create mode 100644 gemfeed/4 create mode 100644 gemfeed/DRAFT-f3s-kubernetes-with-freebsd-part-4.html create mode 100644 gemfeed/a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang/logo-small.png create mode 100644 gemfeed/a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang/screenshot-android.png create mode 100644 gemfeed/bash-golf-part-3/bash-fork-bomb.jpg create mode 100644 gemfeed/dtail-the-distributed-log-tail-program/dgrep.gif create mode 100644 gemfeed/dtail-the-distributed-log-tail-program/dtail.gif create mode 100644 gemfeed/dtail-the-distributed-log-tail-program/title.png create mode 100644 gemfeed/f3s-kubernetes-with-freebsd-part-1/diagram.png create mode 100644 gemfeed/f3s-kubernetes-with-freebsd-part-1/f3slogo.png create mode 100644 gemfeed/f3s-kubernetes-with-freebsd-part-2/3beelinks.jpg create mode 100644 gemfeed/f3s-kubernetes-with-freebsd-part-2/f3s-collage1.jpg create mode 100644 gemfeed/f3s-kubernetes-with-freebsd-part-2/f3s-collage2.jpg create mode 100644 gemfeed/f3s-kubernetes-with-freebsd-part-2/switch.jpg create mode 100644 gemfeed/f3s-kubernetes-with-freebsd-part-2/watt.jpg create mode 100644 gemfeed/f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpg create mode 100644 gemfeed/f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpg create mode 100644 gemfeed/from-.org-to-.cloud/old-man-yells-at-cloud.jpg create mode 100644 gemfeed/gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg create mode 100644 gemfeed/kiss-server-monitoring-with-gogios/gogios-small.png create mode 100644 gemfeed/perl-is-still-a-great-choice/googletrendsperl.jpg create mode 100644 gemfeed/perl-is-still-a-great-choice/regular_expressions.png create mode 100644 gemfeed/random-weird-things-ii/css-conway.png create mode 100644 gemfeed/random-weird-things-ii/go-font-code.png create mode 100644 gemfeed/random-weird-things-ii/sqlite-gem.png create mode 100644 gemfeed/realistic-load-testing-with-ioriot-for-linux/figure1-ioriot-io-recording.png create mode 100644 gemfeed/realistic-load-testing-with-ioriot-for-linux/figure2-ioriot-test-preparation.png create mode 100644 gemfeed/realistic-load-testing-with-ioriot-for-linux/figure3-ioriot-replay.png create mode 100644 gemfeed/realistic-load-testing-with-ioriot-for-linux/figure4-ioriot-read-latency.png create mode 100644 gemfeed/realistic-load-testing-with-ioriot-for-linux/figure5-ioriot-write-latency.png create mode 100644 gemfeed/realistic-load-testing-with-ioriot-for-linux/figure6-iostat.png create mode 100644 gemfeed/run-debian-on-your-phone-with-debroid/Deboroid.png create mode 100644 gemfeed/sgi-onyx-3200/collage.webp create mode 100644 gemfeed/sgi-onyx-3200/collage2.webp create mode 100644 gemfeed/sgi-onyx-3200/desk.webp create mode 100644 gemfeed/sweating-the-small-stuff/jsmstrade.png create mode 100644 gemfeed/sweating-the-small-stuff/ninja.jpg create mode 100644 gemfeed/terminal-multiplexing-with-tmux/tmux-session-fzf.png create mode 100644 gemfeed/terminal-multiplexing-with-tmux/tmux-tree-view.png create mode 100644 gemfeed/the-well-grounded-rubyist/book-backside.jpg create mode 100644 gemfeed/the-well-grounded-rubyist/book-cover.jpg create mode 100644 gemfeed/typing-127.1-words-per-minute/all-time-stats.png create mode 100644 gemfeed/typing-127.1-words-per-minute/glove80.jpg create mode 100644 gemfeed/typing-127.1-words-per-minute/kinesis1.jpg create mode 100644 gemfeed/typing-127.1-words-per-minute/kinesis2.jpg create mode 100644 gemfeed/typing-127.1-words-per-minute/typing-speed-over-lessons.png create mode 100644 gemfeed/ultrarelearning-java-my-takeaways/effective-java.jpg create mode 100644 gemfeed/ultrarelearning-java-my-takeaways/learnjava.jpg create mode 100644 gemfeed/using-my-nokia-n95-for-fixing-my-mta/nokia-n95.jpg create mode 100644 gemfeed/welcome-to-the-geminispace/amfora-screenshot.png create mode 100644 gemfeed/welcome-to-the-geminispace/lagrange-screenshot.png (limited to 'gemfeed') diff --git a/gemfeed/2008-06-26-perl-poetry.html b/gemfeed/2008-06-26-perl-poetry.html index fd8f4af1..dafdc671 100644 --- a/gemfeed/2008-06-26-perl-poetry.html +++ b/gemfeed/2008-06-26-perl-poetry.html @@ -8,10 +8,19 @@ -

Perl Poetry


+

+Home | Markdown | Gemini +

+

Perl Poetry



Published at 2008-06-26T21:43:51+01:00; Updated at 2021-05-04

+Here are some Perl Poems I wrote. They don't do anything useful when you run them, but they don't produce a compiler error either. They only exist for fun and demonstrate what you can do with Perl syntax.
+
+Wikipedia: "Perl poetry is the practice of writing poems that can be compiled as legal Perl code, for example the piece known as Black Perl. Perl poetry is made possible by the large number of English words that are used in the Perl language. New poems are regularly submitted to the community at PerlMonks."
+
+https://en.wikipedia.org/wiki/Perl
+
  '\|/'                                  *
 -- * -----
@@ -35,164 +44,167 @@ _~~|~/_|_|__/|~~~~~~~ |  / ~~~~~ |   | ~~~~~~~~
                     (__)         (____)
 

-Here are some Perl Poems I wrote. They don't do anything useful when you run them, but they don't produce a compiler error either. They only exist for fun and demonstrate what you can do with Perl syntax.
-
-Wikipedia: "Perl poetry is the practice of writing poems that can be compiled as legal Perl code, for example the piece known as Black Perl. Perl poetry is made possible by the large number of English words that are used in the Perl language. New poems are regularly submitted to the community at PerlMonks."
-
-https://en.wikipedia.org/wiki/Perl
+

Table of Contents



-

math.pl


+
+

math.pl



-
#!/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;
+#at
+home: //ig,'nore', time and sleep $very =~ s/tr/on/g;
 __END__
 
 

-

christmas.pl


+

christmas.pl



-
#!/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
+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;
+;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__
 
-This is perl, v5.8.8 built for i386-freebsd-64int
+This is perl, v5.8.8 built for i386-freebsd-64int
 

-

shopping.pl


+

shopping.pl



-
#!/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
+This is perl, v5.8.8 built for i386-freebsd-64int
 

-

More...


+

More...



Did you like what you saw? Have a look at Codeberg to see my other poems too:

https://codeberg.org/snonux/perl-poetry

+E-Mail your comments to paul@nospam.buetow.org :-)
+
Other related posts are:

-2008-06-26 Perl Poetry (You are currently reading this)
-2011-05-07 Perl Daemon (Service Framework)
2022-05-27 Perl is still a great choice
-
-E-Mail your comments to paul@nospam.buetow.org :-)
+2011-05-07 Perl Daemon (Service Framework)
+2008-06-26 Perl Poetry (You are currently reading this)

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 2e586e6b..7fb67c20 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,7 +8,10 @@ -

Using my Nokia N95 for fixing my MTA


+

+Home | Markdown | Gemini +

+

Using my Nokia N95 for fixing my MTA



Published at 2008-12-29T09:10:41+00:00; Updated at 2021-12-01

@@ -32,7 +35,7 @@ _jgs_\|//_\\|///_\V/_\|//__
My first attempt to find an internet café, which was working during Christmastime, failed. However, I found with my N95 phone lots of free WLAN hotspots. The hotspots refused me logging into my server using SSH as I have configured a non-standard port for SSH for security reasons. Without knowing the costs, I used the GPRS internet access of my German phone provider (yes, I had to pay roaming fees).

-Picture of a Nokia N95
+Picture of a Nokia N95

With Putty for N95 and configuring Postfix with Vim and the T9 input mechanism, I managed to fix the problem. But it took half of an hour:

@@ -50,9 +53,9 @@ _jgs_\|//_\\|///_\V/_\|//__
Back to the main site
diff --git a/gemfeed/2008-12-29-using-my-nokia-n95-for-fixing-my-mta/nokia-n95.jpg b/gemfeed/2008-12-29-using-my-nokia-n95-for-fixing-my-mta/nokia-n95.jpg deleted file mode 100644 index 6a11be8b..00000000 Binary files a/gemfeed/2008-12-29-using-my-nokia-n95-for-fixing-my-mta/nokia-n95.jpg and /dev/null differ diff --git a/gemfeed/2009-02-13-sgi-onyx-3200.html b/gemfeed/2009-02-13-sgi-onyx-3200.html new file mode 100644 index 00000000..b8a894a2 --- /dev/null +++ b/gemfeed/2009-02-13-sgi-onyx-3200.html @@ -0,0 +1,89 @@ + + + + +SGI Onyx 3200 + + + + + +

+Home | Markdown | Gemini +

+

SGI Onyx 3200


+
+Published at 2025-02-13T21:17:16+02:00
+
+For nostalgia, I've kept this output of the 'dmesg' around. It's from an SGI Onyx 3200 graphics supercomputer running IRIX with the following specs:
+
+
    +
  • 4 x 400 MHz IP35 MIPS CPUs
  • +
  • 4GB of RAM
  • +

+./sgi-onyx-3200/desk.webp
+
+We used this monster when I was a student worker at the Fraunhofer Institute for Production Technology around the year 2006. It operated a walk-in 2-sided 3D cave (unfortunately, I don't have any pictures of that cave), where you could literally walk around with a set of VR glasses and see everything in 3D (that was when there wasn't any Oculus Quest yet). That was useful for running industrial simulations.
+
+
+4 400 MHZ IP35 Processors
+CPU: MIPS R12000 Processor Chip Revision: 3.5
+FPU: MIPS R12010 Floating Point Chip Revision: 3.5
+Main memory size: 4096 Mbytes
+Instruction cache size: 32 Kbytes
+Data cache size: 32 Kbytes
+Secondary unified instruction/data cache size: 8 Mbytes
+Integral SCSI controller 8: Version Fibre Channel QL2200A
+Integral SCSI controller 6: Version QL12160, single ended
+Integral SCSI controller 7: Version QL12160, low voltage differential
+Integral SCSI controller 9: Version IEEE1394 SBP2
+  IEEE1394 CDROM: node 1010031001a454 port 0 on SCSI controller 9
+Integral SCSI controller 0: Version Fibre Channel QL2200A
+  Disk drive: unit 1 on SpCSI controller 0
+  Disk drive: unit 2 on SCSI controller 0
+Integral SCSI controller 5: Version IEEE1394 SBP2
+  IEEE1394 CDROM: node 1010031001c080 port 0 on SCSI controller 5
+IOC3 serial port: tty3
+IOC3 serial port: tty4
+IOC3 serial port: tty10
+IOC3 serial port: tty11
+IOC3 serial port: tty12
+IOC3 serial port: tty5
+IOC3 serial port: tty6
+IOC3 serial port: tty7
+IOC3 serial port: tty8
+IOC3 serial port: tty9
+Graphics board: InfiniteReality3
+Graphics board: InfiniteReality3
+Gigabit Ethernet: eg0, module 001c04, pci_bus 2, pci_slot 2, firmware version 12.4.10
+Fast Ethernet: ef1, version 1, module 001c07, pci 4
+Integral Fast Ethernet: ef0, version 1, module 001c04, pci 4
+Iris Audio Processor: version RAD revision 13.0, number 1
+IOC3 external interrupts: 2
+IOC3 external interrupts: 1
+IEEE 1394 High performance serial bus controller 0: Type: OHCI, Version 0 0
+IEEE 1394 High performance serial bus controller 1: Type: OHCI, Version 0 0
+USB controller: type OHCI
+USB Human Interface Device: device id 1 type keyboard
+USB Human Interface Device: device id 1 type mouse
+USB controller: type OHCI
+USB Human Interface Device: device id 0 type keyboard
+USB Human Interface Device: device id 0 type mouse
+
+
+./sgi-onyx-3200/collage.webp
+
+I was mainly working on drilling simulations on this machine. Sometimes I worked directly at one of the 2 terminal screens of the Onyx, or often I used a nearby Linux machine and forwarded the X11 windows to my local screen.
+
+./sgi-onyx-3200/collage2.webp
+
+E-Mail your comments to paul@nospam.buetow.org :-)
+
+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 b7272b73..fb72b09b 100644 --- a/gemfeed/2010-04-09-standard-ml-and-haskell.html +++ b/gemfeed/2010-04-09-standard-ml-and-haskell.html @@ -8,7 +8,10 @@ -

Standard ML and Haskell


+

+Home | Markdown | Gemini +

+

Standard ML and Haskell



Published at 2010-04-09T22:57:36+01:00

@@ -18,7 +21,18 @@
Haskell is also a "pure functional" programming language, whereas SML also makes explicit use of imperative concepts. I am by far not a specialist in either of these languages, but here are a few functions implemented in both SML and Haskell:

-

Defining a multi-data type


+

Table of Contents


+
+
+

Defining a multi-data type



Standard ML:

@@ -26,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:
@@ -38,14 +52,14 @@ 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


+

Processing a multi



Standard ML:

@@ -53,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:
@@ -67,14 +81,14 @@ 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


+

Simplify function



Standard ML:

@@ -82,19 +96,19 @@ test_number w = number ( -
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:
@@ -103,20 +117,20 @@ 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


+

Delete all



Standard ML:

@@ -124,12 +138,12 @@ simplify x = x 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:
@@ -138,14 +152,14 @@ 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


+

Delete one



Standard ML:

@@ -153,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:
@@ -176,22 +190,22 @@ 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
+
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)
+    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


+

Higher-order functions



The first line is always the SML code, the second line the Haskell variant:

@@ -213,9 +227,9 @@ 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 534aa6d7..b2f80223 100644 --- a/gemfeed/2010-05-07-lazy-evaluation-with-standarn-ml.html +++ b/gemfeed/2010-05-07-lazy-evaluation-with-standarn-ml.html @@ -8,7 +8,10 @@ -

Lazy Evaluation with Standard ML


+

+Home | Markdown | Gemini +

+

Lazy Evaluation with Standard ML



Published at 2010-05-07T08:17:59+01:00

@@ -32,7 +35,7 @@
You can solve specific problems with lazy evaluation easier than with eager evaluation. For example, you might want to list the number Pi or another infinite list of something. With the help of lazy evaluation, each element of the list is calculated when it is accessed first, but not earlier.

-

Emulating lazy evaluation in SML


+

Emulating lazy evaluation in SML



However, it is possible to emulate lazy evaluation in most eager evaluation languages. This is how it is done with Standard ML (with some play with an infinite list of natural number tuples filtering out 0 elements):

@@ -78,7 +81,7 @@ val test = first 10 (nat_pairs_not_null ());
http://smlnj.org/

-

Real laziness with Haskell


+

Real laziness with Haskell



As Haskell already uses lazy evaluation by default, there is no need to construct a new data type. Lists in Haskell are lazy by default. You will notice that the code is also much shorter and easier to understand than the SML version.

@@ -110,9 +113,9 @@ 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 d71fcfe1..35a1d906 100644 --- a/gemfeed/2010-05-09-the-fype-programming-language.html +++ b/gemfeed/2010-05-09-the-fype-programming-language.html @@ -8,10 +8,19 @@ -

The Fype Programming Language


+

+Home | Markdown | Gemini +

+

The Fype Programming Language



Published at 2010-05-09T12:48:29+01:00; Updated at 2021-05-05

+Fype is an interpreted programming language created by me for learning and fun. The interpreter is written in C. It has been tested on FreeBSD and NetBSD and may also work on other Unix like operating systems such as Linux based ones. Besides learning and fun, there is no other use case of why Fype exists as many other programming languages are much faster and more powerful.
+
+The Fype syntax is straightforward and uses a maximum look ahead of 1 and an effortless top-down parsing mechanism. Fype is parsing and interpreting its code simultaneously. This means that syntax errors are only detected during program runtime.
+
+Fype is a recursive acronym and means "Fype is For Your Program Execution" or "Fype is Free Yak Programmed for ELF". You could also say, "It's not a hype - it's Fype!".
+
       ____                                      _        __       
      / / _|_   _ _ __   ___    _   _  ___  __ _| |__    / _|_   _ 
@@ -21,13 +30,36 @@
            |___/|_|            |___/                        |___/ 
 

-Fype is an interpreted programming language created by me for learning and fun. The interpreter is written in C. It has been tested on FreeBSD and NetBSD and may also work on other Unix like operating systems such as Linux based ones. Besides learning and fun, there is no other use case of why Fype exists as many other programming languages are much faster and more powerful.
+

Table of Contents



-The Fype syntax is straightforward and uses a maximum look ahead of 1 and an effortless top-down parsing mechanism. Fype is parsing and interpreting its code simultaneously. This means that syntax errors are only detected during program runtime.
-
-Fype is a recursive acronym and means "Fype is For Your Program Execution" or "Fype is Free Yak Programmed for ELF". You could also say, "It's not a hype - it's Fype!".
-
-

Object-oriented C style


+
+

Object-oriented C style



The Fype interpreter is written in an object-oriented style of C. Each "main component" has its own .h and .c file. There is a struct type for each (most components at least) component, which can be initialized using a "COMPONENT_new" function and destroyed using a "COMPONENT_delete" function. Method calls follow the same schema, e.g. "COMPONENT_METHODNAME". There is no such as class inheritance and polymorphism involved.

@@ -37,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":
@@ -51,56 +83,56 @@ 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


+

Data types



Fype uses auto type conversion. However, if you want to know what's going on, you may take a look at the following basic data types:
    @@ -114,13 +146,13 @@ http://www.gnu.org/software/src-highlite -->

There is no boolean type, but we can use the integer values 0 for false and 1 for true. There is support for explicit type casting too.

-

Syntax


+

Syntax



-

Comments


+

Comments



Text from a # character until the end of the current line is considered being a comment. Multi-line comments may start with an #* and with a *# anywhere. Exceptions are if those signs are inside of strings.

-

Variables


+

Variables



Variables are defined with the "my" keyword (inspired by Perl :-). If you don't assign a value during declaration, it uses the default integer value 0. Variables may be changed during program runtime. Variables may be deleted using the "undef" keyword! Example:

@@ -151,7 +183,7 @@ if defined foo { }

-

Synonyms


+

Synonyms



Each variable can have as many synonyms as wished. A synonym is another name to access the content of a specific variable. Here is an example of how to use it:

@@ -193,7 +225,7 @@ undef baz; say syms foo; # Prints 1

-

Statements and expressions


+

Statements and expressions



A Fype program is a list of statements. Each keyword, expression or function call is part of a statement. Each statement is ended with a semicolon. Example:

@@ -203,11 +235,11 @@ say foo; exit foo - bar;

-

Parenthesis


+

Parenthesis



All parenthesis for function arguments is optional. They help to make the code better readable. They also help to force the precedence of expressions.

-

Basic expressions


+

Basic expressions



Any "any" value holding a string will be automatically converted to an integer value.

@@ -225,7 +257,7 @@ exit foo - bar; (integer) not <any>

-

Bitwise expressions


+

Bitwise expressions



 (integer) <any> :< <any>
@@ -235,7 +267,7 @@ exit foo - bar;
 (integer) <any> xor <any>
 

-

Numeric expressions


+

Numeric expressions



 (number) neg <number>
@@ -260,7 +292,7 @@ exit foo - bar;
 if yes { say no defined foo; } 
 

-

Control statements


+

Control statements



Control statements available in Fype:

@@ -288,7 +320,7 @@ until <expression> { <statements> }
... runs the statements as long as the expression evaluates to a false value.

-

Scopes


+

Scopes



A new scope starts with an { and ends with an }. An exception is a procedure, which does not use its own scope (see later in this manual). Control statements and functions support scopes. The "scope" function prints out all available symbols at the current scope. Here is a small example:

@@ -339,7 +371,7 @@ SYM_VARIABLE: var4 (id=00035, line=-0001, pos=-001, type=TT_INTEGER, dval=0.0000 SYM_FUNCTION: bar

-

Definedness


+

Definedness



 (integer) defined <identifier>
@@ -353,7 +385,7 @@ SYM_FUNCTION: bar
 
... tries to undefine/delete the "identifier". Returns 1 if it succeeded, otherwise 0 is returned.

-

System


+

System



These are some system and interpreter specific built-in functions supported:

@@ -395,7 +427,7 @@ if pid {
It returns the number of items freed! You may wonder why most of the time, it will produce a value of 0! Fype tries to free not needed memory ASAP. This may change in future versions to gain faster execution speed!

-

I/O


+

I/O



 (any) put <any>
@@ -415,9 +447,9 @@ if pid {
 
... just prints a new line.

-

Procedures and functions


+

Procedures and functions



-

Procedures


+

Procedures



A procedure can be defined with the "proc" keyword and deleted with the "undef" keyword. A procedure does not return any value and does not support parameter passing. It's using already defined variables (e.g. global variables). A procedure does not have its own namespace. It's using the calling namespace. It is possible to define new variables inside of a procedure in the current namespace.

@@ -433,7 +465,7 @@ foo; # Run the procedure. Print out "11\n" say c; # Print out "6\n";

-

Nested procedures


+

Nested procedures



It's possible to define procedures inside of procedures. Since procedures don't have their own scope, nested procedures will be available to the current scope as soon as the main procedure has run the first time. You may use the "defined" keyword to check if a procedure has been defined or not.

@@ -456,7 +488,7 @@ bar; # Now the procedure bar is defined! foo; # Here the procedure foo will redefine bar again!

-

Functions


+

Functions



A function can be defined with the "func" keyword and deleted with the "undef" keyword. Function do not yet return values and do not yet supports parameter passing. It's using local (lexical scoped) variables. If a certain variable does not exist, when It's using already defined variables (e.g. one scope above).

@@ -472,7 +504,7 @@ foo; # Run the procedure. Print out "11\n" say c; # Will produce an error because c is out of scope!

-

Nested functions


+

Nested functions



Nested functions work the same way the nested procedures work, except that nested functions will not be available anymore after the function has been left!

@@ -489,7 +521,7 @@ foo; bar; # Will produce an error because bar is out of scope!

-

Arrays


+

Arrays



Some progress on arrays has been made too. The following example creates a multidimensional array "foo". Its first element is the return value of the func which is "bar". The fourth value is a string" 3" converted to a double number. The last element is an anonymous array which itself contains another anonymous array as its final element:

@@ -512,11 +544,11 @@ BA BB

-

Fancy stuff


+

Fancy stuff



Fancy stuff like OOP or Unicode or threading is not planed. But fancy stuff like function pointers and closures may be considered.:)

-

May the source be with you


+

May the source be with you



You can find all of this on the GitHub page. There is also an "examples" folders containing some Fype scripts!

@@ -526,9 +558,9 @@ 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 26865c9b..cbf0441c 100644 --- a/gemfeed/2011-05-07-perl-daemon-service-framework.html +++ b/gemfeed/2011-05-07-perl-daemon-service-framework.html @@ -8,10 +8,15 @@ -

Perl Daemon (Service Framework)


+

+Home | Markdown | Gemini +

+

Perl Daemon (Service Framework)



Published at 2011-05-07T22:26:02+01:00; Updated at 2021-05-07

+PerlDaemon is a minimal daemon for Linux and other Unix like operating systems programmed in Perl. It is a minimal but pretty functional and fairly generic service framework. This means that it does not do anything useful other than providing a framework for starting, stopping, configuring and logging. To do something useful, a module (written in Perl) must be provided.
+
    a'!   _,,_ a'!   _,,_     a'!   _,,_
      \\_/    \  \\_/    \      \\_/    \.-,
@@ -19,9 +24,21 @@
       //\ //\\   //\ //\\       //\ //\\jrei
 

-PerlDaemon is a minimal daemon for Linux and other Unix like operating systems programmed in Perl. It is a minimal but pretty functional and fairly generic service framework. This means that it does not do anything useful other than providing a framework for starting, stopping, configuring and logging. To do something useful, a module (written in Perl) must be provided.
+

Table of Contents



-

Features


+
+

Features



PerlDaemon supports:

@@ -35,25 +52,25 @@
  • Easy to extend
  • Multi-instance support (just use a different directory for each instance).

  • -

    Quick Guide


    +

    Quick Guide



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

    -

    How to configure


    +

    How to configure



    The daemon instance can be configured in "./conf/perldaemon.conf". If you want to change a property only once, it is also possible to specify it on the command line (which will take precedence over the config file). All available config properties can be displayed via "./control keys":

    @@ -61,33 +78,33 @@ 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


    +

    Example



    So let's start the daemon with a loop interval of 10 seconds:

    @@ -95,17 +112,17 @@ daemon.wd./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:
    @@ -114,16 +131,16 @@ Stopping daemon now... 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


    +

    HiRes event loop



    PerlDaemon uses Time::HiRes to make sure that all the events run incorrect intervals. For each loop run, a time carry value is recorded and added to the next loop run to catch up on lost time.

    -

    Writing your own modules


    +

    Writing your own modules



    -

    Example module


    +

    Example module



    This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-).

    @@ -131,38 +148,38 @@ 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


    +

    Your own module



    Want to give it some better use? It's just as easy as:

    @@ -170,36 +187,36 @@ 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 ./lib/PerlDaemonModules/
    + cp ExampleModule.pm YourModule.pm
    + vi YourModule.pm
      cd -
    - ./bin/perldaemon restart (or shortcurt ./control restart)
    + ./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).

    BTW: You can install as many modules within the same instance as desired. But they are run in sequential order (in future, they can also run in parallel using several threads or processes).

    -

    May the source be with you


    +

    May the source be with you



    You can find PerlDaemon (including the examples) at:

    https://codeberg.org/snonux/perldaemon

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2008-06-26 Perl Poetry
    -2011-05-07 Perl Daemon (Service Framework) (You are currently reading this)
    2022-05-27 Perl is still a great choice
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2011-05-07 Perl Daemon (Service Framework) (You are currently reading this)
    +2008-06-26 Perl Poetry

    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 993925f3..ef9fe4e6 100644 --- a/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html +++ b/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html @@ -8,7 +8,10 @@ -

    The fibonacci.pl.raku.c Polyglot


    +

    +Home | Markdown | Gemini +

    +

    The fibonacci.pl.raku.c Polyglot



    Published at 2014-03-24T21:32:53+00:00; Updated at 2022-04-23

    @@ -16,7 +19,7 @@
    https://en.wikipedia.org/wiki/Polyglot_(computing)

    -

    The Fibonacci numbers


    +

    The Fibonacci numbers



    For fun, I programmed my own Polyglot, which is both valid Perl, Raku, C and C++ code (I have added C++ and Raku support in 2022). The exciting part about C and C++ is that $ is a valid character to start variable names with:

    @@ -24,135 +27,135 @@ 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:

    https://codeberg.org/snonux/perl-c-fibonacci

    -

    Let's run it with C and C++


    +

    Let's run it with C and C++



    -
    % 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


    +

    Let's run it with Perl and Raku



    -
    % 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,9 +164,9 @@ fib(10 -Generated by Gemtexter 2.1.0-release | -served by OpenBSD/httpd(8) | -Site Mirrors +Generated with Gemtexter 3.0.1-develop | +served by OpenBSD/relayd(8)+httpd(8) | +Site Mirrors

    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 06f011ea..6b581b72 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,10 +8,19 @@ -

    Run Debian on your phone with Debroid


    +

    +Home | Markdown | Gemini +

    +

    Run Debian on your phone with Debroid



    Published at 2015-12-05T16:12:57+00:00; Updated at 2021-05-16

    +You can use the following tutorial to install a full-blown Debian GNU/Linux Chroot on an LG G3 D855 CyanogenMod 13 (Android 6). First of all, you need to have root permissions on your phone, and you also need to have the developer mode activated. The following steps have been tested on Linux (Fedora 23).
    +
    +
    +
    +A couple of years have passed since I last worked on Debroid. Currently, I am using the Termux app on Android, which is less sophisticated than a fully blown Debian installation but sufficient for my current requirements. The content of this site may be still relevant, and it would also work with more recent versions of Debian and Android. I would expect that some minor modifications need to be made, though.
    +
      ____       _               _     _ 
     |  _ \  ___| |__  _ __ ___ (_) __| |
    @@ -21,21 +30,25 @@
                                         
     

    -You can use the following tutorial to install a full-blown Debian GNU/Linux Chroot on an LG G3 D855 CyanogenMod 13 (Android 6). First of all, you need to have root permissions on your phone, and you also need to have the developer mode activated. The following steps have been tested on Linux (Fedora 23).
    -
    -
    -
    -

    Foreword


    -
    -A couple of years have passed since I last worked on Debroid. Currently, I am using the Termux app on Android, which is less sophisticated than a fully blown Debian installation but sufficient for my current requirements. The content of this site may be still relevant, and it would also work with more recent versions of Debian and Android. I would expect that some minor modifications need to be made, though.
    +

    Table of Contents



    -

    Step by step guide


    +
    +

    Step by step guide



    All scripts mentioned here can be found on GitHub at:

    https://codeberg.org/snonux/debroid

    -

    First debootstrap stage


    +

    First debootstrap stage



    This is to be performed on a Fedora Linux machine (could work on a Debian too, but Fedora is just what I use on my Laptop). The following steps prepare an initial Debian base image, which can then be transferred to the phone.

    @@ -44,26 +57,26 @@ 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 ]
    +# 5g
    +dd if=/dev/zero of=jessie.img bs=$[ 1024 * 1024 ] \
    +  count=$[ 1024 * 5 ]
     
    -# Show used loop devices
    +# Show used loop devices
     sudo losetup -f
    -# Store the next free one to $loop
    -loop=loopN
    -sudo losetup /dev/$loop jessie.img
    +# 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 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


    +

    Copy Debian image to the phone



    Now setup the Debian image on an external SD card on the Phone via Android Debugger as follows:

    @@ -71,45 +84,45 @@ sudo umount jessie 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
    +# 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
    +cd /storage/sdcard1/Linux
    +gunzip jessie.img.gz
     
    -# Show used loop devices
    +# Show used loop devices
     losetup -f
    -# Store the next free one to $loop
    -loop=loopN
    +# 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


    +

    Second debootstrap stage



    This is to be performed on the Android phone itself (inside a Debian chroot):

    @@ -117,14 +130,14 @@ mount | grep jessie 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
    +
    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
    +exit # Leave chroot
    +exit # Leave adb shell
     

    -

    Setup of various scripts


    +

    Setup of various scripts



    jessie.sh deals with all the loopback mount magic and so on. It will be run later every time you start Debroid on your phone.

    @@ -132,39 +145,39 @@ 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
    +
    # 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
    +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)
    +# 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
    +# 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
    +# 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
    +exit # Exit chroot
     

    -

    Entering Debroid and enable a service


    +

    Entering Debroid and enable a service



    This enters Debroid on your phone and starts the example service uptimed:

    @@ -172,22 +185,22 @@ apt-get dist-upgrade 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
    +# 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
    +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:


    +

    Include to Android startup:



    If you want to start Debroid automatically whenever your phone starts, then do the following:

    @@ -195,10 +208,10 @@ chmod 0755 /etc/rc.deb 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 push data/local/userinit.sh /data/local/userinit.sh
     adb shell
    -chmod +x /data/local/userinit.sh
    -exit
    +chmod +x /data/local/userinit.sh
    +exit
     

    Reboot & test! Enjoy!
    @@ -207,9 +220,9 @@ chmod +x /data/local/userinit
    Back to the main site
    diff --git a/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid/Deboroid.png b/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid/Deboroid.png deleted file mode 100644 index f76cf226..00000000 Binary files a/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid/Deboroid.png and /dev/null differ diff --git a/gemfeed/2016-04-03-offsite-backup-with-zfs.html b/gemfeed/2016-04-03-offsite-backup-with-zfs.html index 5c5bac1e..a94637db 100644 --- a/gemfeed/2016-04-03-offsite-backup-with-zfs.html +++ b/gemfeed/2016-04-03-offsite-backup-with-zfs.html @@ -8,7 +8,10 @@ -

    Offsite backup with ZFS


    +

    +Home | Markdown | Gemini +

    +

    Offsite backup with ZFS



    Published at 2016-04-03T22:43:42+01:00

    @@ -28,25 +31,25 @@ Offsite backup with ZFS Part 1 (you are reading this atm.)
    Offsite backup with ZFS Part 2

    -

    Please don't lose all my pictures again!


    +

    Please don't lose all my pictures again!



    When it comes to data storage and potential data loss, I am a paranoid person. It is due to my job and a personal experience I encountered over ten years ago: A single drive failure and loss of all my data (pictures, music, etc.).

    A little about my personal infrastructure: I am running my own (mostly FreeBSD based) root servers (across several countries: Two in Germany, one in Canada, one in Bulgaria) which store all my online data (E-Mail and my Git repositories). I am syncing incremental (and encrypted) ZFS snapshots between these servers forth and back so either data can be recovered from the other server.

    -

    Local storage box for offline data


    +

    Local storage box for offline data



    Also, I am operating a local server (an HP MicroServer) at home in my apartment. Full snapshots of all ZFS volumes are pulled from the "online" servers to the local server every other week and the incremental ZFS snapshots every day. That local server has a ZFS ZMIRROR with three disks configured (local triple redundancy). I keep up to half a year worth of ZFS snapshots of all volumes. That local server also contains all my offline data such as pictures, private documents, videos, books, various other backups, etc.

    Once weekly, all the local server data is copied to two external USB drives as a backup (without the historic snapshots). For simplicity, these USB drives are not formatted with ZFS but with good old UFS. This gives me a chance to recover from a (potential) ZFS disaster. ZFS is a complex thing. Sometimes it is good not to trust complicated things!

    -

    Storing it at my apartment is not enough


    +

    Storing it at my apartment is not enough



    Now I am thinking about an offsite backup of all this local data. The problem is that all the data remains on a single physical location: My local MicroServer. What happens when the house burns or my server, including the internal disks and the attached USB drives, gets stolen? My first thought was to back up everything to the "cloud". However, the significant issue here is the limited amount of available upload bandwidth (only 1MBit/s).

    The solution is adding another USB drive (2TB) with an encryption container (GELI) and a ZFS pool. The GELI encryption requires a secret key and a secret passphrase. I am updating the data to that drive once every three months (my calendar is reminding me about it), and afterwards, I keep that drive at a secret location outside of my apartment. All the information needed to decrypt (mounting the GELI container) is stored at another (secure) place. Key and passphrase are kept at different sites, though. Even if someone knew of it, he would not be able to decrypt it as some additional insider knowledge would be required as well.

    -

    Walking one round less


    +

    Walking one round less



    I am thinking of buying a second 2TB USB drive and setting it up the same way as the first one. So I could alternate the backups. One drive would be at the secret location, and the other drive would be at home. And these drives would swap place after each cycle. This would give some security about the failure of that drive, and I would have to go to the secret location only once (swapping the drives) instead of twice (picking that drive up to update the data + bringing it back to the remote location).

    @@ -54,9 +57,9 @@
    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 8d983cba..e030a2be 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,10 +8,15 @@ -

    Jails and ZFS with Puppet on FreeBSD


    +

    +Home | Markdown | Gemini +

    +

    Jails and ZFS with Puppet on FreeBSD



    Published at 2016-04-09T18:29:47+01:00

    +Over the last couple of years I wrote quite a few Puppet modules in order to manage my personal server infrastructure. One of them manages FreeBSD Jails and another one ZFS file systems. I thought I would give a brief overview in how it looks and feels.
    +
                 __     __
                (( \---/ ))
    @@ -32,9 +37,16 @@
                    \      `.
     

    -Over the last couple of years I wrote quite a few Puppet modules in order to manage my personal server infrastructure. One of them manages FreeBSD Jails and another one ZFS file systems. I thought I would give a brief overview in how it looks and feels.
    +

    Table of Contents



    -

    ZFS


    +
    +

    ZFS



    The ZFS module is a pretty basic one. It does not manage ZFS pools yet as I am not creating them often enough which would justify implementing an automation. But let's see how we can create a ZFS file system (on an already given ZFS pool named ztank):

    @@ -105,7 +117,7 @@ zsh: done df | zsh: exit 1 grep foo

    -

    Jails


    +

    Jails



    Here is an example in how a FreeBSD Jail can be created. The Jail will have its own public IPv6 address. And it will have its own internal IPv4 address with IPv4 NAT to the internet (this is due to the limitation that the host server only got one public IPv4 address which requires sharing between all the Jails).

    @@ -242,7 +254,7 @@ lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

    -

    Inside-Jail Puppet


    +

    Inside-Jail Puppet



    To automatically setup the applications running in the Jail I am using Puppet as well. I wrote a few scripts which bootstrap Puppet inside of a newly created Jail. It is doing the following:

    @@ -383,7 +395,7 @@ Notice: /Stage[main]/S_user::Root_files/S_user::My_files[root]/File[/root/.task] Notice: Finished catalog run in 206.09 seconds

    -

    Managing multiple Jails


    +

    Managing multiple Jails



    Of course I am operating multiple Jails on the same host this way with Puppet:

    @@ -399,11 +411,22 @@ Notice: Finished catalog run in 206.09 seconds
    E-Mail your comments to paul@nospam.buetow.org :-)

    +Other *BSD related posts are:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +2024-04-01 KISS high-availability with OpenBSD
    +2024-01-13 One reason why I love OpenBSD
    +2022-10-30 Installing DTail on OpenBSD
    +2022-07-30 Let's Encrypt with OpenBSD and Rex
    +2016-04-09 Jails and ZFS with Puppet on FreeBSD (You are currently reading this)
    +
    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 04225f5e..b2a2e893 100644 --- a/gemfeed/2016-04-16-offsite-backup-with-zfs-part2.html +++ b/gemfeed/2016-04-16-offsite-backup-with-zfs-part2.html @@ -8,7 +8,10 @@ -

    Offsite backup with ZFS (Part 2)


    +

    +Home | Markdown | Gemini +

    +

    Offsite backup with ZFS (Part 2)



    Published at 2016-04-16T22:43:42+01:00

    @@ -40,9 +43,9 @@
    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 b26f78f8..e7b07bbd 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,17 +8,29 @@ -

    Spinning up my own authoritative DNS servers


    +

    +Home | Markdown | Gemini +

    +

    Spinning up my own authoritative DNS servers



    Published at 2016-05-22T18:59:01+01:00

    -

    Background


    -
    Finally, I had time to deploy my authoritative DNS servers (master and slave) for my domains "buetow.org" and "buetow.zone". My domain name provider is Schlund Technologies. They allow their customers to edit the DNS records (BIND files) manually. And they also allow you to set your authoritative DNS servers for your domains. From now, I am making use of that option.

    Schlund Technologies

    -

    All FreeBSD Jails


    +

    Table of Contents


    +
    +
    +

    All FreeBSD Jails



    To set up my authoritative DNS servers, I installed a FreeBSD Jail dedicated for DNS with Puppet on my root machine as follows:

    @@ -55,7 +67,7 @@ class { 'jail': }

    -

    PF firewall


    +

    PF firewall



    Please note that "dns.ian.buetow.org" is just the Jail name of the master DNS server (and "caprica.ian.buetow.org" the name of the Jail for the slave DNS server) and that I am using the DNS names "dns1.buetow.org" (master) and "dns2.buetow.org" (slave) for the actual service names (these are the DNS servers visible to the public). Please also note that the IPv4 address is an internal one. I have a PF to use NAT and PAT. The DNS ports are being forwarded (TCP and UDP) to that Jail. By default, all ports are blocked, so I am adding an exception rule for the IPv6 address. These are the PF rules in use:

    @@ -72,7 +84,7 @@ pass in on re0 inet6 proto udp from any to 2a01:4f8:120:30e8::15 port {53} flags .

    -

    Puppet managed BIND zone files


    +

    Puppet managed BIND zone files



    In "manifests/dns.pp" (the Puppet manifest for the Master DNS Jail itself), I configured the BIND DNS server this way:

    @@ -146,7 +158,7 @@ zone "buetow.zone" { };

    -

    The result


    +

    The result



    The result looks like this now:

    @@ -206,7 +218,7 @@ dns2.buetow.org. 86400 IN AAAA 2a03:2500:1:6:20:: ;; MSG SIZE rcvd: 322

    -

    Monitoring


    +

    Monitoring



    For monitoring, I am using Icinga2 (I am operating two Icinga2 instances in two different DCs). I may have to post another blog article about Icinga2, but to get the idea, these were the snippets added to my Icinga2 configuration:

    @@ -233,7 +245,7 @@ apply Service "dig6" { }

    -

    DNS update workflow


    +

    DNS update workflow



    Whenever I have to change a DNS entry, all I have to do is:

    @@ -249,9 +261,9 @@ 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 ccfbeafe..c468f93f 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,7 +8,10 @@ -

    Object oriented programming with ANSI C


    +

    +Home | Markdown | Gemini +

    +

    Object oriented programming with ANSI C



    Published at 2016-11-20T22:10:57+00:00; Updated at 2022-01-29

    @@ -23,7 +26,7 @@
    You can do a little of object-oriented programming in the C Programming Language. However, that is, in my humble opinion, limited. It's easier to use a different programming language than C for OOP. But still it's an interesting exercise to try using C for this.

    -

    Function pointers


    +

    Function pointers



    Let's have a look at the following sample program. All you have to do is to add a function pointer such as "calculate" to the definition of struct "something_s". Later, during the struct initialization, assign a function address to that function pointer:

    @@ -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,15 +93,15 @@ 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!

    -

    That's not OOP, though


    +

    That's not OOP, though



    However, that's not really how it works in object-oriented languages such as Java and C++. The method call in this example is not a method call as "mult" and "div" in this example are not "message receivers". I mean that the functions can not access the state of the "mult" and "div" struct objects. In C, you would need to do something like this instead if you wanted to access the state of "mult" from within the calculate function, you would have to pass it as an argument:

    @@ -106,16 +109,16 @@ Division(3.000000 -
    mult.calculate(mult,a,b));
    +
    mult.calculate(mult,a,b));
     

    -

    Real object oriented programming with C


    +

    Real object oriented programming with C



    If you want to take it further, hit "Object-Oriented Programming with ANSI-C" into your favourite internet search engine or follow the link below. It goes as far as writing a C preprocessor in AWK, which takes some object-oriented pseudo-C and transforms it to plain C so that the C compiler can compile it to machine code. This is similar to how the C++ language had its origins.

    https://www.cs.rit.edu/~ats/books/ooc.pdf

    -

    OOP design patterns in the Linux Kernel


    +

    OOP design patterns in the Linux Kernel



    Big C software projects, like Linux, also follow some OOP techniques:

    @@ -127,9 +130,9 @@ 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 45761407..2c7df5c2 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,10 +8,23 @@ -

    Realistic load testing with I/O Riot for Linux


    +

    +Home | Markdown | Gemini +

    +

    Realistic load testing with I/O Riot for Linux



    Published at 2018-06-01T14:50:29+01:00; Updated at 2021-05-08

    +This text first was published in the german IT-Administrator computer Magazine. 3 years have passed since and I decided to publish it on my blog too.
    +
    +https://www.admin-magazin.de/Das-Heft/2018/06/Realistische-Lasttests-mit-I-O-Riot
    +
    +I havn't worked on I/O Riot for some time now, but all what is written here is still valid. I am still using I/O Riot to debug I/O issues and pattern once in a while, so by all means the tool is not obsolete yet. The tool even helped to resolve a major production incident at work caused by disk I/O.
    +
    +I am eagerly looking forward to revamp I/O Riot so that it uses the new BPF Linux capabilities instead of plain old Systemtap (or alternatively: Newer versions of Systemtap can also use BPF as the backend I have learned). Also, when I wrote I/O Riot initially, I didn't have any experience with the Go programming language yet and therefore I wrote it in C. Once it gets revamped I might consider using Go instead of C as it would spare me from many segmentation faults and headaches during development ;-). I might also just stick to C for plain performance reasons and just refactor the code dealing with concurrency.
    +
    +Pleace notice that some of the screenshots show the command "ioreplay" instead of "ioriot". That's because the name has changed after taking those.
    +
            .---.
           /     \
    @@ -23,25 +36,30 @@
     jgs\__/'---'\__/
     

    -

    Foreword


    -
    -This text first was published in the german IT-Administrator computer Magazine. 3 years have passed since and I decided to publish it on my blog too.
    -
    -https://www.admin-magazin.de/Das-Heft/2018/06/Realistische-Lasttests-mit-I-O-Riot
    -
    -I havn't worked on I/O Riot for some time now, but all what is written here is still valid. I am still using I/O Riot to debug I/O issues and pattern once in a while, so by all means the tool is not obsolete yet. The tool even helped to resolve a major production incident at work caused by disk I/O.
    -
    -I am eagerly looking forward to revamp I/O Riot so that it uses the new BPF Linux capabilities instead of plain old Systemtap (or alternatively: Newer versions of Systemtap can also use BPF as the backend I have learned). Also, when I wrote I/O Riot initially, I didn't have any experience with the Go programming language yet and therefore I wrote it in C. Once it gets revamped I might consider using Go instead of C as it would spare me from many segmentation faults and headaches during development ;-). I might also just stick to C for plain performance reasons and just refactor the code dealing with concurrency.
    -
    -Pleace notice that some of the screenshots show the command "ioreplay" instead of "ioriot". That's because the name has changed after taking those.
    -
    -

    The article


    +

    Table of Contents


    +
    +
    +

    The article



    With I/O Riot IT administrators can load test and optimize the I/O subsystem of Linux-based operating systems. The tool makes it possible to record I/O patterns and replay them at a later time as often as desired. This means bottlenecks can be reproduced and eradicated.

    When storing huge amounts of data, such as more than 200 billion archived emails at Mimecast, it's not only the available storage capacity that matters, but also the data throughput and latency. At the same time, operating costs must be kept as low as possible. The more systems involved, the more important it is to optimize the hardware, the operating system and the applications running on it.

    -

    Background: Existing Techniques


    +

    Background: Existing Techniques



    Conventional I/O benchmarking: Administrators usually use open source benchmarking tools like IOZone and bonnie++. Available database systems such as Redis and MySQL come with their own benchmarking tools. The common problem with these tools is that they work with prescribed artificial I/O patterns. Although this can test both sequential and randomized data access, the patterns do not correspond to what can be found on production systems.

    @@ -49,17 +67,17 @@ jgs\__/'---'\__/
    Testing in the production environment: For these reasons, benchmarks are often carried out in the production environment. In order to derive value from this such tests are especially performed during peak hours when systems are under high load. However, testing on production systems is associated with risks and can lead to failure or loss of data without adequate protection.

    -

    Benchmarking the Email Cloud at Mimecast


    +

    Benchmarking the Email Cloud at Mimecast



    For email archiving, Mimecast uses an internally developed microservice, which is operated directly on Linux-based storage systems. A storage cluster is divided into several replication volumes. Data is always replicated three times across two secure data centers. Customer data is automatically allocated to one or more volumes, depending on throughput, so that all volumes are automatically assigned the same load. Customer data is archived on conventional, but inexpensive hard disks with several terabytes of storage capacity each. I/O benchmarking proved difficult for all the reasons mentioned above. Furthermore, there are no ready-made tools for this purpose in the case of self-developed software. The service operates on many block devices simultaneously, which can make the RAID controller a bottleneck. None of the freely available benchmarking tools can test several block devices at the same time without extra effort. In addition, emails typically consist of many small files. Randomized access to many small files is particularly inefficient. In addition to many software adaptations, the hardware and operating system must also be optimized.

    Mimecast encourages employees to be innovative and pursue their own ideas in the form of an internal competition, Pet Project. The goal of the pet project I/O Riot was to simplify OS and hardware level I/O benchmarking. The first prototype of I/O Riot was awarded an internal roadmap prize in the spring of 2017. A few months later, I/O Riot was used to reduce write latency in the storage clusters by about 50%. The improvement was first verified by I/O replay on a test system and then successively applied to all storage systems. I/O Riot was also used to resolve a production incident caused by disk I/O load.

    -

    Using I/O Riot


    +

    Using I/O Riot



    First, all I/O events are logged to a file on a production system with I/O Riot. It is then copied to a test system where all events are replayed in the same way. The crucial point here is that you can reproduce I/O patterns as they are found on a production system as often as you like on a test system. This results in the possibility of optimizing the set screws on the system after each run.

    -

    Installation


    +

    Installation



    I/O Riot was tested under CentOS 7.2 x86_64. For compiling, the GNU C compiler and Systemtap including kernel debug information are required. Other Linux distributions are theoretically compatible but untested. First of all, you should update the systems involved as follows:

    @@ -81,7 +99,7 @@ jgs\__/'---'\__/
    Note: It is not best practice to install any compilers on production systems. For further information please have a look at the enclosed README.md.

    -

    Recording of I/O events


    +

    Recording of I/O events



    All I/O events are kernel related. If a process wants to perform an I/O operation, such as opening a file, it must inform the kernel of this by a system call (short syscall). I/O Riot relies on the Systemtap tool to record I/O syscalls. Systemtap, available for all popular Linux distributions, helps you to take a look at the running kernel in productive environments, which makes it predestined to monitor all I/O-relevant Linux syscalls and log them to a file. Other tools, such as strace, are not an alternative because they slow down the system too much.

    @@ -91,11 +109,11 @@ jgs\__/'---'\__/ % sudo ioriot -c io.capture

    -Screenshot I/O recording
    +Screenshot I/O recording

    A Ctrl-C (SIGINT) stops recording prematurely. Otherwise, ioriot terminates itself automatically after 1 hour. Depending on the system load, the output file can grow to several gigabytes. Only metadata is logged, not the read and written data itself. When replaying later, only random data is used. Under certain circumstances, Systemtap may omit some system calls and issue warnings. This is to ensure that Systemtap does not consume too many resources.

    -

    Test preparation


    +

    Test preparation



    Then copy io.capture to a test system. The log also contains all accesses to the pseudo file systems devfs, sysfs and procfs. This makes little sense, which is why you must first generate a cleaned and playable version io.replay from io.capture as follows:

    @@ -105,7 +123,7 @@ jgs\__/'---'\__/
    The parameter -n allows you to assign a freely selectable test name. An arbitrary system user under which the test is to be played is specified via paramater -u.

    -

    Test Initialization


    +

    Test Initialization



    The test will most likely want to access existing files. These are files the test wants to read but does not create by itself. The existence of these must be ensured before the test. You can do this as follows:

    @@ -115,17 +133,17 @@ jgs\__/'---'\__/
    To avoid any damage to the running system, ioreplay only works in special directories. The tool creates a separate subdirectory for each file system mount point (e.g. /, /usr/local, /store/00,...) (here: /.ioriot/TESTNAME, /usr/local/.ioriot/TESTNAME, /store/00/.ioriot/TESTNAME,...). By default, the working directory of ioriot is /usr/local/ioriot/TESTNAME.

    -Screenshot test preparation
    +Screenshot test preparation

    You must re-initialize the environment before each run. Data from previous tests will be moved to a trash directory automatically, which can be finally deleted with "sudo ioriot -P".

    -

    Replay


    +

    Replay



    After initialization, you can replay the log with -r. You can use -R to initiate both test initialization and replay in a single command and -S can be used to specify a file in which statistics are written after the test run.

    You can also influence the playback speed: "-s 0" is interpreted as "Playback as fast as possible" and is the default setting. With "-s 1" all operations are performed at original speed. "-s 2" would double the playback speed and "-s 0.5" would halve it.

    -Screenshot replaying I/O
    +Screenshot replaying I/O

    As an initial test, for example, you could compare the two Linux I/O schedulers CFQ and Deadline and check which scheduler the test runs the fastest. They run the test separately for each scheduler. The following shell loop iterates through all attached block devices of the system and changes their I/O scheduler to the one specified in variable $new_scheduler (in this case either cfq or deadline). Subsequently, all I/O events from the io.replay protocol are played back. At the end, an output file with statistics is generated:

    @@ -167,21 +185,21 @@ Total time: 1213.00s
    In any case, you should also set up a time series database, such as Graphite, where the I/O throughput can be plotted. Figures 4 and 5 show the read and write access times of both tests. The break-in makes it clear when the CFQ test ended and the deadline test was started. The reading latency of both tests is similar. Write latency is dramatically improved using the Deadline Scheduler.

    -Graphite visualization of the mean read access times in ms with CFQ and Deadline Scheduler.
    +Graphite visualization of the mean read access times in ms with CFQ and Deadline Scheduler.

    -Graphite visualization of the average write access times in ms with CFQ and Deadline Scheduler.
    +Graphite visualization of the average write access times in ms with CFQ and Deadline Scheduler.

    You should also take a look at the iostat tool. The iostat screenshot shows the output of iostat -x 10 during a test run. As you can see, a block device is fully loaded with 99% utilization, while all other block devices still have sufficient buffer. This could be an indication of poor data distribution in the storage system and is worth pursuing. It is not uncommon for I/O Riot to reveal software problems.

    -Output of iostat. The block device sdy seems to be almost fully utilized by 99%.
    +Output of iostat. The block device sdy seems to be almost fully utilized by 99%.

    -

    I/O Riot is Open Source


    +

    I/O Riot is Open Source



    The tool has already proven to be very useful and will continue to be actively developed as time and priority permits. Mimecast intends to be an ongoing contributor to Open Source. You can find I/O Riot at:

    https://github.com/mimecast/ioriot

    -

    Systemtap


    +

    Systemtap



    Systemtap is a tool for the instrumentation of the Linux kernel. The tool provides an AWK-like programming language. Programs written in it are compiled from Systemtap to C- and then into a dynamically loadable kernel module. Loaded into the kernel, the program has access to Linux internals. A Systemtap program written for I/O Riot monitors when, with which parameters, at which time, and from which process I/O syscalls take place and their return values.

    @@ -189,7 +207,7 @@ Total time: 1213.00s
    https://sourceware.org/systemtap/

    -

    More refereces


    +

    More refereces



    IOZone
    Bonnie++
    @@ -200,9 +218,9 @@ Total time: 1213.00s
    Back to the main site
    diff --git a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure1-ioriot-io-recording.png b/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure1-ioriot-io-recording.png deleted file mode 100644 index 43ac852f..00000000 Binary files a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure1-ioriot-io-recording.png and /dev/null differ diff --git a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure2-ioriot-test-preparation.png b/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure2-ioriot-test-preparation.png deleted file mode 100644 index 709d7490..00000000 Binary files a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure2-ioriot-test-preparation.png and /dev/null differ diff --git a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure3-ioriot-replay.png b/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure3-ioriot-replay.png deleted file mode 100644 index 3bd66b6f..00000000 Binary files a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure3-ioriot-replay.png and /dev/null differ diff --git a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure4-ioriot-read-latency.png b/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure4-ioriot-read-latency.png deleted file mode 100644 index 160b2305..00000000 Binary files a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure4-ioriot-read-latency.png and /dev/null differ diff --git a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure5-ioriot-write-latency.png b/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure5-ioriot-write-latency.png deleted file mode 100644 index e30efdbb..00000000 Binary files a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure5-ioriot-write-latency.png and /dev/null differ diff --git a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure6-iostat.png b/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure6-iostat.png deleted file mode 100644 index 0d3fc0d8..00000000 Binary files a/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux/figure6-iostat.png and /dev/null differ 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 1641ae47..9e90200c 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,12 +8,13 @@ -

    DTail - The distributed log tail program


    +

    +Home | Markdown | Gemini +

    +

    DTail - The distributed log tail program



    Published at 2021-04-22T19:28:41+01:00; Updated at 2021-04-26

    -DTail logo image
    -
    This article first appeared at the Mimecast Engineering Blog but I made it available here in my personal internet site too.

    Original Mimecast Engineering Blog post at Medium
    @@ -26,7 +27,23 @@
    Think of DTail as a distributed version of the tail program which is very useful when you have a distributed application running on many servers. DTail is an Open-Source, cross-platform, fairly easy to use, support and maintain log file analysis & statistics gathering tool designed for Engineers and Systems Administrators. It is programmed in Google Go.

    -

    A Mimecast Pet Project


    +DTail logo image
    +
    +

    Table of Contents


    +
    +
    +

    A Mimecast Pet Project



    DTail got its inspiration from public domain tools available already in this area but it is a blue sky from-scratch development which was first presented at Mimecast’s annual internal Pet Project competition (awarded with a Bronze prize). It has gained popularity since and is one of the most widely deployed DevOps tools at Mimecast (reaching nearly 10k server installations) and many engineers use it on a regular basis. The Open-Source version of DTail is available at:

    @@ -34,17 +51,17 @@
    Try it out — We would love any feedback. But first, read on…

    -

    Differentiating from log management systems


    +

    Differentiating from log management systems



    Why not just use a full-blown log management system? There are various Open-Source and commercial log management solutions available on the market you could choose from (e.g. the ELK stack). Most of them store the logs in a centralized location and are fairly complex to set up and operate. Possibly they are also pretty expensive to operate if you have to buy dedicated hardware (or pay fees to your cloud provider) and have to hire support staff for it.

    DTail does not aim to replace any of the log management tools already available but is rather an additional tool crafted especially for ad-hoc debugging and troubleshooting purposes. DTail is cheap to operate as it does not require any dedicated hardware for log storage as it operates directly on the source of the logs. It means that there is a DTail server installed on all server boxes producing logs. This decentralized comes with the direct advantages that there is no introduced delay because the logs are not shipped to a central log storage device. The reduced complexity also makes it more robust against outages. You won’t be able to troubleshoot your distributed application very well if the log management infrastructure isn’t working either.

    -DTail sample session animated gif
    +DTail sample session animated gif

    As a downside, you won’t be able to access any logs with DTail when the server is down. Furthermore, a server can store logs only up to a certain capacity as disks will fill up. For the purpose of ad-hoc debugging, these are not typically issues. Usually, it’s the application you want to debug and not the server. And disk space is rarely an issue for bare metal and VM-based systems these days, with sufficient space for several weeks’ worth of log storage being available. DTail also supports reading compressed logs. The currently supported compression algorithms are gzip and zstd.

    -

    Combining simplicity, security and efficiency


    +

    Combining simplicity, security and efficiency



    DTail also has a client component that connects to multiple servers concurrently for log files (or any other text files).

    @@ -54,7 +71,7 @@
    Recent log files are very likely still in the file system caches on the servers. Therefore, there tends to be a minimal I/O overhead involved.

    -

    The DTail family of commands


    +

    The DTail family of commands



    Following the UNIX philosophy, DTail includes multiple command-line commands each of them for a different purpose:

    @@ -65,9 +82,9 @@
  • dgrep: The distributed grep client for searching text files for a regular expression pattern.
  • dmap: The distributed map-reduce client for aggregating stats from log files.

  • -DGrep sample session animated gif
    +DGrep sample session animated gif

    -

    Usage example


    +

    Usage example



    The use of these commands is almost self-explanatory for a person already used to the standard command line in Unix systems. One of the main goals is to make DTail easy to use. A tool that is too complicated to use under high-pressure scenarios (e.g., during an incident) can be quite detrimental.

    @@ -85,11 +102,11 @@ dtail –servers serverlist.txt –files ‘/var/log/*.log’ –regex ‘(?i:er
    You could also provide a comma-separated list of servers as opposed to a text file. There are many more options you could use. The ones listed here are just the very basic ones. There are more instructions and usage examples on the GitHub page. Also, you can study even more of the available options via the –help switch (some real treasures might be hidden there).

    -

    Fitting it in


    +

    Fitting it in



    DTail integrates nicely into the user management of existing infrastructure. It follows normal system permissions and does not open new “holes” on the server which helps to keep security departments happy. The user would not have more or less file read permissions than he would have via a regular SSH login shell. There is a full SSH key, traditional UNIX permissions, and Linux ACL support. There is also a very low resource footprint involved. On average for tailing and searching log files less than 100MB RAM and less than a quarter of a CPU core per participating server are required. Complex map-reduce queries on big data sets will require more resources accordingly.

    -

    Advanced features


    +

    Advanced features



    The features listed here are out of the scope of this blog post but are worthwhile to mention:

    @@ -100,7 +117,7 @@ dtail –servers serverlist.txt –files ‘/var/log/*.log’ –regex ‘(?i:er
  • Server-side stats streaming with continuous map-reduce queries. This for example can be used to periodically generate stats from the logs at a configured interval, e.g., log error counts by the minute. These then can be sent to a time-series database (e.g., Graphite) and then plotted in a Grafana dashboard.
  • Support for custom extensions. E.g., for different server discovery methods (so you don’t have to rely on plain server lists) and log file formats (so that map-reduce queries can parse more stats from the logs).

  • -

    For the future


    +

    For the future



    There are various features we want to see in the future.

    @@ -110,26 +127,26 @@ dtail –servers serverlist.txt –files ‘/var/log/*.log’ –regex ‘(?i:er
  • A more complex change would be the support of federated queries. You can connect to thousands of servers from a single client running on a laptop. But does it scale to 100k of servers? Some of the servers could be used as middleware for connecting to even more servers.
  • Another aspect is to extend the documentation. Especially the advanced features such as map-reduce query language and how to configure the server-side queries currently do require more documentation. For now, you can read the code, sample config files or just ask the author for that! But this will be certainly addressed in the future.

  • -

    Open Source


    +

    Open Source



    Mimecast highly encourages you to have a look at DTail and submit an issue for any features you would like to see. Have you found a bug? Maybe you just have a question or comment? If you want to go a step further: We would also love to see pull requests for any features or improvements. Either way, if in doubt just contact us via the DTail GitHub page.

    https://dtail.dev

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2021-04-22 DTail - The distributed log tail program (You are currently reading this)
    -2022-03-06 The release of DTail 4.0.0
    -2022-10-30 Installing DTail on OpenBSD
    2023-09-25 DTail usage examples
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2022-10-30 Installing DTail on OpenBSD
    +2022-03-06 The release of DTail 4.0.0
    +2021-04-22 DTail - The distributed log tail program (You are currently reading this)

    Back to the main site
    diff --git a/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dgrep.gif b/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dgrep.gif deleted file mode 100644 index e2f2ac64..00000000 Binary files a/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dgrep.gif and /dev/null differ diff --git a/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dtail.gif b/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dtail.gif deleted file mode 100644 index 8f6b56bf..00000000 Binary files a/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dtail.gif and /dev/null differ diff --git a/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/title.png b/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/title.png deleted file mode 100644 index 4e343c4f..00000000 Binary files a/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/title.png and /dev/null differ diff --git a/gemfeed/2021-04-24-welcome-to-the-geminispace.html b/gemfeed/2021-04-24-welcome-to-the-geminispace.html index 6af17e54..2c2c592f 100644 --- a/gemfeed/2021-04-24-welcome-to-the-geminispace.html +++ b/gemfeed/2021-04-24-welcome-to-the-geminispace.html @@ -8,18 +8,13 @@ -

    Welcome to the Geminispace


    +

    +Home | Markdown | Gemini +

    +

    Welcome to the Geminispace



    Published at 2021-04-24T19:28:41+01:00; Updated at 2021-06-18

    -ASCII Art by Andy Hood!
    -
    -Have you reached this article already via Gemini? It requires a Gemini client; web browsers such as Firefox, Chrome, Safari, etc., don't support the Gemini protocol. The Gemini address of this site (or the address of this capsule as people say in Geminispace) is:
    -
    -gemini://foo.zone
    -
    -However, if you still use HTTP, you are just surfing the fallback HTML version of this capsule. In that case, I suggest reading on what this is all about :-).
    -
         /\
        /  \
    @@ -39,30 +34,51 @@
     
     

    -

    Motivation


    +

    Table of Contents


    +
    +
    +

    Introduction


    +
    +Have you reached this article already via Gemini? It requires a Gemini client; web browsers such as Firefox, Chrome, Safari, etc., don't support the Gemini protocol. The Gemini address of this site (or the address of this capsule as people say in Geminispace) is:
    +
    +gemini://foo.zone
    +
    +However, if you still use HTTP, you are just surfing the fallback HTML version of this capsule. In that case, I suggest reading on what this is all about :-).
    +
    +

    Motivation



    -

    My urge to revamp my personal website


    +

    My urge to revamp my personal website



    For some time, I had to urge to revamp my personal website. Not to update the technology and its design but to update all the content (+ keep it current) and start a small tech blog again. So unconsciously, I began to search for an excellent platform to do all of that in a KISS (keep it simple & stupid) way.

    -

    My still great Laptop running hot


    +

    My still great Laptop running hot



    Earlier this year (2021), I noticed that my almost seven-year-old but still great Laptop started to become hot and slowed down while surfing the web. Also, the Laptop's fan became quite noisy. This was all due to the additional bloat such as JavaScript, excessive use of CSS, tracking cookies+pixels, ads, and so on there was on the website.

    All I wanted was to read an interesting article, but after a big advertising pop-up banner appeared and made everything worse, I gave up and closed the browser tab.

    -

    Discovering the Gemini internet protocol


    +

    Discovering the Gemini internet protocol



    Around the same time, I discovered a relatively new, more lightweight protocol named Gemini, which does not support all these CPU-intensive features like HTML, JavaScript, and CSS. Also, tracking and ads are unsupported by the Gemini protocol.

    The "downside" is that due to the limited capabilities of the Gemini protocol, all sites look very old and spartan. But that is not a downside; that is, in fact, a design choice people made. It is up to the client software how your capsule looks. For example, you could use a graphical client, such as Lagrange, with nice font renderings and colours to improve the appearance. Or you could use a very minimalistic command line black-and-white Gemini client. It's your (the user's) choice.

    -Screenshot Amfora Gemini terminal client surfing this site
    -Screenshot graphical Lagrange Gemini client surfing this site
    +Screenshot Amfora Gemini terminal client surfing this site
    +Screenshot graphical Lagrange Gemini client surfing this site

    Why is there a need for a new protocol? As the modern web is a superset of Gemini, can't we use simple HTML 1.0 instead? That's a good and valid question. It is not a technical problem but a human problem. We tend to abuse the features once they are available. You can ensure that things stay efficient and straightforward as long as you are using the Gemini protocol. On the other hand, you can't force every website on the modern web to only create plain and straightforward-looking HTML pages.

    -

    My own Gemini capsule


    +

    My own Gemini capsule



    As it is effortless to set up and maintain your own Gemini capsule (Gemini server + content composed via the Gemtext markup language), I decided to create my own. What I like about Gemini is that I can use my favourite text editor and get typing. I don't need to worry about the style and design of the presence, and I also don't have to test anything in ten different web browsers. I can only focus on the content! As a matter of fact, I am using the Vim editor + its spellchecker + auto word completion functionality to write this.

    @@ -70,7 +86,7 @@
    Gemtexter - One Bash script to rule it all

    -

    Gemini advantages summarised


    +

    Gemini advantages summarised



    • Supports an alternative to the modern bloated web
    • @@ -81,28 +97,29 @@
    • Supports privacy (no cookies, no request header fingerprinting, TLS encryption)
    • Fun to play with (it's a bit geeky, yes, but a lot of fun!)

    -

    Dive into deep Gemini space


    +

    Dive into deep Gemini space



    Check out one of the following links for more information about Gemini. For example, you will find a FAQ that explains why the protocol is named Gemini. Many Gemini capsules are dual-hosted via Gemini and HTTP(S) so that people new to Gemini can sneak peek at the content with a regular web browser. Some people go as far as tri-hosting all their content via HTTP(S), Gemini and Gopher.

    -gemini://gemini.circumlunar.space
    -https://gemini.circumlunar.space
    +gemini://geminiprotocol.net/
    +https://geminiprotocol.net/
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)

    Other related posts are:

    -2021-04-24 Welcome to the Geminispace (You are currently reading this)
    -2021-06-05 Gemtexter - One Bash script to rule it all
    -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
    -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
    +2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴
    2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
    +2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
    +2021-06-05 Gemtexter - One Bash script to rule it all
    +2021-04-24 Welcome to the Geminispace (You are currently reading this)

    Back to the main site
    diff --git a/gemfeed/2021-04-24-welcome-to-the-geminispace/amfora-screenshot.png b/gemfeed/2021-04-24-welcome-to-the-geminispace/amfora-screenshot.png deleted file mode 100644 index 093aec79..00000000 Binary files a/gemfeed/2021-04-24-welcome-to-the-geminispace/amfora-screenshot.png and /dev/null differ diff --git a/gemfeed/2021-04-24-welcome-to-the-geminispace/lagrange-screenshot.png b/gemfeed/2021-04-24-welcome-to-the-geminispace/lagrange-screenshot.png deleted file mode 100644 index 478d2fdd..00000000 Binary files a/gemfeed/2021-04-24-welcome-to-the-geminispace/lagrange-screenshot.png and /dev/null differ 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 72c24941..f34a8170 100644 --- a/gemfeed/2021-05-16-personal-bash-coding-style-guide.html +++ b/gemfeed/2021-05-16-personal-bash-coding-style-guide.html @@ -8,10 +8,17 @@ -

    Personal Bash coding style guide


    +

    +Home | Markdown | Gemini +

    +

    Personal Bash coding style guide



    Published at 2021-05-16T14:51:57+01:00

    +Lately, I have been polishing and writing a lot of Bash code. Not that I never wrote a lot of Bash, but now as I also looked through the Google Shell Style Guide, I thought it is time also to write my thoughts on that. I agree with that guide in most, but not in all points.
    +
    +Google Shell Style Guide
    +
        .---------------------------.
       /,--..---..---..---..---..--. `.
    @@ -25,29 +32,53 @@
     "\__/"---------------"\__/"-+---+'
     

    -Lately, I have been polishing and writing a lot of Bash code. Not that I never wrote a lot of Bash, but now as I also looked through the Google Shell Style Guide, I thought it is time also to write my thoughts on that. I agree with that guide in most, but not in all points.
    -
    -Google Shell Style Guide
    -
    -

    My modifications


    +

    Table of Contents


    +
    +
    +

    My modifications



    These are my modifications to the Google Guide.

    -

    Shebang


    +

    Shebang



    Google recommends using always...

    -
    -#!/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:

    -
    -#!/usr/bin/env bash
    +
    +
    #!/usr/bin/env bash
     

    -

    Two space soft-tabs indentation


    +

    Two space soft-tabs indentation



    I know there have been many tab- and soft-tab wars on this planet. Google recommends using two space soft-tabs for Bash scripts.

    @@ -57,15 +88,18 @@
    I hit the 80 character line length quicker with the four spaces than with two spaces, but that makes me refactor the Bash code more aggressively, which is a good thing.

    -

    Breaking long pipes


    +

    Breaking long pipes



    Google recommends breaking up long pipes like this:

    -
    -# All fits on one line
    +
    +
    # All fits on one line
     command1 | command2
     
    -# Long commands
    +# Long commands
     command1 \
       | command2 \
       | command3 \
    @@ -74,58 +108,75 @@ command1 \
     
    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:

    -
    -# Long commands
    +
    +
    # Long commands
     command1 |
         command2 |
         command3 |
         command4
     

    -

    Quoting your variables


    +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!
    +
    +

    Quoting your variables



    Google recommends always quote your variables. Generally, it would be best if you did that only for variables where you are unsure about the content/values of the variables (e.g., content is from an external input source and may contain whitespace or other special characters). In my opinion, the code will become quite noisy when you always quote your variables like this:

    -
    -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:

    -
    -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:

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

    -

    Prefer built-in commands over external commands


    +

    Prefer built-in commands over external commands



    Google recommends using the built-in commands over available external commands where possible:

    -
    -# Prefer this:
    +
    +
    # Prefer this:
     addition=$(( X + Y ))
    -substitution="${string/#foo/bar}"
    +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).
    @@ -136,41 +187,46 @@ substitution="$(echo "${string}" | sed -e 's/^foo/bar/')"
    I even didn't get started with what you can do with awk (especially GNU Awk), a fully-fledged programming language. Tiny Awk snippets tend to be used quite often in Shell scripts without honouring the real power of Awk. But if you did everything in Perl or Awk or another scripting language, then it wouldn't be a Bash script anymore, wouldn't it? ;-)

    -

    My additions


    +

    My additions



    -

    Use of 'yes' and 'no'


    +

    Use of 'yes' and 'no'



    Bash does not support a boolean type. I tend just to use the strings 'yes' and 'no' here. I used 0 for false and 1 for true for some time, but I think that the yes/no strings are easier to read. Yes, the Bash script would need to perform string comparisons on every check, but if performance is crucial to you, you wouldn't want to use a Bash script anyway, correct?

    -
    -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
    +    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
     

    -

    Non-evil alternative to variable assignments via eval


    +

    Non-evil alternative to variable assignments via eval



    Google is in the opinion that eval should be avoided. I think so too. They list these examples in their guide:

    -
    -# 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 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)"
     

    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:
    @@ -201,32 +257,35 @@ Hello paul, it is Sat 15 May 19:21:12 BST 2021
    The downside is that ShellCheck won't be able to follow the dynamic sourcing anymore.

    -

    Prefer pipes over arrays for list processing


    +

    Prefer pipes over arrays for list processing



    When I do list processing in Bash, I prefer to use pipes. You can chain them through Bash functions as well, which is pretty neat. Usually, my list processing scripts are of a structure like this:

    -
    -filter_lines () {
    -    echo 'Start filtering lines in a fancy way!' >&2
    +
    +
    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 
    +    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
    +# Do some post-processing of the data
     postprocess_lines () {
    -    echo 'Start removing duplicates!' >&2
    +    echo 'Start removing duplicates!' >&2
         sort -u
     }
     
     genreate_report () {
    -    echo 'My boss wants to have a report!' >&2
    +    echo 'My boss wants to have a report!' >&2
         tee outfile.txt
         wc -l outfile.txt
     }
    @@ -243,139 +302,172 @@ main
     
    The stdout is always passed as a pipe to the next following stage. The stderr is used for info logging.

    -

    Assign-then-shift


    +

    Assign-then-shift



    I often refactor existing Bash code. That leads me to add and removing function arguments quite often. It's pretty repetitive work changing the $1, $2.... function argument numbers every time you change the order or add/remove possible arguments.

    The solution is to use of the "assign-then-shift"-method, which goes like this: "local -r var1=$1; shift; local -r var2=$1; shift". The idea is that you only use "$1" to assign function arguments to named (better readable) local function variables. You will never have to bother about "$2" or above. That is very useful when you constantly refactor your code and remove or add function arguments. It's something that I picked up from a colleague (a pure Bash wizard) some time ago:

    -
    -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:

    -
    -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:

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

    -

    Paranoid mode


    +

    Paranoid mode



    I call this the paranoid mode. The Bash will stop executing when a command exits with a status not equal to 0:

    -
    -set -e
    +
    +
    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:

    -
    -#!/usr/bin/env bash
    +
    +
    #!/usr/bin/env bash
     
    -set -e
    +set -e
     
     some_function () {
    -    .. some critical code
    -    ...
    +    # .. some critical code
    +    # ...
     
    -    set +e
    -    # Grep might fail, but that's OK now
    +    set +e
    +    # Grep might fail, but that's OK now
         grep ....
    -    local -i ec=$?
    -    set -e
    +    local -i ec=$?
    +    set -e
     
    -    .. critical code continues ...
    -    if [[ $ec -ne 0 ]]; then
    -        ...
    -    fi
    -    ...
    +    # .. critical code continues ...
    +    if [[ $ec -ne 0 ]]; then
    +        : # ...
    +    fi
    +    # ...
     }
     

    -

    Learned


    +

    Learned



    There are also a couple of things I've learned from Google's guide.

    -

    Unintended lexicographical comparison.


    +

    Unintended lexicographical comparison.



    The following looks like a valid Bash code:

    -
    -if [[ "${my_var}" > 3 ]]; then
    -    # True for 4, false for 22.
    +
    +
    if [[ "${my_var}" > 3 ]]; then
    +    # True for 4, false for 22.
         do_something
    -fi
    +fi
     

    ... but it is probably an unintended lexicographical comparison. A correct way would be:

    -
    -if (( my_var > 3 )); then
    +
    +
    if (( my_var > 3 )); then
         do_something
    -fi
    +fi
     

    or

    -
    -if [[ "${my_var}" -gt 3 ]]; then
    +
    +
    if [[ "${my_var}" -gt 3 ]]; then
         do_something
    -fi
    +fi
     

    -

    PIPESTATUS


    +

    PIPESTATUS



    I have never used the PIPESTATUS variable before. I knew that it's there, but I never bothered to understand how it works until now thoroughly.

    The PIPESTATUS variable in Bash allows checking of the return code from all parts of a pipe. If it's only necessary to check the success or failure of the whole pipe, then the following is acceptable:

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

    -
    -tar -cf - ./* | ( cd "${DIR}" && tar -xf - )
    -return_codes=( "${PIPESTATUS[@]}" )
    -if (( return_codes[0] != 0 )); then
    +
    +
    tar -cf - ./* | ( cd "${DIR}" && tar -xf - )
    +return_codes=( "${PIPESTATUS[@]}" )
    +if (( return_codes[0] != 0 )); then
         do_something
    -fi
    -if (( return_codes[1] != 0 )); then
    +fi
    +if (( return_codes[1] != 0 )); then
         do_something_else
    -fi
    +fi
     

    -

    Use common sense and BE CONSISTENT.


    +

    Use common sense and BE CONSISTENT.



    The following two paragraphs are thoroughly quoted from the Google guidelines. But they hit the hammer on the head:

    @@ -384,26 +476,27 @@ fi The point of having style guidelines is to have a common vocabulary of coding so people can concentrate on what you are saying rather than on how you are saying it. We present global style rules here, so people know the vocabulary. But local style is also important. If the code you add to a file looks drastically different from the existing code around it, the discontinuity throws readers out of their rhythm when they go to read it. Try to avoid this.


    -

    Advanced Bash learning pro tip


    +

    Advanced Bash learning pro tip



    I also highly recommend having a read through the "Advanced Bash-Scripting Guide" (not from Google). I use it as the universal Bash reference and learn something new every time I look at it.

    Advanced Bash-Scripting Guide

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2021-05-16 Personal Bash coding style guide (You are currently reading this)
    -2021-06-05 Gemtexter - One Bash script to rule it all
    -2021-11-29 Bash Golf Part 1
    +2023-12-10 Bash Golf Part 3
    2022-01-01 Bash Golf Part 2
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2021-11-29 Bash Golf Part 1
    +2021-06-05 Gemtexter - One Bash script to rule it all
    +2021-05-16 Personal Bash coding style guide (You are currently reading this)

    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 62bfcceb..89e518d9 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,10 +8,17 @@ -

    Gemtexter - One Bash script to rule it all


    +

    +Home | Markdown | Gemini +

    +

    Gemtexter - One Bash script to rule it all



    Published at 2021-06-05T19:03:32+01:00

    +You might have read my previous blog posts about entering the Geminispace, where I pointed out the benefits of having and maintaining an internet presence there. This whole site (the blog and all other pages) is composed in the Gemtext markup language.
    +
    +This comes with the benefit that I can write content in my favourite text editor (Vim).
    +
                                                                    o .,<>., o
                                                                    |\/\/\/\/|
    @@ -53,15 +60,28 @@
                                                                `+a:f:......jrei'''
     

    -You might have read my previous blog posts about entering the Geminispace, where I pointed out the benefits of having and maintaining an internet presence there. This whole site (the blog and all other pages) is composed in the Gemtext markup language.
    -
    -This comes with the benefit that I can write content in my favourite text editor (Vim).
    +

    Table of Contents



    -

    Motivation


    +
    +

    Motivation



    Another benefit of using Gemini is that the Gemtext markup language is easy to parse. As my site is dual-hosted (Gemini+HTTP), I could, in theory, just write a shell script to deal with the conversion from Gemtext to HTML; there is no need for a full-featured programming language here. I have done a lot of Bash in the past, but I am also often revisiting old tools and techniques for refreshing and keeping the knowledge up to date here.

    -Motivational comic strip
    +Motivational comic strip

    I have exactly done that - I wrote a Bash script, named Gemtexter, for that:

    @@ -69,7 +89,7 @@
    In short, Gemtexter is a static site generator and blogging engine that uses Gemtext as its input format.

    -

    Output formats


    +

    Output formats



    Gemtexter takes the Gemtext Markup files as the input and generates the following outputs from it (you find examples for each of these output formats on the Gemtexter GitHub page):

    @@ -82,11 +102,11 @@
    I could have done all of that with a more robust language than Bash (such as Perl, Ruby, Go...), but I didn't. The purpose of this exercise was to challenge what I can do with a "simple" Bash script and learn new things.

    -

    Taking it as far as I should, but no farther


    +

    Taking it as far as I should, but no farther



    The Bash is suitable very well for small scripts and ad-hoc automation on the command line. But it is for sure not a robust programming language. Writing this blog post, Gemtexter is nearing 1000 lines of code, which is actually a pretty large Bash script.

    -

    Modularization


    +

    Modularization



    I modularized the code so that each core functionality has its own file in ./lib. All the modules are included from the main Gemtexter script. For example, there is one module for HTML generation, one for Markdown generation, and so on.

    @@ -94,23 +114,23 @@ 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.

    -

    Bash best practises and ShellCheck


    +

    Bash best practises and ShellCheck



    While working on Gemtexter, I also had a look at the Google Shell Style Guide and wrote a blog post on that:

    @@ -126,7 +146,7 @@ http://www.gnu.org/software/src-highlite -->
    https://shellcheck.net

    -

    Unit testing


    +

    Unit testing



    There is a basic unit test module in ./lib/assert.source.sh, which is used for unit testing. I found this to be very beneficial for cross-platform development. For example, I noticed that some unit tests failed on macOS while everything still worked fine on my Fedora Linux laptop.

    @@ -134,29 +154,29 @@ http://www.gnu.org/software/src-highlite -->
    It has been proven quite helpful to have unit tests in place for the HTML part already when working on the Markdown generator part. To test the Markdown part, I copied the HTML unit tests and changed the expected outcome in the assertions. This way, I could implement the Markdown generator in a test-driven way (writing the test first and afterwards the implementation).

    -

    HTML unit test example


    +

    HTML unit test example



    -
    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


    +

    Markdown unit test example



    -
    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


    +

    Handcrafted HTML styles



    I had a look at some ready off the shelf CSS styles, but they all seemed too bloated. There is a whole industry selling CSS styles on the interweb. I preferred an effortless and minimalist style for the HTML site. So I handcrafted the Cascading Style Sheets manually with love and included them in the HTML header template.

    @@ -164,11 +184,11 @@ assert::equals "$(generate::m
    It's worth mentioning that all generated HTML files and Atom feeds pass the W3C validation tests.

    -

    Configurability


    +

    Configurability



    In case someone else than me wants to use Gemtexter for his own site, it is pretty much configurable. It is possible to specify your own configuration file and your own HTML templates. Have a look at the GitHub page for examples.

    -

    Future features


    +

    Future features



    I could think of the following features added to a future version of Gemtexter:

    @@ -178,30 +198,32 @@ assert::equals "$(generate::m
  • External CSS file for HTML.
  • Improve speed by introducing parallelism and/or concurrency and/or better caching.

  • -

    Conclusion


    +

    Conclusion



    It was quite a lot of fun writing Gemtexter. It's a relatively small project, but given that I worked on that in my spare time once in a while, it kept me busy for several weeks.

    I finally revamped my personal internet site and started to blog again. I wanted the result to be exactly how it is now: A slightly retro-inspired internet site built for fun with unconventional tools.

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2021-04-24 Welcome to the Geminispace
    -2021-05-16 Personal Bash coding style guide
    -2021-06-05 Gemtexter - One Bash script to rule it all (You are currently reading this)
    -2021-11-29 Bash Golf Part 1
    -2022-01-01 Bash Golf Part 2
    -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
    -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
    +2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴
    +2023-12-10 Bash Golf Part 3
    2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
    +2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
    +2022-01-01 Bash Golf Part 2
    +2021-11-29 Bash Golf Part 1
    +2021-06-05 Gemtexter - One Bash script to rule it all (You are currently reading this)
    +2021-05-16 Personal Bash coding style guide
    +2021-04-24 Welcome to the Geminispace

    Back to the main site
    diff --git a/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg b/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg deleted file mode 100644 index 844bc9fc..00000000 Binary files a/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg and /dev/null differ diff --git a/gemfeed/2021-07-04-the-well-grounded-rubyist.html b/gemfeed/2021-07-04-the-well-grounded-rubyist.html index 745e8d18..6e831de5 100644 --- a/gemfeed/2021-07-04-the-well-grounded-rubyist.html +++ b/gemfeed/2021-07-04-the-well-grounded-rubyist.html @@ -8,7 +8,10 @@ -

    The Well-Grounded Rubyist


    +

    +Home | Markdown | Gemini +

    +

    The Well-Grounded Rubyist



    Published at 2021-07-04T10:51:23+01:00

    @@ -16,15 +19,30 @@
    You should learn or try out one new programming language once yearly anyway. If you end up not using the new language, that's not a problem. You will learn new techniques with each new programming language and this also helps you to improve your overall programming skills even for other languages. Also, having some background in a similar programming language makes it reasonably easy to get started. Besides that, learning a new programming language is kick-a** fun!

    -
    +

    Superficially, Perl seems to have many similarities to Ruby (but, of course, it is entirely different to Perl when you look closer), which pushed me towards Ruby instead of Python. I have tried Python a couple of times before, and I managed to write good code, but I never felt satisfied with the language. I didn't love the syntax, especially the indentations used; they always confused me. I don't dislike Python, but I don't prefer to program in it if I have a choice, especially when there are more propelling alternatives available. Personally, it's so much more fun to program in Ruby than in Python.

    -
    +

    Yukihiro Matsumoto, the inventor of Ruby, said: "I wanted a scripting language that was more powerful than Perl and more object-oriented than Python" - So I can see where some of the similarities come from. I personally don't believe that Ruby is more powerful than Perl, though, especially when you take CPAN and/or Perl 6 (now known as Raku) into the equation. Well, it all depends on what you mean with "more powerful". But I want to stay pragmatic and use what's already used at my workplace.

    -

    My Ruby problem domain


    +

    Table of Contents


    +
    +
    +

    My Ruby problem domain



    I wrote a lot of Ruby code over the last couple of years. There were many small to medium-sized tools and other projects such as Nagios monitoring checks, even an internal monitoring & reporting site based on Sinatra. All Ruby scripts I wrote do their work well; I didn't encounter any significant problems using Ruby for any of these tasks. Of course, there's nothing that couldn't be written in Perl (or Python), though, after all, these languages are all Turing-complete and all these languages also come with a huge set of 3rd party libraries :-).

    @@ -42,7 +60,7 @@
    For all other in-between tasks I mainly use the Ruby programming language (unless I decide to give something new a shot once in a while).

    -

    Being stuck in Ruby-mediocrity


    +

    Being stuck in Ruby-mediocrity



    As a Site Reliability Engineer there were many tasks and problems to be solved as efficiently and quickly as possible and, of course, without bugs. So I learned Ruby relatively fast by doing and the occasional web search for "how to do thing X". I always was eager to get the problem at hand solved and as long as the code solved the problem I usually was happy.

    @@ -50,7 +68,7 @@
    An unexpected benefit was that most of my Ruby code (probably not all, there are always dark corners in some old code bases lurking around) was easy to follow and extend or fix, even by people who usually don't speak Ruby, as there wasn't too much magic involved in my code - However, I could have done better still. Looking at other Ruby projects, I noticed over time that there is so much more to the language I wanted to explore. For example new techniques and the Ruby best practise, and much more about how things work under the hood, I wanted to learn about.

    -

    O'Reilly Safari Books Online


    +

    O'Reilly Safari Books Online



    I do have an O'Reilly Safari Online subscription (thank you, employer). To my liking, I found the "The Well-Grounded Rubyist" book there (the text version and also the video version of it). I watched the video version for a couple of weeks, chunking the content into small pieces so it was able to fit into my schedule, increasing the playback speed for the topics I knew already well enough and slowed it down to actual pace when there was something new to learn and occasionally jumped back to the text book to review what I just learned. To my satisfaction, I was already familiar with over half of the language. But there was still the big chunk, especially how the magic happens under the hood in Ruby, which I missed out on, but I am happy now to be aware of it now.

    @@ -58,25 +76,25 @@
    Will I rewrite and refactor all of my existing Ruby programs? Probably not, as they all do their work as intended. Some of these scripts will be eventually replaced or retired. But depending on the situation, I might refactor a module, class or a method or two once in a while. I already knew how to program in an object-oriented style from other languages (e.g. Java, C++, Perl Moose and plain) before I started Ruby, so my existing Ruby code is not as bad as you might assume after reading this article :-). In contrast to Java/C++, Ruby is a dynamic language, and the idiomatic ways of doing things differs from statically typed languages.

    -

    Key takeaways


    +

    Key takeaways



    These are my key takeaways. These only point out some specific things I have learned, and represent, by far, not everything I've learned from the book.

    -

    "Everything" is an object


    +

    "Everything" is an object



    In Ruby, everything is an object. However, Ruby is not Smalltalk. It depends on what you mean by "everything". Fixnums are objects. Classes also are, as instances of class Class. Methods, operators and blocks aren't but can be wrapped by objects via a "Proc". A simple assignment is not and can't. Statements like "while" also aren't and can't. Comments obviously also fall in the latter group. Ruby is more object-oriented than everything else I have ever seen, except for Smalltalk.

    In Ruby, like in Java/C++, classes are classes, objects are instances of classes, and there are class inheritances. There is single inheritance in Ruby, but with the power of mixing in modules, you can extend your classes in a better way than multiple class inheritances (like in C++) would allow. It's also different to Java interfaces, as interfaces in Java only come with the method prototypes and not with the actual method implementations like Ruby modules.

    -

    "Normal" objects and singleton objects


    +

    "Normal" objects and singleton objects



    In Ruby, you can also have singleton objects. A singleton object can be an instance of a class but be modified after its creation (e.g. a method added to only this particular instance after its instantiation). Or, another variant of a singleton object is a class (yes, classes are also objects in Ruby). All of that is way better described in the book, so have a read by yourself if you are confused now; just remember: Rubys object system is very dynamic and flexible. At runtime, you can add and modify classes, objects of classes, singleton objects and modules. You don't need to restart the Ruby interpreter; you can change the code during runtime dynamically through Ruby code.

    -

    Domain specific languages


    +

    Domain specific languages



    Due to Ruby's flexibility through object individualization (e.g. adding methods at runtime, or changing the core behaviour of classes, catching unknown method calls and dynamically dispatch and/or generate the missing methods via the "method_missing" method), Ruby is a very good language to write your own small domain specific language (DSL) on top of Ruby syntax. I only noticed that after reading this book. Maybe, this is one of the reasons why even the configuration management system Puppet once tried to use a Ruby DSL instead of the Puppet DSL for its manifests. I am not sure why the project got abandoned though, probably it has to do with performance. Do be honest, Ruby is not the fastest language, but it is fast enough for most use cases. And, especially from Ruby 3, performance is one of the main things being worked on currently. If I want performance, I can always use another programming language.

    -

    Ruby is "self-ish"


    +

    Ruby is "self-ish"



    Ruby will fall back to the default "self" object if you don't specify an object method receiver. To give you an example, some more explanation is needed: There is the "Kernel" module mixed into almost every Ruby object. For example, "puts" is just a method of module "Kernel". When you write "puts :foo", Ruby sends the message "puts" to the current object "self". The class of object "self" is "Object". Class Object has module "Kernel" mixed in, and "Kernel" defines the method "puts".

    @@ -101,7 +119,7 @@ Hello World
    Ruby offers a lot of syntactic sugar and seemingly magic, but it all comes back to objects and messages to objects under the hood. As all is hidden in objects, you can unwrap and even change the magic and see what's happening under the hood. Then, suddenly everything makes so much sense.

    -

    Functional programming


    +

    Functional programming



    Ruby embraces an object-oriented programming style. But there is good news for fans of the functional programming paradigm: From immutable data (frozen objects), pure functions, lambdas and higher-order functions, lazy evaluation, tail-recursion optimization, method chaining, currying and partial function application, all of that is there. I am delighted about that, as I am a big fan of functional programming (having played with Haskell and Standard ML before).

    @@ -109,7 +127,7 @@ Hello World
    I liked this book so much so that I even bought myself a (used) paper copy of it. To my delight, there was also a free eBook version in ePub format included, which I now have on my Kobo Forma eBook reader. :-)

    -

    Perl


    +

    Perl



    Will I abandon my beloved Perl? Probably not. There are also some Perl scripts I use at work. But unfortunately I only have a limited amount of time and I have to use it wisely. I might look into Raku (formerly known as Perl 6) next year and use it for a personal pet project, who knows. :-). I also highly recommend reading the two Perl books "Modern Perl" and "Higher-Order Perl".

    @@ -117,9 +135,9 @@ Hello World
    Back to the main site
    diff --git a/gemfeed/2021-07-04-the-well-grounded-rubyist/book-backside.jpg b/gemfeed/2021-07-04-the-well-grounded-rubyist/book-backside.jpg deleted file mode 100644 index 2190e679..00000000 Binary files a/gemfeed/2021-07-04-the-well-grounded-rubyist/book-backside.jpg and /dev/null differ diff --git a/gemfeed/2021-07-04-the-well-grounded-rubyist/book-cover.jpg b/gemfeed/2021-07-04-the-well-grounded-rubyist/book-cover.jpg deleted file mode 100644 index b5a00063..00000000 Binary files a/gemfeed/2021-07-04-the-well-grounded-rubyist/book-cover.jpg and /dev/null differ 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 5ebfd451..4ac4418b 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,10 +8,15 @@ -

    On being Pedantic about Open-Source


    +

    +Home | Markdown | Gemini +

    +

    On being Pedantic about Open-Source



    Published at 2021-08-01T10:37:58+03:00; Updated at 2023-01-23

    +I believe that it is essential to always have free and open-source alternatives to any kind of closed-source proprietary software available to choose from. But there are a couple of points you need to take into consideration.
    +
                                                __
                                    _____....--' .'
    @@ -24,21 +29,38 @@
     '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^' LGB - Art by lgbearrd
     

    -I believe that it is essential to always have free and open-source alternatives to any kind of closed-source proprietary software available to choose from. But there are a couple of points you need to take into consideration.
    +

    Table of Contents



    -

    The costs of open-source


    +
    +

    The costs of open-source



    One benefit of using open-source software is that it doesn't cost anything, right? That's correct in many cases. However, in some cases you still need to spend a significant amount of time configuring the software to work for you. It will be more expensive to use open-source software than proprietary commercial one if you aren't careful.

    Not to say that I haven't seen the same effect with commercial software where people had to, after buying it, put a bunch of effort to make it work due to the lack of quality or due to high complexity. But that's either bad luck or bad decision-making. Most commercial providers I have worked with try to make it work for you, so you also will buy other products and services from them later on and don't lose you as a happy customer.

    -

    Commercial providers


    +

    Commercial providers



    Producers of commercial software want to earn money after all. This is to grow their businesses and also to be able to pay their employees, who also need to care for their families. Employees build up their careers, build houses, and are proud of their accomplishments in the company.

    So per se, commercial software is not a bad thing. Right? At least, commercial closed-source software is not a bad thing in its heart. Unfortunately, some companies have to keep their software closed-source to not lose their competitive edge over other competitors.

    -

    Earning on open-source


    +

    Earning on open-source



    There are also companies that earn on open-source software. All the code they write is free for download and use, but you, as a customer, could pay for service and support if you are not an expert and can't manage it by yourself.

    @@ -46,25 +68,25 @@
    Also, once an open-source project reached a certain size, it is unlikely to be abandoned one day. As long as at least one person is willing to be the open-source maintainer, the project won't die. Whereas commercial providers can decide from today to tomorrow to retire software or go bankrupt (unless you purchase Microsoft Word, I don't believe it will die anytime soon).

    -

    Open-source organizations and individual contributors


    +

    Open-source organizations and individual contributors



    Besides corporations, millions of individual open-source contributors write free and open-source software not for money but for pleasure. Often, they are organized in non-profit organizations, working together to reach a common goal (it is worth mentioning that there are also many professionals, payed by large corporations, working full-time for non-profit open-source projects in order to push the features and reach the goals of the corporations). Sometimes, people don't agree on the project goal, so it gets forked, which can be a good thing. The more diversity, the better, as this is where competition and innovation happens. Also, the end user will end up with more choices.

    These open-source projects are of a very high quality standard and are rock-solid, if not better, alternatives to proprietary counterparts. If the project isn't backed by a large corporation already, you should donate to these open-source organizations and/or individual contributors. I have donated to some projects I use personally. Do you learn a foreign language and use Anki flashcards? It's entirely free and open-source, and they happily accept donations ensuring future maintenance and development.

    -

    Lesser known projects and the charm of clunkiness


    +

    Lesser known projects and the charm of clunkiness



    Looking at the smaller, lesser-known open-source projects (not talking about established open-source projects like FreeBSD and Linux): You can't, however, expect the software to be perfect and bug-free. After all, most of the code is written for pleasure and fun in the developers' free time. Besides the developer himself, you might be the only user of the project. The software may be a bit clunky to use, and probably bugs are lurking around, and it might only work for a very specific use case.

    Clunkiness can be charmful, though. And it can also encourage you to contribute code to make it better. There is a lot of such code in personal GitHub and GitLab repositories. The quality of such small open-source projects varies drastically. Many hobbyist programmers see programming as an art and put tons of effort into their projects. Others upload broken crap, which is dangerous to use. So have a look at the code before you use it!

    -

    The security aspect


    +

    The security aspect



    One of the main conceptions about open-source software is that it is more secure than closed-source software because everybody can read and fix the code. Is that actually true? You can only be sure when you audit the code by yourself. If you are like me, you won't have time to audit all the open-source software you use. It's impossible to audit more than 100 million lines of Linux kernel code. Static code analysis tools come in handy here, but they still require humans to look at the results.

    Security bugs in open-source projects are exposed to the public and fixed quickly, while we don't know exactly what happens to security bugs in closed-source ones. Still, hackers and security specialists can find them through reverse engineering and penetration testing. Overall, thinking of security, In my opinion it is still better to prefer open-source software because the more significant the project, the higher the probability that security bugs are found and fixed as more parties are looking into it. Furthermore, provided you have the necessary resources, you could still deduct an audit by yourself. The latter especially happens when companies with its own security and penetration testing departments are evaluating the use of open-source. This is something not every company can afford though.

    -

    Always watch out for open-source alternatives


    +

    Always watch out for open-source alternatives



    Do you need Microsoft Word? Why don't you just use the Vim text editor or GNU Emacs to write your letters? If that's too nerdy, you can still use open-source alternatives such as AbiWord or LibreOffice. Larger organizations have the tendency to standardize the software their employees have to use. Unfortunately, as Microsoft Word is the de-facto standard text processing program, most companies prefer Word over LibreOffice. Same with Microsoft Excel vs LibreOffice Calc or other spreadsheet alternatives like Gnumeric. I don't know why that is; please....

    @@ -72,7 +94,7 @@
    I only use free and open-source operating systems on my personal Laptops, Desktop PCs and servers (FreeBSD and Linux based ones). Most of the programs and apps I use on them are free and open-source as well, and I am comfortable with it for over twenty years. Exceptions are the BIOSes and some firmwares of my devices. I also use Skype as most of my friends and family are using it. They are, unfortunately, proprietary software still. But I will be looking into Matrix as a Skype alternative when I have time. There are also open BIOS alternatives, but they usually don't work on my devices.

    -

    What about mobile?


    +

    What about mobile?



    Update 2023-01-21: Check out my newer post about GrapheneOS, which solves some of my dilemmas

    @@ -82,19 +104,19 @@
    I could get a LineageOS based phone to get rid of the proprietary Android parts (I tried that out a couple of times in the past). But then a couple of convenient apps, such as Google Maps or Banking or Skype or the E-Ticket apps of various Airlines, various review apps when searching for restaurants, Audible (I think Audible offers an excellent service), etc., won't work anymore. The proprietary Google Maps is still the best maps app, even though there are open alternatives available. It's not that I couldn't live without these apps, but they make life a lot more convenient.

    -

    Know the alternatives


    +

    Know the alternatives



    Thinking about alternative solutions is always a good idea. My advice is never to be entirely dependant on any proprietary software. Before you decide to use proprietary software, try to find alternatives in the open-source world. You might need to invest some time playing around with the options available. Maybe they are good enough for you, or maybe not.

    If you still want to use proprietary software, use it with caution. Have a look at the recent change at Google Photos: For a long time, "high quality" photos could be uploaded there quota-less for free. However, Google recently changed the model so that people exceeding a quota have to start paying for the extra space consumed. I am not against Google's decision, but it shows you that a provider can always change its direction. So you can't entirely rely on these. I repeat myself: Don't fully rely on anything proprietary, but you might still use proprietary software or services for your own convenience.

    -

    You can't control it all


    +

    You can't control it all



    The biggest problem I have with going 100% open-source is actually time. You can't control all the software you use or might be using in the future. You have only a finite amount of time available in your life. So you have to decide what's more important: Investigate and use an open-source alternative of every program and app you have installed, or rather spend quality time with your family and have a nice walk in the park or go to a sports class or cook a nice meal? You can't control it all in today's world of tech, not as a user and even not as a tech worker. There's a great blog post worth reading:

    https://unixsheikh.com/articles/how-to-stay-sane-in-todays-world-of-tech.html

    -

    The middle way


    +

    The middle way



    Regarding my personal Smartphone dilemma: I guess the middle way is to use two phones:

    @@ -109,17 +131,17 @@
    Anyhow, any gadgets, including your phone, should be a tool you use. Don't let the phone use you!

    -

    The downside of being a nobody


    +

    The downside of being a nobody



    Be aware that it might be to your disadvantage if you manage to go completely under cover without anyone collecting data from you. Suppose you are a nobody on the web (no social media profiles, no tracking history, etc.). In that case, you aren't behaving like the mass, and therefore you are suspicious. So it might be even a good thing to leave your marks here and there once in a while. You aren't hiding anything anyway, correct? Just be mindful what you are sharing about yourself. I share personal things very rarely on Facebook for example. And I only share a small subset of my personal life on my personal homepage and this blog and on all of my social media accounts. Nobody is interested in what I have for breakfast anyway I guess. Write me an E-Mail if you are interested in what I am having for breakfast.

    -

    Mobile open-source OSes are still evolving


    +

    Mobile open-source OSes are still evolving



    You might have noticed that I wrote a lot about Smartphones in this article. The reason is that free and open-source software for Smartphones is still evolving. In contrast, for Laptops and Desktop PCs, it's already there. There is no reason to use proprietary operating systems such as Windows or macOS on your computers unless your employer forces you to use one of these. Why would they force you? It has to do with standardization again. The IT department only can manage so many platforms. It wouldn't be manageable by IT if every employee would install their own Linux distribution or one of the *BSDs. That might work for small startups but not for larger companies, especially not for a security-focused companies.

    I would love a standardized Linux at work, though. Dell and Lenovo also officially support Linux on their notebooks. The culprit may be knowledgeable IT staff maintaining and giving support to the Desktop Linux users. Not all colleagues are Linux geeks like you and me. I am using macOS for work, but I am not an Apple expert. Occasionally I have to contact IT support regarding some issues I have. I don't use the macOS GUI a lot; I mainly live in the terminal so I can run the same tools I also use on Linux.

    -

    Conclusion


    +

    Conclusion



    Should you be pedantic about open-source software? It depends. It depends on your fundamental values and how much time you are ready to invest. Open-source software is not just free as in money, but also free as in freedom. You will gain back complete control of your personal data. Unfortunately, installing ready proprietary apps from the Play Store is much more convenient than building up a trustworthy open-source-based infrastructure by yourself. As a guideline, use proprietary software and services with caution. Be mindful about your choices and where you leave your digital fingerprints. In doubt, think less is more. Do you really need this new shiny app? What benefit does it provide to you? Probably you don't really need that shiny new app.

    @@ -129,9 +151,9 @@
    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 8ea957bb..e275e922 100644 --- a/gemfeed/2021-09-12-keep-it-simple-and-stupid.html +++ b/gemfeed/2021-09-12-keep-it-simple-and-stupid.html @@ -8,10 +8,15 @@ -

    Keep it simple and stupid


    +

    +Home | Markdown | Gemini +

    +

    Keep it simple and stupid



    Published at 2021-09-12T09:39:20+03:00; Updated at 2023-03-23

    +A robust computer system must be kept simple and stupid (KISS). The fancier the system is, the more can break. Unfortunately, most systems tend to become complex and challenging to maintain in today's world. In the early days, so I was told, engineers understood every part of the system, but nowadays, we see more of the "lasagna" stack. One layer or framework is built on top of another layer, and in the end, nobody has got a clue what's going on.
    +
       _______________                        |*\_/*|_______
       |  ___________  |     .-.     .-.      ||_/-\_|______  |
    @@ -27,25 +32,41 @@
     --------------------                    --------------------
     

    -A robust computer system must be kept simple and stupid (KISS). The fancier the system is, the more can break. Unfortunately, most systems tend to become complex and challenging to maintain in today's world. In the early days, so I was told, engineers understood every part of the system, but nowadays, we see more of the "lasagna" stack. One layer or framework is built on top of another layer, and in the end, nobody has got a clue what's going on.
    -
    -

    Need faster hardware


    +

    Table of Contents


    +
    +
    +

    Need faster hardware



    This not just makes the system much more complex, difficult to maintain and challenging to troubleshoot, but also slow. So more experts are needed to support it. Also, newer and faster hardware is required to make it run smoothly. Often, it's so much easier to buy speedier hardware than rewrite a whole system from scratch from the bottom-up. The latter would require much more resources in the short run, but in the long run, it should pay off. Unfortunately, many project owners scare away from it as they only want to get their project done and then move on.

    -

    Too complex to be replaced


    +

    Too complex to be replaced



    -

    On COBOL


    +

    On COBOL



    Have a look at COBOL, a prevalent programming language of the past. No one is learning COBOL in college or university anymore, but many legacy systems still require COBOL experts. Why is this? It's just too scary to write everything from scratch. There's too much COBOL code out there that can't be replaced from today to tomorrow.

    https://nymag.com/intelligencer/2020/04/what-is-cobol-what-does-it-have-to-do-with-the-coronavirus.html

    -

    On Kubernetes


    +

    On Kubernetes



    Now have a look at Kubernetes (k8s), the current trendy infrastructure thing to use nowadays. Of course, there are many benefits of using k8s (auto-scaling, reproducible deployments, dynamic resource allocation and resource sharing, saving of hardware costs, good commercial for potential employees as it is the current hot sauce of infrastructure). But all of this also comes with costs: You need experts operating the k8s cluster (or you need to pay extra for a managed cluster in the cloud), increased complexity of the system (k8s comes with a steep learning curve). The latter not only applies to the engineers managing the k8s cluster - it also applies to the software engineers, who now have to develop 'cloud native' applications and, therefore, have to change how they developed software how they used to. They all need to be re-educated on what cloud-native means, and they also need to understand the key concepts of k8s for writing optimal software for it.

    -

    The younger generation of IT professionals


    +

    The younger generation of IT professionals



    Maybe the younger generation knows all of this already after graduation, but then they are missing other critical parts of the system for sure. I have seen engineers who knew about containers and how to configure resource restrictions for a Docker container managed via k8s but have never heard the terms Linux control groups and Linux namespaces. So obviously, there is some knowledge gap of the underlying architecture. This can be a big problem when you have to troubleshoot such a system during a production incident and k8s adds a lot of abstraction to the mix which doesn't make it easier.

    @@ -61,7 +82,7 @@
    https://christine.website/blog/theres-a-node-2021-10-02

    -

    The bloated web


    +

    The bloated web



    Another example is the modern web. Have you ever wondered why the internet becomes slower and slower nowadays? The modern web is so much like lasagna that I decided to use Gemini to be the primary protocol of my website. The HTML version of this website is just a fallback as many visitors don't know what Gemini is and don't have any compatible software installed for surfing the Geminispace:

    @@ -69,7 +90,7 @@
    The Gemtext protocol is KISS. There's no way to do other formattings than headings, links, paragraphs, lists, quotes, and bare text blocks (e.g., ASCII art or code snippets). There's no way to create bloated Gemini sites, and due to its limited capabilities, there's also no way to commercialise it (e.g. there's no good way to track the site visitors as things like cookies don't exist). By design, the Gemini protocol can't be extended, so there is no chance to abuse it even in the future. Gemini sites will stay KISS forever, and there won't be any fancy HTML/JavaScript frameworks like we see on the modern web.

    -

    Fancy log-management solutions


    +

    Fancy log-management solutions



    Yet another example I want to bring up is DTail, the distributed log tail program I wrote. There are many great and fancy log-management solutions available to choose from, and they all seem complex to set up and maintain. The ELK stack, for example, requires you to operate an ElasticSearch cluster (or multiple, if you are geo-redundant), Logstash (different configurations and instances, depending on your infrastructure) and a Kibana web-frontend (which also needs to be highly available). I have operated ElasticSearch clusters on multiple occasions, and I must say that it is not an easy task to optimise it for the particular workload you might encounter. I also have seen many ES clusters operated by other people, and I have seen these clusters failing a lot (so it's not just me). The reduced complexity of DTail also makes it more robust against outages. You won't troubleshoot your distributed application very well if the log management infrastructure isn't working either.

    @@ -77,48 +98,49 @@
    I don't say that the ELK stack doesn't work, but it requires experts and additional hardware resources to support it. But instead, if you keep your infrastructure simple (e.g. only use DTail), it will maintain pretty much by itself.

    -

    More KISS


    +

    More KISS



    -

    The Adslowbe PDF Reader


    +

    The Adslowbe PDF Reader



    Another perfect example is the Adobe PDF reader. How can it be that the inventor of the PDF format creates such a terrible user experience with its official reader? The reader is awful bloated, and slow. There are much better alternatives around (especially for Linux and other UNIX like operating systems, look at Zathura for example). I believe the reason Adobe's reader is like this is featuritis, and 90% of the users don't use 90% of all available features. Less is more; keep it simple and stupid.

    -

    The power of plain text files


    +

    The power of plain text files



    Speaking of file formats, never underestimate the power of plain text files. Plain text files don't require any special software to be opened, and they outlive the software which created them in the first place. You will still be able to read a plain text file on a modern computer system ten (or twenty) years from now, but you probably won't be able to read such an old version of an Adobe Photoshop image file if the software required for reading that format isn't supported anymore and doesn't run anymore on modern computers.

    -

    KISS for programmers


    +

    KISS for programmers



    Not to mention, keeping things simple and stupid also reduces the potential malicious attack surface. It's not just about the software and services you use and operate. It's also about the software you write. Here is a nice article about the KISS principle in software development:

    https://thevaluable.dev/kiss-principle-explained/

    -

    When KISS is not KISS anymore


    +

    When KISS is not KISS anymore



    There is, however, a trap. The more you spend time with things, the more these things feel natural to you and you become an expert. The more you become an expert, the more you introduce more abstractions and other clever ways of doing things. For you, things seem to be KISS still, but another person may not be an expert and might not understand what you do. One of the fundamental challenges is to keep things really KISS. You might add abstraction upon abstraction to a system and don't even notice it until it is too late.

    -

    Other relevant readings


    +

    Other relevant readings



    Is the madness ever going to end?
    Write plain text files

    Enough ranted for now!

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other KISS-related posts are:

    -2021-09-12 Keep it simple and stupid (You are currently reading this)
    -2023-06-01 KISS server monitoring with Gogios
    +2024-04-01 KISS high-availability with OpenBSD
    2023-10-29 KISS static web photo albums with photoalbum.sh
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2023-06-01 KISS server monitoring with Gogios
    +2021-09-12 Keep it simple and stupid (You are currently reading this)

    Controversially, a lack of features is a feature. Enjoy your peace an quiet. - Michael W Lucas

    Back to the main site
    diff --git a/gemfeed/2021-10-22-defensive-devops.html b/gemfeed/2021-10-22-defensive-devops.html index edf1e540..14354f50 100644 --- a/gemfeed/2021-10-22-defensive-devops.html +++ b/gemfeed/2021-10-22-defensive-devops.html @@ -8,10 +8,23 @@ -

    Defensive DevOps


    +

    +Home | Markdown | Gemini +

    +

    Defensive DevOps



    Published at 2021-10-22T10:02:46+03:00

    +I have seen many different setups and infrastructures during my carreer. My roles always included front-line ad-hoc fire fighting production issues. This often involves identifying and fixing these under time pressure, without the comfort of 2-week-long SCRUM sprints and without an exhaustive QA process. I also wrote a lot of code (Bash, Ruby, Perl, Go, and a little Java), and I followed the typical software development process, but that did not always apply to critical production issues.
    +
    +Unfortunately, no system is 100% reliable, and you can never be prepared for a subset of the possible problem-space. IT infrastructures can be complex. Not even mentioning Kubernetes yet, a Microservice-based infrastructure can complicate things even further. You can take care of 99% of all potential problems by following all DevOps best practices. Those best practices are not the subject of this blog post; this post is about the sub 1% of the issues arising from nowhere you can't be prepared for.
    +
    +Is there a software bug in a production, even though the software passed QA (after all, it is challenging to reproduce production behaviour in an artificial testing environment) and the software didn't show any issues running in production until a special case came up just now after it got deployed to production a week ago? Are there multiple hardware failure happening which causes loss of service redundancy or data inaccessibility? Is the automation of external customers connected to our infrastructure putting unexpectedly extra pressure on your grid, driving higher latencies and putting the SLAs at risk? You bet the solution is: Sysadmins, SREs and DevOps Engineers to the rescue.
    +
    +You agree that fixing production issues this way is not proactive but rather reactive. I prefer to call it defensive, though, as you "defend" your system against a production issue. But, at the same time, you have to take a cautious (defensive) approach to fix it, as you don't want to make things worse.
    +
    +Over time, I have compiled a list of fire-fighting automation strategies, which I would like to share here.
    +
                                                                 c=====e
                                                                    H
    @@ -22,17 +35,20 @@
                                ASCII Art by Clyde Watson
     

    -I have seen many different setups and infrastructures during my carreer. My roles always included front-line ad-hoc fire fighting production issues. This often involves identifying and fixing these under time pressure, without the comfort of 2-week-long SCRUM sprints and without an exhaustive QA process. I also wrote a lot of code (Bash, Ruby, Perl, Go, and a little Java), and I followed the typical software development process, but that did not always apply to critical production issues.
    -
    -Unfortunately, no system is 100% reliable, and you can never be prepared for a subset of the possible problem-space. IT infrastructures can be complex. Not even mentioning Kubernetes yet, a Microservice-based infrastructure can complicate things even further. You can take care of 99% of all potential problems by following all DevOps best practices. Those best practices are not the subject of this blog post; this post is about the sub 1% of the issues arising from nowhere you can't be prepared for.
    +

    Table of Contents



    -Is there a software bug in a production, even though the software passed QA (after all, it is challenging to reproduce production behaviour in an artificial testing environment) and the software didn't show any issues running in production until a special case came up just now after it got deployed to production a week ago? Are there multiple hardware failure happening which causes loss of service redundancy or data inaccessibility? Is the automation of external customers connected to our infrastructure putting unexpectedly extra pressure on your grid, driving higher latencies and putting the SLAs at risk? You bet the solution is: Sysadmins, SREs and DevOps Engineers to the rescue.
    -
    -You agree that fixing production issues this way is not proactive but rather reactive. I prefer to call it defensive, though, as you "defend" your system against a production issue. But, at the same time, you have to take a cautious (defensive) approach to fix it, as you don't want to make things worse.
    -
    -Over time, I have compiled a list of fire-fighting automation strategies, which I would like to share here.
    -
    -

    Meet Defensive DevOps


    +
    +

    Meet Defensive DevOps



    Defensive DevOps is a term I invented by myself. I define it this way:

    @@ -45,7 +61,7 @@
    That sounds a bit crazy, but this is, unfortunately, in rare occasions the reality. As the question is not whether production issues will happen, the question is WHEN they will happen. Every large provider, such as Google, Netflix, and so on, suffered significant outages before, and I firmly believe that their engineers know what they are doing. But you can prepare for the unexpected only to a certain degree.

    -

    Don't fully automate from the beginning


    +

    Don't fully automate from the beginning



    Do you have to solve problem X? The best solution would be to fully automate it away, correct? No, the best way is to fix problem X manually first. Does the problem appear on one server or on thousand servers? The scale does not matter here. The point is that you should fix the problem at least once manually, so you understand the problem and how to solve it before implementing automation around it.

    @@ -53,7 +69,7 @@
    Once you understand the problem, fix it on a different server again. This time maybe write a small program or script. Semi-automate the process, but don't fully automate it yet. Start the semi-automated solution manually on a couple of more servers and observe the result. You want to gain more confidence that this really solved the problem. This can take a couple of hours manually running it over and over again. During that process, you will improve your script iteratively.

    -

    Develop code directly on production systems


    +

    Develop code directly on production systems



    You have to develop code directly on a production system. This sounds a bit controversial, but you want to get a working solution ASAP, and there is a very high chance that you can't reproduce problem X in a development or QA environment. Or at least it will consume significant effort and time to reproduce the problem, and by the time your code is ready, it's already too late. So the most practical solution is to directly develop your solution against a production system with the problem at hand.

    @@ -61,7 +77,7 @@
    Unfortunately, it will be a bit more complicated when you rely on code reviews (e.g. in a FIPS environment). Pair-programming could be the solution here.

    -

    Don't make it worse


    +

    Don't make it worse



    You want to triple-check that your script is not damaging your system even further. You might introduce a bug to the code, so there should always be a way to roll back any permanent change it causes. You have to program it in a defensive style:

    @@ -75,7 +91,7 @@
    Furthermore, when you write Bash script, always run the tool ShellSheck (https://shellshock.io/) on it. This helps to catch many potential issues before applying it in production.

    -

    Test your code


    +

    Test your code



    You probably won't have time for writing unit tests. But what you can do is to pedantically test your code manually. But you have to do the testing on a production machine. So how can you test your code in production without causing more damage?

    @@ -85,7 +101,7 @@
    By following these principles, you test every line of code while you are developing on it.

    -

    Automation


    +

    Automation



    At one point, you will be tired of manually running your script and also confident enough to automate it. You could deploy it with a configuration management system such as puppet Puppet and schedule a periodic execution via cron, a systemd timer or even a separate background daemon process. You have to be extremely careful here. The more you automate, the more damage you can cause. You don't want to automate it on all servers involved at once, but you want to slowly ramp up the automation.

    @@ -99,13 +115,13 @@
    Remember, whenever something goes wrong, you will have plenty of logs and backup files available. The disaster recovery would involve extending your script to take care of that too or writing a new script for rolling back the backups.

    -

    Out of office hours


    +

    Out of office hours



    If possible, don't deploy any automation shortly before out of office hours, such as in the evening, before holidays or weekends. The only exception would be that you, or someone else, will be available to monitor the automation out of office hours. If it is a critical issue, someone, for example, the on-call person, could take over. Or ask your boss to work now but to take off another day to compensate.

    You should add an easy off-switch to your automation so that everyone from your team knows how to pause it if something goes wrong in order to adjust the automation accordingly. Of course, you should still follow all the principles mentioned in this blog post when making any changes.

    -

    Retrospective


    +

    Retrospective



    For every major incident, you need to follow up with an incident retrospective. A blame-free, detailed description of exactly what went wrong to cause the incident, along with a list of steps to take to prevent a similar incident from occurring again in the future.

    @@ -115,9 +131,9 @@
    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 4bccd556..529941d3 100644 --- a/gemfeed/2021-11-29-bash-golf-part-1.html +++ b/gemfeed/2021-11-29-bash-golf-part-1.html @@ -8,10 +8,19 @@ -

    Bash Golf Part 1


    +

    +Home | Markdown | Gemini +

    +

    Bash Golf Part 1



    Published at 2021-11-29T14:06:14+00:00; Updated at 2022-01-05

    +This is the first blog post about my Bash Golf series. This series is about random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.
    +
    +2021-11-29 Bash Golf Part 1 (You are currently reading this)
    +2022-01-01 Bash Golf Part 2
    +2023-12-10 Bash Golf Part 3
    +
          '\                   .  .                        |>18>>
            \              .         ' .                   |
    @@ -23,12 +32,20 @@ jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                 Art by Joan Stark
     

    -This is the first blog post about my Bash Golf series. This series is about random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.
    +

    Table of Contents



    -2021-11-29 Bash Golf Part 1 (You are currently reading this)
    -2022-01-01 Bash Golf Part 2
    -
    -

    TCP/IP networking


    +
    +

    TCP/IP networking



    You probably know the Netcat tool, which is a swiss army knife for TCP/IP networking on the command line. But did you know that the Bash natively supports TCP/IP networking?

    @@ -62,7 +79,7 @@ X-Frame-Options: SAMEORIGIN
    You would assume that this also works with the ZSH, but it doesn't. This is one of the few things which don't work with the ZSH but in the Bash. There might be plugins you could use for ZSH to do something similar, though.

    -

    Process substitution


    +

    Process substitution



    The idea here is, that you can read the output (stdout) of a command from a file descriptor:

    @@ -142,7 +159,7 @@ foo bar baz
    Just think a while and see whether you understand fully what is happening here.

    -

    Grouping


    +

    Grouping



    Command grouping can be quite useful for combining the output of multiple commands:

    @@ -209,7 +226,7 @@ $ Expands to the process ID of the shell. In a () subshell, it expands to 1028739

    -

    Expansions


    +

    Expansions



    Let's start with simple examples:

    @@ -266,7 +283,7 @@ one:A one:B one:C two:A two:B two:C Linux-one:A-FreeBSD Linux-one:B-FreeBSD Linux-one:C-FreeBSD Linux-two:A-FreeBSD Linux-two:B-FreeBSD Linux-two:C-FreeBSD Linux-three:A-FreeBSD Linux-three:B-FreeBSD Linux-three:C-FreeBSD

    -

    - aka stdin and stdout placeholder


    +

    - aka stdin and stdout placeholder



    Some commands and Bash builtins use "-" as a placeholder for stdin and stdout:

    @@ -317,7 +334,7 @@ $ file - /dev/stdin: Perl script text executable

    -

    Alternative argument passing


    +

    Alternative argument passing



    This is a quite unusual way of passing arguments to a Bash script:

    @@ -359,7 +376,7 @@ paul:secret
    But the downside of it is that the variables will also be defined in your current shell environment and not just in the scripts sub-process.

    -

    : aka the null command


    +

    : aka the null command



    First, let's use the "help" Bash built-in to see what it says about the null command:

    @@ -446,7 +463,7 @@ bash: 1: command not found... 4

    -

    (No) floating point support


    +

    (No) floating point support



    I have to give a plus-point to the ZSH here. As the ZSH supports floating point calculation, whereas the Bash doesn't:

    @@ -473,20 +490,21 @@ bash: line 1: 1/10.0 : syntax error: invalid arithmetic operator (error token is
    See you later for the next post of this series.

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2021-05-16 Personal Bash coding style guide
    -2021-06-05 Gemtexter - One Bash script to rule it all
    -2021-11-29 Bash Golf Part 1 (You are currently reading this)
    +2023-12-10 Bash Golf Part 3
    2022-01-01 Bash Golf Part 2
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2021-11-29 Bash Golf Part 1 (You are currently reading this)
    +2021-06-05 Gemtexter - One Bash script to rule it all
    +2021-05-16 Personal Bash coding style guide

    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 28eb7eda..2a0ca68c 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,10 +8,19 @@ -

    How to stay sane as a DevOps person


    +

    +Home | Markdown | Gemini +

    +

    How to stay sane as a DevOps person



    Published at 2021-12-26T12:02:02+00:00; Updated at 2022-01-12

    +Log4shell (CVE-2021-44228) made it clear, once again, that working in information technology is not an easy job (especially when you are a DevOps person). I thought it would be interesting to summarize a few techniques to help you to relax.
    +
    +(PS: When I mean DevOps, I also mean Site Reliability Engineers and Sysadmins. I believe SRE, DevOps Engineer and Sysadmin are just synonym titles for the same job).
    +
    +https://en.wikipedia.org/wiki/Log4Shell
    +
                                          )
                                  )      ((     (
    @@ -34,13 +43,26 @@
       ~~~~~'
     

    -Log4shell (CVE-2021-44228) made it clear, once again, that working in information technology is not an easy job (especially when you are a DevOps person). I thought it would be interesting to summarize a few techniques to help you to relax.
    -
    -(PS: When I mean DevOps, I also mean Site Reliability Engineers and Sysadmins. I believe SRE, DevOps Engineer and Sysadmin are just synonym titles for the same job).
    +

    Table of Contents



    -https://en.wikipedia.org/wiki/Log4Shell
    -
    -

    Set clear expectations


    +
    +

    Set clear expectations



    It's important to set clear expectations. It can be difficult to guess what others expect or don't expect from you. If you know exactly what you are supposed to do, you can work towards a specific goal and don't worry about all the other noise so much.

    @@ -48,21 +70,21 @@
    Due to politeness, many people are not setting clear expectations. I personally may sound sometimes "too German" when setting expectations, but so far nobody complained, and I have even received positive feedback about it.

    -

    Always respond to requests but set expectations and boundaries


    +

    Always respond to requests but set expectations and boundaries



    There are many temptations to get side-tracked by other projects and/or issues. It is important to set boundaries here. But always answer to all requests as nothing is more frustrating than asking a person and never getting any answer back. This is especially the case when everyone is working form home where people are using tools such as Slack and E-Mail for most of their communications.

    -

    Dealing with requests


    +

    Dealing with requests



    If the request is urgent, and you have the capacity to help, probably you should help. If it's not urgent, maybe ask to pospone the request (e.g. ask to create a ticket, so that someone from your team can work on it later).

    If the request is urgent, but you don't have the knowledge or the capacity to help, try to defer to a colleague who might be able to help. You could also provide some quick tips and hints, so that the requester can resolve the issue by himself. Make it transparent why you might not have the time right now, as this can help the person to review his own priorities or to escalate.

    -

    Escalation is only a tool


    +

    Escalation is only a tool



    Never make or take an escalation personally. The only forms of escalation should be due to technical issues or lack of resources. An escalation then becomes like a math equation and does not need human resources involved. So de-facto, an escalation is nothing negative, but just a process people can follow to form decision-making. In a good company escalations tend to be an exception, though. Staff knows how to deal with the things by themselves without bothering management too much.

    -

    Think positively


    +

    Think positively



    If times are very stressful, think that it could always be worse:

    @@ -72,17 +94,17 @@
  • You probably will never run out of work in the IT sector. So you will always be able to make a living.
  • Your IT job and life is actually pretty good (compared to a homeless person for example). You are probably part of the world's top 1% regarding life standard.

  • -

    Go slower even if you could go faster


    +

    Go slower even if you could go faster



    When working in a team, you may feel that you could get done things faster when you just did everything by yourself. This can be a bit frustrating at times, as you might need to work late hours and also might need to explain things over and over again to others. Also, you could be the one who needs to get things explained over and over again as you are not so familiar with the topic (yet). You will appreciate it if the other person is slowing down for you a bit.

    -

    You work in a team


    +

    You work in a team



    Security is a team sport. So slow down and make sure that everyone is on track with the goals. You can go full-speed with your very own subtasks, though. Not everyone knows how to use all the tools so well like a full-time DevOps person. As a DevOps person, you are not a security expert, though. Security experts are different people in your company, but DevOps will be the main tribe deploying mitigations (following the security recommendations) and management will be the main tribe coordinating all the efforts.

    So even if you think that you can do everything faster by your own, can you really? You probably don't know what you don't know about IT security. The more you know about it, the more you know about what you don't know.

    -

    Don't rush


    +

    Don't rush



    Slowing down also helps to prevent errors. Don't rush your tasks, even if they are urgent. Try to be quick, but don't rush them. Maybe you are writing a script to mitigate a production issue. You could others peer review that script, for example. Their primary programming language may not be the same (e.g. Golang vs Perl), but they would understand the logic. Or ask another DevOps person from your company with good scripting skills review your mitigation, but he then may lack the domain knowledge of the software you are patching. So in either case, the review will take a bit longer as the reviewer might not be an expert in everything.

    @@ -90,7 +112,7 @@
    Read also "Defensive DevOps" about deploying mitigation scripts.

    -

    You are not a superhero


    +

    You are not a superhero



    Always keep that in mind. You can't solve all problems by your own. Maybe you could, but that would be a lot of additional stress (and this will reflect to your personal life). Also, Superman and Wonder Woman receive much higher salaries than you will ever do ;-).

    @@ -98,7 +120,7 @@
    This doesn't mean, that you shouldn't try your best. But you don't need to try to be the superhero. Maybe someone else will be the superhero, but that's OK as long as it's not always the same person every time. Everyone can have a good day after all. If I could choose between being a superhero or having a good night sleep, I would probably prefer the sleep.

    -

    Give away some of your superpowers


    +

    Give away some of your superpowers



    If you are a superhero, try to give away some of your superpowers, so that you can relax in the evening knowing that others (e.g. the current on-call engineers) know how to tackle things. Every member of the team needs to do DevOps (even the team managers, in my humble opinion). Some may be less experienced than others or have other expertises, but to counteract this you could document the recurring tasks so that they are easy to follow (which then later could be either automated away or, even better, fully fixed).

    @@ -106,7 +128,7 @@
    So you are not a superhero. Or, if you are a superhero, then all colleagues should be superheroes too.

    -

    Don't jump on all problems immediately


    +

    Don't jump on all problems immediately



    In a perfect world, every member of a team comes along with the same strengths and skills. But in reality, everyone is different.

    @@ -116,19 +138,19 @@
    If the issue is a very critical one, then you might better off trying to resolve it as fast as possible with your full powers in order to avoid any major damage to the company. This, of course, only works if you know how to resolve it quickly. So, don't leave others with not much experience yet looking at it. If possible, work with the team to resolve the issue. Unfortunately, solving it with the team is not always the fastest way. So in this particular circumstance, the company may be better off being saved by a single superhero. Make sure that the problem will not occur again or, at least, that others can fix it the next time without Superman flying by.

    -

    Force breaks; and shutdown now


    +

    Force breaks; and shutdown now



    Be strict about your time off. Nowadays, tech workers check their messages also out of office hours and are reachable 24/7. This really should only be the case when you are on-call, to be honest (or if you work for a startup). All other out-of-office time is owned by you and not your employer. You have signed an 40 hour/week and not 7 days/week contract. Of course, there will be always some sort of flexibility and exceptions. You might need to work over the weekend to get a migration done or a problem solved. But to balance it out, you should have other days off as substitutes.

    It's important to shut down your brain from work during your breaks (be strict with your breaks, leave your desk for lunch or for a walk early afternoon and if you aren't on-call also don't take your work-phone with you). You will be happier and also much more energized and productive in the afternoon. Also, when you are reachable 24/7, your colleagues will start thinking that you don't have anything more important to do than work.

    -

    Block time every day for personal advance


    +

    Block time every day for personal advance



    It does not matter how many tasks are in your backlog or how many issues are to be tackled. *Always* find time for personal advance. The most issues aren't critical anyway and can wait a bit. At the end of the day, you will have a nice feeling that you have accomplished something meaningful. This can be an interesting project or learning a new technology you are interested in. Of course, there must be consensus with your manager (unless you do that kind of thing in your personal time of course).

    If you are too busy at work and just can't block time, then maybe it's time to think about alternatives. But before you do that, probably there is something else you can do. Perhaps you just think you can't block time, but you would be positively surprised to hear from your manager that he will fully support you. Of course, he won't agree to you working full-time on your pet projects. But a certain portion of your time should be allocated for personal advance. After all, your employer also want's you to stay happy so that you don't look for alternatives. It's of everyone's interest that you like your job and stay motivated. The more you are motivated, the more productive you are. The more productive you are, the more valuable you are for the company.

    -

    More


    +

    More



    Another blog post worth reading:

    @@ -138,9 +160,9 @@
    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 4106611c..b8d4f5b7 100644 --- a/gemfeed/2022-01-01-bash-golf-part-2.html +++ b/gemfeed/2022-01-01-bash-golf-part-2.html @@ -8,10 +8,19 @@ -

    Bash Golf Part 2


    +

    +Home | Markdown | Gemini +

    +

    Bash Golf Part 2



    Published at 2022-01-01T23:36:15+00:00; Updated at 2022-01-05

    +This is the second blog post about my Bash Golf series. This series is random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.
    +
    +2021-11-29 Bash Golf Part 1
    +2022-01-01 Bash Golf Part 2 (You are currently reading this)
    +2023-12-10 Bash Golf Part 3
    +
         '\       '\                   .  .                |>18>>
           \        \              .         ' .           |
    @@ -23,12 +32,19 @@ jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                             Art by Joan Stark, mod. by Paul Buetow
     

    -This is the second blog post about my Bash Golf series. This series is random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.
    -
    -2021-11-29 Bash Golf Part 1
    -2022-01-01 Bash Golf Part 2 (You are currently reading this)
    +

    Table of Contents



    -

    Redirection


    +
    +

    Redirection



    Let's have a closer look at Bash redirection. As you might already know that there are 3 standard file descriptors:

    @@ -57,6 +73,8 @@ Foo Foo

    +Update: A reader pointed out, that the redirection should actually go to /proc/self/fd/1 and not 0. But apparently, either way works for this particular example. Do you know why?
    +
    Other useful redirections are:

      @@ -158,7 +176,7 @@ First line: Learn You a Haskell Second line: for Great Good

    -

    HERE


    +

    HERE



    I have mentioned HERE-documents and HERE-strings already in this post. Let's do some more examples. The following "cat" receives a multi line string from stdin. In this case, the input multi line string is a HERE-document. As you can see, it also interpolates variables (in this case the output of "date" running in a subshell).

    @@ -241,7 +259,7 @@ Learn you a Golang for Great Good I like Perl too

    -

    RANDOM


    +

    RANDOM



    Random is a special built-in variable containing a different pseudo random number each time it's used.

    @@ -286,11 +304,11 @@ Delaying script execution for 42 seconds... Continuing script execution...

    -

    set -x and set -e and pipefile


    +

    set -x and set -e and pipefile



    In my opinion, -x and -e and pipefile are the most useful Bash options. Let's have a look at them one after another.

    -

    -x


    +

    -x



    -x prints commands and their arguments as they are executed. This helps to develop and debug your Bash code:

    @@ -332,7 +350,7 @@ Second line: for Great Good ❯

    -

    -e


    +

    -e



    This is a very important option you want to use when you are paranoid. This means, you should always "set -e" in your scripts when you need to make absolutely sure that your script runs successfully (with that I mean that no command should exit with an unexpected status code).

    @@ -451,7 +469,7 @@ Hello You!
    ./2021-05-16-personal-bash-coding-style-guide.html

    -

    pipefail


    +

    pipefail



    The pipefail option makes it so that not only the exit code of the last command of the pipe counts regards its exit code but any command of the pipe:

    @@ -491,20 +509,21 @@ PAUL:X:1000:1000:PAUL BUETOW:/HOME/PAUL:/BIN/BASH 1

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2021-05-16 Personal Bash coding style guide
    -2021-06-05 Gemtexter - One Bash script to rule it all
    -2021-11-29 Bash Golf Part 1
    +2023-12-10 Bash Golf Part 3
    2022-01-01 Bash Golf Part 2 (You are currently reading this)
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2021-11-29 Bash Golf Part 1
    +2021-06-05 Gemtexter - One Bash script to rule it all
    +2021-05-16 Personal Bash coding style guide

    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 68fc4bef..49cf3df2 100644 --- a/gemfeed/2022-01-23-welcome-to-the-foo.zone.html +++ b/gemfeed/2022-01-23-welcome-to-the-foo.zone.html @@ -8,7 +8,10 @@ -

    Welcome to the foo.zone


    +

    +Home | Markdown | Gemini +

    +

    Welcome to the foo.zone



    Published at 2022-01-23T16:42:04+00:00

    @@ -27,7 +30,7 @@
    https://en.wikipedia.org/wiki/Metasyntactic_variable

    -

    What is the foo zone?


    +

    What is the foo zone?



    It's my personal internet site and blog. Everything you read on this site is my personal opinion and experience. It's not intended to be anything professional. If you want my professional background, then go to my LinkedIn profile.

    @@ -45,13 +48,13 @@
    So I think that foo.zone is the perfect match. It's a bit geeky, but so is this site. The meta-syntactic variable relates to computer science and programming, so does this site. Other than that, staying in this sphere, it's a pretty generic name.

    -

    To be in the .zone and not in a .surf club


    +

    To be in the .zone and not in a .surf club



    I was pretty happy finding out that foo.zone was still available for registration. I stumbled across it just yesterday while I was playing around with my new authoritative DNS servers. I was actually quite surprised as usually such short SLDs (second level domains), especially "foo", are all taken already.

    As a funny bit, I almost chose "foo.surf" over "foo.zone" as in "surfing this site", but then decided against it as I would have to tell everyone that I am not into water sports so much. Well, on the other hand, I now may have to explain to non-programmers that I am not a fan of the rock band "Foo Fighters". But that will be acceptable, as I don't expect "normal" people visiting the foo zone as much anyway. If you reached as far, I have to congratulate you. You are not a normal person.

    -

    What about my old hosts


    +

    What about my old hosts



    The host buetow.org will stay. However, not as the primary address for this site. I will keep using it for my personal internet infrastructure as well as for most of my E-Mail addresses. I used buetow.org for that over the past 10 years already anyway and that won't change any time soon. I don't know what I am going to do with snonux.de in the long run. A .de SLD (for Germany) is pretty cheap, so I might just keep it for now.

    @@ -59,9 +62,9 @@
    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 43ca9acf..ea0c8332 100644 --- a/gemfeed/2022-02-04-computer-operating-systems-i-use.html +++ b/gemfeed/2022-02-04-computer-operating-systems-i-use.html @@ -8,10 +8,15 @@ -

    Computer operating systems I use(d)


    +

    +Home | Markdown | Gemini +

    +

    Computer operating systems I use(d)



    Published at 2022-02-04T09:58:22+00:00; Updated at 2022-02-18

    +This is a list of Operating Systems I currently use. This list is in no particular order and also will be updated over time. The very first operating system I used was MS-DOS (mainly for games) and the very first Unix like operating system I used was SuSE Linux 5.3. My first smartphone OS was Symbian on a clunky Sony Ericsson device.
    +
                   /(        )`
                   \ \___   / |
    @@ -33,9 +38,32 @@
              `--{__________)        \/   "Berkeley Unix Daemon"
     

    -This is a list of Operating Systems I currently use. This list is in no particular order and also will be updated over time. The very first operating system I used was MS-DOS (mainly for games) and the very first Unix like operating system I used was SuSE Linux 5.3. My first smartphone OS was Symbian on a clunky Sony Ericsson device.
    +

    Table of Contents



    -

    Fedora Linux


    +
    +

    Fedora Linux



    Fedora Linux is the operating system I use on my primary (personal) laptop. It's a ThinkPad X1 Carbon Gen. 9. Lenovo which comes along with official Lenovo Linux support. I already noticed hardware firmware updates being installed directly through Fedora from Lenovo. Fedora is a real powerhouse, cutting-edge and reasonably stable at the same time. It's baked by Red Hat.

    @@ -43,7 +71,7 @@
    I use the GNOME Desktop on my Fedora boxes. I have memorized and customized a bunch of keyboard shortcuts. But the fact that I mostly work in the terminal (with tmux) makes the Desktop environment I use only secondary.

    -

    EndeavourOS


    +

    EndeavourOS



    I installed EndeavourOS on my (older) ThinkPad X240 to try out an Arch based Linux distribution. I also could have installed plain Arch, but I don't see the point when there is EndeavourOS. EndeavourOS is as close as you can get to the plain Arch experience but with an easy installer. I am not saying that it's difficult to install plain Arch but it's, unless you are new to Linux and want to learn about the installation procedure, just waste of time in my humble opinion. Give Linux From Scratch a shot instead if you really want to learn about Linux.

    @@ -59,7 +87,7 @@
    https://endeavouros.com/

    -

    FreeBSD


    +

    FreeBSD



    I have run FreeBSD in many occasions. Right after SuSE Linux, FreeBSD (around 4.x) was the second open source system I used in my life on regular basis. I didn't even go to university yet then I started using it :-). Also, a former employer of mine even allowed me to install FreeBSD on my main workstation (which I actually did and used it for a couple of years).

    @@ -92,7 +120,7 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2
    https://www.FreeBSD.org

    -

    CentOS 7


    +

    CentOS 7



    While CentOS 8 is already out of support, I still use CentOS 7 (which will receive security updates until 2024). CentOS 7 runs in a cloud VM and is the home to my personal NextCloud and Wallabag installations. You probably know already NextCloud. About Wallabag: It is a great free and open source alternative to Pocket (for reading articles from the web offline later). Yes, you can pay for a Wallabag subscription, but you can also host it for free on your own server.

    @@ -105,7 +133,7 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2
    https://www.centos.org

    -

    OpenBSD


    +

    OpenBSD



    I use two small OpenBSD "cloud" boxes for my "public facing internet front-ends". The services I run here are:

    @@ -122,7 +150,7 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2
    https://www.openbsd.org

    -

    macOS (proprietary)


    +

    macOS (proprietary)



    I have to use a MacBook Pro with macOS for work. What else can I say but that this would have never been my personal choice. At least macOS is a UNIX under the hood and comes with a decent terminal and there are plenty of terminal apps available via Brew. Some of the inner workings of macOS were actually forked from the FreeBSD project.

    @@ -130,7 +158,7 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2
    I find the macOS UI rather confusing.

    -

    LineageOS (mobile)


    +

    LineageOS (mobile)



    At some point I got fed up with big tech, like Google and Samsung (or Apple, but personally I don't use Apple), spying on me. So I purchased a Google phone (a midrange Pixel phone) and installed LineageOS, a free and open source distribution of Android, on it. I don't have anything from Google installed on it (not even the play store, I install my apps from F-Droid). It's my daily driver since mid 2021 now.

    @@ -143,33 +171,33 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2 https://lineageos.org/
    https://termux.com/

    -

    Samsung's Stock Android (mobile proprietary)


    +

    Samsung's Stock Android (mobile proprietary)



    Unfortunatley, I still have to keep my proprietary Android phone around. Sometimes, I really need to use some proprietary apps which are only available form the Google play store and also require the Google services installed on the phone. I don't carry this phone around all the time and I only use it intentionally for very specific use cases. I think this is the best compromise I can make.

    -

    iOS (mobile proprietary)


    +

    iOS (mobile proprietary)



    I have to use an iPhone for work. I like the hardware but I hate the OS (you can also call it spyOS), but it's the necessarries evil, unfortunately. Apple is even worse than Google here (despite claiming for themselves to produce the most secure phone(s)). I don't have it with me all the time or switched off when I don't need it. I also find iOS quite unintuitive to use.

    Being on-call for work means to to be reachable 24/7. This implies that the phone is carried around all the time (in an switched-on state). 1984 is now.
    https://en.wikipedia.org/wiki/Nineteen_Eighty-Four

    -

    Other OSes


    +

    Other OSes



    -

    InfinyTime (smartwatch)


    +

    InfinyTime (smartwatch)



    I use it on my PineTime smartwatch. Other than checking the time and my step count, I really don't do anything else fancy with it (yet).

    https://www.pine64.org/pinetime/
    https://infinitime.io/

    -

    motionEyeOS


    +

    motionEyeOS



    I usually install an army of RaspberryPi 3's in my house before I travel for a prolonged amount of time. All Pi's are equipped with an camera and have motionEyeOS (Linux based video surveillance system) installed. There's a neat Android app in the F-Droid store which let's me keep an eye on everything. I make the Pi's accessible from the internet via reverse SSH tunnels through one of my frontend servers.

    https://github.com/ccrisan/motioneyeos

    -

    Kobo OS (proprietary)


    +

    Kobo OS (proprietary)



    I use a Kobo Forma as my e-reader device. I have started to switch off the Wifi and to only sideload DRM free ePubs on it. Even offline, it's a fully capable reader device. I wouldn't like the Kobo to call home to Rakuten. I would love to replace it one day with an open source e-reader alternative like the PineNote. There are also some interesting attempts installing postmarketOS Linux on Kobo devices. The latter boots already, but is far from being usable as a normal e-reader.

    @@ -178,28 +206,28 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2
    But as a fall-back, someone could still use the good old dead tree format!

    -

    Android TV (proprietary)


    +

    Android TV (proprietary)



    An Android TV box is used for watching movies and series on Netflix and Amazon Prime video (yes, I am human too and rely once in a while on big tech streaming services). The Android TV box is currently in the process of being replaced by OSMC, though. Most services seem to work fine with OSMC, but didn't get around tinkering with Netflix and Amazon there yet.

    https://osmc.tv/

    -

    Other OSes..


    +

    Other OSes..



    This section is just for the sake of having a complete list of all OSes I used for some significant amount of time. I might not use all of them any more...

    -

    NetBSD


    +

    NetBSD



    I have been using NetBSD on an old Sun Sparcstation 10 as a student. I also have run NetBSD on a very old ThinkPad with 96MB!!! of RAM (even with X/evilWM). I also installed (but never really used) NetBSD on an HP Jornada 680. But that's all more than 10 years ago. I haven't looked at NetBSD for long time. I want to revive it on an "old" ThinkPad T450 of mine which I currently don't use.

    https://netbsd.org

    -

    Other OSes in use...


    +

    Other OSes in use...



    SailfishOS - Nice mobile OS, but unfortunately includes proprietary components
    Red Hat Enterprise Linux - Only for some work stuff

    -

    Other OSes not used any more...


    +

    Other OSes not used any more...



    SuSE Linux 5.3 - The first Linux OS I used
    SGI's IRIX - On a SGI Onyx 3200
    @@ -213,7 +241,7 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2 Linux from scratch - The best way to learn Linux
    SUSE Linux Enterprise - Only for some work stuff

    -

    Other OSes I only had a glance at...


    +

    Other OSes I only had a glance at...



    OpenSolaris - Continuation of the open source version of Solaris
    Arch Linux ARM
    @@ -231,7 +259,7 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2 Sun Solaris (now owned by Oracle)
    OpenDarwin ("now" PureDarwin) - Open source operating system based on the open parts of macOS

    -

    Other OSes which seem interesting...


    +

    Other OSes which seem interesting...



    Asteroids OS - Open source smartphone OS
    DragonFly BSD - Fork of FreeBSD 4
    @@ -241,9 +269,9 @@ 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 d90636b2..622470f8 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,10 +8,17 @@ -

    The release of DTail 4.0.0


    +

    +Home | Markdown | Gemini +

    +

    The release of DTail 4.0.0



    Published at 2022-03-06T18:11:39+00:00

    +I have recently released DTail 4.0.0 and this blog post goes through all the new goodies. If you want to jump directly to DTail, do it here (there are nice animated gifs which demonstrates the usage pretty well):
    +
    +https://dtail.dev
    +
                                   ,_---~~~~~----._
                             _,,_,*^____      _____``*g*\"*,
    @@ -26,13 +33,27 @@
                              |                           |
     

    -I have recently released DTail 4.0.0 and this blog post goes through all the new goodies. If you want to jump directly to DTail, do it here (there are nice animated gifs which demonstrates the usage pretty well):
    -
    -https://dtail.dev
    +

    Table of Contents



    -

    So, what's new in 4.0.0?


    +
    +

    So, what's new in 4.0.0?



    -

    Rewritten logging


    +

    Rewritten logging



    For DTail 4, logging has been completely rewritten. The new package name is "internal/io/dlog". I rewrote the logging because DTail is a special case here: There are logs processed by DTail, there are logs produced by the DTail server itself, there are logs produced by a DTail client itself, there are logs only logged by a DTail client, there are logs only logged by the DTail server, and there are logs logged by both, server and client. There are also different logging levels and outputs involved.

    @@ -59,7 +80,7 @@ const (
    DTail also supports multiple log outputs (e.g. to file or to stdout). More are now easily pluggable with the new logging package. The output can also be "enriched" (default) or "plain" (read more about that further below).

    -

    Configurable terminal color codes


    +

    Configurable terminal color codes



    A complaint I received from the users of DTail 3 were the terminal colors used for the output. Under some circumstances (terminal configuration) it made the output difficult to read so that users defaulted to "--noColor" (disabling colored output completely). I toke it by heart and also rewrote the color handling. It's now possible to configure the foreground and background colors and an attribute (e.g. dim, bold, ...).

    @@ -175,7 +196,7 @@ const ( jsonschema -i dtail.json schemas/dtail.schema.json

    -

    Serverless mode


    +

    Serverless mode



    All DTail commands can now operate on log files (and other text files) directly without any DTail server running. So there isn't a need anymore to install a DTail server when you are on the target server already anyway, like the following example shows:

    @@ -191,7 +212,7 @@ jsonschema -i dtail.json schemas/dtail.schema.json
    The way it works in Go code is that a connection to a server is managed through an interface and in serverless mode DTail calls through that interface to the server code directly without any TCP/IP and SSH connection made in the background. This means, that the binaries are a bit larger (also ship with the code which normally would be executed by the server) but the increase of binary size is not much.

    -

    Shorthand flags


    +

    Shorthand flags



    The "--files" from the previous example is now redundant. As a shorthand, It is now possible to do the following instead:

    @@ -201,7 +222,7 @@ jsonschema -i dtail.json schemas/dtail.schema.json
    Of course, this also works with all other DTail client commands (dgrep, dcat, ... etc).

    -

    Spartan (aka plain) mode


    +

    Spartan (aka plain) mode



    There's a plain mode, which makes DTail only print out the "plain" text of the files operated on (without any DTail specific enriched output). E.g.:

    @@ -212,7 +233,7 @@ jsonschema -i dtail.json schemas/dtail.schema.json
    This might be useful if you wanted to post-process the output.

    -

    Standard input pipe


    +

    Standard input pipe



    In serverless mode, you might want to process your data in a pipeline. You can do that now too through an input pipe:

    @@ -227,7 +248,7 @@ jsonschema -i dtail.json schemas/dtail.schema.json % awk '.....' < /some/file | dtail ....

    -

    New command dtailhealth


    +

    New command dtailhealth



    Prior to DTail 4, there was a flag for the "dtail" command to check the health of a remote DTail server (for use with monitoring system such as Nagios). That has been moved out to a separate binary to reduce complexity of the "dtail" command. The following checks whether DTail is operational on the current machine (you could also check a remote instance of DTail server, just adjust the server address).

    @@ -238,7 +259,7 @@ jsonschema -i dtail.json schemas/dtail.schema.json exec /usr/local/bin/dtailhealth --server localhost:2222

    -

    Improved documentation


    +

    Improved documentation



    Some features, such as custom log formats and the map-reduce query language, are now documented. Also, the examples have been updated to reflect the new features added. This also includes the new animated example Gifs (plus documentation how they were created).

    @@ -252,7 +273,7 @@ exec /usr/local/bin/dtailhealth --server localhost:2222
    That will be added in one of the future releases.

    -

    Integration testing suite


    +

    Integration testing suite



    DTail comes already with some unit tests, but what's new is a full integration testing suite which covers all common use cases of all the commands (dtail, dcat, dgrep, dmap) with a server backend and also in serverless mode.

    @@ -273,7 +294,7 @@ exec /usr/local/bin/dtailhealth --server localhost:2222 % go test -race -v ./integrationtests

    -

    Improved code


    +

    Improved code



    Not that the code quality of DTail has been bad (I have been using Go vet and Go lint for previous releases and will keep using these), but this time I had new tools (such as SonarQube and BlackDuck) in my arsenal to:

    @@ -283,11 +304,11 @@ exec /usr/local/bin/dtailhealth --server localhost:2222
    Other than that, a lot of other code has been refactored as I saw fit.

    -

    Use of memory pools


    +

    Use of memory pools



    DTail makes excessive use of string builder and byte buffer objects. For performance reasons, those are now re-used from memory pools.

    -

    What's next


    +

    What's next



    DTail 5 won't be released any time soon I guess, but some 4.x.y releases will follow this year fore sure. I can think of:

    @@ -300,24 +321,24 @@ exec /usr/local/bin/dtailhealth --server localhost:2222
    I am a bit busy at the moment with two other pet projects of mine (one internal work-project, and one personal one, the latter you will read about in the next couple of months). If you have ideas (or even a patch), then please don't hesitate to contact me (either via E-Mail or a request at GitHub).

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2021-04-22 DTail - The distributed log tail program
    -2022-03-06 The release of DTail 4.0.0 (You are currently reading this)
    -2022-10-30 Installing DTail on OpenBSD
    2023-09-25 DTail usage examples
    +2022-10-30 Installing DTail on OpenBSD
    +2022-03-06 The release of DTail 4.0.0 (You are currently reading this)
    +2021-04-22 DTail - The distributed log tail program

    Thanks!

    Paul

    -E-Mail your comments to paul@nospam.buetow.org :-)
    -
    Back to the main site
    diff --git a/gemfeed/2022-04-10-creative-universe.html b/gemfeed/2022-04-10-creative-universe.html index c0b51e09..df7d8711 100644 --- a/gemfeed/2022-04-10-creative-universe.html +++ b/gemfeed/2022-04-10-creative-universe.html @@ -8,10 +8,30 @@ -

    Creative universe


    +

    +Home | Markdown | Gemini +

    +

    Creative universe



    Published at 2022-04-10T10:09:11+01:00; Updated at 2022-04-18

    +I have been participating in an annual work-internal project contest (we call it Pet Project contest) since I moved to London and switched jobs to my current employer. I am very happy to say that I won a "silver" prize last week here 🎆. Over the last couple of years I have been a finalist in this contest six times and won some kind of prize five times. Some of my projects were also released as open source software. One had a magazine article published, and for another one I wrote an article on my employer's engineering blog. If you have followed all my posts on this blog (the one you are currently reading), then you have probably figured out what these projects were:
    +
    +DTail - The distributed log tail program
    +Realistic load testing with I/O Riot for linux
    +
    +Note that my latest silver prize project isn't open source software and because of that there is no public material I can refer to. Maybe the next one again?
    +
    +I want to point out that I never won the "gold" prize and it's the first time I won "silver", though. I believe, looking at the company's contest history, I am the employee with the most consecutive successful project submissions (my streak broke as I didn't participate last year) and am also the one with the highest successful project count in total. Sorry if this all sounds a bit self-promotional, but I think it is something to be proud of. Consistency beats a one-off success.
    +
    +I often put endless hours and sometimes sleepless nights into such projects and all of that in my own time. I, an engineer whose native tongue is not English, also have to present such a project in front of the CEO, CTO and CPO, the Chief Scientist, the founders of the company, and, if it is not enough, to all other staff of the company too. I usually also demonstrate a working prototype live on a production grid during the presentation. 😓
    +
    +So why would I sign up myself for such side projects? Isn't it a lot of stress and extra work? Besides the prize in form of money (you can not count on that, you may win or you may not win something) and recognition, there are also other motivational points:
    +
    +
      +
    • I want to learn new technologies or to deepen my knowledge of a given technology. I want to have a personal benefit from the project, even when I don't win any prize. So when the company is offering a contest, why not use it as a motivational trampoline? It's good to have a hard deadline for a project. And the project will also benefit the company in some way. So it's a win-win.
    • +
    • I love the idea of combining several old things into a new thing. You can call this creativity. At work, we call this sometimes Lego: Building new things from given blocks. But I also love to add something new and unique to the mix, something that didn't exist as a Lego block before and could not be built by using only the already existing blocks.
    • +

      .              +   .                .   . .     .  .
                        .                    .       .     *
    @@ -33,36 +53,31 @@
                                              - the universe
     

    -

    Prelude


    -
    -I have been participating in an annual work-internal project contest (we call it Pet Project contest) since I moved to London and switched jobs to my current employer. I am very happy to say that I won a "silver" prize last week here 🎆. Over the last couple of years I have been a finalist in this contest six times and won some kind of prize five times. Some of my projects were also released as open source software. One had a magazine article published, and for another one I wrote an article on my employer's engineering blog. If you have followed all my posts on this blog (the one you are currently reading), then you have probably figured out what these projects were:
    -
    -DTail - The distributed log tail program
    -Realistic load testing with I/O Riot for linux
    -
    -Note that my latest silver prize project isn't open source software and because of that there is no public material I can refer to. Maybe the next one again?
    -
    -I want to point out that I never won the "gold" prize and it's the first time I won "silver", though. I believe, looking at the company's contest history, I am the employee with the most consecutive successful project submissions (my streak broke as I didn't participate last year) and am also the one with the highest successful project count in total. Sorry if this all sounds a bit self-promotional, but I think it is something to be proud of. Consistency beats a one-off success.
    -
    -I often put endless hours and sometimes sleepless nights into such projects and all of that in my own time. I, an engineer whose native tongue is not English, also have to present such a project in front of the CEO, CTO and CPO, the Chief Scientist, the founders of the company, and, if it is not enough, to all other staff of the company too. I usually also demonstrate a working prototype live on a production grid during the presentation. 😓
    -
    -So why would I sign up myself for such side projects? Isn't it a lot of stress and extra work? Besides the prize in form of money (you can not count on that, you may win or you may not win something) and recognition, there are also other motivational points:
    +

    Table of Contents




    -

    How to be creative


    +

    How to be creative



    How did I manage to be creative with all these Pet Projects? Unfortunately, there is no step-by-step guide I could point you to. But what I want to do in this blog post is share my personal experience so far.

    -

    Know which problem you want to solve


    +

    Know which problem you want to solve



    There must be a problem to be solved or a thing to be improved. It makes no sense to have a project without a goal. A problem might be obvious to you, and you don't even need to think about it. In that case, you are all set, and you can immerse yourself with the problem.

    If, however, you don't know what problem you want to solve: Do you really need to be creative? All problems are solved anyway, correct? In that case, just go on with your work. As you immerse yourself with your daily work, you will find a project naturally after a while. I don't believe you should artificially find a project. It should come naturally to you. You should have an interest in the problem domain and a strong desire to find a proper solution for the problem. Artificially created projects come with the catch that you might give up on it rather sooner than later due to lack of motivation and desire.

    -

    Immerse / deep dive


    +

    Immerse / deep dive



    If you want to be creative in a field, you must know a lot about it. The more you know about it, the more dots you can connect. When you are learning a new technology or if you are thinking about a tough problem, do it thoroughly. Don't let anything distract you. Read books, watch lectures, listen to podcasts or audiobooks about the topic, talk to other people working on similar topics. Immerse yourself for multiple hours per day, multiple days per week, multiple weeks and maybe even months. Create your own inner universe.

    @@ -72,7 +87,7 @@
    Sometimes, depending on how deeply you were immersed, you may need to let the problem go for a couple of days (e.g. over a weekend) before you can download a new insight.

    -

    Always have a notebook with you


    +

    Always have a notebook with you



    Wherever you go, ensure that you always have something to take notes with you. Once you have an idea from nowhere (or from your unconscious but volatile brain), you really want to write it down to persistent storage. It doesn't matter what kind of note-taking device you use here. It can be a paper journal, or it can be your smartphone. 

    @@ -80,23 +95,23 @@
    I prefer taking notes on paper, as it gives you more freedom of how to structure it. You can use any colour, and you can also quickly create diagrams without the use of any complex computer program.

    -

    When you didn't sleep enough


    +

    When you didn't sleep enough



    I noticed while being sleep-deprived I am (obviously) unable to concentrate so much, and it is difficult to be immersed in a focused way. But on the other hand, I am a lot more creative compared to when I am not sleep-deprived. Then, my brain suddenly presents me with connections I have not thought of before. Here, I usually write any idea I have down on a sheet of paper or in my journal, so I can pick it up later. I then often continue to philosophise about a possible solution. Sometimes to the absurd, and sometimes to something pretty useful.

    I am not saying that you should skip sleep. By all means, if you can sleep, then sleep. But there are some days when you don't manage to sleep (e.g. think too much about a project and didn't manage to hit the off switch). This is, where you can take advantage of your current state of mind. Disclaimer: Skipping sleep damages your health. So, please don't try this out on purpose. But in case you had a bad night, remember this trick.

    -

    Have regular breaks and relax


    +

    Have regular breaks and relax



    Have regular breaks. Don't skip your lunch break. Best, have a walk during lunchtime. And after work, do some kind of workout or visit a sports class. Do something completely unrelated to work before going to sleep (e.g. visit a parallel universe and read a Science Fiction novel). In short: Totally hit the off-switch after your work for the day is finished. You will be much more energised and motivated the next time you open your work laptop.

    -I personally love to read Science Fiction novels
    +I personally love to read Science Fiction novels

    I skip breakfast and lunch during the week. This means that on average, I intermittent fast on average 18-20 hours daily. It may sound odd to most people (who don't intermittent fast), but in a fasted state, I can be even more focused, thus helping me immerse myself in something even more. Not having breakfast and lunch also gives me back some time for other things (e.g. a nice walk, where I listen to podcasts or audiobooks or practise using my camera (street photography)). I relax my routine during the week ends, where I may enjoy a meal at any given time of the day.

    It also helps a lot eat healthy. Healthy food makes your brain work more efficiently. But I won't go into more details here, as nothing is as contradictory as the health and food industry. Conduct your own research. Your opinion may be different from mine anyway, and everyone's body reacts to certain foods differently. What for one person works may not work for another person. But be aware that you will find a lot of wrong and also conflicting information on the internet. So always use multiple resources for your research.

    -

    Upside-down approach


    +

    Upside-down approach



    It's easy to fall into the habit of "boxed" thinking, but creativity is exactly the opposite. Once in a while, make yourself think "Is A really required to do B?". Many assumptions are believed to be true. But are they really? A concrete example: "At work we only use the programming language L and framework F" and therefore, it is the standard we must use.

    @@ -110,7 +125,7 @@
    A small additional trick: you can train yourself to generate new and unconventional ideas. Just write down 20 random ideas every day. It doesn't matter what the ideas are about and whether they are useful or not. The purpose of this exercise is to make your brain think about something new and unconventional. These can be absurd ideas such as "Jump out of the window naked in the morning in order to wake up faster". Of course, you would never do that, but at least you had an idea and made your brain generate something.

    -

    Don't be busy all the time


    +

    Don't be busy all the time



    Especially as a DevOps Engineer, you could be busy all the time with small, but frequent, ad hoc tasks. Don't lose yourself here. Yes, you should pay attention to your job and those tasks, but you should also make some room for creativity. Don't schedule meeting after ad hoc work after meeting after Jira ticket work after another Jira ticket. There should also be some "free" space in your calendar.

    @@ -130,7 +145,7 @@ learn () { timedatectl - Control the system time and date

    -

    Conclusion


    +

    Conclusion



    This all summarises advice I have, really.  I hope this was interesting and helpful for you.

    @@ -153,9 +168,9 @@ 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 803a3d7d..8c53c83f 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,17 +8,18 @@ -

    Perl is still a great choice


    +

    +Home | Markdown | Gemini +

    +

    Perl is still a great choice



    Published at 2022-05-27T07:50:12+01:00; Updated at 2023-01-28

    -Comic source: XKCD
    -
    Perl (the Practical Extraction and Report Language) is a battle-tested, mature, multi-paradigm dynamic programming language. Note that it's not called PERL, neither P.E.R.L. nor Pearl. "Perl" is the name of the language and perl the name of the interpreter or the interpreter command.

    Unfortunately (it makes me sad), Perl's popularity has been declining over the last years as Google trends shows:

    -
    +

    So why is that? Once the de-facto standard super-glue language for the web nowadays seems to have a bad reputation. Often, people state:

    @@ -28,7 +29,19 @@
  • Why use Perl as there are better alternatives?
  • Why all the sigils? It looks like an exploding ASCII factory!!

  • -

    Write-only language


    +Comic source: XKCD
    +
    +

    Table of Contents


    +
    +
    +

    Write-only language



    Is Perl really a write-only language? You have to understand that Perl 5 was released in 1994 (28 years ago as of this writing) and when we refer to Perl we usually mean Perl 5. That's many years, and there are many old scripts not following the modern Perl best practices (as they didn't exist yet). So yes, legacy scripts may be difficult to read. Japanese may be difficult to read too if you don't know Japanese, though.

    @@ -54,7 +67,7 @@
    This all doesn't mean that you can't "get things done" with Perl. Quite the opposite is the case. Perl is a very pragmatic programming language and is suitable very well for rapid prototyping and any kind of small to medium-sized scripts and programs. You can write large enterprise scale application in Perl too, but that wasn't the original intend of why Perl was invented (more on that later).

    -

    Is Perl abandoned?


    +

    Is Perl abandoned?



    As I pointed out in the previous section, Perl 5 is around for quite some time without any new major version released. This can lead to the impression that development is not progressing and that the project is abandoned. Nothing can be further from the truth. Perl 5.000 was released in 1994 and the latest version (as of this writing) Perl 5.34.1 was released two months ago in 2022. You can check the version history on Wikipedia. You will notice releases being made regularly:

    @@ -95,7 +108,7 @@
    Perl New Features

    -

    Why use Perl as there are better alternatives?


    +

    Why use Perl as there are better alternatives?



    Here, common sense must be applied. I don't believe there is anything like "the perfect" programming language. Everyone has got his preferred (or a set of preferred) programming language to chose from. All programming languages come with their own set of strengths and weaknesses. These are the strengths making Perl shine, and you (technically) don't need to bother to look for "better" alternatives:

    @@ -124,7 +137,7 @@
    Cor - Bringing modern OOP to the Perl Core

    -

    Why all the sigils? It looks like an exploding ASCII factory!!


    +

    Why all the sigils? It looks like an exploding ASCII factory!!



    The sigils $ @ % & (where Perl is famously known for) serve a purpose. They seem confusing at first, but they actually make the code better readable. $scalar is a scalar variable (holding a single value), @array is an array (holding a list of values), %hash holds a list of key-value pairs and &sub is for subroutines. A given variable $ref can also hold reference to something. @$arrayref dereferences a reference to an array, %$hashref to a hash, $$scalarref to a scalar, &$subref dereferences a referene to a subroutine, etc. That can be encapsulated as deep as you want. (This paragraph only scratched the surface here of what Perl can do, and there is a lot of syntactic sugar not mentioned here).

    @@ -132,7 +145,7 @@
    https://www.perl.com/article/on-sigils/

    -

    Where do I personally still use perl?


    +

    Where do I personally still use perl?



    • I use Rexify for my OpenBSD server automation. Rexify is a configuration management system developed in Perl with similar features to Ansible but less bloated. It suits my personal needs perfectly.
    • @@ -149,20 +162,20 @@
      Why Perl is still relevant in 2022

      +E-Mail your comments to paul@nospam.buetow.org :-)
      +
      Other related posts are:

      -2008-06-26 Perl Poetry
      -2011-05-07 Perl Daemon (Service Framework)
      -2022-05-27 Perl is still a great choice (You are currently reading this)
      2023-05-01 Unveiling guprecords.raku: Global Uptime Records with Raku
      -
      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2022-05-27 Perl is still a great choice (You are currently reading this)
      +2011-05-07 Perl Daemon (Service Framework)
      +2008-06-26 Perl Poetry

      Back to the main site
      diff --git a/gemfeed/2022-05-27-perl-is-still-a-great-choice/googletrendsperl.jpg b/gemfeed/2022-05-27-perl-is-still-a-great-choice/googletrendsperl.jpg deleted file mode 100644 index 397c9f29..00000000 Binary files a/gemfeed/2022-05-27-perl-is-still-a-great-choice/googletrendsperl.jpg and /dev/null differ diff --git a/gemfeed/2022-05-27-perl-is-still-a-great-choice/regular_expressions.png b/gemfeed/2022-05-27-perl-is-still-a-great-choice/regular_expressions.png deleted file mode 100644 index acbc2437..00000000 Binary files a/gemfeed/2022-05-27-perl-is-still-a-great-choice/regular_expressions.png and /dev/null differ diff --git a/gemfeed/2022-06-15-sweating-the-small-stuff.html b/gemfeed/2022-06-15-sweating-the-small-stuff.html index 5efa9408..61a2ba31 100644 --- a/gemfeed/2022-06-15-sweating-the-small-stuff.html +++ b/gemfeed/2022-06-15-sweating-the-small-stuff.html @@ -8,18 +8,13 @@ -

      Sweating the small stuff - Tiny projects of mine


      +

      +Home | Markdown | Gemini +

      +

      Sweating the small stuff - Tiny projects of mine



      Published at 2022-06-15T08:47:44+01:00; Updated at 2022-06-18

      -
      -         _
      -        /_/_      .'''.
      -     =O(_)))) ...'     `.
      - jgs    \_\              `.    .'''
      -                           `..'
      -
      -
      This blog post is a bit different from the others. It consists of multiple but smaller projects worth mentioning. I got inspired by Julia Evan's "Tiny programs" blog post and the side projects of The Sephist, so I thought I would also write a blog posts listing a couple of small projects of mine:

      Tiny programs
      @@ -29,7 +24,41 @@
      But before going through the tiny projects let's take a paragraph for the 1y anniversary retrospective.

      -

      1y anniversary


      +
      +         _
      +        /_/_      .'''.
      +     =O(_)))) ...'     `.
      + jgs    \_\              `.    .'''
      +                           `..'
      +
      +
      +

      Table of Contents


      +
      +
      +

      1y anniversary



      It has been one year since I started posting regularly (at least once monthly) on this blog again. It has been a lot of fun (and work) doing so for various reasons:

      @@ -48,17 +77,17 @@
      But now, let's continue with the small projects worth mentioning :-)

      -

      Static photo album generator


      +

      Static photo album generator



      photoalbum.sh is a minimal static HTML photo album generator. I use it to drive "The Irregular Ninja" site and for some ad-hoc (personal) albums to share photos with the family and friends.

      https://codeberg.org/snonux/photoalbum

      -

      The Irregular Ninja


      +

      The Irregular Ninja



      Photography is one of my casual hobbies. I love to capture interesting perspectives and motifs. I love to walk new streets and neighbourhoods I never walked before so I can capture those unexpected motifs, colours and moments. Unfortunately, because of time constraints (and sometime weather constraints), I do that on a pretty infrequent basis.

      -
      +

      More than 10 years ago I wrote the bespoke small static photo album generator in Bash photoalbum.sh which I recently refactored to a modern Bash coding style and also freshened up the Cascading Style Sheets. Last but not least, the new domain name irregular.ninja has been registered.

      @@ -72,7 +101,7 @@
      I hope you like this photo site. It's worth checking it out again around once every other month!

      -

      Random journal page extractor


      +

      Random journal page extractor



      I bullet journal. I write my notes into a Leuchtturm paper notebook. Once full, I am scanning it to a PDF file and archive it. As of writing this, I am at journal #7 (each from 123 up to 251 pages in A5). It means that there is a lot of material already.

      @@ -82,7 +111,7 @@
      There's also a weekly CRON job on my servers to send me a reminder that I might want to read in my old journals again. My laptop also runs this script each time it boots and saves the output to a NextCloud folder. From there, it's synchronized to the NextCloud server so I can pick it up from there with my smartphone later when I am "on the road".

      -

      Global uptime records statistic generator


      +

      Global uptime records statistic generator



      guprecords is a Perl script which reads multiple uprecord files (produced by uptimed - a widely available daemon for recording server uptimes) and generates uptime statistics of multiple hosts combined. I keep all the record files of all my personal computers in a Git repository (I even keep the records of the boxes I don't own or use anymore) and there's already quite a collection of it. It looks like this:

      @@ -142,7 +171,7 @@ Pos | System | Kernel | Uptime |
      This all is of no real practical use but fun!

      -

      Server configuration management


      +

      Server configuration management



      The rexfiles project contains all Rex files for my (personal) server setup automation. A Rexfile is written in a Perl DSL run by the Rex configuration management system. It's pretty much KISS and that's why I love it. It suits my personal needs perfectly.

      @@ -153,7 +182,7 @@ Pos | System | Kernel | Uptime |
      Hi there! I was searching for a simple way to automate my personal OpenBSD setup. I found that configuration management systems like Puppet, Salt, Chef, etc.. were too bloated for my personal needs. So for a while I was configuring everything by hand. At one point I got fed up and started writing Shell scripts. But that was not the holy grail so that I looked at Ansible. I found that Ansible had some dependencies on Python on the target machine when you want to use all the features. Furthermore, I am not really familiar with Python. But then I remembered that there was also Rex. It's written in my beloved Perl. Also, OpenBSD comes with Perl in the base system out of the box which makes it integrate better than all my scripts (automation and also scripts deployed via the automation to the system) are all in the same language. Rex may not have all the features like other configuration management systems, but its easy to work-around or extend when you know Perl. Thanks!

      -

      Fancy SSH execution loop


      +

      Fancy SSH execution loop



      rubyfy is a fancy SSH loop wrapper written in Ruby for running shell commands on multiple remote servers at once. I also forked this project for work (under a different name) where I added even more features such as automatic server discovery. It's used by many colleagues on a frequent basis. Here are some examples:

      @@ -178,7 +207,7 @@ echo foo.example.com |
      https://codeberg.org/snonux/rubyfy

      -

      A KISS dynamic DNS solution


      +

      A KISS dynamic DNS solution



      dyndns is a tiny shell script which implements "your" own DynDNS service. It relies on SSH access to the authoritative DNS server and the nsupdate command. There is really no need to use any of the "other" free DynDNS services out there.

      @@ -198,7 +227,7 @@ ssh dyndns@dyndnsserver /path/to/dyndns-update \
      https://codeberg.org/snonux/dyndns

      -

      CPU information gatherer for Linux


      +

      CPU information gatherer for Linux



      This is a tiny GNU Awk script for Linux which displays information about the CPU. All what it does is presenting /proc/cpuinfo in an easier to read way. The output is somewhat more compact than the standard lscpu command you find commonly on Linux distributions.

      @@ -222,7 +251,7 @@ v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs
      https://codeberg.org/snonux/cpuinfo

      -

      Show differences of two files over the network


      +

      Show differences of two files over the network



      This is a shell wrapper to use the standard diff tool over the network to compare a file between two computers. It uses NetCat for the network part and also encrypts all traffic using OpenSSL. This is how its used:

      @@ -230,34 +259,34 @@ v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs
      https://codeberg.org/snonux/netdiff

      -

      Delay sending out E-Mails with Mutt


      +

      Delay sending out E-Mails with Mutt



      This is a shell script for the Mutt email client for delaying sending out E-Mails. For example, you want to write an email on Saturday but don't want to bother the recipient earlier than Monday. It relies on CRON.

      https://codeberg.org/snonux/muttdelay

      -

      Graphical UI for sending text messages


      +

      Graphical UI for sending text messages



      jsmstrade is a minimalistic graphical Java swing client for sending SMS messages over the SMStrade service.

      -
      +

      https://codeberg.org/snonux/jsmstrade
      https://smstrade.de

      -

      IPv6 and IPv4 connectivity testing site


      +

      IPv6 and IPv4 connectivity testing site



      ipv6test is a quick and dirty Perl CGI script for testing whether your browser connects via IPv4 or IPv6. It requires you to setup three sub-domains: One reachable only via IPv4 (e.g. test4.ipv6.buetow.org), another reachable only via IPv6 (e.g. test6.ipv6.buetow.org) and the main one reachable through both protocols (e.g. ipv6.buetow.org).

      I don't have it running on any of my servers at the moment. This means that there is no demo to show now. Sorry!

      -

      List open Jira tickets in the terminal


      +

      List open Jira tickets in the terminal



      japi s a small Perl script for listing open Jira issues. It might be broken by now as the Jira APIs may have changed. Sorry! But feel free to fork and modernize it. :-)

      https://codeberg.org/snonux/jsmstrade

      -

      Debian running on "your" Android phone


      +

      Debian running on "your" Android phone



      Debroid is a tutorial and a set of scripts to install and to run a Debian chroot on an Android phone.

      @@ -267,17 +296,17 @@ v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs
      https://termux.com

      -

      Perl service framework


      +

      Perl service framework



      PerlDaemon is a minimal daemon for Linux and other Unix like operating systems programmed in Perl. It is a minimal but pretty functional and fairly generic service framework. This means that it does not do anything useful other than providing a framework for starting, stopping, configuring and logging. To do something useful, a module (written in Perl) must be provided.

      Checkout my previous post about it

      -

      More


      +

      More



      There are more projects on my Codeberg page but they aren't as tiny as the ones mentioned in this post or aren't finished yet so I won't bother listing them here. However, there also a few more scripts used frequently by me (not publicly accessible (yet?)) which I would like to mention here:

      -

      Work time tracker


      +

      Work time tracker



      worktime.rb, for example, is a command line Ruby script I use to track my time spent working. This is to make sure that I don't overwork (in particular useful when working from home). It also generates some daily and weekly stats and carries over work time (surpluses or minuses) to the next work day, week or even year.

      @@ -299,19 +328,19 @@ v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs
      All I do when I start work is to run the wtlogin command and after finishing work to run the wtlogout command. My shell will remind me when I work without having logged in. It uses a simple JSON database which is editable with wtedit (this opens the JSON in Vim). The report shown above can be generated with wtreport. Any out-of-bounds reporting can be added with the wtadd command.

      -

      Password and document store


      +

      Password and document store



      geheim.rb is my personal password and document store ("geheim" is the German word for secret). It's written in Ruby and heavily relies on Git, FZF (for search), Vim and standard encryption algorithms. Other than the standard pass Unix password manager, geheim also encrypts the file names and password titles.

      The tool is command line driven but also provides an interactive shell when invoked with geheim shell. It also works on my Android phone via Termux so I have all my documents and passwords always with me.

      -

      Backup procedure


      +

      Backup procedure



      backup is a Bash script which does run once daily (or every time on boot) on my home FreeBSD NAS server and performs backup related tasks such as creating a local backup of my remote NextCloud instance, creating encrypted (incremental) ZFS snapshots of everything what's stored on the NAS and synchronizes (via rsync) backups to a remote cloud storage. It also can synchronize backups to a local external USB drive.

      Check out my offsite backup series

      -

      konpeito.media


      +

      konpeito.media



      Here's a bonus...

      @@ -338,9 +367,9 @@ v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs
      Back to the main site
      diff --git a/gemfeed/2022-06-15-sweating-the-small-stuff/jsmstrade.png b/gemfeed/2022-06-15-sweating-the-small-stuff/jsmstrade.png deleted file mode 100644 index ce5276f8..00000000 Binary files a/gemfeed/2022-06-15-sweating-the-small-stuff/jsmstrade.png and /dev/null differ diff --git a/gemfeed/2022-06-15-sweating-the-small-stuff/ninja.jpg b/gemfeed/2022-06-15-sweating-the-small-stuff/ninja.jpg deleted file mode 100644 index 8a036323..00000000 Binary files a/gemfeed/2022-06-15-sweating-the-small-stuff/ninja.jpg and /dev/null differ 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 fba01a4c..7ad59bf4 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,10 +8,15 @@ -

      Let's Encrypt with OpenBSD and Rex


      +

      +Home | Markdown | Gemini +

      +

      Let's Encrypt with OpenBSD and Rex



      Published at 2022-07-30T12:14:31+01:00

      +I was amazed at how easy it is to automatically generate and update Let's Encrypt certificates with OpenBSD.
      +
                                                      /    _    \
         The Hebern Machine                            \ ." ". /
      @@ -39,9 +44,24 @@
                                        ASCII Art by John Savard
       

      -I was amazed at how easy it is to automatically generate and update Let's Encrypt certificates with OpenBSD.
      +

      Table of Contents



      -

      What's Let's Encrypt?


      +
      +

      What's Let's Encrypt?



      Let's Encrypt is a non-profit certificate authority run by Internet Security Research Group that provides X.509 certificates for Transport Layer Security (TLS) encryption at no charge. It is the world's largest certificate authority, used by more than 265 million websites, with the goal of all websites being secure and using HTTPS.

      @@ -49,7 +69,7 @@
      In short, it gives away TLS certificates for your website - for free! The catch is, that the certificates are only valid for three months. So it is better to automate certificate generation and renewals.

      -

      Meet acme-client


      +

      Meet acme-client



      acme-client is the default Automatic Certifcate Management Environment (ACME) client on OpenBSD and part of the OpenBSD base system.

      @@ -69,11 +89,11 @@
    • Let's Encrypt then will contact the hostname for the certificate through a particular URL (e.g. http://foo.zone/.well-known/acme-challenge/...) to verify that the requester is the valid owner of the host.
    • Let's Encrypt generates a certificate, which then is downloaded to /etc/ssl/....

    -

    Configuration


    +

    Configuration



    There is some (but easy) configuration required to make that all work on OpenBSD.

    -

    acme-client.conf


    +

    acme-client.conf



    This is how my /etc/acme-client.conf looks like (I copied a template from /etc/examples/acme-client.conf to /etc/acme-client.conf and added my domains to the bottom:

    @@ -139,7 +159,7 @@ domain snonux.land { }

    -

    httpd.conf


    +

    httpd.conf



    For ACME to work, you will need to configure the HTTP daemon so that the "special" ACME requests from Let's Encrypt are served correctly. I am using the standard OpenBSD httpd here. These are the snippets I use for the foo.zone host in /etc/httpd.conf (of course, you need a similar setup for all other hosts as well):

    @@ -172,7 +192,7 @@ server "foo.zone" {
    It is worth noticing that httpd will start without the certificates being present. This will cause a certificate error when you try to reach the HTTPS endpoint, but it helps to bootstrap Let's Encrypt. As you saw in the config snippet above, Let's Encrypt only requests the plain HTTP endpoint for the verification process, so HTTPS doesn't need to be operational yet at this stage. But once the certificates are generated, you will have to reload or restart httpd to use any new certificate.

    -

    CRON job


    +

    CRON job



    You could now run doas acme-client foo.zone to generate the certificate or to renew it. Or you could automate it with CRON.

    @@ -250,11 +270,11 @@ acme-client: /etc/ssl/irregular.ninja.fullchain.pem: certificate valid: 80 days acme-client: /etc/ssl/snonux.land.fullchain.pem: certificate valid: 79 days left

    -

    relayd.conf and smtpd.conf


    +

    relayd.conf and smtpd.conf



    Besides httpd, relayd (mainly for Gemini) and smtpd (for mail, of course) also use TLS certificates. And as you can see in acme.sh, the services are reloaded or restarted (smtpd doesn't support reload) whenever a certificate is generated or updated.

    -

    Rexification


    +

    Rexification



    I didn't write all these configuration files by hand. As a matter of fact, everything is automated with the Rex configuration management system.

    @@ -266,7 +286,7 @@ acme-client: /etc/ssl/snonux.land.fullchain.pem: certificate valid: 79 days left our @acme_hosts = qw/buetow.org paul.buetow.org tmp.buetow.org dtail.dev foo.zone irregular.ninja snonux.land/;

    -

    General ACME client configuration


    +

    General ACME client configuration



    ACME will be installed into the frontend group of hosts. Here, blowfish is the primary, and twofish is the secondary OpenBSD box.

    @@ -418,7 +438,7 @@ if [ $has_update = yes ]; then fi

    -

    Service rexification


    +

    Service rexification



    These are the Rex tasks setting up httpd, relayd and smtpd services:

    @@ -646,7 +666,7 @@ match from local for local action localmail match from local for any action outbound

    -

    All pieces together


    +

    All pieces together



    For the complete Rexfile example and all the templates, please look at the Git repository:

    @@ -660,7 +680,7 @@ rex commons
    The commons is a group of tasks I specified which combines a set of common tasks I always want to execute on all frontend machines. This also includes the ACME tasks mentioned in this article!

    -

    Conclusion


    +

    Conclusion



    ACME and Let's Encrypt greatly help reduce recurring manual maintenance work (creating and renewing certificates). Furthermore, all the certificates are free of cost! I love to use OpenBSD and Rex to automate all of this.

    @@ -670,11 +690,22 @@ rex commons
    E-Mail your comments to paul@nospam.buetow.org :-)

    +Other *BSD related posts are:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +2024-04-01 KISS high-availability with OpenBSD
    +2024-01-13 One reason why I love OpenBSD
    +2022-10-30 Installing DTail on OpenBSD
    +2022-07-30 Let's Encrypt with OpenBSD and Rex (You are currently reading this)
    +2016-04-09 Jails and ZFS with Puppet on FreeBSD
    +
    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 1c210bfb..31193d7b 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,10 +8,19 @@ -

    Gemtexter 1.1.0 - Let's Gemtext again


    +

    +Home | Markdown | Gemini +

    +

    Gemtexter 1.1.0 - Let's Gemtext again



    Published at 2022-08-27T18:25:57+01:00

    +I proudly announce that I've released Gemtexter version 1.1.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.
    +
    +https://codeberg.org/snonux/gemtexter
    +
    +It has been around a year since I released the first version 1.0.0. Although, there aren't any groundbreaking changes, there have been a couple of smaller commits and adjustments. I was quite surprised that I received a bunch of feedback and requests about Gemtexter so it means that I am not the only person in the universe actually using it.
    +
     -=[ typewriter ]=-  1/98
     
    @@ -24,15 +33,23 @@
      jgs  `"""""""""`
     

    -I proudly announce that I've released Gemtexter version 1.1.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.
    -
    -https://codeberg.org/snonux/gemtexter
    -
    -It has been around a year since I released the first version 1.0.0. Although, there aren't any groundbreaking changes, there have been a couple of smaller commits and adjustments. I was quite surprised that I received a bunch of feedback and requests about Gemtexter so it means that I am not the only person in the universe actually using it.
    +

    Table of Contents



    -

    What's new?


    +
    +

    What's new?



    -

    Automatic check for GNU version requirements


    +

    Automatic check for GNU version requirements



    Gemtexter relies on the GNU versions of the tools grep, sed and date and it also requires the Bash shell in version 5 at least. That's now done in the check_dependencies() function:

    @@ -40,36 +57,36 @@ 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.

    -

    Backticks now produce inline code blocks in the HTML output


    +

    Backticks now produce inline code blocks in the HTML output



    The Gemtext format doesn't support inline code blocks, but Gemtexter now produces inline code blocks (means, small code fragments can be placed in the middle of a paragraph) in the HTML output when the code block is enclosed with Backticks. There were no adjustments required for the Markdown output format, because Markdown supports it already out of the box.

    -

    Cache for Atom feed generation


    +

    Cache for Atom feed generation



    The Bash is not the most performant language. Gemtexter already takes a couple of seconds only to generate the Atom feed for around two hand full of articles on my slightly underpowered Surface Go 2 Linux tablet. Therefore, I introduced a cache, so that subsequent Atom feed generation runs finish much quicker. The cache uses a checksum of the Gemtext .gmi file to decide whether anything of the content has changed or not.

    -

    Input filter support


    +

    Input filter support



    Once your capsule reaches a certain size, it can become annoying to re-generate everything if you only want to preview the HTML or Markdown output of one single content file. The following will add a filter to only generate the files matching a regular expression:

    @@ -77,45 +94,46 @@ 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


    +

    Revamped git support



    The Git support has been completely rewritten. It's now more reliable and faster too. Have a look at the README for more information.

    -

    Addition of htmlextras and web font support


    +

    Addition of htmlextras and web font support



    The htmlextras folder now contains all extra files required for the HTML output format such as cascading style sheet (CSS) files and web fonts.

    -

    Sub-section support


    +

    Sub-section support



    It's now possible to define sub-sections within a Gemtexter capsule. For the HTML output, each sub-section can use its own CSS and web font definitions. E.g.:

    The foo.zone main site
    The notes sub-section (with different fonts)

    -

    More


    +

    More



    Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.

    Overall I think it's a pretty solid 1.1.0 release without anything groundbreaking (therefore no major version jump). But I am happy about it.

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2021-04-24 Welcome to the Geminispace
    -2021-06-05 Gemtexter - One Bash script to rule it all
    -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again (You are currently reading this)
    -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
    +2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴
    2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
    +2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again (You are currently reading this)
    +2021-06-05 Gemtexter - One Bash script to rule it all
    +2021-04-24 Welcome to the Geminispace

    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 f552a6f2..4d4e9cb5 100644 --- a/gemfeed/2022-09-30-after-a-bad-nights-sleep.html +++ b/gemfeed/2022-09-30-after-a-bad-nights-sleep.html @@ -8,10 +8,15 @@ -

    After a bad night's sleep


    +

    +Home | Markdown | Gemini +

    +

    After a bad night's sleep



    Published at 2022-09-30T09:53:23+03:00; Updated at 2022-10-12

    +Everyone has it once in a while: A bad night's sleep. Here I attempt to list valuable tips on how to deal with it.
    +
                    z
                     z
    @@ -26,17 +31,35 @@ jgs                (________\  \
                                  '-'
     

    -Everyone has it once in a while: A bad night's sleep. Here I attempt to list valuable tips on how to deal with it.
    +

    Table of Contents



    -

    Don't take the day off.


    +
    +

    Don't take the day off.



    Don't take a day off after not sleeping enough the previous night. That would be wasting the holiday allowance. It wouldn't be possible to enjoy my free time anyway, so why not just work? There's still a way for an IT Engineer to be productive (sometimes even more) with half or less of the concentration power available!

    -

    Start work early


    +

    Start work early



    Probably I am already awake early and am unable to fall asleep again. My strategy here is to "attack" the day: Start work early and finish early. The early bird will also encounter fewer distractions from colleagues.

    -

    Sweat the small stuff


    +

    Sweat the small stuff



    There's never a shortage of small items to hook off my list. Most of these items don't require my full concentration power, and I will be happy to get them off my list so that the next day, after a good night's sleep, I can immerse myself again in focused, deep work with all concentration powers at hand.

    @@ -50,57 +73,57 @@ jgs (________\ \
  • Going through any tedious paperwork.
  • Catch up with the journal and mark off all trivial action items.

  • -

    Enter the flow state


    +

    Enter the flow state



    I find it easy to enter the "flow state" after a bad night's sleep. All I need to do is to put on some ambient music (preferably instrumental chill house) and start to work on a not-too-difficult ticket.

    Usually, the "flow state" is associated with deep-focused work, but deep-focused work isn't easily possible under sleep deprivation. It's still possible to be in the flow by working on more manageable tasks and leaving the difficult ones for the next day.

    -

    Reschedule meetings


    +

    Reschedule meetings



    I find engaging in discussions and demanding meetings challenging after a lousy night's sleep. I still attend the sessions I am invited to as "only" a participant, but I prefer to reschedule all meetings I am the primary driver of.

    This, unfortunately, also includes interviews. Interviews require full concentration power. So for interviews, I would find a colleague to step in for me or ask to reschedule the interview altogether. Everything else wouldn't make it justice and would waste everyone's time!

    -

    Invent


    +

    Invent



    The mind works differently under sleep deprivation: It's easier to invent new stuff as it's easier to have a look at things from different perspectives. Until an hour ago, I didn't know yet what I would be blogging about for this month, and then I just started writing this, and it took me only half an hour to write the first draft of this blog post!

    -

    Fast


    +

    Fast



    I don't eat breakfast, and I don't eat lunch on these days. I only have dinner. Not eating means my mind doesn't get foggy, and I keep up the work momentum. This is called intermittent fasting, which not only generally helps to keep the weight under control and boosts the concentration power. Furthermore, intermittent fasting is healthy. You should include it in your routine, even after a good night's sleep.

    -

    Stretch


    +

    Stretch



    I won't have enough energy for strenuous physical exercise on those days, but a 30 to a 60-minute stretching session can make the day. Stretching will even hurt less under sleep deprivation! The stretching could also be substituted with a light Yoga session.

    -

    Walk


    +

    Walk



    Walking is healthy, and the time can be used to listen to interesting podcasts. The available concentration power might not be enough for more sophisticated audio literature. I will have enough energy for one or two daily walks (~10k steps for the day in total). Sometimes, I listen to music during walks. I also try to catch the bright sunlight.

    -

    Red Bull


    +

    Red Bull



    I don't think that Red Bull is a healthy drink. But once in a while, a can in the early afternoon brings wonders, and productivity will skyrocket. Other than Red Bull, drink a lot of water throughout the day. Don't forget to drink the sugar-free version; otherwise, your intermittent fast will be broken.

    -

    Power nap


    +

    Power nap



    I don't know how to "enforce" a nap, but sometimes I manage to power nap, and it helps wonders. A 30-minute nap sometimes brings me back to normal. If you don't tend to fast as you are too hungry, it helps to try to nap approximately 30 minutes after eating something.

    -

    Don't take anything personally.


    +

    Don't take anything personally.



    It's much more challenging to keep the mind "under control" in this state. Every annoyance can potentially upset, which could reflect on the work colleagues. It is wise to attempt to go with a positive attitude into the day, always smile and be polite to the family and colleagues at work. Don't let anything drop out to the people next; they don't deserve it as they didn't do anything wrong! Also, remember, it can't be controlled at all. It's time to let go of the annoyances for the day.

    -

    Meditate


    +

    Meditate



    To keep the good vibe, it helps to meditate for 10 minutes. Meditation must nothing be fancy. It can be just lying on the sofa and observing your thoughts as they come and go. Don't judge your thoughts, as that could put you in a negative mood. It's not necessary to sit in an uncomfortable Yoga pose, and it is not required to chant "Ohhmmmmm".

    -

    Write things down


    +

    Write things down



    Sometimes something requiring more concentration power demands time. This is where it helps to write a note in a journal and return to it another day. This doesn't mean slacking off but managing the rarely available concentration power for the day. I might repeat myself: Today, sweat all the small stuff. Tomorrow, do the deep-focused work on that crucial project again.

    It's easier to forget things on those days, so everything should be written down so that it can be worked off later. Things written down will not be overlooked!

    -

    Social media


    +

    Social media



    I wouldn't say I like checking social media, as it can consume a lot of time and can become addictive. But once in a while, I want to catch up with my "networks". After a bad night's sleep, it's the perfect time to check your social media. Once done, you don't have to do it anymore for the next couple of days!

    @@ -108,9 +131,9 @@ 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 0f103cc4..eeb45812 100644 --- a/gemfeed/2022-10-30-installing-dtail-on-openbsd.html +++ b/gemfeed/2022-10-30-installing-dtail-on-openbsd.html @@ -8,10 +8,25 @@ -

    Installing DTail on OpenBSD


    +

    +Home | Markdown | Gemini +

    +

    Installing DTail on OpenBSD



    Published at 2022-10-30T11:03:19+02:00

    +This will be a quick blog post, as I am busy with my personal life now. I have relocated to a different country and am still busy arranging things. So bear with me :-)
    +
    + In this post, I want to give a quick overview (or how-to) about installing DTail on OpenBSD, as the official documentation only covers Red Hat and Fedora Linux! And this blog post will also be used as my reference!
    +
    +https://dtail.dev
    +
    +I am using Rexify for my OpenBSD automation. Check out the following article covering my Rex setup in a little bit more detail:
    +
    +Let's Encrypt with OpenBSD and Rex
    +
    +I will also mention some relevant Rexfile snippets in this post!
    +
            ,_---~~~~~----._
      _,,_,*^____      _____``*g*\"*,
    @@ -49,19 +64,22 @@
                                            '     '
     

    -This will be a quick blog post, as I am busy with my personal life now. I have relocated to a different country and am still busy arranging things. So bear with me :-)
    -
    - In this post, I want to give a quick overview (or how-to) about installing DTail on OpenBSD, as the official documentation only covers Red Hat and Fedora Linux! And this blog post will also be used as my reference!
    -
    -https://dtail.dev
    -
    -I am using Rexify for my OpenBSD automation. Check out the following article covering my Rex setup in a little bit more detail:
    -
    -Let's Encrypt with OpenBSD and Rex
    -
    -I will also mention some relevant Rexfile snippets in this post!
    -
    -

    Compile it


    +

    Table of Contents


    +
    +
    +

    Compile it



    First of all, DTail needs to be downloaded and compiled. For that, git, go, and gmake are required:

    @@ -96,7 +114,7 @@ $ doas pkg_delete git go gmake
    One day I shall create an official OpenBSD port for DTail.

    -

    Install it


    +

    Install it



    Installing the binaries is now just a matter of copying them to /usr/local/bin as follows:

    @@ -138,7 +156,7 @@ END $ doas chmod 755 /etc/rc.d/dserver

    -

    Rexification


    +

    Rexification



    This is the task for setting it up via Rex. Note the . . . ., that's a placeholder which we will fill up more and more during this blog post:

    @@ -165,7 +183,7 @@ task 'dtail', group => 'frontends', };

    -

    Configure it


    +

    Configure it



    Now, DTail is fully installed but still needs to be configured. Grab the default config file from GitHub ...

    @@ -188,7 +206,7 @@ $ curl https://raw.githubusercontent.com/mimecast/dtail/master/examples/dtail.js }

    -

    Rexification


    +

    Rexification



    That's as simple as adding the following to the Rex task:

    @@ -204,7 +222,7 @@ file '/etc/dserver/dtail.json', on_change => sub { $restart = TRUE };

    -

    Update the key cache for it


    +

    Update the key cache for it



    DTail relies on SSH for secure authentication and communication. However, the system user _dserver has no permission to read the SSH public keys from the user's home directories, so the DTail server also checks for available public keys in an alternative path /var/run/dserver/cache.

    @@ -257,7 +275,7 @@ $ echo /usr/local/bin/dserver-update-key-cache.sh | doas tee -a /etc/daily.local /usr/local/bin/dserver-update-key-cache.sh

    -

    Rexification


    +

    Rexification



    That's done by adding ...

    @@ -273,7 +291,7 @@ append_if_no_such_line '/etc/daily.local', '/usr/local/bin/dserver-u
    ... to the Rex task!

    -

    Start it


    +

    Start it



    Now, it's time to enable and start the DTail server:

    @@ -313,7 +331,7 @@ Caching /home/rex/.ssh/authorized_keys -> /var/cache/dserver/rex.authorized_k All set...

    -

    Use it


    +

    Use it



    The DTail server is now ready to serve connections. You can use any DTail commands, such as dtail, dgrep, dmap, dcat, dtailhealth, to do so. Checkout out all the usage examples on the official DTail page.

    @@ -339,7 +357,7 @@ REMOTE|blowfish|100|7|fstab|31bfd9d9a6788844.h /usr/local ffs rw,wxallowed,nodev REMOTE|fishfinger|100|7|fstab|093f510ec5c0f512.h /usr/local ffs rw,wxallowed,nodev 1 2

    -

    Conclusions


    +

    Conclusions



    It's a bit of manual work, but it's ok on this small scale! I shall invest time in creating an official OpenBSD port, though. That would render most of the manual steps obsolete, as outlined in this post!

    @@ -349,20 +367,20 @@ REMOTE|fishfinger|100|7|fstab|093f510ec5c0f512.h /usr/local ffs rw,wxallowed,nod https://github.com/mimecast/dtail
    https://www.rexify.org

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2021-04-22 DTail - The distributed log tail program
    -2022-03-06 The release of DTail 4.0.0
    -2022-10-30 Installing DTail on OpenBSD (You are currently reading this)
    2023-09-25 DTail usage examples
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2022-10-30 Installing DTail on OpenBSD (You are currently reading this)
    +2022-03-06 The release of DTail 4.0.0
    +2021-04-22 DTail - The distributed log tail program

    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 d1759547..b5aaa3d9 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,10 +8,25 @@ -

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


    +

    +Home | Markdown | Gemini +

    +

    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

    +As a long-lasting user of Vim (and NeoVim), I always wondered what GNU Emacs is really about, so I decided to try it. I didn't try vanilla GNU Emacs, but Doom Emacs. I chose Doom Emacs as it is a neat distribution of Emacs with Evil mode enabled by default. Evil mode allows Vi(m) key bindings (so to speak, it's emulating Vim within Emacs), and I am pretty sure I won't be ready to give up all the muscle memory I have built over more than a decade.
    +
    +GNU Emacs
    +Doom Emacs
    +
    +I used Doom Emacs for around two months. Still, ultimately I decided to switch back to NeoVim as my primary editor and IDE and Vim (usually pre-installed on Linux-based systems) and Nvi (usually pre-installed on *BSD systems) as my "always available editor" for quick edits. (It is worth mentioning that I don't have a high opinion on whether Vim or NeoVim is the better editor, I prefer NeoVim as it comes with better defaults out of the box, but there is no real blocker to use Vim instead).
    +
    +Vim
    +NeoVim
    +
    +So why did I switch back to the Vi-family?
    +
                  _/  \    _(\(o
                  /     \  /  _  ^^^o
    @@ -25,25 +40,25 @@ Art by      \ \_!  / __!
              ^^----^^    "^--v'
     

    -As a long-lasting user of Vim (and NeoVim), I always wondered what GNU Emacs is really about, so I decided to try it. I didn't try vanilla GNU Emacs, but Doom Emacs. I chose Doom Emacs as it is a neat distribution of Emacs with Evil mode enabled by default. Evil mode allows Vi(m) key bindings (so to speak, it's emulating Vim within Emacs), and I am pretty sure I won't be ready to give up all the muscle memory I have built over more than a decade.
    -
    -GNU Emacs
    -Doom Emacs
    -
    -I used Doom Emacs for around two months. Still, ultimately I decided to switch back to NeoVim as my primary editor and IDE and Vim (usually pre-installed on Linux-based systems) and Nvi (usually pre-installed on *BSD systems) as my "always available editor" for quick edits. (It is worth mentioning that I don't have a high opinion on whether Vim or NeoVim is the better editor, I prefer NeoVim as it comes with better defaults out of the box, but there is no real blocker to use Vim instead).
    -
    -Vim
    -NeoVim
    -
    -So why did I switch back to the Vi-family?
    +

    Table of Contents



    -

    Emacs is a giant dragon


    +
    +

    Emacs is a giant dragon



    Emacs feels like a giant dragon as it is much more than an editor or an integrated development environment. Emacs is a whole platform on its own. There's an E-Mail client, an IRC client, or even games you can run within Emacs. And you can also change Emacs within Emacs using its own Lisp dialect, Emacs Lisp (Emacs is programmed in Emacs Lisp). Therefore, Emacs is also its own programming language. You can change every aspect of Emacs within Emacs itself. People jokingly state Emacs is an operating system and that you should directly use it as the init 1 process (if you don't know what the init 1 process is: Under UNIX and similar operating systems, it's the very first userland processed launched. That's usually systemd on Linux-based systems, launchd on macOS, or any other init script or init system used by the OS)!

    In many aspects, Emacs is like shooting at everything with a bazooka! However, I prefer it simple. I only wanted Emacs to be a good editor (which it is, too), but there's too much other stuff in Emacs that I don't need to care about! Vim and NeoVim do one thing excellent: Being great text editors and, when loaded with plugins, decent IDEs, too.

    -

    Magit love


    +

    Magit love



    I almost fell in love with Magit, an integrated Git client for Emacs. But I think the best way to interact with Git is to use the git command line directly. I don't worry about typing out all the commands, as the most commonly used commands are in my shell history. Other useful Git programs I use frequently are bit and tig. Also, get a mechanical keyboard that makes hammering whole commands into the terminal even more enjoyable.

    @@ -52,13 +67,13 @@ Art by \ \_! / __!
    Magit is pretty neat for basic Git operations, but I found myself searching the internet for the correct sub-commands to do the things I wanted to do in Git. Mainly, the way how branches are managed is confusing. Often, I fell back to the command line to fix up the mess I produced with Magit (e.g. accidentally pushing to the wrong remote branch, so I found myself fixing things manually on the terminal with the git command with forced pushes....). Magit is hotkey driven, and common commands are quickly explorable through built-in hotkey menus. Still, I found it challenging to navigate to more advanced Git sub-commands that way which was much easier accomplished by using the git command directly.

    -

    Graphical UI


    +

    Graphical UI



    If there is one thing I envy about Emacs is that it's a graphical program, whereas the Vi-family of editors are purely terminal-based. I see the benefits of being a graphical program as this enables the use of multiple fonts simultaneously to embed pictures and graphs (that would be neat as a Markdown preview, for example). There's also GVim (Vim with GTK UI), but that's more of an afterthought.

    There are now graphical front-end clients for NeoVim, but I still need to dig into them. Let me know your experience if you have one. Luckily, I don't rely on something graphical in my text editor, but it would improve how the editor looks and feels. UTF8 can already do a lot in the terminal, and terminal emulators also allow you to use TrueType fonts. Still, you will always be limited to one TTF font for the whole terminal, and it isn't possible to have, for example, a different font for headings, paragraphs, etc... you get the idea. TTF+UTF8 can't beat authentic graphics.

    -

    Scripting it


    +

    Scripting it



    It is possible to customize every aspect of Emacs through Emacs Lisp. I have done some Elk Scheme programming in the past (a dialect of Lisp), but that was a long time ago, and I am not willing to dive here again to customize my environment. I would instead take the pragmatic approach and script what I need in VimScript (a terrible language, but it gets the job done!). I watched Damian Conway's VimScript course on O'Reilly Safari Books Online, which I greatly recommend. Yes, VimScript feels clunky, funky and weird and is far less elegant than Lisp, but it gets its job done - in most cases! (That reminds me that the Vim team has announced a new major version of VimScript with improvements and language changes made - I haven't gotten to it yet - but I assume that VimScript will always stay VimScript).

    @@ -79,15 +94,15 @@ 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.

    -

    The famous Emacs Org mode


    +

    The famous Emacs Org mode



    Org-mode is an Emacs mode for keeping notes, authoring documents, computational notebooks, literate programming, maintaining to-do lists, planning projects, and more — in a fast and effective plain-text system. There's even a dedicated website for it:

    @@ -107,13 +122,13 @@ nmap ,i !wpbpaste<C Z shell
    tmux terminal multiplexer

    -

    Seeking simplicity


    +

    Seeking simplicity



    I am not ready to dive deep into the whole world of Emacs. I prefer small and simple tools as opposed to complex tools. Emacs comes with many features out of the box, whereas in Vim/NeoVim, you would need to install many plugins to replicate some of the behaviour. Yes, I need to invest time managing all the Vim/NeoVim plugins I use, but I feel more in control compared to Doom Emacs, where a framework around vanilla Emacs manages all the plugins. I could use vanilla Emacs and manage all my plugins the vanilla way, but for me, it's not worth the effort to learn and dive into that as all that I want to do I can already do with Vim/NeoVim.

    I am not saying that Vim/NeoVim are simple programs, but they are much simpler than Emacs with much smaller footprints; furthermore, they appear to be more straightforward as I am used to them. I only need Vim/NeoVim to be an editor, an IDE (through some plugins), and nothing more.

    -

    Conclusion


    +

    Conclusion



    I understand the Emacs users now. Emacs is an incredibly powerful platform for almost everything, not just text editing. With Emacs, you can do nearly everything (Writing, editing, programming, calendar scheduling and note taking, Jira integration, playing games, listening to music, reading/writing emails, browsing the web, using as a calculator, generating HTML pages, configuring interactive menus, jumping around between every feature and every file within one single session, chat on IRC, surf the Gopherspace, ... the options are endless....). If you want to have one piece of software which rules it all and you are happy to invest a large part of your time in your platform: Pick Emacs, and over time Emacs will become "your" Emacs, customized to your own needs and change the way it works, which makes the Emacs users stick even more to it.

    @@ -127,9 +142,9 @@ nmap ,i !wpbpaste<C
    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 e3bc3908..3c558741 100644 --- a/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways.html +++ b/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways.html @@ -8,12 +8,13 @@ -

    (Re)learning Java - My takeaways


    +

    +Home | Markdown | Gemini +

    +

    (Re)learning Java - My takeaways



    Published at 2022-12-24T23:18:40+02:00

    -
    -
    As a regular participant in the annual Pet Project competition at work, I always try to find a project where I can learn something new. In this post, I would like to share my takeaways after revisiting Java. You can read about my motivations in my "Creative universe" post:

    Creative universe
    @@ -26,46 +27,64 @@
    At my workplace, as an SRE, I don't do Java a lot. I have been reading Java code to understand the software better so I can apply and suggest workarounds or fixes to existing issues and bugs. However, most of our stack is in Java, and our Software Engineers use Java as their primary programming language.

    -

    Stuck at Java 1.4


    +
    +
    +

    Table of Contents


    +
    +
    +

    Stuck at Java 1.4



    Over time, I had been missing out on many new features that were added to the language since Java 1.4, so I decided to implement my next Pet Project in Java and learn every further aspect of the language as my main goal. Of course, I still liked the idea of winning a Pet Project Prize, but my main objective was to level up my Java skills.

    -

    (Re)learning & upskilling to Java 18


    +

    (Re)learning & upskilling to Java 18



    -

    Effective Java


    +

    Effective Java



    This book was recommended by my brother and also by at least another colleague at work to be one of the best, if not the best, book about Java programming. I read the whole book from the beginning to the end and immersed myself in it. I fully agree; this is a great book. Every Java developer or Java software engineer should read it!

    -
    +

    I recommend reading the 90-part effective Java Series on dev.to. It's a perfect companion to the book as it explains all the chapters again but from a slightly different perspective and helps you to really understand the content.

    Kyle Carter's 90-part Effective Java Series

    -

    Java Pub House


    +

    Java Pub House



    During my lunch breaks, I usually have a walk around the block or in a nearby park. I used that time to listen to the Java Pub House podcast. I listened to *every* episode and learned tons of new stuff. I can highly recommend this podcast. Especially GraalVM, a high-performance JDK distribution written for Java and other JVM languages, captured my attention. GraalVM can compile Java code into native binaries, improving performance and easing the distribution of Java programs. Because of the latter, I should release a VS-Sim GraalVM edition one day through a Linux AppImage ;-).

    https://www.javapubhouse.com
    https://www.graalvm.org

    -

    Java Concurrency course


    +

    Java Concurrency course



    I also watched a course on O'Reilly Safari Books online about Java Concurrency. That gave an excellent refresher on how the Java thread pools work and what were the concurrency primitives available in the standard library.

    -

    Read a lot of Java code


    +

    Read a lot of Java code



    First, the source code is often the best documentation (if programmed nicely), and second, it helps to get the hang of the language and standard practices. I started to read more and more Java code at work. I did that whenever I had to understand how something, in particular, worked (e.g. while troubleshooting and debugging an issue).

    -

    Observed Java code reviews


    +

    Observed Java code reviews



    Another great way to get the hang of Java again was to sneak into the code reviews of the Software Engineer colleagues. They are the expert on the matter and are a great source to copy knowledge. It's OK to stay passive and only follow the reviews. Sometimes, it's OK to step up and take ownership of the review. The developers will also always be happy to answer any naive questions which come up.

    -

    Took ownership of a roadmap-Java project


    +

    Took ownership of a roadmap-Java project



    Besides my Pet Project, I also took ownership of a regular roadmap Java project at work, making an internal Java service capable of running in Kubernetes. This was a bunch of minor changes and adding a bunch of classes and unit tests dealing with the statelessness and a persistent job queue in Redis. The job also involved reading and understanding a lot of already existing Java code. It wasn't part of my job description, but it was fun, and I learned a lot. The service runs smoothly in production now. Of course, all of my code got reviewed by my Software Engineering colleagues.

    -

    The good


    +

    The good



    From the new language features and syntaxes, there are many personal takeaways, and I can't possibly list them all, but here are some of my personal highlights:

    @@ -86,7 +105,7 @@
  • Lambdas are much cleaner, shorter and easier to read than anonymous classes. Many Java libraries require passing instances of (anonymous) classes (e.g. in Swing) to other objects. Lambdas are so lovely because they are primarily compatible with the passing of anonymous classes, so they are a 1:1 replacement in many instances. Lambdas also play very nicely together with the Java functional interfaces, as each Lambda got a type, and the type can be an already existing functional interface (or, if you got a particular case, you could define your custom functional interface for your own set of Lambdas, of course).
  • I love the concept of Java records. You can think of a record as an immutable object holding some data (as members). They are ideal for pipe and stream processing. They are much easier to define (with much less boilerplate) and come with write protection out of the box.

  • -

    The bad and the ugly


    +

    The bad and the ugly



    There are also many ugly corners in Java. Many are doomed to stay there forever due to historical decisions and ensuring backward compatibility with older versions of the Java language and the Java standard library.

    @@ -100,7 +119,7 @@
  • Being a bit spoiled by Golang's Goroutines, I was shocked about the limitations of the Java threads. They are resource hungry, and you can't just spin up millions of them as you would with Goroutines. I knew this limitation of threads already (as it's not a problem of the language but of how threads work in the OS), but still, I was pretty shocked when I got reminded of them again. Of course, there's a workaround: Use asynchronous sockets so that you don't waste a whole thread on a single I/O operation (in my case, waiting for a network response). Golang's runtime does that automatically for you: An OS thread will be re-used for other tasks until the network socket unblocks. Every modern programming language should support lightweight threads or Coroutines like Go's Goroutines.


  • -

    Conclusion


    +

    Conclusion



    While (re)learning Java, I felt like a student again and was quite enthusiastic about it initially. I invested around half a year, immersing myself intensively in Java (again). The last time I did that was many years ago as a university student. I even won a Silver Prize at work, implementing a project this year (2022 as of writing this). I feel confident now with understanding, debugging and patching Java code at work, which boosted my debugging and troubleshooting skills.

    @@ -118,9 +137,9 @@
    Back to the main site
    diff --git a/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways/effective-java.jpg b/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways/effective-java.jpg deleted file mode 100644 index 213c6e03..00000000 Binary files a/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways/effective-java.jpg and /dev/null differ diff --git a/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways/learnjava.jpg b/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways/learnjava.jpg deleted file mode 100644 index 4c3b9e7b..00000000 Binary files a/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways/learnjava.jpg and /dev/null differ diff --git a/gemfeed/2023-01-23-why-grapheneos-rox.html b/gemfeed/2023-01-23-why-grapheneos-rox.html index 55ad0068..18d5ee93 100644 --- a/gemfeed/2023-01-23-why-grapheneos-rox.html +++ b/gemfeed/2023-01-23-why-grapheneos-rox.html @@ -8,10 +8,26 @@ -

    Why GrapheneOS rox


    +

    +Home | Markdown | Gemini +

    +

    Why GrapheneOS rox



    Published at 2023-01-23T15:31:52+02:00

    +In 2021 I wrote "On Being Pedantic about Open-Source", and there was a section "What about mobile?" where I expressed the dilemma about the necessity of using proprietary mobile operating systems. With GrapheneOS, I found my perfect solution for personal mobile phone use.
    +
    +On Being Pedantic about Open-Source
    +
    +What is GrapheneOS?
    +
    +GrapheneOS is a privacy and security-focused mobile OS with Android app compatibility developed as a non-profit open-source project. It's focused on the research and development of privacy and security technologies, including substantial improvements to sandboxing, exploits mitigations and the permission model.
    +
    +GrapheneOS is an independent Android distribution based on the Android Open Source Project (AOSP) but hardened in multiple ways. Other independent Android distributions, like LineageOS, are also based on AOSP, but GrapheneOS takes it further so that it can be my daily driver on my phone.
    +
    +https://GrapheneOS.org
    +https://LineageOS.org
    +
     Art by Joan Stark
                    _.===========================._
    @@ -35,20 +51,20 @@ Art by Joan Stark
       '-'-'-'--'
     

    -In 2021 I wrote "On Being Pedantic about Open-Source", and there was a section "What about mobile?" where I expressed the dilemma about the necessity of using proprietary mobile operating systems. With GrapheneOS, I found my perfect solution for personal mobile phone use.
    -
    -On Being Pedantic about Open-Source
    -
    -What is GrapheneOS?
    -
    -GrapheneOS is a privacy and security-focused mobile OS with Android app compatibility developed as a non-profit open-source project. It's focused on the research and development of privacy and security technologies, including substantial improvements to sandboxing, exploits mitigations and the permission model.
    +

    Table of Contents



    -GrapheneOS is an independent Android distribution based on the Android Open Source Project (AOSP) but hardened in multiple ways. Other independent Android distributions, like LineageOS, are also based on AOSP, but GrapheneOS takes it further so that it can be my daily driver on my phone.
    -
    -https://GrapheneOS.org
    -https://LineageOS.org
    -
    -

    User Profiles


    +
    +

    User Profiles



    GrapheneOS allows configuring up to 32 user profiles (including a guest profile) on a single phone. A profile is a completely different environment within the phone, and it is possible to switch between them instantly. Sessions of a profile can continue running in the background or be fully terminated. Each profile can have completely different settings and different applications installed.

    @@ -58,7 +74,7 @@ Art by Joan Stark
    You notice how much longer (multiple days) your phone can be on a single charge when Google Play Services isn't running in the background. This tells a lot about the background activities and indicates that using Google Play shouldn't be the norm.

    -

    Proxying some of the Google offerings


    +

    Proxying some of the Google offerings



    There's also the case that I am using an app from the Google Play store (as the app isn't available from F-Droid), which doesn't require Google Play Services to run in the background. Here's where I use the Aurora Android store. The Aurora store can be installed through F-Droid. Aurora acts as an anonymous proxy from your phone to the Google Play Store and lets you install apps from there. No Google credentials are required for that!

    @@ -66,7 +82,7 @@ Art by Joan Stark
    There's a similar solution for watching videos on YouTube. You can use the NewPipe app (also from F-Droid), which acts as an anonymous proxy for watching videos from YouTube. So there isn't any need to install the official YouTube app, and there isn't any need to login to your Google account. What's so bad about the official app? You don't know which data it is sending about you to Google, so it is a privacy concern.

    -

    Google Play Sandboxing


    +

    Google Play Sandboxing



    Before switching to GrapheneOS, I had been using LineageOS on one of my phones for a couple of years. Still, I always had to have a secondary personal phone with all of these proprietary apps which (partially) only work with Google Play on the phone (e.g. Banking, Navigation, various travel apps from various Airlines, etc.) somewhere around as I didn't install Google Play on my LineageOS phone due to privacy concerns and only installed apps from the F-Droid store on it. When travelling, I always had to carry around a second phone with Google Play on it, as without it; life would become inconvenient pretty soon.

    @@ -84,7 +100,7 @@ Art by Joan Stark
    It is great to have the flexibility to use any proprietary Android app when needed. That only applies to around 1% of my phone usage time, but you often don't always know when you need "that one app now". So it's perfect that it's covered with the phone you always have with you.

    -

    The camera and the cloud


    +

    The camera and the cloud



    I really want my phone to shoot good looking pictures, so that I can later upload them to the Irregular Ninja:

    @@ -104,7 +120,7 @@ Art by Joan Stark
    I also use NextCloud to synchronize my notes (NextCloud Notes), my RSS news feeds (NextCloud News) and contacts (DAVx5). All apps required are available in the F-Droid store.

    -

    Fine granular permissions


    +

    Fine granular permissions



    Another great thing about GrapheneOS is that, besides putting your apps into different profiles, you can also restrict network access and configure storage scopes per app individually.

    @@ -112,7 +128,7 @@ Art by Joan Stark
    The app also wants to store and read some data from your phone (e.g. it could be a proprietary app for enhancing photos, and therefore storage access to a photo folder would be required). In GrapheneOS, you can configure a storage scope for that particular app, e.g. only read and write from one folder but still forbid access to all other folders on your phone.

    -

    Termux


    +

    Termux



    Termux can be installed on any Android phone through F-Droid, so it doesn't need to be a GrapheneOS phone. But I have to mention Termux here as it significantly adds value to my phone experience.

    @@ -124,7 +140,7 @@ Art by Joan Stark
    There are Pixel phones with a screen size of 6", and that's decent enough for occasional use like that, and everything (the phone, the BT keyboard, maybe an external battery pack) all fit nicely in a small travel pocket.

    -

    So, why not use a pure Linux phone?


    +

    So, why not use a pure Linux phone?



    Strictly speaking, an Android phone is a Linux phone, but it's heavily modified and customized. For me, a "pure" Linux phone is a more streamlined Linux kernel running in a distribution like Ubuntu Touch or Mobian.

    @@ -139,7 +155,7 @@ Art by Joan Stark
    SailfishOS

    -

    Small GrapheneOS downsides


    +

    Small GrapheneOS downsides



    Sometimes, switching a profile to use a different app is annoying, and you can't copy and paste from the system clipboard from one profile to another. But that's a small price I am willing to pay!

    @@ -151,9 +167,9 @@ 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 a696e0f2..3705bbf6 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,10 +8,15 @@ -

    How to shut down after work


    +

    +Home | Markdown | Gemini +

    +

    How to shut down after work



    Published at 2023-02-26T23:48:01+02:00

    +Do you need help fully discharging from work in the evenings or for the weekend? Shutting down from work won't just improve your work-life balance; it will also significantly improve the quality of your personal life and work. After a restful weekend, you will be much more energized and productive the next working day. So it should not just be in your own, but also your employers' interest that you fully relax and shut down after work.
    +
         |\   "Music should be heard not only with the ears, but also the soul."
     |---|--\-----------------------|-----------------------------------------|  
    @@ -27,15 +32,25 @@
                                       -@-        [kom...@uwec.edu]
     

    -Do you need help fully discharging from work in the evenings or for the weekend? Shutting down from work won't just improve your work-life balance; it will also significantly improve the quality of your personal life and work. After a restful weekend, you will be much more energized and productive the next working day. So it should not just be in your own, but also your employers' interest that you fully relax and shut down after work.
    +

    Table of Contents



    -

    Have a shutdown routine


    +
    +

    Have a shutdown routine



    Have a routine. Try to finish work around the same time every day. Write any outstanding tasks down for the next day, so you are sure you will remember them. Writing them down brings wonders as you can remove them from your mind for the remainder of the day (or the upcoming weekend) as you know you will surely pick them up the next working day. Tidying up your workplace could also count toward your daily shutdown routine.

    A commute home from the office also greatly helps, as it disconnects your work from your personal life. Don't work on your commute home, though! If you don't commute but work from home, then it helps to walk around the block or in a nearby park to disconnect from work.

    -

    Don't work when you officially don't work


    +

    Don't work when you officially don't work



    Unless you are self-employed, you have likely signed an N-hour per week contract with your employer, and your regular working times are from X o'clock in the morning to Y o'clock in the evening (with M minutes lunch break in the middle). And there might be some flexibility in your working times, too. But that kind of flexibility (e.g. extending the lunch break so that there is time to pick up a family member from the airport) will be agreed upon, and you will counteract it, for example, by starting working earlier the next day or working late, that one exception. But overall, your weekly working time will stay N hours.

    @@ -49,7 +64,7 @@
    Checking for your messages constantly outside of regular office times makes it impossible to shut down and relax from work altogether.

    -

    Distract your mind


    +

    Distract your mind



    Often, your mind goes back to work-related stuff even after work. That's normal as you concentrated highly on your work throughout the day. The brain unconsciously continues to work and will automatically present you with random work-related thoughts. You can counteract this by focusing on non-work stuff, which may include:

    @@ -62,23 +77,23 @@
    Some of these can be habit-stacked: Exercise could be combined with watching videos about your passion project (e.g. watching lectures about that new programming language you are currently learning for fun). With walking, for example, you could combine listening to an Audiobook or music, or you could also think about your passion project during that walk.

    -

    Get a pet


    +

    Get a pet



    Even if you have children, it helps wonders to get a pet. My cat, for example, will remind me a few times daily to take a few minute's breaks to pet, play or give food. So my cat not only helps me after work but throughout the day.

    My neighbour also works from home, and he has dogs, which he regularly has to take out to the park.

    -

    Journal your day


    +

    Journal your day



    If you are upset about something, making it impossible to shut down from work, write down everything (e.g., with a pen in a paper journal). Writing things down helps you to "get rid" of the negative. Especially after conflicts with colleagues or company decisions, you don't agree on. This kind of self-therapy is excellent. Brainstorm all your emotions and (even if opinionated) opinions so you have everything on paper. Once done, you don't think about it so much anymore, as you know you can access that information if required. But stopping ruminating about it will be much easier now. You will likely never access that information again, though. But at least writing the thoughts down saved your day.

    Write down three things which went well for the day. This helps you to appreciate the day.

    -

    Don't stress about what your employer expects from you


    +

    Don't stress about what your employer expects from you



    Think about what's fun and motivates you. Maybe the next promotion to Principal or a Manager role isn't for you. Many fall into the trap of stressing themselves out to satisfy the employer so that the next upgrade will happen and think about it constantly, even after work. But it is more important that you enjoy your craftsmanship. Work on what you expect from yourself. Ideally, your goals should be aligned with your employer. I am not saying you should abandon everything what your manager is asking you to do, but it is, after all, your life. And you have to decide where and on what you want to work. But don't sell yourself short. Keep track of your accomplishments.

    -

    Call it a day


    +

    Call it a day



    Every day you gave your best was good; the day's outcome doesn't matter. What matters is that you know you gave your best and are closer to your goals than the previous day. This gives you a sense of progress and accomplishment.

    @@ -88,9 +103,9 @@
    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 1ac45d3e..deb3d4d8 100644 --- a/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html +++ b/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html @@ -8,7 +8,10 @@ -

    "The Pragmatic Programmer" book notes


    +

    +Home | Markdown | Gemini +

    +

    "The Pragmatic Programmer" book notes



    Published at 2023-03-16T00:55:20+02:00

    @@ -59,7 +62,7 @@
    Do what works and not what's fashionable. E.g. does SCRUM make sense? The goal is to deliver deliverables and not to "become" agile.

    -

    Continuous learning


    +

    Continuous learning



    Add new tools to your repertoire every day and keep the momentum up. Learning new things is your most crucial aspect. Invest regularly in your knowledge portfolio. The learning process extends your thinking. It does not matter if you will never use it.

    @@ -70,7 +73,7 @@
    Think critically about everything you learn. Use paper for your notes. There is something special about it.

    -

    Stay connected


    +

    Stay connected



    It's your life, and you own it. Bruce Lee once said:

    @@ -83,7 +86,7 @@
    It's your life. Share it, celebrate it, be proud and have fun.

    -

    The story of stone soup


    +

    The story of stone soup



    How to motivate others to contribute something (e.g. ideas to a startup):

    @@ -91,22 +94,24 @@
    By working together, everyone contributes what they can, achieving a greater good together.

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other book notes of mine are:

    -2023-03-16 "The Pragmatic Programmer" book notes (You are currently reading this)
    -2023-04-01 "Never split the difference" book notes
    -2023-05-06 "The Obstacle is the Way" book notes
    -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2024-10-24 "Staff Engineer" book notes
    +2024-07-07 "The Stoic Challenge" book notes
    +2024-05-01 "Slow Productivity" book notes
    2023-11-11 "Mind Management" book notes
    +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2023-05-06 "The Obstacle is the Way" book notes
    +2023-04-01 "Never split the difference" book notes
    +2023-03-16 "The Pragmatic Programmer" book notes (You are currently reading this)

    -E-Mail your comments to paul@nospam.buetow.org :-)
    -
    -More books and other resources I found useful.
    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 c789d771..0cc81533 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,10 +8,21 @@ -

    Gemtexter 2.0.0 - Let's Gemtext again²


    +

    +Home | Markdown | Gemini +

    +

    Gemtexter 2.0.0 - Let's Gemtext again²



    Published at 2023-03-25T17:50:32+02:00

    +I proudly announce that I've released Gemtexter version 2.0.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.
    +
    +https://codeberg.org/snonux/gemtexter
    +
    +This is a new major release, so it contains a breaking change (see "Meta cache made obsolete").
    +
    +Let's list what's new!
    +
     -=[ typewriters ]=-  1/98
     
    @@ -25,15 +36,18 @@
       mod. by Paul Buetow  `"""""""""`
     

    -I proudly announce that I've released Gemtexter version 2.0.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.
    -
    -https://codeberg.org/snonux/gemtexter
    -
    -This is a new major release, so it contains a breaking change (see "Meta cache made obsolete").
    -
    -Let's list what's new!
    +

    Table of Contents



    -

    Minimal template engine


    +
    +

    Minimal template engine



    Gemtexter now supports templating, enabling dynamically generated content to .gmi files before converting anything to any output format like HTML and Markdown.

    @@ -81,7 +95,7 @@ Multiline template line 10
     See more entries about DTail and Golang:
     
    -<< template::inline::index dtail golang
    +<< template::inline::rindex dtail golang
     
     Blablabla...
     
    @@ -99,7 +113,7 @@ See more entries about DTail and Golang: Blablabla...

    -

    Added hooks


    +

    Added hooks



    You can configure PRE_GENERATE_HOOK and POST_PUBLISH_HOOK to point to scripts to be executed before running --generate, or after running --publish. E.g. you could populate some of the content by an external script before letting Gemtexter do its thing or you could automatically deploy the site after running --publish.

    @@ -109,15 +123,15 @@ 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


    +

    Use of safer Bash options



    Gemtexter now does set -euf -o pipefile, which helps to eliminate bugs and to catch scripting errors sooner. Previous versions only set -e.

    -

    Meta cache made obsolete


    +

    Meta cache made obsolete



    Here is the breaking change to older versions of Gemtexter. The $BASE_CONTENT_DIR/meta directory was made obsolete. meta was used to store various information about all the blog post entries to make generating an Atom feed in Bash easier. Especially the publishing dates of each post were stored there. Instead, the publishing date is now encoded in the .gmi file. And if it is missing, Gemtexter will set it to the current date and time at first run.

    @@ -127,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.
    @@ -139,37 +153,38 @@ The remaining content of the Gemtext file... 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


    +

    XMLLint support



    Optionally, when the xmllint binary is installed, Gemtexter will perform a simple XML lint check against the Atom feed generated. This is a double-check of whether the Atom feed is a valid XML.

    -

    More


    +

    More



    Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other related posts are:

    -2021-04-24 Welcome to the Geminispace
    -2021-06-05 Gemtexter - One Bash script to rule it all
    -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
    -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again² (You are currently reading this)
    +2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴
    2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again² (You are currently reading this)
    +2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
    +2021-06-05 Gemtexter - One Bash script to rule it all
    +2021-04-24 Welcome to the Geminispace

    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 8dec98ec..c8e8db3d 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,7 +8,10 @@ -

    "Never split the difference" book notes


    +

    +Home | Markdown | Gemini +

    +

    "Never split the difference" book notes



    Published at 2023-04-01T20:00:17+03:00

    @@ -26,7 +29,23 @@ '''

    -

    Tactical listening, spreading empathy


    +

    Table of Contents


    +
    +
    +

    Tactical listening, spreading empathy



    Be a mirror, copy each other to be comfy with each other to build up trust. Mirroring is mainly body language. A mirror is to repeat the words the other just said. Simple but effective.

    @@ -37,7 +56,7 @@
    Mirror training is like Jedi training. Simple but effective. A mirror needs space. Be silent after "you want this?"

    -

    Mindset of discovery


    +

    Mindset of discovery



    Try to have multiple realities in your mind and use facts to distinguish between real and false.

    @@ -49,7 +68,7 @@
    Try: to put a label on someone's emotion and then be silent. Wait for the other to reveal himself. "You seem unhappy about this?"

    -

    More tips


    +

    More tips



    • Put on a poker face and don't show emotions.
    • @@ -58,7 +77,7 @@
    • Being right is not the key to successful negotiation; being mindful is.
    • Be in the safe zone of empathy and acknowledge bad news.

    -

    "No" starts the conversation


    +

    "No" starts the conversation



    When the opponent starts with a "no", he feels in control and comfortable. That's why he has to start with "no".

    @@ -71,11 +90,11 @@
    Get a "That's right" when negotiating. Don't get a "you're right". You can summarise the opponent to get a "that's right".

    -

    Win-win


    +

    Win-win



    Win-win is a naive approach when encountering the win-lose counterpart, but always cooperate. Don't compromise, and don't split the difference. We don't compromise because it's right; we do it because it is easy. You must embrace the hard stuff; that's where the great deals are.

    -

    On Deadlines


    +

    On Deadlines



    • All deadlines are imaginary.
    • @@ -83,7 +102,7 @@
    • They push a deal to a conclusion.
    • They rush the counterpart to cause pressure and anxiety.

    -

    Analyse the opponent


    +

    Analyse the opponent



    • Understand the motivation of people behind the table as well.
    • @@ -93,7 +112,7 @@

    The person on the other side is never the issue; the problem is the issue. Keep this in mind to avoid emotional issues with the person and focus on the problem, not the person. The bond is essential; never create an enemy.

    -

    Use different ways of saying "no."


    +

    Use different ways of saying "no."



    I had paid my rent always in time. I had positive experiences with the building and would be sad for the landlord to lose a good tenant. I am looking for a win-win agreement between us. Pulling out the research, other neighbours offer much lower prices even if your building is a better location and services. How can I effort 200 more....

    @@ -101,7 +120,7 @@
    You always have to embrace thoughtful confrontation for good negotiation and life. Don't avoid honest, clear conflict. It will give you the best deals. Compromises are mostly bad deals for both sides. Most people don't negotiate a win-win but a win-lose. Know the best and worst outcomes and what is acceptable for you.

    -

    Calibrated question


    +

    Calibrated question



    Calibrated questions. Give the opponent a sense of power. Ask open-how questions to get the opponent to solve your problem and move him in your direction. Calibrated questions are the best tools. Summarise everything, and then ask, "how I am supposed to do that?". Asking for help this way with a calibrated question is a powerful tool for joint problem solving

    @@ -117,11 +136,11 @@
    Prepare 3 to 5 calibrated questions for your counterpart. Be curious what is really motivating the other side. You can get out the "Black Swan".

    -

    The black swan


    +

    The black swan



    What we don't know can break our deal. Uncovering it can bring us unexpected success. You get what you ask for in this world, but you must learn to ask correctly. Reveal the black swan by asking questions.

    -

    More


    +

    More



    Establish a range at top places like corp. I get... (e.g. remote London on a project basis). Set a high salary range and not a number. Also, check on LinkedIn premium for the salaries.

    @@ -138,21 +157,24 @@
    Slow.... it.... down....

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other book notes of mine are:

    -2023-03-16 "The Pragmatic Programmer" book notes
    -2023-04-01 "Never split the difference" book notes (You are currently reading this)
    -2023-05-06 "The Obstacle is the Way" book notes
    -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2024-10-24 "Staff Engineer" book notes
    +2024-07-07 "The Stoic Challenge" book notes
    +2024-05-01 "Slow Productivity" book notes
    2023-11-11 "Mind Management" book notes
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2023-05-06 "The Obstacle is the Way" book notes
    +2023-04-01 "Never split the difference" book notes (You are currently reading this)
    +2023-03-16 "The Pragmatic Programmer" book notes

    Back to the main site
    diff --git a/gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.html b/gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.html deleted file mode 100644 index 1d6e9981..00000000 --- a/gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - -Algorithms and Data Structures in Go - Part 1 - - - - - -

    Algorithms and Data Structures in Go - Part 1


    -
    -Published at 2023-04-09T22:31:42+03:00
    -
    -
    -         ,_---~~~~~----._         
    -  _,,_,*^____      _____``*g*\"*, 
    - / __/ /'     ^.  /      \ ^@q   f 
    -[  @f | @))    |  | @))   l  0 _/  
    - \`/   \~____ / __ \_____/    \   
    -  |           _l__l_           I   
    -  }          [______]           I  
    -  ]            | | |            |  
    -  ]             ~ ~             |  
    -  |                            |   
    -   |                           |   
    -
    -
    -This is the first blog post about my Algorithms and Data Structures in Go series. I am not a Software Developer in my day job. In my current role, programming and scripting skills are desirable but not mandatory. I have been learning about Data Structures and Algorithms many years ago at University. I thought it would be fun to revisit/refresh my knowledge here and implement many of the algorithms in Go.
    -
    -2023-04-09 Algorithms and Data Structures in Go - Part 1 (You are currently reading this)
    -
    -This post is about setting up some basic data structures and methods for this blog series. I promise, everything will be easy to follow in this post. It will become more interesting later in this series.
    -
    -

    Type constraints


    -
    -First, the package ds (data structures) defines the types.go. All examples will either operate on the Integer or Number type:
    -
    - -
    package ds
    -
    -import (
    -	"golang.org/x/exp/constraints"
    -)
    -
    -type Integer interface {
    -	constraints.Integer
    -}
    -
    -type Number interface {
    -	constraints.Integer | constraints.Float
    -}
    -
    -
    -
    -

    ArrayList


    -
    -Next comes the arraylist.go, which defines the underlying data structure all the algorithms of this series will use. ArrayList is just a type alias of a Go array (or slice) with custom methods on it:
    -
    - -
    package ds
    -
    -import (
    -	"fmt"
    -	"math/rand"
    -	"strings"
    -)
    -
    -type ArrayList[V Number] []V
    -
    -func NewArrayList[V Number](l int) ArrayList[V] {
    -	return make(ArrayList[V], l)
    -}
    -
    -
    -As you can see, the code uses Go generics, which I refactored recently. Besides the default constructor (which only returns an empty ArrayList with a given capacity), there are also a bunch of special constructors. NewRandomArrayList is returning an ArrayList with random numbers, NewAscendingArrayList and NewDescendingArrayList are returning ArrayLists in either ascending or descending order. They all will be used later on for testing and benchmarking the algorithms.
    -
    - -
    func NewRandomArrayList[V Number](l, max int) ArrayList[V] {
    -	a := make(ArrayList[V], l)
    -	for i := 0; i < l; i++ {
    -		if max > 0 {
    -			a[i] = V(rand.Intn(max))
    -			continue
    -		}
    -		a[i] = V(rand.Int())
    -	}
    -	return a
    -}
    -
    -func NewAscendingArrayList[V Number](l int) ArrayList[V] {
    -	a := make(ArrayList[V], l)
    -	for i := 0; i < l; i++ {
    -		a[i] = V(i)
    -	}
    -	return a
    -}
    -
    -func NewDescendingArrayList[V Number](l int) ArrayList[V] {
    -	a := make(ArrayList[V], l)
    -	j := l - 1
    -	for i := 0; i < l; i++ {
    -		a[i] = V(j)
    -		j--
    -	}
    -	return a
    -}
    -
    -
    -

    Helper methods


    -
    -The FirstN method only returns the first N elements of the ArrayList. This is useful for printing out only parts of the data structure:
    -
    - -
    func (a ArrayList[V]) FirstN(n int) string {
    -	var sb strings.Builder
    -	j := n
    -
    -	l := len(a)
    -	if j > l {
    -		j = l
    -	}
    -
    -	for i := 0; i < j; i++ {
    -		fmt.Fprintf(&sb, "%v ", a[i])
    -	}
    -
    -	if j < l {
    -		fmt.Fprintf(&sb, "... ")
    -	}
    -
    -	return sb.String()
    -}
    -
    -
    -The Sorted method checks whether the ArrayList is sorted. This will be used by the unit tests later on:
    -
    - -
    func (a ArrayList[V]) Sorted() bool {
    -	for i := len(a) - 1; i > 0; i-- {
    -		if a[i] < a[i-1] {
    -			return false
    -		}
    -	}
    -	return true
    -}
    -
    -
    -And the last utility method used is Swap, which allows swapping the values of two indices in the ArrayList:
    -
    - -
    func (a ArrayList[V]) Swap(i, j int) {
    -	aux := a[i]
    -	a[i] = a[j]
    -	a[j] = aux
    -}
    -
    -
    -
    -

    Sleep sort


    -
    -Let's implement our first algorithm, sleep sort. Sleep sort is a non-traditional and unconventional sorting algorithm based on the idea of waiting a certain amount of time corresponding to the value of each element in the input ArrayList. It's more of a fun, creative concept rather than an efficient or practical sorting technique. This is not a sorting algorithm you would use in any production code. As you can imagine, it is quite an inefficient sorting algorithm (it's only listed here as a warm-up exercise). This sorting method may also return false results depending on how the Goroutines are scheduled by the Go runtime.
    -
    -
    - -
    package sort
    -
    -import (
    -	"codeberg.org/snonux/algorithms/ds"
    -	"sync"
    -	"time"
    -)
    -
    -func Sleep[V ds.Integer](a ds.ArrayList[V]) ds.ArrayList[V] {
    -	sorted := ds.NewArrayList[V](len(a))
    -
    -	numCh := make(chan V)
    -	var wg sync.WaitGroup
    -	wg.Add(len(a))
    -
    -	go func() {
    -		wg.Wait()
    -		close(numCh)
    -	}()
    -
    -	for _, num := range a {
    -		go func(num V) {
    -			defer wg.Done()
    -			time.Sleep(time.Duration(num) * time.Second)
    -			numCh <- num
    -		}(num)
    -	}
    -
    -	for num := range numCh {
    -		sorted = append(sorted, num)
    -	}
    -
    -	return sorted
    -}
    -
    -
    -This Go code implements the sleep sort algorithm using generics and goroutines. The main function Sleep[V ds.Integer](a ds.ArrayList[V]) ds.ArrayList[V] takes a generic ArrayList as input and returns a sorted ArrayList. The code creates a separate goroutine for each element in the input array, sleeps for a duration proportional to the element's value, and then sends the element to a channel. Another goroutine waits for all the sleeping goroutines to finish and then closes the channel. The sorted result ArrayList is constructed by appending the elements received from the channel in the order they arrive. The sync.WaitGroup is used to synchronize goroutines and ensure that all of them have completed before closing the channel.
    -
    -

    Testing


    -
    -For testing, we only allow values up to 10, as otherwise, it would take too long to finish:
    -
    - -
    package sort
    -
    -import (
    -	"fmt"
    -	"testing"
    -
    -	"codeberg.org/snonux/algorithms/ds"
    -)
    -
    -func TestSleepSort(t *testing.T) {
    -	a := ds.NewRandomArrayList[int](10, 10)
    -	a = Sleep(a)
    -	if !a.Sorted() {
    -		t.Errorf("Array not sorted: %v", a)
    -	}
    -}
    -
    -
    -As you can see, it takes 9s here for the algorithm to finish (which is the highest value in the ArrayList):
    -
    - -
    ❯ go test ./sort -v -run SleepSort
    -=== RUN   TestSleepSort
    ---- PASS: TestSleepSort (9.00s)
    -PASS
    -ok      codeberg.org/snonux/algorithms/sort     9.002s
    -
    -
    -I won't write any benchmark for sleep sort; that will be done for the algorithms to come in this series :-).
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    -
    -Back to the main site
    - - - diff --git a/gemfeed/2023-05-01-unveiling-guprecords b/gemfeed/2023-05-01-unveiling-guprecords new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/gemfeed/2023-05-01-unveiling-guprecords @@ -0,0 +1 @@ + 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 822b4991..1528ff96 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,7 +8,10 @@ -

    Unveiling guprecords.raku: Global Uptime Records with Raku


    +

    +Home | Markdown | Gemini +

    +

    Unveiling guprecords.raku: Global Uptime Records with Raku



    Published at 2023-04-30T13:10:26+03:00

    @@ -29,7 +32,16 @@ +-----+-----------------+-----------------------------+

    -

    Introduction


    +

    Table of Contents


    +
    +
    +

    Introduction



    For fun, I am tracking the uptime of various personal machines (servers, laptops, workstations...). I have been doing this for over ten years now, so I have a lot of statistics collected.

    @@ -52,7 +64,7 @@
    And I have been following the Raku newsletter, and sometimes I have been lurking around in the IRC channels, too. Watching Raku coding challenges on YouTube was pretty fun, too. However, nothing beats actually using Raku to learn the language. After reading all of these resources, I may have a good idea about the features and paradigms, but I am by far not an expert.

    -

    How Guprecords works


    +

    How Guprecords works



    Guprecords works in three stages:

    @@ -65,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.
    @@ -78,7 +90,7 @@ http://www.gnu.org/software/src-highlite -->
  • Output formats available: Plaintext, Markdown, and Gemtext
  • Provides top entries based on the specified limit

  • -

    Example


    +

    Example



    You have already seen an example at the very top of this post, where the hosts were grouped by their total lifespans (uptime+downtime). Here's an example of what the global uptime report (grouped by total host uptimes) might look like:

    @@ -149,7 +161,7 @@ no1 in 455 days, 18:52:44 | at Sun Jul 21 07:37:51 2024 %up 99.997 | since Tue Dec 18 10:16:08 2018

    -

    Conclusion


    +

    Conclusion



    Guprecords is a small, yet powerful tool for analyzing uptime statistics. While developing Guprecords, I have come to truly appreciate and love Raku's expressiveness. The language is designed to be both powerful and flexible, allowing developers to express their intentions and logic more clearly and concisely.

    @@ -164,21 +176,21 @@ no1 in 455 days, 18:52:44 | at Sun Jul 21 07:37:51 2024
  • A social media sharing scheduler a la buffer.com. I am using Buffer at the moment to share posts on Mastadon, Twitter, Telegram and LinkedIn, but it is proprietary and also it's not really reliable.
  • Rewrite the static photo album generator of irregular.ninja in Raku (from Bash).

  • +E-Mail your comments to hi@foo.zone :-)
    +
    Other related posts are:

    -2008-06-26 Perl Poetry
    -2011-05-07 Perl Daemon (Service Framework)
    -2022-05-27 Perl is still a great choice
    -2022-06-15 Sweating the small stuff - Tiny projects of mine
    2023-05-01 Unveiling guprecords.raku: Global Uptime Records with Raku (You are currently reading this)
    -
    -E-Mail your comments to hi@foo.zone :-)
    +2022-06-15 Sweating the small stuff - Tiny projects of mine
    +2022-05-27 Perl is still a great choice
    +2011-05-07 Perl Daemon (Service Framework)
    +2008-06-26 Perl Poetry

    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 92be78fc..ac1eb445 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,13 +8,15 @@ -

    "The Obstacle is the Way" book notes


    +

    +Home | Markdown | Gemini +

    +

    "The Obstacle is the Way" book notes



    Published at 2023-05-06T17:23:16+03:00

    These are my personal takeaways after reading "The Obstacle Is the Way" by Ryan Holiday. This is mainly for my own use, but you might find it helpful too.

    -
              ,..........   ..........,
          ,..,'          '.'          ',..,
    @@ -27,9 +29,26 @@
                         '''
     

    +

    Table of Contents


    +
    +
    "The obstacle is the way" is a powerful statement that encapsulates the wisdom of turning challenges into opportunities for growth and success. We will explore using obstacles as fuel, transforming weaknesses into strengths, and adopting a mindset that allows us to be creative and persistent in the face of adversity.

    -

    Reframe your perspective


    +

    Reframe your perspective



    The obstacle in your path can become your path to success. Instead of being paralyzed by challenges, see them as opportunities to learn and grow. Remember, the things that hurt us often instruct us.

    @@ -37,38 +56,37 @@
    Don't always try to use the front door; a backdoor could open. It's nonsense. Don't fight the judo master with judo. Non-action can be action, exposing the weaknesses of others.

    -
    -

    Embrace rationality


    +

    Embrace rationality



    It is a superpower to see things rationally when others are fearful. Focus on the reality of the situation without letting emotions, such as anger, cloud your judgment. This ability will enable you to make better decisions in adversity. Ability to see things what they really are. E.g. wine is old fermented grapes, or other people behaving like animals during a fight. Show the middle finger if someone persists on the stupid rules occasionally.

    -

    Control your response


    +

    Control your response



    You can choose how you respond to obstacles. Focus on what you can control, and don't let yourself feel harmed by external circumstances. Remember, you decide how things affect you; nobody else does. Choose to feel good in response to any situation. Embrace the challenges and obstacles that come your way, as they are opportunities for growth and learning.

    -

    Practice emotional and physical resilience


    +

    Practice emotional and physical resilience



    Martial artists know the importance of developing physical and emotional strength. Cultivate the art of not panicking; it will help you avoid making mistakes during high-pressure situations.

    Focus on what you can control. Don't choose to feel harmed, and then you won't be harmed. I decide things that affect me; nobody else does. E.g., in prison, your mind stays your own. Don't ignore fear but explain it away, have a different view.

    -

    Persistence and patience


    +

    Persistence and patience



    Practice persistence and patience in your pursuits. Focus on the process rather than the prize and take one step at a time. Remember, the journey is about finishing tasks, projects, or workouts to the best of your ability. Never be in a hurry and never be desperate. There is no reason to be rushed; there are all in the long haul. Follow the process and not the price. Take it one step at a time. The process is about finishing (workout, task, project, etc.).

    -

    Embrace failure


    +

    Embrace failure



    Failure is a natural part of life and can make us stronger. Treat defeat as a stepping stone to success and education. What is defeat? The first step to education. Failure makes you stronger. If we do our best, we can be proud of it, regardless of the result. Do your job, but do it right. Only an asshole thinks he is too good at the things he does. Also, asking for forgiveness is easier than asking for permission.

    -

    Be adaptable


    +

    Be adaptable



    There are many ways to achieve your goals; sometimes, unconventional methods are necessary. Feel free to break the rules or go off the beaten path if it will lead to better results. Transform weaknesses into strengths. We have a choice of how to respond to things. It's not about being positive but to be creative. Aim high, but stuff will happen; E.g., surprises will always happen.

    -

    Embrace non-action


    +

    Embrace non-action



    We constantly push to the next thing. Sometimes the best course of action is standing still or even going backwards. Obstacles might resolve by themselves. Or going sideways. Sometimes, the best action is to stand still, go sideways, or even go backwards. Obstacles may resolve themselves or present new opportunities if you're patient and observant. People always want your input before you have all the facts. They want you to play after their rules. The question is, do you let them? The English call it the cool head. Being in control of Stress; requires practice. Appear, the absence of fear (Greek). When all others do it one way, it does not mean it is the correct or best practice.

    -

    Leverage crisis


    +

    Leverage crisis



    In times of crisis, seize the chance to do things never done before. Great people use negative situations to their advantage and become the most effective in challenging circumstances.

    @@ -76,38 +94,40 @@
    Be prepared for nothing to work. Problems are an opportunity to do your best, not to do miracles. Always manage your expectations. It will suck, but it will be ok. Be prepared to begin from the beginning. Be cheerful and eagerly work on the next obstacle. Each time you become better. Life is not a sprint but a marathon. After each obstacle lies another obstacle, there won't be anything without obstacles. Passing one means you are ready for the next.

    -

    Build your inner citadel


    +

    Build your inner citadel



    Develop your inner strength during good times so you can rely on it in bad times. Always prepare for adversity and face it with calmness and resilience. Be humble enough that things which happen will happen. Build your inner citadel. In good times strengthen it. In bad times rely on it.

    We should always prepare for things to get tough. Your house burns down: no worries, we eliminated much rubbish. Imagine what can go wrong before things go wrong. We are prepared for adversity; it's other people who aren't. Phil Jackson's hip problem example. To receive unexpected benefits, you must first accept the unexpected obstacles. Meditate on death. It's a universal obstacle. Use it as a reminder to do your best.

    -

    Love everything that happens


    +

    Love everything that happens



    Turn an obstacle the other way around for your benefit. Use it at fuel. It's simple but challenging. Most are paralyzed instead. The obstacle in the path becomes the path. Obstacles are neither good nor bad. The things which hurt, instruct.

    Should I hate people who hate me? That's their problem and not mine. Be always calm and relaxed during the fight. The story of the battle is the story of the smile. Cheerfulness in all situations, especially the bad ones. Love for everything that happens; if it happens, it was meant to happen. We can choose how we react to things, so why not choose to feel good? I love everything that happens. You must never lower yourself to the person you don't like.

    -

    Conclusion


    +

    Conclusion



    Life is a marathon, not a sprint. Each obstacle we overcome prepares us for the next one. Remember, the obstacle is not just a barrier to be turned upside down; it can also be used as a catapult to propel us forward. By embracing challenges and using them as opportunities for growth, we become stronger, more adaptable, and, ultimately, more successful.

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other book notes of mine are:

    -2023-03-16 "The Pragmatic Programmer" book notes
    -2023-04-01 "Never split the difference" book notes
    -2023-05-06 "The Obstacle is the Way" book notes (You are currently reading this)
    -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2024-10-24 "Staff Engineer" book notes
    +2024-07-07 "The Stoic Challenge" book notes
    +2024-05-01 "Slow Productivity" book notes
    2023-11-11 "Mind Management" book notes
    +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2023-05-06 "The Obstacle is the Way" book notes (You are currently reading this)
    +2023-04-01 "Never split the difference" book notes
    +2023-03-16 "The Pragmatic Programmer" book notes

    -E-Mail your comments to paul@nospam.buetow.org :-)
    -
    -More books and other resources I found useful.
    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 0f48933d..57cc96a1 100644 --- a/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios.html +++ b/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios.html @@ -8,20 +8,39 @@ -

    KISS server monitoring with Gogios


    +

    +Home | Markdown | Gemini +

    +

    KISS server monitoring with Gogios



    Published at 2023-06-01T21:10:17+03:00

    -Gogios logo
    -
    -

    Introduction


    -
    Gogios is a minimalistic and easy-to-use monitoring tool I programmed in Google Go designed specifically for small-scale self-hosted servers and virtual machines. The primary purpose of Gogios is to monitor my personal server infrastructure for foo.zone, my MTAs, my authoritative DNS servers, my NextCloud, Wallabag and Anki sync server installations, etc.

    With compatibility with the Nagios Check API, Gogios offers a simple yet effective solution to monitor a limited number of resources. In theory, Gogios scales to a couple of thousand checks, though. You can clone it from Codeberg here:

    https://codeberg.org/snonux/gogios

    +Gogios logo
    +
    +

    Table of Contents


    +
    +
         _____________________________    ____________________________
        /                             \  /                            \
    @@ -45,7 +64,7 @@ The original can be found at
     https://asciiart.website/index.php?art=objects/computers
     

    -

    Motivation


    +

    Motivation



    With experience in monitoring solutions like Nagios, Icinga, Prometheus and OpsGenie, these tools often came with many features that I didn't necessarily need for personal use. Contact groups, host groups, check clustering, and the requirement of operating a DBMS and a WebUI added complexity and bloat to my monitoring setup.

    @@ -53,7 +72,7 @@ https://asciiart.website/index.php?art=objects/computers
    This led me to create Gogios, a lightweight monitoring tool tailored to my specific needs. I chose the Go programming language for this project as it comes, in my opinion, with the best balance of ease to use and performance.

    -

    Features


    +

    Features



    • Compatible with Nagios Check scripts: Gogios leverages the widely-used Nagios Check API, allowing to use existing Nagios plugins.
    • @@ -64,7 +83,7 @@ https://asciiart.website/index.php?art=objects/computers
    • Email Notifications: Gogios can send email notifications regarding the status of monitored services, ensuring you stay informed about potential issues.
    • CRON-based Execution: Gogios can be quickly scheduled to run periodically via CRON, allowing you to automate monitoring without needing a complex setup.

    -

    Example alert


    +

    Example alert



    This is an example alert report received via E-Mail. Whereas, [C:2 W:0 U:0 OK:51] means that we've got two alerts in status critical, 0 warnings, 0 unknowns and 51 OKs.

    @@ -86,9 +105,9 @@ CRITICAL: Check ICMP6 vulcan.buetow.org: Check command timed out Have a nice day!

    -

    Installation


    +

    Installation



    -

    Compiling and installing Gogios


    +

    Compiling and installing Gogios



    This document is primarily written for OpenBSD, but applying the corresponding steps to any Unix-like (e.g. Linux-based) operating system should be easy. On systems other than OpenBSD, you may always have to replace does with the sudo command and replace the /usr/local/bin path with /usr/bin.

    @@ -98,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
    +
    git clone https://codeberg.org/snonux/gogios.git
     cd gogios
    -go build -o gogios cmd/gogios/main.go
    +go build -o gogios cmd/gogios/main.go
     doas cp gogios /usr/local/bin/gogios
    -doas chmod 755 /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:
    @@ -111,16 +130,16 @@ doas chmod 755 /usr/local/bin/gogios 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.

    https://www.rexify.org

    -

    Setting up user, group and directories


    +

    Setting up user, group and directories



    It is best to create a dedicated system user and group for Gogios to ensure proper isolation and security. Here are the steps to create the _gogios user and group under OpenBSD:

    @@ -131,13 +150,13 @@ 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 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.

    -

    Installing monitoring plugins


    +

    Installing monitoring plugins



    Gogios relies on external Nagios or Icinga monitoring plugin scripts. On OpenBSD, you can install the monitoring-plugins package with Gogios. The monitoring-plugins package is a collection of monitoring plugins, similar to Nagios plugins, that can be used to monitor various services and resources:

    @@ -146,14 +165,14 @@ 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 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.

    -

    Configuration


    +

    Configuration



    -

    MTA


    +

    MTA



    Gogios requires a local Mail Transfer Agent (MTA) such as Postfix or OpenBSD SMTPD running on the same server where the CRON job (see about the CRON job further below) is executed. The local MTA handles email delivery, allowing Gogios to send email notifications to monitor status changes. Before using Gogios, ensure that you have a properly configured MTA installed and running on your server to facilitate the sending of emails. Once the MTA is set up and functioning correctly, Gogios can leverage it to send email notifications.

    @@ -165,7 +184,7 @@ echo 'This is a test email from OpenBSD.' | mail -s 'Test Email'
    Check the recipient's inbox to confirm the delivery of the test email. If the email is delivered successfully, it indicates that your email server is configured correctly and functioning. Please check your MTA logs in case of issues.

    -

    Configuring Gogios


    +

    Configuring Gogios



    To configure Gogios, create a JSON configuration file (e.g., /etc/gogios.json). Here's an example configuration:

    @@ -173,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"]
    +    }
    +  }
    +}
     

      @@ -228,7 +247,7 @@ http://www.gnu.org/software/src-highlite -->
      The state.json file mentioned above keeps track of the monitoring state and check results between Gogios runs, enabling Gogios only to send email notifications when there are changes in the check status.

      -

      Running Gogios


      +

      Running Gogios



      Now it is time to give it a first run. On OpenBSD, do:

      @@ -236,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:
      @@ -250,7 +269,7 @@ http://www.gnu.org/software/src-highlite -->
      Gogios is now configured to run every five minutes from 8 am to 10 pm via CRON as the _gogios user. It will execute the checks and send monitoring status whenever a check status changes via email according to your configuration. Also, Gogios will run once at 7 am every morning and re-notify all unhandled alerts as a reminder.

      -

      High-availability


      +

      High-availability



      To create a high-availability Gogios setup, you can install Gogios on two servers that will monitor each other using the NRPE (Nagios Remote Plugin Executor) plugin. By running Gogios in alternate CRON intervals on both servers, you can ensure that even if one server goes down, the other will continue monitoring your infrastructure and sending notifications.

      @@ -263,23 +282,24 @@ http://www.gnu.org/software/src-highlite -->

    There are plans to make it possible to execute certain checks only on certain nodes (e.g. on elected leader or master nodes). This is still in progress (check out my Gorum Git project).

    -

    Conclusion:


    +

    Conclusion:



    Gogios is a lightweight and straightforward monitoring tool that is perfect for small-scale environments. With its compatibility with the Nagios Check API, email notifications, and CRON-based scheduling, Gogios offers an easy-to-use solution for those looking to monitor a limited number of resources. I personally use it to execute around 500 checks on my personal server infrastructure. I am very happy with this solution.

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other KISS-related posts are:

    -2021-09-12 Keep it simple and stupid
    -2023-06-01 KISS server monitoring with Gogios (You are currently reading this)
    +2024-04-01 KISS high-availability with OpenBSD
    2023-10-29 KISS static web photo albums with photoalbum.sh
    -
    -E-Mail your comments to paul@nospam.buetow.org :-)
    +2023-06-01 KISS server monitoring with Gogios (You are currently reading this)
    +2021-09-12 Keep it simple and stupid

    Back to the main site
    diff --git a/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios/gogios-small.png b/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios/gogios-small.png deleted file mode 100644 index aebe695c..00000000 Binary files a/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios/gogios-small.png and /dev/null differ 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 f472778d..6e55aa01 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,7 +8,10 @@ -

    "Software Developmers Career Guide and Soft Skills" book notes


    +

    +Home | Markdown | Gemini +

    +

    "Software Developmers Career Guide and Soft Skills" book notes



    Published at 2023-07-17T04:56:20+03:00

    @@ -26,9 +29,42 @@ '''

    -

    Improve


    +

    Table of Contents


    +
    +
    +

    Improve



    -

    Always learn new things


    +

    Always learn new things



    When you learn something new, e.g. a programming language, first gather an overview, learn from multiple sources, play around and learn by doing and not consuming and form your own questions. Don't read too much upfront. A large amount of time is spent in learning technical skills which were never use. You want to have a practical set of skills you are actually using. You need to know 20 percent to get out 80 percent of the results.

    @@ -46,11 +82,11 @@
    Boot camps: The advantage of a boot camp is to pragmatically learn things fast. We almost always overestimate what we can do in a day. Especially during boot camps. Connect to others during the boot camps

    -

    Set goals


    +

    Set goals



    Your own goals are important but the manager also looks at how the team performs and how someone can help the team perform better. Check whether you are on track with your goals every 2 weeks in order to avoid surprises for the annual review. Make concrete goals for next review. Track and document your progress. Invest in your education. Make your goals known. If you want something, then ask for it. Nobody but you knows what you want.

    -

    Ratings


    +

    Ratings



    That's a trap: If you have to rate yourself, that's a trap. That never works in an unbiased way. Rate yourself always the best way but rate your weakest part as high as possible minus one point. Rate yourself as good as you can otherwise. Nobody is putting for fun a gun on his own head.

    @@ -58,7 +94,7 @@
  • Don't do peer rating, it can fire back on you. What if the colleague becomes your new boss?
  • Cooperate rankings are unfortunately HR guidelines and politics and only mirror a little your actual performance.

  • -

    Promotions


    +

    Promotions



    The most valuable employees are the ones who make themselves obsolete and automate all away. Keep a safety net of 3 to 6 months of finances. Safe at least 10 percent of your earnings. Also, if you make money it does not mean that you have to spent more money. Is a new car better than a used car which both can bring you from A to B? Liability vs assets.

    @@ -71,7 +107,7 @@
  • If you want a raise be specific how much and know to back your demands. Don't make a thread and no ultimatums.
  • Best way for a promotion is to switch jobs. You can even switch back with a better salary.

  • -

    Finish things


    +

    Finish things



    Hard work is necessary for accomplish results. However, work smarter not harder. Furthermore, working smart is not a substitute for working hard. Work both, hard and smart.

    @@ -86,7 +122,7 @@
    Defeat is finally give up. Failure is the road to success, embrace it. Failure does not define you but how you respond to it. Events don't make your unhappy, but how you react to events do.

    -

    Expand the empire


    +

    Expand the empire



    The larger your empire is, the larger your circle of influence is. The larger the circle of influence is, the more opportunities you have.

    @@ -97,7 +133,7 @@
    Become visible, keep track that you accomplishments. E.g. write a weekly summary. Do presentations, be seen. Learn new things and share your learnings. Be the problem solver and not the blamer.

    -

    Be pragmatic and also manage your time


    +

    Be pragmatic and also manage your time



    Make use of time boxing via the Pomodoro technique: Set a target of rounds and track the rounds. That give you exact focused work time. That's really the trick. For example set a goal of 6 daily pomodores.

    @@ -107,7 +143,7 @@
    You should feel good of the work done even if you don't finished the task. You will feel good about pomodoro wise even you don't finish the task on hand yet. Helps you to enjoy time off more. Working longer may not sell anything.

    -

    The quota system


    +

    The quota system



    Defined quota of things done. E.g. N runs per week or M Blog posts per month or O pomodoros per week. This helps with consistency. Truly commit to these quotas. Failure is not an option. Start with small commitments. Don't commit to something you can't fulfill otherwise you set yourself up for failure.

    @@ -116,7 +152,7 @@
  • Internal motivation is more important over external motivation. Check out Daniels book drive.
  • Multitasking: Batching is effective. E.g. emails twice daily at pre-set times..

  • -

    Don't waste time


    +

    Don't waste time



    The biggest time waster is TV watching. The TV is programming you. It's insane that Americans watch so much TV as they work full time. Schedule one show at a time and watch it when you want to watch it. Most movies are crap anyways. The good movies will come to you as people will talk about them.

    @@ -125,7 +161,7 @@
  • Meetings can waste time as well. Simply don't go to them. Try to cancel meeting if it can be dealt with via email.
  • Enjoying things is not a waste of time. E.g. you could still play a game once in a while. It is important not to cut away all you enjoy from your life.

  • -

    Habits


    +

    Habits



    Try to have as many good habits as possible. Start with easy habits, and make them a little bit more challenging over time. Set ankers and rewards. Over time the routines will become habits naturally.

    @@ -135,7 +171,7 @@
  • We don't have control over our habits but our own routines.
  • Routines help to form the habits, though.

  • -

    Work-life balance


    +

    Work-life balance



    Avoid overwork hours. That's not as beneficial as you might think and comes only with very small rewards. Invest rather in yourself and not in your employer.

    @@ -147,7 +183,7 @@
    Use your most productive hours to work on you. Make that your priority. Take care of yourself a priority (E.g. do workouts or learn a new language). You can always workout 2 or 1 hour per day, but will you pay the price?

    -

    Mental health


    +

    Mental health



    • Friendships and positive thinking help to have and maintain better health, longer Life, better productivity and increased happiness.
    • @@ -158,7 +194,7 @@
      In most cases burnout is just an illusion. If you don't have motivation push through the wall. People usually don't pass the wall as they feel they are burned out. After pushing through the wall you will have the most fun, for example you will be able playing the guitar greatly.

      -

      Physical health


      +

      Physical health



      Utilise a standing desk and treadmill (you could walk and type at the same time). Increase the incline in order to burn more calories. Even on the standing desk you burn more calories than sitting. When you use pomodoro then you can use the small breaks for push-ups (maybe won't do as good when you are in a fasted state).

      @@ -170,7 +206,7 @@

    Intermittent fasting is an effective method to maintain weight and health. But it does not mean that you can only eat junk food in the feeding windows. Also, diet and nutrition is the most important for health and fitness. They make it also easier to stay focused and positive.

    -

    No drama


    +

    No drama



    Avoid drama at work. Where are humans there is drama. You can decide where to spent your energy in. But don't avoid conflict. Conflict is healthy in any kind of relationship. Be tactful and state your opinion. The goal is to find the best solution to the problem.

    @@ -186,13 +222,13 @@
    You have to learn how to work in a team. Be honest but tactful. It's not too be the loudest but about selling your ideas. Don't argue otherwise you won't sell anything. Be persuasive by finding the common ground. Or lead the colleagues to your idea and don't sell it upfront. Communicate clearly.

    -

    Personal brand


    +

    Personal brand



    • Invest your value outside the company. Build your personal brand. Show how valuable you are, also to other companies. Become an asset.
    • Invest in your education. Make your goals known. If you want something ask for it (see also the sections about goals in this document).

    -

    Market yourself


    +

    Market yourself



    • The best way to market yourself is to make you usable.
    • @@ -205,11 +241,11 @@
    • Have an elevator pitch: "buetow.org - Having fun with computers!"
    • Have social media accounts, especially the ones which are more tech related.

    -

    Networking


    +

    Networking



    Ask people so they talk about themselves. They are not really interested in you. Use meetup.com to find groups you are interested and build up the network over time. Don't drink on social networking events even when others do. Talking to other people at events only has upsides. Just saying "hi" and introducing yourself is enough. What worse can happen? If the person rejects you so what, life goes on. Ask open questions and no "yes" and "no" questions. E.g.: "What is your story, why are you here?".

    -

    Public speaking


    +

    Public speaking



    Before your talk go on stage 10 minutes in advance. Introduce yourself to the front row people. During the talk they will smile at you and encourage you during your talk.

    @@ -219,9 +255,9 @@
    Just do it. Just go to conferences. Even if you are not speaking. Sell your boss what you would learn and "this and that" and you would present the learnings to the team afterwards.

    -

    New job


    +

    New job



    -

    For the interview


    +

    For the interview



    • Build up a network before the interview. E.g., follow and comment blogs. Or go to meet-ups and conferences. Join user groups.
    • @@ -230,7 +266,7 @@

    If you are specialized then there is a better chance to get a fitting job. No one will hire a general lawyer if there are specialized lawyers available. Even if you are specialized, you will have a wide range of skills (T-shape knowledge).

    -

    Find the right type of company


    +

    Find the right type of company



    Not all companies are equal. They have individual cultures and guidelines.

    @@ -242,7 +278,7 @@
    Work in a tech. company if you want to work on/with cutting edge technologies.

    -

    Apply for the new job


    +

    Apply for the new job



    Get a professional resume writer. Get referrals of writers and get samples from there. Get sufficient with algorithm and data structures interview questions. Cracking the coding interview book and blog

    @@ -255,7 +291,7 @@
    Invest in your dress code as appearance masters. It does make sense to invest in your style. You could even hire a professional stylist (not my personal way though).

    -

    Negotiation


    +

    Negotiation



    • Whoever names the number first loses. You don't know what someone else is expecting unless told. Low ball number may be an issue but you have to know the market.
    • @@ -273,21 +309,21 @@
      • Never spilt the difference is the best book for learning negotiation techniques..

      -

      Leaving the old job


      +

      Leaving the old job



      When leaving a job make a clean and non personal as possible. Never complain and never explain. Don't worry about abandonment of the team. Everybody is replacement and you make a business decision. Don't threaten to quit as you are replaceable.

      -

      Other things


      +

      Other things



      • As a leader lead by example and don't lead from the Eiffel tower.
      • As a leader you are responsible for the team. If the team fails then it's your fault only.

      -

      Testing


      +

      Testing



      Unit testing Vs regression testing: Unit tests test the smallest possible unit and get rewritten if the unit gets changed. It's like programming against a specification n. Regression tests test whether the software still works after the change. Now you know more than most software engineers.

      -

      Books to read


      +

      Books to read



      • Clean Code
      • @@ -306,22 +342,24 @@
      • The war of Art (to combat procrastination)
      • Willpower Instinct

      +E-Mail your comments to paul@nospam.buetow.org :-)
      +
      Other book notes of mine are:

      -2023-03-16 "The Pragmatic Programmer" book notes
      -2023-04-01 "Never split the difference" book notes
      -2023-05-06 "The Obstacle is the Way" book notes
      -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes (You are currently reading this)
      +2024-10-24 "Staff Engineer" book notes
      +2024-07-07 "The Stoic Challenge" book notes
      +2024-05-01 "Slow Productivity" book notes
      2023-11-11 "Mind Management" book notes
      +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes (You are currently reading this)
      +2023-05-06 "The Obstacle is the Way" book notes
      +2023-04-01 "Never split the difference" book notes
      +2023-03-16 "The Pragmatic Programmer" book notes

      -E-Mail your comments to paul@nospam.buetow.org :-)
      -
      -More books and other resources I found useful.
      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 4a9efe70..94bfe479 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,10 +8,17 @@ -

      Gemtexter 2.1.0 - Let's Gemtext again³


      +

      +Home | Markdown | Gemini +

      +

      Gemtexter 2.1.0 - Let's Gemtext again³



      Published at 2023-07-21T10:19:31+03:00

      +I proudly announce that I've released Gemtexter version 2.1.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash.
      +
      +https://codeberg.org/snonux/gemtexter
      +
       -=[ typewriters ]=-  1/98
                                               .-------.
      @@ -25,21 +32,29 @@
         mod. by Paul Buetow  `"""""""""`
       

      -I proudly announce that I've released Gemtexter version 2.1.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash.
      -
      -https://codeberg.org/snonux/gemtexter
      +

      Table of Contents



      -

      Why Bash?


      +
      +

      Why Bash?



      This project is too complex for a Bash script. Writing it in Bash was to try out how maintainable a "larger" Bash script could be. It's still pretty maintainable and helps me try new Bash tricks here and then!

      Let's list what's new!

      -

      Switch to GPL3 license


      +

      Switch to GPL3 license



      Many (almost all) of the tools and commands (GNU Bash, GMU Sed, GNU Date, GNU Grep, GNU Source Highlight) used by Gemtexter are licensed under the GPL anyway. So why not use the same? This was an easy switch, as I was the only code contributor so far!

      -

      Source code highlighting support


      +

      Source code highlighting support



      The HTML output now supports source code highlighting, which is pretty neat if your site is about programming. The requirement is to have the source-highlight command, which is GNU Source Highlight, to be installed. Once done, you can annotate a bare block with the language to be highlighted. E.g.:

      @@ -57,18 +72,18 @@ 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.

      -

      HTML exact variant


      +

      HTML exact variant



      Gemtexter is there to convert your Gemini Capsule into other formats, such as HTML and Markdown. An HTML exact variant can now be enabled in the gemtexter.conf by adding the line declare -rx HTML_VARIANT=exact. The HTML/CSS output changed to reflect a more exact Gemtext appearance and to respect the same spacing as you would see in the Geminispace.

      -

      Use of Hack webfont by default


      +

      Use of Hack webfont by default



      The Hack web font is a typeface designed explicitly for source code. It's a derivative of the Bitstream Vera and DejaVu Mono lineage, but it features many improvements and refinements that make it better suited to reading and writing code.

      @@ -76,7 +91,7 @@ http://www.gnu.org/software/src-highlite -->
      Hack is open-source and freely available for use and modification under the MIT License.

      -

      HTML Mastodon verification support


      +

      HTML Mastodon verification support



      The following link explains how URL verification works in Mastodon:

      @@ -88,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:
      @@ -103,28 +118,29 @@ 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


      +

      More



      Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.

      +E-Mail your comments to paul@nospam.buetow.org :-)
      +
      Other related posts are:

      -2021-04-24 Welcome to the Geminispace
      -2021-06-05 Gemtexter - One Bash script to rule it all
      -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
      -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
      +2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴
      2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³ (You are currently reading this)
      -
      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
      +2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
      +2021-06-05 Gemtexter - One Bash script to rule it all
      +2021-04-24 Welcome to the Geminispace

      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 940c453d..31e350f7 100644 --- a/gemfeed/2023-08-18-site-reliability-engineering-part-1.html +++ b/gemfeed/2023-08-18-site-reliability-engineering-part-1.html @@ -8,15 +8,19 @@ -

      Site Reliability Engineering - Part 1: SRE and Organizational Culture


      +

      +Home | Markdown | Gemini +

      +

      Site Reliability Engineering - Part 1: SRE and Organizational Culture



      Published at 2023-08-18T22:43:47+03:00

      -The universe of Site Reliability Engineering (SRE) is like an intricate tapestry woven with diverse technology, culture, and personal grit threads. Site Reliability Engineering is one of the most demanding jobs. With all the facets, it's impossible to get bored. There is always a new challenge to master, and there is always a new technology to tinker with. It's not just technical; it's also about communication, collaboration and teamwork. I am currently employed as a Principal Site Reliability Engineer and will try to share what SRE is about in this blog series.
      +Being a Site Reliability Engineer (SRE) is like stepping into a lively, ever-evolving universe. The world of SRE mixes together different tech, a unique culture, and a whole lot of determination. It’s one of the toughest but most exciting jobs out there. There's zero chance of getting bored because there's always a fresh challenge to tackle and new technology to play around with. It's not just about the tech side of things either; it's heavily rooted in communication, collaboration, and teamwork. As someone currently working as an SRE, I’m here to break it all down for you in this blog series. Let's dive into what SRE is really all about!

      2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture (You are currently reading this)
      -2023-08-19 Site Reliability Engineering - Part 2: Operational Balance in SRE
      -2023-08-20 Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect
      +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance
      +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture
      +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers

       ▓▓▓▓░░                                                                                  
      @@ -40,37 +44,37 @@ DC on fire:
         ░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░
       

      -

      SRE and Organizational Culture: Navigating the Nexus


      +

      SRE and Organizational Culture: Navigating the Nexus



      -At the heart of SRE lies the proactive mindset of "prevention over cure." Traditional IT models focused predominantly on reactive solutions, but SRE mandates a shift towards foresight. By adopting Service Level Indicators (SLIs) and Service Level Objectives (SLOs), teams are equipped with clear metrics and goals that guide them toward ensuring reliability and user satisfaction. They reflect an organisational culture prioritising user experience and constant system alignment with user needs.
      +At the core of SRE is the principle of "prevention over cure." Unlike traditional IT setups that mostly react to problems, SRE focuses on spotting issues before they happen. This proactive approach involves using Service Level Indicators (SLIs) and Service Level Objectives (SLOs). These tools give teams specific metrics and targets to aim for, helping them keep systems reliable and users happy. It's all about creating a culture that prioritizes user experience and makes sure everything runs smoothly to meet their needs.

      -Another defining SRE idea concept the "error budget." This ingenious framework accepts that no system is flawless. Failures are inevitable. However, instead of being punitive, the culture here is to accept, learn, and iterate. By providing teams with a "budget" for errors, organisations create an environment where innovation is encouraged, and failures are viewed as learning opportunities.
      +Another key concept in SRE is the "error budget." It’s a clever approach that recognizes no system is perfect and that failures will happen. Instead of punishing mistakes, SRE culture embraces them as chances to learn and improve. The idea is to give teams a "budget" for errors, creating a space where innovation can thrive and failures are simply seen as lessons learned.

      -But SRE isn't just about technology and metrics; it's deeply human. It challenges the "hero culture" that plagues many IT teams. While individual heroics might occasionally save the day, a sustainable model requires collective expertise. An SRE culture recognises that heroes achieve their best within teams, negating the need for a hero-centric environment. This philosophy promotes a balanced on-call experience, emphasising the importance of trust, ownership, effective communication, and collaboration as cornerstones of team success. I personally have fallen into the hero trap, and know it's unsustainable to be the only go-to person for every problem.
      +SRE isn't just about tech and metrics; it's also about people. It tackles the "hero culture" that often ends up burning out IT teams. Sure, having a hero swoop in to save the day can be great, but relying on that all the time just isn’t sustainable. Instead, SRE focuses on collective expertise and teamwork. It recognizes that heroes are at their best within a solid team, making the need for constant heroics unnecessary. This way of thinking promotes a balanced on-call experience and highlights trust, ownership, good communication, and collaboration as key to success. I've been there myself, falling into the hero trap, and I know firsthand that it's just not feasible to be the go-to person for every problem that comes up.

      -Additionally, the SRE model requires good documentation. However, it's essential ensuring that this documentation undergoes the same quality checks as code, reinforcing effective onboarding, training and communication.
      +Also, the SRE model puts a big emphasis on good documentation. It's not enough to just have docs; they need to be top-notch and go through the same quality checks as code. This really helps with onboarding new team members, training, and keeping everyone on the same page.

      -Organisations might face a significant challenge when adopting SRE. Some might feel SRE principles counter their goals. They might prioritise feature rollouts over reliability or view SRE practices as cumbersome. Hence, creating an SRE culture often demands patient explanations and showcasing benefits, such as increased release velocity and improved user experience.
      +Adopting SRE can be a big challenge for some organizations. They might think the SRE approach goes against their goals, like preferring to roll out new features quickly rather than focusing on reliability, or seeing SRE practices as too much hassle. Building an SRE culture often means taking the time to explain things patiently and showing the benefits, like faster release cycles and a better user experience.

      -Monitoring and observability form another SRE aspect, emphasising the need for high-quality tools to query and analyse data. This ties back to the cultural emphasis on continuous learning and adaptability. SREs, by nature, need to be curious, ready to delve into anomalies, and keen on adopting new tools and practices.
      +Monitoring and observability are also big parts of SRE, highlighting the need for top-notch tools to query and analyze data. This aligns with the SRE focus on continuous learning and being adaptable. SREs naturally need to be curious, ready to dive into any strange issues, and always open to picking up new tools and practices.

      -The success of SRE within any organisation depends on the broader acceptance of its principles. It demands a move away from siloed operations, where SRE acts as a bandage on flawed systems, to a model where reliability is everyone's responsibility.
      +For SRE to really work in any organization, everyone needs to buy into its principles. It's about moving away from working in isolated silos and relying on SRE to just patch things up. Instead, it’s about making reliability a shared responsibility across the whole team.

      -In essence, the integration of SRE principles transcends technical practices. It paves the way for a shift in organisational culture that values proactive prevention, continuous learning, collaboration, and transparent communication. The successful melding of SRE and corporate culture promises not just reliable systems but also a robust, resilient, and progressive work environment.
      +In short, bringing SRE principles into the mix goes beyond just the technical stuff. It helps shift the whole organizational culture to value things like preventing issues before they happen, always learning, working together, and being open with communication. When SRE and corporate culture blend well, you end up with not just reliable systems but also a strong, resilient, and forward-thinking workplace.

      -Organisations with the implementation of SLIs, SLOs and error budgets are already advanced in their SRE journey. It takes a lot of communication, convincing, and patience until that point is reached.
      +Organizations that have SLIs, SLOs, and error budgets in place are already pretty far along in their SRE journey. Getting there takes a lot of communication, convincing people, and patience.

      Continue with the second part of this series:

      -2023-08-19 Site Reliability Engineering - Part 2: Operational Balance in SRE
      +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance

      E-Mail your comments to paul@nospam.buetow.org :-)

      Back to the main site
      diff --git a/gemfeed/2023-08-19-site-reliability-engineering-part-2.html b/gemfeed/2023-08-19-site-reliability-engineering-part-2.html deleted file mode 100644 index f1ad2b23..00000000 --- a/gemfeed/2023-08-19-site-reliability-engineering-part-2.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Site Reliability Engineering - Part 2: Operational Balance in SRE - - - - - -

      Site Reliability Engineering - Part 2: Operational Balance in SRE


      -
      -Published at 2023-08-19T00:18:18+03:00
      -
      -This is the second part of my Site Reliability Engineering (SRE) series. I am currently employed as a Principal Site Reliability Engineer and will try to share what SRE is about in this blog series.
      -
      -2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
      -2023-08-19 Site Reliability Engineering - Part 2: Operational Balance in SRE (You are currently reading this)
      -2023-08-20 Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect
      -
      -
      -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      -⠀⠀⠀⠀⣾⠿⠿⠿⠶⠾⠿⠿⣿⣿⣿⣿⣿⣿⠿⠿⠶⠶⠿⠿⠿⣷⠀⠀⠀⠀
      -⠀⠀⠀⣸⢿⣆⠀⠀⠀⠀⠀⠀⠀⠙⢿⡿⠉⠀⠀⠀⠀⠀⠀⠀⣸⣿⡆⠀⠀⠀
      -⠀⠀⢠⡟⠀⢻⣆⠀⠀⠀⠀⠀⠀⠀⣾⣧⠀⠀⠀⠀⠀⠀⠀⣰⡟⠀⢻⡄⠀⠀
      -⠀⢀⣾⠃⠀⠀⢿⡄⠀⠀⠀⠀⠀⢠⣿⣿⡀⠀⠀⠀⠀⠀⢠⡿⠀⠀⠘⣷⡀⠀
      -⠀⣼⣏⣀⣀⣀⣈⣿⡀⠀⠀⠀⠀⣸⣿⣿⡇⠀⠀⠀⠀⢀⣿⣃⣀⣀⣀⣸⣧⠀
      -⠀⢻⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⣿⣿⣿⣿⠀⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⡿⠀
      -⠀⠀⠉⠛⠛⠛⠋⠁⠀⠀⠀⠀⢸⣿⣿⣿⣿⡆⠀⠀⠀⠀⠈⠙⠛⠛⠛⠉⠀⠀
      -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      -⠀⠀⠀⠀⠀⠀⠴⠶⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠶⠦⠀⠀
      -
      -
      -

      Operational Balance in SRE: Finding the Equilibrium in Reliability and Velocity


      -
      -Site Reliability Engineering has established itself as more than just a set of best practices or methodologies. Instead, it stands as a beacon of operational excellence, which guides engineering teams through the turbulent waters of modern software development and system management.
      -
      -In the universe of software production, two fundamental forces are often at odds: The drive for rapid feature release (velocity) and the need for system reliability. Traditionally, the faster teams moved, the more risk was introduced into systems. SRE offers a approach to mitigate these conflicting drives through concepts like error budgets and SLIs/SLOs. These mechanisms offer a tangible metric, allowing teams to quantify how much they can push changes while ensuring they don't compromise system health. Thus, the error budget becomes a balancing act, where teams weigh the trade-offs between innovation and reliability.
      -
      -An important part of this balance is the dichotomy between operations and coding. According to SRE principles, an engineer should ideally spend an equal amount of time on operations work and coding - 50% on each. This isn't just a random metric; it's a reflection of the value SRE places on both maintaining operational excellence and progressing forward with innovations. This balance ensures that while SREs are solving today's problems, they are also preparing for tomorrow's challenges.
      -
      -However, not all operational tasks are equal. SRE differentiates between "ops work" and "toil". While ops work is integral to system maintenance and can provide value, toil represents repetitive, mundane tasks which offer little value in the long run. Recognising and minimising toil is crucial. A culture that allows engineers to drown in toil stifles innovation and growth. Hence, an organisation's approach to toil indicates its operational health and commitment to balance.
      -
      -A cornerstone of achieving operational balance lies in the tools and processes SREs use. Effective monitoring, observability tools, and ensuring that tools can handle high cardinality data are foundational. These aren't just technical requisites but reflective of an organisational culture prioritising proactive problem-solving. By having systems that effectively flag potential issues before they escalate, SREs can maintain the balance between system stability and forward momentum.
      -
      -Moreover, operational balance isn't just a technological or process challenge; it's a human one. The health of on-call engineers is as crucial as the health of the services they manage. On-call postmortems, continuous feedback loops, and recognising gaps (be it tooling, operational expertise, or resources) ensure that the human elements of operations are noticed.
      -
      -In conclusion, operational balance in SRE isn't static thing but an ongoing journey. It requires organisations to constantly evaluate their practices, tools, and, most importantly, their culture. By achieving this balance, organisations can ensure that they have time for innovation while maintaining the robustness and reliability of their systems, resulting in sustainable long-term success.
      -
      -That all sounds very romantic. The truth is, it's brutal to archive the perfect balance. No system will ever be perfect. But at least we should aim for it!
      -
      -Continue with the third part of this series:
      -
      -2023-08-20 Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect
      -
      -E-Mail your comments to paul@nospam.buetow.org :-)
      -
      -Back to the main site
      - - - diff --git a/gemfeed/2023-08-20-site-reliability-engineering-part-3.html b/gemfeed/2023-08-20-site-reliability-engineering-part-3.html deleted file mode 100644 index 31bd5d0e..00000000 --- a/gemfeed/2023-08-20-site-reliability-engineering-part-3.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - -Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect - - - - - -

      Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect


      -
      -Published at 2023-08-20T12:17:56+03:00
      -
      -This is the third part of my Site Reliability Engineering (SRE) series. I am currently employed as a Principal Site Reliability Engineer and will try to share what SRE is about in this blog series.
      -
      -2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
      -2023-08-19 Site Reliability Engineering - Part 2: Operational Balance in SRE
      -2023-08-20 Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect (You are currently reading this)
      -
      -
      -                    ..--""""----..                 
      -                 .-"   ..--""""--.j-.              
      -              .-"   .-"        .--.""--..          
      -           .-"   .-"       ..--"-. \/    ;         
      -        .-"   .-"_.--..--""  ..--'  "-.  :         
      -      .'    .'  /  `. \..--"" __ _     \ ;         
      -     :.__.-"    \  /        .' ( )"-.   Y          
      -     ;           ;:        ( )     ( ).  \         
      -   .':          /::       :            \  \        
      - .'.-"\._   _.-" ; ;      ( )    .-.  ( )  \       
      -  "    `."""  .j"  :      :      \  ;    ;  \      
      -    bug /"""""/     ;      ( )    "" :.( )   \     
      -       /\    /      :       \         \`.:  _ \    
      -      :  `. /        ;       `( )     (\/ :" \ \   
      -       \   `.        :         "-.(_)_.'   t-'  ;  
      -        \    `.       ;                    ..--":  
      -         `.    `.     :              ..--""     :  
      -           `.    "-.   ;       ..--""           ;  
      -             `.     "-.:_..--""            ..--"   
      -               `.      :             ..--""        
      -                 "-.   :       ..--""              
      -                    "-.;_..--""                    
      -
      -
      -
      -

      On-Call Culture and the Human Aspect: Prioritising Well-being in the Realm of Reliability


      -
      -Site Reliability Engineering is synonymous with ensuring system reliability, but the human factor is an often-underestimated part of this discipline. Ensuring an healthy on-call culture is as critical as any technical solution. The well-being of the engineers is an important factor.
      -
      -Firstly, a healthy on-call rotation is about more than just managing and responding to incidents. It's about the entire ecosystem that supports this practice. This involves reducing pain points, offering mentorship, rapid iteration, and ensuring that engineers have the right tools and processes. One ceavat is, that engineers should be willing to learn. Especially in on-call rotation embedding SREs with other engineers (for example Software Engineers or QA Engineers), it's difficult to motivate everyone to engage. QA Engineers want to test the software, Software Engineers want to implement new features; they don't want to troubleshoot and debug production incidents. It can be depressing for the mentoring SRE.
      -
      -Furthermore, the metrics that measure the success of an on-call experience are only sometimes straightforward. While one might assume that fewer pages translate to better on-call expertise (which is true to a degree, as who wants to receive a page out of office hours?), it's not always the volume of pages that matters most. Trust, ownership, accountability, and effective communication play the important roles.
      -
      -An important part is giving feedback about the on-call experience to ensure continuous learning. If alerts are mostly noise, they should be tuned or even eliminated. If alerts are actionable, can recurring tasks be automated? If there are knowledge gaps, is the documentation not good enough? Continuous retrospection ensures that not only do systems evolve, but the experience for the on-call engineers becomes progressively better.
      -
      -Onboarding for on-call duties is a crucial aspect of ensuring the reliability and efficiency of systems. This process involves equipping new team members with the knowledge, tools, and support to handle incidents confidently. It begins with an overview of the system architecture and common challenges, followed by training on monitoring tools, alerting mechanisms, and incident response protocols. Shadowing experienced on-call engineers can offer practical exposure. Too often, new engineers are thrown into the cold water without proper onboarding and training because the more experienced engineers are too busy fire-fighting production issues in the first place.
      -
      -An always-on, always-alert culture can lead to burnout. Engineers should be encouraged to recognise their limits, take breaks, and seek support when needed. This isn't just about individual health; a burnt-out engineer can have cascading effects on the entire team and the systems they manage. A successful on-call culture ensures that while systems are kept running, the engineers are kept happy, healthy, and supported. The more experienced engineers should take time to mentor the junior engineers, but the junior engineers should also be fully engaged, try to investigate and learn new things by themselves.
      -
      -For the junior engineer, it's too easy to fall back and ask the experts in the team every time an issue arises. This seems reasonable, but serving recipes for solving production issues on a silver tablet won't scale forever, as there are infinite scenarios of how production systems can break. So every engineer should learn to debug, troubleshoot and resolve production incidents independently. The experts will still be there for guidance and step in when the junior gets stuck after trying, but the experts should also learn to step down so that lesser experienced engineers can step up and learn. But mistakes can always happen here; that's why having a blameless on-call culture is essential.
      -
      -A blameless on-call culture is a must for a safe and collaborative environment where engineers can effectively respond to incidents without fear of retribution. This approach acknowledges that mistakes are a natural part of the learning and innovation process. When individuals are assured they won't be punished for errors, they're more likely to openly discuss mistakes, allowing the entire team to learn and grow from each incident. Furthermore, a blameless culture promotes psychological safety, enhances job satisfaction, reduces burnout, and ensures that talent remains committed and engaged.
      -
      -The fourth part of this blog series will be published soon :-)
      -
      -E-Mail your comments to paul@nospam.buetow.org :-)
      -
      -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 220ee174..d210c8a4 100644 --- a/gemfeed/2023-09-25-dtail-usage-examples.html +++ b/gemfeed/2023-09-25-dtail-usage-examples.html @@ -8,7 +8,10 @@ -

      DTail usage examples


      +

      +Home | Markdown | Gemini +

      +

      DTail usage examples



      Published at 2023-09-25T14:57:42+03:00

      @@ -32,6 +35,23 @@ | |

      +

      Table of Contents


      +
      +
      +

      Commands


      +
      DTail consists out of a server and several client binaries. In this post, I am showcasing their use!

        @@ -42,7 +62,7 @@
      • Use dmap to aggregate logs and other text files already written
      • dserver is the DTail server, where all the clients can connect to

      -

      Following logs


      +

      Following logs



      The following example demonstrates how to follow logs of several servers at once. The server list is provided as a flat text file. The example filters all records containing the string INFO. Any other Go compatible regular expression can also be used instead of INFO.

      @@ -50,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,...
      @@ -63,10 +83,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 --grep INFO "/var/log/dserver/*.log"
      +
      % dtail --servers serverlist.txt --grep INFO "/var/log/dserver/*.log"
       

      -

      Aggregating logs


      +

      Aggregating logs



      To run ad-hoc map-reduce aggregations on newly written log lines you must add a query. The following example follows all remote log lines and prints out every few seconds the result to standard output.

      @@ -76,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.
      @@ -92,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:
      @@ -104,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
      @@ -118,12 +138,12 @@ 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


      +

      How to use dcat



      The following example demonstrates how to cat files (display the full content of the files) on several servers at once.

      @@ -133,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
      @@ -144,10 +164,10 @@ 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


      +

      How to use dgrep



      The following example demonstrates how to grep files (display only the lines which match a given regular expression) of multiple servers at once. In this example, we look after some entries in /etc/passwd. This time, we don't provide the server list via an file but rather via a comma separated list directly on the command line. We also explore the -before, -after and -max flags (see animation).

      @@ -155,8 +175,8 @@ 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 \
      +
      % dgrep --servers server1.example.org:2223 \
      +    --files /etc/passwd \
           --regex nologin
       

      @@ -166,7 +186,7 @@ http://www.gnu.org/software/src-highlite -->
      Hint: -regex is an alias for -grep.

      -

      How to use dmap


      +

      How to use dmap



      To run a map-reduce aggregation over logs written in the past, the dmap command can be used. The following example aggregates all map-reduce fields dmap will print interim results every few seconds. You can also write the result to an CSV file by adding outfile result.csv to the query.

      @@ -174,17 +194,17 @@ 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.

      DMap example

      -

      How to use the DTail serverless mode


      +

      How to use the DTail serverless mode



      Until now, all examples so far required to have remote server(s) to connect to. That makes sense, as after all DTail is a *distributed* tool. However, there are circumstances where you don't really need to connect to a server remotely. For example, you already have a login shell open to the server an all what you want is to run some queries directly on local log files.

      @@ -192,7 +212,7 @@ http://www.gnu.org/software/src-highlite -->
      All commands shown so far also work in a serverless mode. All what needs to be done is to omit a server list. The DTail client then starts in serverless mode.

      -

      Serverless map-reduce query


      +

      Serverless map-reduce query



      The following dmap example is the same as the previously shown one, but the difference is that it operates on a local log file directly:

      @@ -200,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:
      @@ -211,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:
      @@ -222,12 +242,12 @@ 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


      +

      Aggregating CSV files



      In essence, this works exactly like aggregating logs. All files operated on must be valid CSV files and the first line of the CSV must be the header. E.g.:

      @@ -235,21 +255,21 @@ 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.

      -

      Other serverless commands


      +

      Other serverless commands



      The serverless mode works transparently with all other DTail commands. Here are some examples:

      @@ -257,29 +277,29 @@ Einstein,Albert 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.
      +
      % dcat --plain /etc/passwd > /etc/test
      +# Should show no differences.
       diff /etc/test /etc/passwd 
       

      @@ -287,36 +307,36 @@ diff /etc/test /etc/passwd by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
      % 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!

      +E-Mail your comments to paul@nospam.buetow.org :-)
      +
      Other related posts are:

      -2021-04-22 DTail - The distributed log tail program
      -2022-03-06 The release of DTail 4.0.0
      -2022-10-30 Installing DTail on OpenBSD
      2023-09-25 DTail usage examples (You are currently reading this)
      +2022-10-30 Installing DTail on OpenBSD
      +2022-03-06 The release of DTail 4.0.0
      +2021-04-22 DTail - The distributed log tail program

      I hope you find the tools presented in this post useful!

      Paul

      -E-Mail your comments to paul@nospam.buetow.org :-)
      -
      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 8e64a105..a0f4b9a2 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,10 +8,19 @@ -

      KISS static web photo albums with photoalbum.sh


      +

      +Home | Markdown | Gemini +

      +

      KISS static web photo albums with photoalbum.sh



      Published at 2023-10-29T22:25:04+02:00

      +Once in a while, I share photos on the inter-web with either family and friends or on my The Irregular Ninja photo site. One hobby of mine is photography (even though I don't have enough time for it - so I am primarily a point-and-shoot photographer).
      +
      +I'm not particularly eager to use any photo social sharing platforms such as Flickr, 500px (I used them regularly in the past), etc., anymore. I value self-hosting, DIY and privacy (nobody should data mine my photos), and no third party should have any rights to my pictures.
      +
      +I value KISS (keep it simple and stupid) and simplicity. All that's required for a web photo album is some simple HTML and spice it up with CSS. No need for JavaScript, no need for a complex dynamic website.
      +
                ___        .---------.._
         ______!fsc!_....-' .g8888888p. '-------....._
      @@ -29,19 +38,23 @@
       '._____________________________________________.'   
       

      -

      Motivation


      -
      -Once in a while, I share photos on the inter-web with either family and friends or on my The Irregular Ninja photo site. One hobby of mine is photography (even though I don't have enough time for it - so I am primarily a point-and-shoot photographer).
      -
      -I'm not particularly eager to use any photo social sharing platforms such as Flickr, 500px (I used them regularly in the past), etc., anymore. I value self-hosting, DIY and privacy (nobody should data mine my photos), and no third party should have any rights to my pictures.
      -
      -I value KISS (keep it simple and stupid) and simplicity. All that's required for a web photo album is some simple HTML and spice it up with CSS. No need for JavaScript, no need for a complex dynamic website.
      +

      Table of Contents



      -

      Introducing photoalbum.sh


      +
      +

      Introducing photoalbum.sh



      photoalbum.sh is a minimal Bash (Bourne Again Shell) script for Unix-like operating systems (such as Linux) to generate static web photo albums. The resulting static photo album is pure HTML+CSS (without any JavaScript!). It is specially designed to be as simple as possible.

      -

      Installation


      +

      Installation



      Installation is straightforward. All required is a recent version of GNU Bash, GNU Make, Git and ImageMagick. On Fedora, the dependencies are installed with:

      @@ -84,7 +97,7 @@ cp ./src/photoalbum.default.conf /etc/default/photoalbum This is Photoalbum Version 0.5.1

      -

      Setting it up


      +

      Setting it up



      Now, it's time to set up the Irregular Ninja static web photo album (or any other web photo album you may be setting up!)! Create a directory (here: irregular.ninja for the Irregular Ninja Photo site - or any oter sub-directory reflecting your album's name), and inside of that directory, create an incoming directory. The incoming directory. Copy all photos to be part of the album there.

      @@ -117,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:
      +% cat Makefile
      +all:
       	photoalbum generate photoalbumrc
      -clean:
      +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:
      @@ -161,43 +174,43 @@ clean: 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 @@
      +
      --- 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'
      +-TITLE='A simple Photoalbum'
      ++TITLE='Irregular.Ninja'
       
        # Thumbnail height geometry
      --THUMBHEIGHT=300
      -+THUMBHEIGHT=400
      +-THUMBHEIGHT=300
      ++THUMBHEIGHT=400
        # Normal geometry height (when viewing photo). Uncomment, to keep original size.
      --HEIGHT=1200
      -+HEIGHT=1800
      +-HEIGHT=1200
      ++HEIGHT=1800
        # Max previews per page.
        MAXPREVIEWS=40
      --# Randomly shuffle all previews.
      --# SHUFFLE=yes
      -+# Randomly shuffle
      -+SHUFFLE=yes
      +-# 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
      +-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_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.

      -

      Generating the static photo album


      +

      Generating the static photo album



      Let's generate it. Depending on the image sizes and count, the following step may take a while.

      @@ -260,15 +273,15 @@ blurs html index.html photos thumbs
      PS: There's also a server-side synchronisation script mirroring the same content to another server for high availability reasons (out of scope for this blog post).

      -

      Cleaning it up


      +

      Cleaning it up



      A simple make clean will clean up the ./dist directory and all other (if any) temp files created.

      -

      HTML templates


      +

      HTML templates



      Poke around in this source directory. You will find a bunch of Bash-HTML template files. You could tweak them to your liking.

      -

      Conclusion


      +

      Conclusion



      A decent looking (in my opinion, at least) in less than 500 (273 as of this writing, to be precise) lines of Bash code and with minimal dependencies; what more do you want? How many LOCs would this be in Raku with the same functionality (can it be sub-100?).

      @@ -276,23 +289,25 @@ blurs html index.html photos thumbs
      photoalbum.sh source code on Codeberg.

      +E-Mail your comments to paul@nospam.buetow.org :-)
      +
      Other Bash and KISS-related posts are:

      -2021-05-16 Personal Bash coding style guide
      -2021-06-05 Gemtexter - One Bash script to rule it all
      -2021-09-12 Keep it simple and stupid
      -2021-11-29 Bash Golf Part 1
      -2022-01-01 Bash Golf Part 2
      -2023-06-01 KISS server monitoring with Gogios
      +2024-04-01 KISS high-availability with OpenBSD
      +2023-12-10 Bash Golf Part 3
      2023-10-29 KISS static web photo albums with photoalbum.sh (You are currently reading this)
      -
      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2023-06-01 KISS server monitoring with Gogios
      +2022-01-01 Bash Golf Part 2
      +2021-11-29 Bash Golf Part 1
      +2021-09-12 Keep it simple and stupid
      +2021-06-05 Gemtexter - One Bash script to rule it all
      +2021-05-16 Personal Bash coding style guide

      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 61a97c96..1f1bcdb4 100644 --- a/gemfeed/2023-11-11-mind-management-book-notes.html +++ b/gemfeed/2023-11-11-mind-management-book-notes.html @@ -8,7 +8,10 @@ -

      "Mind Management" book notes


      +

      +Home | Markdown | Gemini +

      +

      "Mind Management" book notes



      Published at 2023-11-11T22:21:47+02:00

      @@ -26,17 +29,33 @@ '''

      +

      Table of Contents


      +
      +
      +

      It's not about time management


      +
      Productivity isn't about time management - it's about mind management. When you put a lot of effort into something, there are:

      • The point of diminishing returns
      • The point of negative return

      -

      Empty slots in the calendar


      +

      Empty slots in the calendar



      If we do more things in less time and use all possible slots, speed read, etc., we are more productive. But in reality, that's not the entire truth. You also exchange one thing against everything else.... You cut out too much from your actual life.

      -

      When you safe time...


      +

      When you safe time...



      ...keep it.

      @@ -45,7 +64,7 @@
    • Creative thinking needs space. It will pay dividends tomorrow.
    • You will be rewarded with the "Eureka effect" - a sudden new insight.

    -

    Follow your mood


    +

    Follow your mood



    Ask yourself: what is my mood now? We never have the energy to do anything, so the better strategy is to follow your current mode and energy. E.g.:

    @@ -53,7 +72,7 @@
  • Didn't sleep enough today? Then, do simple, non-demanding tasks at work
  • Had a great sleep, and there is even time before work starts? Pull in a workout...

  • -

    Boosting creativity


    +

    Boosting creativity



    The morning without coffee is a gift for creativity, but you often get distracted. Minimize distractions, too. I have no window to stare out but a plain blank wall.

    @@ -63,7 +82,7 @@
  • Don't race with time but walk alongside it as rough time lines.
  • Don't judge every day after the harvest, but the seed you lay

  • -

    The right mood for the task at hand


    +

    The right mood for the task at hand



    We need to try many different combinations. Limiting ourselves and trying too hard makes us frustrated and burn out. Creativity requires many iterations.

    @@ -77,7 +96,7 @@
    It gives you pleasure and is in a good mood. This increases creativity if you do what you want to do.

    -

    Creativity hacks


    +

    Creativity hacks



    • Coffee can cause anxiety.
    • @@ -88,7 +107,7 @@
    • Go to open spaces for creativity.
    • Go to closed spaces for polishing.

    -

    Planning and strategizing


    +

    Planning and strategizing



    Minds work better in sprints and not in marathons. Have a weekly plan, not a daily one.

    @@ -101,29 +120,31 @@
    You could schedule exploratory tasks when you are under grief. Sound systems should create slack for creativity. Plan only for a few minutes.

    -

    Fake it until you make it.


    +

    Fake it until you make it.



    • E.g. act calm if you want to be calm.
    • Talk slowly and deepen your voice a bit to appear more confident. You will also become more confident.
    • Also, use power positions for better confidence.

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    Other book notes of mine are:

    -2023-03-16 "The Pragmatic Programmer" book notes
    -2023-04-01 "Never split the difference" book notes
    -2023-05-06 "The Obstacle is the Way" book notes
    -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2024-10-24 "Staff Engineer" book notes
    +2024-07-07 "The Stoic Challenge" book notes
    +2024-05-01 "Slow Productivity" book notes
    2023-11-11 "Mind Management" book notes (You are currently reading this)
    +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2023-05-06 "The Obstacle is the Way" book notes
    +2023-04-01 "Never split the difference" book notes
    +2023-03-16 "The Pragmatic Programmer" book notes

    -E-Mail your comments to paul@nospam.buetow.org :-)
    -
    -More books and other resources I found useful.
    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 new file mode 100644 index 00000000..9b900d76 --- /dev/null +++ b/gemfeed/2023-11-19-site-reliability-engineering-part-2.html @@ -0,0 +1,70 @@ + + + + +Site Reliability Engineering - Part 2: Operational Balance + + + + + +

    +Home | Markdown | Gemini +

    +

    Site Reliability Engineering - Part 2: Operational Balance


    +
    +Published at 2023-11-19T00:18:18+03:00
    +
    +This is the second part of my Site Reliability Engineering (SRE) series. I am currently employed as a Site Reliability Engineer and will try to share what SRE is about in this blog series.
    +
    +2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
    +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance (You are currently reading this)
    +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture
    +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers
    +
    +
    +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
    +⠀⠀⠀⠀⣾⠿⠿⠿⠶⠾⠿⠿⣿⣿⣿⣿⣿⣿⠿⠿⠶⠶⠿⠿⠿⣷⠀⠀⠀⠀
    +⠀⠀⠀⣸⢿⣆⠀⠀⠀⠀⠀⠀⠀⠙⢿⡿⠉⠀⠀⠀⠀⠀⠀⠀⣸⣿⡆⠀⠀⠀
    +⠀⠀⢠⡟⠀⢻⣆⠀⠀⠀⠀⠀⠀⠀⣾⣧⠀⠀⠀⠀⠀⠀⠀⣰⡟⠀⢻⡄⠀⠀
    +⠀⢀⣾⠃⠀⠀⢿⡄⠀⠀⠀⠀⠀⢠⣿⣿⡀⠀⠀⠀⠀⠀⢠⡿⠀⠀⠘⣷⡀⠀
    +⠀⣼⣏⣀⣀⣀⣈⣿⡀⠀⠀⠀⠀⣸⣿⣿⡇⠀⠀⠀⠀⢀⣿⣃⣀⣀⣀⣸⣧⠀
    +⠀⢻⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⣿⣿⣿⣿⠀⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⡿⠀
    +⠀⠀⠉⠛⠛⠛⠋⠁⠀⠀⠀⠀⢸⣿⣿⣿⣿⡆⠀⠀⠀⠀⠈⠙⠛⠛⠛⠉⠀⠀
    +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
    +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
    +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
    +⠀⠀⠀⠀⠀⠀⠴⠶⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠶⠦⠀⠀
    +
    +
    +

    Striking the Right Balance Between Reliability and Speed


    +
    +Site Reliability Engineering is more than just a bunch of best practices or methods. It's a guiding light for engineering teams, helping them navigate the tricky waters of modern software development and system management.
    +In the world of software production, there are two big forces that often clash: the push for fast feature releases (velocity) and the need for reliable systems. Traditionally, moving faster meant more risk. SRE helps balance these opposing goals with things like error budgets and SLIs/SLOs. These tools give teams a clear way to measure how much they can push changes without hurting system health. So, the error budget becomes a balancing act, helping teams trade off between innovation and reliability.
    +
    +Finding the right balance in SRE means juggling operations and coding. Ideally, engineers should split their time 50/50 between these tasks. This isn't just a random rule; it highlights how much SRE values both maintaining smooth operations and driving innovation. This way, SREs not only handle today's problems but also prepare for tomorrow's challenges.
    +
    +But not all operations tasks are the same. SRE makes a clear distinction between "ops work" and "toil." Ops work is essential for maintaining systems and adds value, while toil is the repetitive, boring stuff that doesn’t. It's super important to recognize and minimize toil because a culture that lets engineers get bogged down in it will kill innovation and growth. The way an organization handles toil says a lot about its operational health and commitment to balance.
    +
    +A key part of finding operational balance is the tools and processes that SREs use. Great monitoring and observability tools, especially those that can handle lots of complex data, are essential. This isn’t just about having the right tech—it shows that the organization values proactive problem-solving. With systems that can spot potential issues early, SREs can keep things stable while still pushing forward.
    +
    +Operational balance isn't just about tech or processes; it's also about people. The well-being of on-call engineers is just as important as the health of the services they manage. Doing postmortems after incidents, having continuous feedback loops, and identifying gaps in tools, skills, or resources all help make sure the human side of operations gets the attention it deserves.
    +
    +In the end, finding operational balance in SRE is an ongoing journey, not a one-time thing. Companies need to keep reassessing their practices, tools, and especially their culture. When they get this balance right, they can keep innovating without sacrificing the reliability of their systems, leading to long-term success.
    +
    +That all sounds pretty idealistic. The reality is that getting the perfect balance is really tough. No system is ever going to be perfect. But hey, we should still strive for it!
    +
    +Continue with the third part of this series:
    +
    +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +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 new file mode 100644 index 00000000..c69ef361 --- /dev/null +++ b/gemfeed/2023-12-10-bash-golf-part-3.html @@ -0,0 +1,435 @@ + + + + +Bash Golf Part 3 + + + + + +

    +Home | Markdown | Gemini +

    +

    Bash Golf Part 3


    +
    +Published at 2023-12-10T11:35:54+02:00
    +
    +This is the third blog post about my Bash Golf series. This series is random Bash tips, tricks, and weirdnesses I have encountered over time.
    +
    +2021-11-29 Bash Golf Part 1
    +2022-01-01 Bash Golf Part 2
    +2023-12-10 Bash Golf Part 3 (You are currently reading this)
    +
    +
    +    '\       '\        '\                   .  .          |>18>>
    +      \        \         \              .         ' .     |
    +     O>>      O>>       O>>         .                 'o  |
    +      \       .\. ..    .\. ..   .                        |
    +      /\    .  /\     .  /\    . .                        |
    +     / /   .  / /  .'.  / /  .'    .                      |
    +jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    +                        Art by Joan Stark, mod. by Paul Buetow
    +
    +
    +

    Table of Contents


    +
    +
    +

    FUNCNAME


    +
    +FUNCNAME is an array you are looking for a way to dynamically determine the name of the current function (which could be considered the callee in the context of its own execution), you can use the special variable FUNCNAME. This is an array variable that contains the names of all shell functions currently in the execution call stack. The element FUNCNAME[0] holds the name of the currently executing function, FUNCNAME[1] the name of the function that called that, and so on.
    +
    +This is particularly useful for logging when you want to include the callee function in the log output. E.g. look at this log helper:
    +
    + +
    #!/usr/bin/env bash
    +
    +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)
    +
    +    echo "$level|$stamp|$pid|$callee|$message" >&2
    +}
    +
    +at_home_friday_evening () {
    +    log INFO 'One Peperoni Pizza, please'
    +}
    +
    +at_home_friday_evening
    +
    +
    +The output is as follows:
    +
    + +
    ❯ ./logexample.sh
    +INFO|20231210-082732|123002|at_home_friday_evening|One Peperoni Pizza, please
    +
    +
    +

    :(){ :|:& };:


    +
    +This one may be widely known already, but I am including it here as I found a cute image illustrating it. But to break :(){ :|:& };: down:
    +
    +
      +
    • :(){ } is really a declaration of the function :
    • +
    • The ; is ending the current statement
    • +
    • The : at the end is calling the function :
    • +
    • :|:& is the function body
    • +

    +Let's break down the function body :|:&:
    +
    +
      +
    • The first : is calling the function recursively
    • +
    • The |: is piping the output to the function : again (parallel recursion)
    • +
    • The & lets it run in the background.
    • +

    +So, it's a fork bomb. If you run it, your computer will run out of resources eventually. (Modern Linux distributions could have reasonable limits configured for your login session, so it won't bring down your whole system anymore unless you run it as root!)
    +
    +And here is the cute illustration:
    +
    +Bash fork bomb
    +
    +

    Inner functions


    +
    +Bash defines variables as it is interpreting the code. The same applies to function declarations. Let's consider this code:
    +
    + +
    #!/usr/bin/env bash
    +
    +outer() {
    +  inner() {
    +    echo 'Intel inside!'
    +  }
    +  inner
    +}
    +
    +inner
    +outer
    +inner
    +
    +
    +And let's execute it:
    +
    +
    +❯ ./inner.sh
    +/tmp/inner.sh: line 10: inner: command not found
    +Intel inside!
    +Intel inside!
    +
    +
    +What happened? The first time inner was called, it wasn't defined yet. That only happens after the outer run. Note that inner will still be globally defined. But functions can be declared multiple times (the last version wins):
    +
    + +
    #!/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:
    +
    +
    +❯ ./inner2.sh
    +Intel inside!
    +Intel inside!
    +Wintel inside!
    +Wintel inside!
    +
    +
    +

    Exporting functions


    +
    +Have you ever wondered how to execute a shell function in parallel through xargs? The problem is that this won't work:
    +
    + +
    #!/usr/bin/env bash
    +
    +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 "{}"'
    +
    +
    +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:
    +
    +
    +❯ ./xargs.sh
    +bash: line 1: some_expensive_operations: command not found
    +bash: line 1: some_expensive_operations: command not found
    +bash: line 1: some_expensive_operations: command not found
    +bash: line 1: some_expensive_operations: command not found
    +bash: line 1: some_expensive_operations: command not found
    +bash: line 1: some_expensive_operations: command not found
    +bash: line 1: some_expensive_operations: command not found
    +bash: line 1: some_expensive_operations: command not found
    +bash: line 1: some_expensive_operations: command not found
    +bash: line 1: some_expensive_operations: command not found
    +
    +
    +There's an easy solution for this. Just export the function! It will then be magically available in any sub-shell!
    +
    + +
    #!/usr/bin/env bash
    +
    +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 "{}"'
    +
    +
    +When we run this now, we get:
    +
    +
    +❯ ./xargs.sh
    +Doing expensive operations with '0' from pid 132831
    +Doing expensive operations with '1' from pid 132832
    +Doing expensive operations with '2' from pid 132833
    +Doing expensive operations with '3' from pid 132834
    +Doing expensive operations with '4' from pid 132835
    +Doing expensive operations with '5' from pid 132836
    +Doing expensive operations with '6' from pid 132837
    +Doing expensive operations with '7' from pid 132838
    +Doing expensive operations with '8' from pid 132839
    +Doing expensive operations with '9' from pid 132840
    +
    +
    +If some_expensive_function would call another function, the other function must also be exported. Otherwise, there will be a runtime error again. E.g., this won't work:
    +
    + +
    #!/usr/bin/env bash
    +
    +some_other_function() {
    +  echo "$1"
    +}
    +
    +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 "{}"'
    +
    +
    +... because some_other_function isn't exported! You will also need to add an export -f some_other_function!
    +
    +

    Dynamic variables with local


    +
    +You may know that local is how to declare local variables in a function. Most don't know that those variables actually have dynamic scope. Let's consider the following example:
    +
    + +
    #!/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?
    +
    +Let's run it:
    +
    +
    +❯ ./dynamic.sh
    +bar
    +baz
    +foo
    +
    +
    +What happened? The variable foo (declared with local) is available in the function it was declared in and in all other functions down the call stack! We can even modify the value of foo, and the change will be visible up the call stack. It's not a global variable; on the last line, echo "$foo" echoes the global variable content.
    +
    +
    +

    if conditionals


    +
    +Consider all variants here more or less equivalent:
    +
    + +
    #!/usr/bin/env bash
    +
    +declare -r foo=foo
    +declare -r bar=bar
    +
    +if [ "$foo" = foo ]; then
    +  if [ "$bar" = bar ]; then
    +    echo ok1
    +  fi
    +fi
    +
    +if [ "$foo" = foo ] && [ "$bar" == bar ]; then
    +  echo ok2a
    +fi
    +
    +[ "$foo" = foo ] && [ "$bar" == bar ] && echo ok2b
    +
    +if [[ "$foo" = foo && "$bar" == bar ]]; then
    +  echo ok3a
    +fi
    +
    + [[ "$foo" = foo && "$bar" == bar ]] && echo ok3b
    +
    +if test "$foo" = foo && test "$bar" = bar; then
    +  echo ok4a
    +fi
    +
    +test "$foo" = foo && test "$bar" = bar && echo ok4b
    +
    +
    +The output we get is:
    +
    +
    +❯ ./if.sh
    +ok1
    +ok2a
    +ok2b
    +ok3a
    +ok3b
    +ok4a
    +ok4b
    +
    +
    +

    Multi-line comments


    +
    +You all know how to comment. Put a # in front of it. You could use multiple single-line comments or abuse heredocs and redirect it to the : no-op command to emulate multi-line comments.
    +
    + +
    #!/usr/bin/env bash
    +
    +# Single line comment
    +
    +# These are two single line
    +# comments one after another
    +
    +: <<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!
    +
    +

    Don't change it while it's executed


    +
    +Consider this script:
    +
    + +
    #!/usr/bin/env bash
    +
    +echo foo
    +echo echo baz >> $0
    +echo bar
    +
    +
    +When it is run, it will do:
    +
    +
    +❯ ./if.sh
    +foo
    +bar
    +baz
    +❯ cat if.sh
    +#!/usr/bin/env bash
    +
    +echo foo
    +echo echo baz >> $0
    +echo bar
    +echo baz
    +
    +
    +So what happened? The echo baz line was appended to the script while it was still executed! And the interpreter also picked it up! It tells us that Bash evaluates each line as it encounters it. This can lead to nasty side effects when editing the script while it is still being executed! You should always keep this in mind!
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Other related posts are:
    +
    +2023-12-10 Bash Golf Part 3 (You are currently reading this)
    +2022-01-01 Bash Golf Part 2
    +2021-11-29 Bash Golf Part 1
    +2021-06-05 Gemtexter - One Bash script to rule it all
    +2021-05-16 Personal Bash coding style guide
    +
    +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 new file mode 100644 index 00000000..b93d92a8 --- /dev/null +++ b/gemfeed/2024-01-09-site-reliability-engineering-part-3.html @@ -0,0 +1,84 @@ + + + + +Site Reliability Engineering - Part 3: On-Call Culture + + + + + +

    +Home | Markdown | Gemini +

    +

    Site Reliability Engineering - Part 3: On-Call Culture


    +
    +Published at 2024-01-09T18:35:48+02:00
    +
    +Welcome to Part 3 of my Site Reliability Engineering (SRE) series. I'm currently working as a Site Reliability Engineer, and I’m here to share what SRE is all about in this blog series.
    +
    +2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
    +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance
    +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture (You are currently reading this)
    +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers
    +
    +
    +                    ..--""""----..                 
    +                 .-"   ..--""""--.j-.              
    +              .-"   .-"        .--.""--..          
    +           .-"   .-"       ..--"-. \/    ;         
    +        .-"   .-"_.--..--""  ..--'  "-.  :         
    +      .'    .'  /  `. \..--"" __ _     \ ;         
    +     :.__.-"    \  /        .' ( )"-.   Y          
    +     ;           ;:        ( )     ( ).  \         
    +   .':          /::       :            \  \        
    + .'.-"\._   _.-" ; ;      ( )    .-.  ( )  \       
    +  "    `."""  .j"  :      :      \  ;    ;  \      
    +    bug /"""""/     ;      ( )    "" :.( )   \     
    +       /\    /      :       \         \`.:  _ \    
    +      :  `. /        ;       `( )     (\/ :" \ \   
    +       \   `.        :         "-.(_)_.'   t-'  ;  
    +        \    `.       ;                    ..--":  
    +         `.    `.     :              ..--""     :  
    +           `.    "-.   ;       ..--""           ;  
    +             `.     "-.:_..--""            ..--"   
    +               `.      :             ..--""        
    +                 "-.   :       ..--""              
    +                    "-.;_..--""                    
    +
    +
    +
    +

    Putting Well-being First


    +
    +Site Reliability Engineering is all about keeping systems reliable, but we often forget how important the human side is. A healthy on-call culture is just as crucial as any technical fix. The well-being of the engineers really matters.
    +
    +First off, a healthy on-call rotation is about more than just handling incidents. It's about creating a supportive ecosystem. This means cutting down on pain points, offering mentorship, quickly iterating on processes, and making sure engineers have the right tools. But there's a catch—engineers need to be willing to learn. Especially in on-call rotations where SREs work with Software Engineers or QA Engineers, it can be tough to get everyone motivated. QA Engineers want to test, Software Engineers want to build new features; they don’t want to deal with production issues. This can be really frustrating for the SREs trying to mentor them.
    +
    +Plus, measuring a good on-call experience isn't always clear-cut. You might think fewer pages mean a better on-call setup—and yeah, no one wants to get paged after hours—but it's not just about the number of pages. Trust, ownership, accountability, and solid communication are what really matter.
    +
    +A key part is giving feedback about the on-call experience to keep learning and improving. If alerts are mostly noise, they need to be tweaked or even ditched. If alerts are helpful, can we automate the repetitive tasks? If there are knowledge gaps, is the documentation lacking? Regular retrospectives ensure that the systems get better over time and the on-call experience improves for the engineers.
    +
    +Getting new team members ready for on-call duties is super important for keeping systems reliable and efficient. This means giving them the knowledge, tools, and support they need to handle incidents with confidence. It starts with a rundown of the system architecture and common issues, then training on monitoring tools, alerting systems, and incident response protocols. Watching experienced on-call engineers in action can provide some hands-on learning. Too often, though, new engineers get thrown into the deep end without proper onboarding because the more experienced engineers are too busy dealing with ongoing production issues.
    +
    +A culture where everyone's always on and alert can cause burnout. Engineers need to know their limits, take breaks, and ask for help when they need it. This isn't just about personal health; a burnt-out engineer can drag down the whole team and the systems they manage. A good on-call culture keeps systems running while making sure engineers are happy, healthy, and supported. Experienced engineers should take the time to mentor juniors, but junior engineers should also stay engaged, investigate issues, and learn new things on their own.
    +
    +For junior engineers, it's tempting to always ask the experts for help whenever something goes wrong. While that might seem reasonable, constantly handing out solutions doesn't scale—there are endless ways for production systems to break. So, every engineer needs to learn how to debug, troubleshoot, and resolve incidents on their own. The experts should be there for guidance and can step in when a junior gets really stuck, but they also need to give space for less experienced engineers to grow and learn.
    +
    +A blameless on-call culture is essential for creating a safe and collaborative environment where engineers can handle incidents without worrying about getting blamed. It recognizes that mistakes are just part of learning and innovating. When people know they won’t be punished for errors, they’re more likely to talk openly about what went wrong, which helps the whole team learn and improve. Plus, a blameless culture boosts psychological safety, job satisfaction, and reduces burnout, keeping everyone committed and engaged.
    +
    +Mistakes are gonna happen, which is why having a blameless on-call culture is so important.
    +
    +Continue with the fourth part of this series:
    +
    +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +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 new file mode 100644 index 00000000..f60200f2 --- /dev/null +++ b/gemfeed/2024-01-13-one-reason-why-i-love-openbsd.html @@ -0,0 +1,89 @@ + + + + +One reason why I love OpenBSD + + + + + +

    +Home | Markdown | Gemini +

    +

    One reason why I love OpenBSD


    +
    +Published at 2024-01-13T22:55:33+02:00
    +
    +
    +           FISHKISSFISHKIS               
    +       SFISHKISSFISHKISSFISH            F
    +    ISHK   ISSFISHKISSFISHKISS         FI
    +  SHKISS   FISHKISSFISHKISSFISS       FIS
    +HKISSFISHKISSFISHKISSFISHKISSFISH    KISS
    +  FISHKISSFISHKISSFISHKISSFISHKISS  FISHK
    +      SSFISHKISSFISHKISSFISHKISSFISHKISSF
    +  ISHKISSFISHKISSFISHKISSFISHKISSF  ISHKI
    +SSFISHKISSFISHKISSFISHKISSFISHKIS    SFIS
    +  HKISSFISHKISSFISHKISSFISHKISS       FIS
    +    HKISSFISHKISSFISHKISSFISHK         IS
    +       SFISHKISSFISHKISSFISH            K
    +         ISSFISHKISSFISHK               
    +
    +
    +I just upgraded my OpenBSD's from 7.3 to 7.4 by following the unattended upgrade guide:
    +
    +https://www.openbsd.org/faq/upgrade74.html
    +
    + +
    $ 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:
    +
    + +
    $ 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.
    +
    +I followed the same procedure the previous times and never encountered any difficulties with any OpenBSD upgrades.
    +
    +I have seen upgrades of other Operating Systems either take a long time or break the system (which takes manual steps to repair). That's just one of many reasons why I love OpenBSD! There appear never to be any problems. It just gets its job done!
    +
    +The OpenBSD Project
    +
    +BTW: are you looking for an opinionated OpenBSD VM hoster? OpenBSD Amsterdam may be for you. They rock (I am having a VM there, too)!
    +
    +https://openbsd.amsterdam
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Other *BSD related posts are:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +2024-04-01 KISS high-availability with OpenBSD
    +2024-01-13 One reason why I love OpenBSD (You are currently reading this)
    +2022-10-30 Installing DTail on OpenBSD
    +2022-07-30 Let's Encrypt with OpenBSD and Rex
    +2016-04-09 Jails and ZFS with Puppet on FreeBSD
    +
    +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 new file mode 100644 index 00000000..45d5409c --- /dev/null +++ b/gemfeed/2024-02-04-from-babylon5.buetow.org-to-.cloud.html @@ -0,0 +1,205 @@ + + + + +From `babylon5.buetow.org` to `*.buetow.cloud` + + + + + +

    +Home | Markdown | Gemini +

    +

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


    +
    +Published at 2024-02-04T00:50:50+02:00
    +
    +Recently, my employer sent me to a week-long AWS course. After the course, there wasn't any hands-on project I could dive into immediately, so I moved parts of my personal infrastructure to AWS to level up a bit through practical hands-on.
    +
    +So, I migrated all of my Docker-based self-hosted services to AWS. Usually, I am not a big fan of big cloud providers and instead use smaller hosters or indie providers and self-made solutions. However, I also must go with the times and try out technologies currently hot on the job market. I don't want to become the old man who yells at cloud :D
    +
    +Old man yells at cloud
    +
    +

    Table of Contents


    +
    +
    +

    The old *.buetow.org way


    +
    +Before the migration, all those services were reachable through buetow.org-subdomains (Buetow is my last name) and ran on Docker containers on a single Rocky Linux 9 VM at Hetzner. And there was a Nginx reverse proxy with TLS offloading (with Let's Encrypt certificates). The Rocky Linux 9's hostname was babylon5.buetow.org (based on the Science Fiction series).
    +
    +https://en.wikipedia.org/wiki/Babylon_5
    +
    +The downsides of this setup were:
    +
    +
      +
    • Not highly available. If the server goes down, no service is reachable until it's repaired. To be fair, the Hetzner cloud VM is redundant by itself and would have re-spawned on a different worker node, I suppose.
    • +
    • Manual installation.
    • +

    +About the manual installation part: I could have used a configuration management system like Rexify, Puppet, etc. But I decided against it back in time, as setting up Docker containers isn't so complicated through simple start scripts. And it's only a single Linux box where a manual installation is less painful. However, regular backups (which Hetzner can do automatically for you) were a must.
    +
    +The benefits of this setup were:
    +
    +
      +
    • KISS (Keep it Simple Stupid)
    • +
    • Cheap
    • +

    +

    I kept my buetow.org OpenBSD boxes alive


    +
    +As pointed out, I only migrated the Docker-based self-hosted services (which run on the Babylon 5 Rocky Linux box) to AWS. Many self-hostable apps come with ready-to-use container images, making deploying them easy.
    +
    +My other two OpenBSD VMs (blowfish.buetow.org, hosted at Hetzner, and fishfinger.buetow.org, hosted at OpenBSD Amsterdam) still run (and they will keep running) the following services:
    +
    +
      +
    • HTTP server for my websites (e.g. https://foo.zone, ...)
    • +
    • ACME for Let's Encrypt TLS certificate auto-renewal.
    • +
    • Gemini server for my capsules (e.g. gemini://foo.zone)
    • +
    • Authoritative DNS servers for my domains (but buetow.cloud, which is on Route 53 now)
    • +
    • Mail transfer agent (MTA)
    • +
    • My Gogios monitoring system.
    • +
    • My IRC bouncer.
    • +

    +It is all automated with Rex, aka Rexify. This OpenBSD setup is my "fun" or "for pleasure" setup. Whereas the Rocky Linux 9 one I always considered the "pratical means to the end"-setup to have 3rd party Docker containers up and running with as little work as possible.
    +
    +(R)?ex, the friendly automation framework
    +KISS server monitoring with Gogios
    +Let's encrypt with OpenBSD and Rex
    +
    +

    The new *.buetow.cloud way


    +
    +With AWS, I decided to get myself a new domain name, as I could fully separate my AWS setup from my conventional setup and give Route 53 as an authoritative DNS a spin.
    +
    +I decided to automate everything with Terraform, as I wanted to learn to use it as it appears standard now in the job market.
    +
    +All services are installed automatically to AWS ECS Fargate. ECS is AWS's Elastic Container Service, and Fargate automatically manages the underlying hardware infrastructure (e.g., how many CPUs, RAM, etc.) for me. So I don't have to bother about having enough EC2 instances to serve my demands, for example.
    +
    +The authoritative DNS for the buetow.cloud domain is AWS Route 53. TLS certificates are free here at AWS and offloaded through the AWS Application Load Balancer. The LB acts as a proxy to the ECS container instances of the services. A few services I run in ECS Fargate also require the AWS Network Load Balancer.
    +
    +All services require some persistent storage. For that, I use an encrypted EFS file system, automatically replicated across all AZs (availability zones) of my region of choice, eu-central-1.
    +
    +In case of an AZ outage, I could re-deploy all the failed containers in another AZ, and all the data would still be there.
    +
    +The EFS automatically gets backed up by AWS for me following their standard Backup schedule. The daily backups are kept for 30 days.
    +
    +Domain registration, TLS certificate configuration and configuration of the EFS backup were quickly done through the AWS web interface. These were only one-off tasks, so they weren't fully automated through Terraform.
    +
    +You can find all Terraform manifests here:
    +
    +https://codeberg.org/snonux/terraform
    +
    +Whereas:
    +
    +
      +
    • org-buetow-base sets up the bare VPC (IPv4 and IPv6 subnets in 3 AZs, EFS, ECR (the AWS container registry for some self-built containers) and Route 53 zone. It's the requirement for most other Terraform manifests in this repository.
    • +
    • org-buetow-bastion sets up a minimal Amazon Linux EC2 instance where I can manually SSH into and look at the EFS file system (if required).
    • +
    • org-buetow-elb sets up the Elastic Load Balancer, a prerequisite for any service running in ECS Fargate.
    • +
    • org-buetow-ecs finally sets up and deploys all the Docker apps mentioned above. Any apps can be turned on or off via the variables.tf file.
    • +

    +

    The container apps


    +
    +And here, finally, is the list of all the container apps my Terraform manifests deploy. The FQDNs here may not be reachable. I spin them up only on demand (for cost reasons). All services are fully dual-stacked (IPv4 & IPv6).
    +
    +

    flux.buetow.cloud


    +
    +Miniflux is a minimalist and opinionated feed reader. With the move to AWS, I also retired my bloated instance of NextCloud. So, with Miniflux, I retired from NextCloud News.
    +
    +Miniflux requires two ECS containers. One is the Miniflux app, and the other is the PostgreSQL DB.
    +
    +https://miniflux.app/
    +
    +
    +

    audiobookshelf.buetow.cloud


    +
    +Audiobookshelf was the first Docker app I installed. It is a Self-hosted audiobook and podcast server. It comes with a neat web interface, and there is also an Android app available, which works also in offline mode. This is great, as I only have the ECS instance sometimes running for cost savings.
    +
    +With Audiobookshelf, I replaced my former Audible subscription and my separate Podcast app. For Podcast synchronisation I used to use the Gpodder NextCloud sync app. But that one I retired now with Audiobookshelf as well :-)
    +
    +https://www.audiobookshelf.org
    +
    +

    syncthing.buetow.cloud


    +
    +Syncthing is a continuous file synchronisation program. In real-time, it synchronises files between two or more computers, safely protected from prying eyes. Your data is your own, and you deserve to choose where it is stored, whether it is shared with some third party, and how it's transmitted over the internet.
    +
    +With Syncthing, I retired my old NextCloud Files and file sync client on all my devices. I also quit my NextCloud Notes setup. All my Notes are now plain Markdown files in a Notes directory. On Android, I can edit them with any text or Markdown editor (e.g. Obsidian), and they will be synchronised via Syncthing to my other computers, both forward and back.
    +
    +I use Syncthing to synchronise some of my Phone's data (e.g. Notes, Pictures and other documents). Initially, I synced all of my pictures, videos, etc., with AWS. But that was pretty expensive. So for now, I use it only whilst travelling. Otherwise, I will use my Syncthing instance here on my LAN (I have a cheap cloud backup in AWS S3 Glacier Deep Archive, but that's for another blog post).
    +
    +https://syncthing.net/
    +
    +

    radicale.buetow.cloud


    +
    +Radicale is an excellent minimalist WebDAV calendar and contact synchronisation server. It was good enough to replace my NextCloud Calendar and NextCloud Contacts setup. Unfortunately, there wasn't a ready-to-use Docker image. So, I created my own.
    +
    +On Android, it works great together with the DAVx5 client for synchronisation.
    +
    +https://radicale.org/
    +https://codeberg.org/snonux/docker-radicale-server
    +https://www.davx5.com/
    +
    +

    bag.buetow.cloud


    +
    +Wallabag is a self-hostable "save now - read later" service, and it also comes with an Android app which also has an offline mode. Think of Getpocket, but open-source!
    +
    +https://wallabag.org/
    +https://github.com/wallabag/wallabag
    +
    +

    anki.buetow.cloud


    +
    +Anki is a great (the greatest) flash-card learning program. I am currently learning Bulgarian as my 3rd language. There is also an Android app that has an offline mode, and advanced users can also self-host the server anki-sync-server. For some reason (not going into the details here), I had to build my own Docker image for the server.
    +
    +https://apps.ankiweb.net/
    +https://codeberg.org/snonux/docker-anki-sync-server
    +
    +

    vault.buetow.cloud


    +
    +Vaultwarden is an alternative implementation of the Bitwarden server API written in Rust and compatible with upstream Bitwarden clients, perfect for self-hosted deployment where running the official resource-heavy service might not be ideal. So, this is a great password manager server which can be used with any Bitwarden Android app.
    +
    +I currently don't use it, but I may in the future. I made it available in my ECS Fargate setup anyway for now.
    +
    +https://github.com/dani-garcia/vaultwarden
    +
    +I currently use geheim, a Ruby command line tool I wrote, as my current password manager. You can read a little bit about it here under "More":
    +
    +Sweating the small stuff
    +
    +

    bastion.buetow.cloud


    +
    +This is a tiny ARM-based Amazon Linux EC2 instance, which I sometimes spin up for investigation or manual work on my EFS file system in AWS.
    +
    +

    Conclusion


    +
    +I have learned a lot about AWS and Terraform during this migration. This was actually my first AWS hands-on project with practical use.
    +
    +All of this was not particularly difficult (but at times a bit confusing). I see the use of Terraform managing more extensive infrastructures (it was even helpful for my small setup here). At least I know now what all the buzz is about :-). I don't think Terraform's HCL is a nice language. It get's it's job done, but it could be more elegant IMHO.
    +
    +Deploying updates to AWS are much easier, and some of the manual maintenance burdens of my Rocky Linux 9 VM are no longer needed. So I will have more time for other projects!
    +
    +Will I keep it in the cloud? I don't know yet. But maybe I won't renew the buetow.cloud domain and instead will use *.cloud.buetow.org or *.aws.buetow.org subdomains.
    +
    +Will the AWS setup be cheaper than my old Rocky Linux setup? It might be more affordable as I only turn ECS and the load balancers on or off on-demand. Time will tell! The first forecasts suggest that it will be around the same costs.
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +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 new file mode 100644 index 00000000..b48aa9ee --- /dev/null +++ b/gemfeed/2024-03-03-a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang.html @@ -0,0 +1,80 @@ + + + + +A fine Fyne Android app for quickly logging ideas programmed in Go + + + + + +

    +Home | Markdown | Gemini +

    +

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


    +
    +Published at 2024-03-03T00:07:21+02:00
    +
    +I am an ideas person. I find myself frequently somewhere on the streets with an idea in my head but no paper journal noting it down.
    +
    +I have tried many note apps for my Android (I use GrapheneOS) phone. Most of them either don't do what I want, are proprietary software, require Google Play services (I have the main profile on my phone de-googled) or are too bloated. I was never into mobile app development, as I'm not too fond of the complexity of the developer toolchains. I don't want to use Android Studio (as a NeoVim user), and I don't want to use Java or Kotlin. I want to use a language I know (and like) for mobile app development. Go would be one of those languages.
    +
    +Quick logger Logo
    +
    +

    Table of Contents


    +
    +
    +

    Enter Quick logger


    +
    +Enter Quick logger – a compact GUI Android (well, cross-platform due to Fyne) app I've crafted using Go and the nifty Fyne framework. With Fyne, the app can be compiled easily into an Android APK. As of this writing, this app's whole Go source code is only 75 lines short!! This little tool is designed for spontaneous moments, allowing me to quickly log my thoughts as plain text files on my Android phone. There are no fancy file formats. Just plain text!
    +
    +https://codeberg.org/snonux/quicklogger
    +https://fyne.io
    +https://go.dev
    +
    +There's no need to navigate complex menus or deal with sync issues. I jot down my Idea, and Quick logger saves it to a plain text file in a designated local folder on my phone. There is one text file per note (timestamp in the file name). Once logged, the file can't be edited anymore (it keeps it simple). If I want to correct or change a note, I simply write a new one. My notes are always small (usually one short sentence each), so there isn't the need for an edit functionality. I can edit them later on my actual computer if I want to.
    +
    +With Syncthing, the note files are then synchronised to my home computer to my ~/Notes directory. From there, a small glue Raku script adds them to my Taskwarrior DB so that I can process them later (e.g. take action on that one Idea I had). That then will delete the original note files from my computer and also (through Syncthing) from my phone.
    +
    +https://syncthing.net
    +https://raku.org
    +https://taskwarrior.org
    +
    +Quick logger's user interface is as minimal as it gets. When I launch Quick logger, I'm greeted with a simple window where I can type plain text. Hit the "Log text" button, and voilà – the input is timestamped and saved as a file in my chosen directory. If I need to change the directory, the "Preferences" button brings up a window where I can set the notes folder and get back to logging.
    +
    +For the code-savvy folks out there, Quick logger is a neat example of what you can achieve with Go and Fyne. It's a testament to building functional, cross-platform apps without getting bogged down in the nitty-gritty of platform-specific details. Thanks to Fyne, I am pleased with how easy it is to make mobile Android apps in Go.
    +
    +Quick logger running on Android
    +
    +My Android apps will never be polished, but they will get the job done, and this is precisely how I want them to be. Minimalistic but functional. I could spend more time polishing Quick logger, but my Quick logger app then may be the same as any other notes app out there (complicated or bloated).
    +
    +

    All easy-peasy?


    +
    +I did have some issues with the app logo for Android, though. Android always showed the default app icon and not my custom icon whenever I used a custom AndroidManifest.xml for custom app storage permissions. Without a custom AndroidAmnifest.xml the app icon would be displayed under Android, but then the app would not have the MANAGE_EXTERNAL_STORAGE permission, which is required for Quick logger to write to a custom directory. I found a workaround, which I commented on here at Github:
    +
    +https://github.com/fyne-io/fyne/issues/3077#issuecomment-1912697360
    +
    +What worked however (app icon showing up) was to clone the fyne project, change the occurances of android.permission.INTERNET to android.permission.MANAGE_EXTERNAL_STORAGE (as these are all the changes I want in my custom android manifest) in the source tree, re-compile fyne. Now all works. I know, this is more of an hammer approach!
    +
    +Hopefully, I won't need to use this workaround anymore. But for now, it is a fair tradeoff for what I am getting.
    +
    +I hope this will inspire you to write your own small mobile apps in Go using the awesome Fyne framework! PS: The Quick logger logo was generated by ChatGPT.
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Other Go related posts are:
    +
    +2024-03-03 A fine Fyne Android app for quickly logging ideas programmed in Go (You are currently reading this)
    +
    +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 new file mode 100644 index 00000000..e2a81eeb --- /dev/null +++ b/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html @@ -0,0 +1,352 @@ + + + + +KISS high-availability with OpenBSD + + + + + +

    +Home | Markdown | Gemini +

    +

    KISS high-availability with OpenBSD


    +
    +Published at 2024-03-30T22:12:56+02:00
    +
    +I have always wanted a highly available setup for my personal websites. I could have used off-the-shelf hosting solutions or hosted my sites in an AWS S3 bucket. I have used technologies like (in unsorted and slightly unrelated order) BGP, LVS/IPVS, ldirectord, Pacemaker, STONITH, scripted VIP failover via ARP, heartbeat, heartbeat2, Corosync, keepalived, DRBD, and commercial F5 Load Balancers for high availability at work.
    +
    +But still, my personal sites were never highly available. All those technologies are great for professional use, but I was looking for something much more straightforward for my personal space - something as KISS (keep it simple and stupid) as possible.
    +
    +It would be fine if my personal website wasn't highly available, but the geek in me wants it anyway.
    +
    +PS: ASCII-art below reflects an OpenBSD under-water world with all the tools available in the base system.
    +
    +
    +Art by Michael J. Penick (mod. by Paul B.)
    +                                               ACME-sky
    +        __________
    +       / nsd tower\                                             (
    +      /____________\                                           (\) awk-ward
    +       |:_:_:_:_:_|                                             ))   plant
    +       |_:_,--.:_:|                       dig-bubble         (\//   )
    +       |:_:|__|_:_|  relayd-castle          _               ) ))   ((
    +    _  |_   _  :_:|   _   _   _            (_)             ((((   /)\`
    +   | |_| |_| |   _|  | |_| |_| |             o              \\)) (( (
    +    \_:_:_:_:/|_|_|_|\:_:_:_:_/             .                ((   ))))
    +     |_,-._:_:_:_:_:_:_:_.-,_|                                )) ((//
    +     |:|_|:_:_:,---,:_:_:|_|:|                               ,-.  )/
    +     |_:_:_:_,'puffy `,_:_:_:_|           _  o               ,;'))((
    +     |:_:_:_/  _ | _  \_:_:_:|          (_O                   ((  ))
    +_____|_:_:_|  (o)-(o)  |_:_:_|--'`-.     ,--. ksh under-water (((\'/
    + ', ;|:_:_:| -( .-. )- |:_:_:| ', ; `--._\  /,---.~  goat     \`))
    +.  ` |_:_:_|   \`-'/   |_:_:_|.  ` .  `  /()\.__( ) .,-----'`-\(( sed-root
    + ', ;|:_:_:|    `-'    |:_:_:| ', ; ', ; `--'|   \ ', ; ', ; ',')).,--
    +.  ` MJP ` .  ` .  ` .  ` . httpd-soil ` .    .  ` .  ` .  ` .  ` .  `
    + ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ;
    +
    +
    +
    +

    Table of Contents


    +
    +
    +

    My auto-failover requirements


    +
    +
      +
    • Be OpenBSD-based (I prefer OpenBSD because of the cleanliness and good documentation) and rely on as few external packages as possible.
    • +
    • Don't rely on the hottest and newest tech (don't want to migrate everything to a new and fancier technology next month already!).
    • +
    • It should be reasonably cheap. I want to avoid paying a premium for floating IPs or fancy Elastic Load Balancers.
    • +
    • It should be geo-redundant.
    • +
    • It's fine if my sites aren't reachable for five or ten minutes every other month. Due to their static nature, I don't care if there's a split-brain scenario where some requests reach one server and other requests reach another server.
    • +
    • Failover should work for both HTTP/HTTPS and Gemini protocols. My self-hosted MTAs and DNS servers should also be highly available.
    • +
    • Let's Encrypt TLS certificates should always work (before and after a failover).
    • +
    • Have good monitoring in place so I know when a failover was performed and when something went wrong with the failover.
    • +
    • Don't configure everything manually. The configuration should be automated and reproducible.
    • +

    +

    My HA solution


    +
    +

    Only OpenBSD base installation required


    +
    +My HA solution for Web and Gemini is based on DNS (OpenBSD's nsd) and a simple shell script (OpenBSD's ksh and some little sed and awk and grep). All software used here is part of the OpenBSD base system and no external package needs to be installed - OpenBSD is a complete operating system.
    +
    +https://man.OpenBSD.org/nsd.8
    +https://man.OpenBSD.org/ksh
    +https://man.OpenBSD.org/awk
    +https://man.OpenBSD.org/sed
    +https://man.OpenBSD.org/dig
    +https://man.OpenBSD.org/ftp
    +https://man.OpenBSD.org/cron
    +
    +I also used the dig (for DNS checks) and ftp (for HTTP/HTTPS checks) programs.
    +
    +The DNS failover is performed automatically between the two OpenBSD VMs involved (my setup doesn't require any quorum for a failover, so there isn't a need for a 3rd VM). The ksh script, executed once per minute via CRON (on both VMs), performs a health check to determine whether the current master node is available. If the current master isn't available (no HTTP response as expected), a failover is performed to the standby VM:
    +
    + +
    #!/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:
    +
    + +
    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/;
    +	}
    +  '
    +}
    +
    +
    +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:
    +
    + +
    #! 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.
    +
    +The authorative nameserver for my domains runs on both VMs, and both are configured to be a "master" DNS server so that they have their own individual zone files, which can be changed independently. Otherwise, my setup wouldn't work. The side effect is that under a split-brain scenario (both VMs cannot see each other), both would promote themselves to master via their local DNS entries. More about that later, but that's fine in my use case.
    +
    +Check out the whole script here:
    +
    +dns-failover.ksh
    +
    +

    Fairly cheap and geo-redundant


    +
    +I am renting two small OpenBSD VMs: One at OpenBSD Amsterdam and the other at Hetzner Cloud. So, both VMs are hosted at another provider, in different IP subnets, and in different countries (the Netherlands and Germany).
    +
    +https://OpenBSD.Amsterdam
    +https://www.Hetzner.cloud
    +
    +I only have a little traffic on my sites. I could always upload the static content to AWS S3 if I suddenly had to. But this will never be required.
    +
    +A DNS-based failover is cheap, as there isn't any BGP or fancy load balancer to pay for. Small VMs also cost less than millions.
    +
    +

    Failover time and split-brain


    +
    +A DNS failover doesn't happen immediately. I've configured a DNS TTL of 300 seconds, and the failover script checks once per minute whether to perform a failover or not. So, in total, a failover can take six minutes (not including other DNS caching servers somewhere in the interweb, but that's fine - eventually, all requests will resolve to the new master after a failover).
    +
    +A split-brain scenario between the old master and the new master might happen. That's OK, as my sites are static, and there's no database to synchronise other than HTML, CSS, and images when the site is updated.
    +
    +

    Failover support for multiple protocols


    +
    +With the DNS failover, HTTP, HTTPS, and Gemini protocols are failovered. This works because all domain virtual hosts are configured on either VM's httpd (OpenBSD's HTTP server) and relayd (it's also part of OpenBSD and I use it to TLS offload the Gemini protocol). So, both VMs accept requests for all the hosts. It's just a matter of the DNS entries, which VM receives the requests.
    +
    +https://man.OpenBSD.org/httpd.8
    +https://man.OpenBSD.org/relayd.8
    +
    +For example, the master is responsible for the https://www.foo.zone and https://foo.zone hosts, whereas the standby can be reached via https://standby.foo.zone (port 80 for plain HTTP works as well). The same principle is followed with all the other hosts, e.g. irregular.ninja, paul.buetow.org and so on. The same applies to my Gemini capsules for gemini://foo.zone, gemini://standby.foo.zone, gemini://paul.buetow.org and gemini://standby.paul.buetow.org.
    +
    +On DNS failover, master and standby swap roles without config changes other than the DNS entries. That's KISS (keep it simple and stupid)!
    +
    +

    Let's encrypt TLS certificates


    +
    +All my hosts use TLS certificates from Let's Encrypt. The ACME automation for requesting and keeping the certificates valid (up to date) requires that the host requesting a certificate from Let's Encrypt is also the host using that certificate.
    +
    +If the master always serves foo.zone and the standby always standby.foo.zone, then there would be a problem after the failover, as the new master wouldn't have a valid certificate for foo.zone and the new standby wouldn't have a valid certificate for standby.foo.zone which would lead to TLS errors on the clients.
    +
    +As a solution, the CRON job responsible for the DNS failover also checks for the current week number of the year so that:
    +
    +
      +
    • In an odd week number, the first server is the default master
    • +
    • In an even week number, the second server is the default master.
    • +

    +Which translates to:
    +
    + +
    # 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.
    +
    +The ACME automation is yet another daily CRON script /usr/local/bin/acme.sh. It iterates over all of my Let's Encrypt hosts, checks whether they resolve to the same IP address as the current VM, and only then invokes the ACME client to request or renew the TLS certificates. So, there are always correct requests made to Let's Encrypt.
    +
    +Let's encrypt certificates usually expire after 3 months, so a weekly failover of my VMs is plenty.
    +
    +acme.sh.tpl - Rex template for the acme.sh script of mine.
    +https://man.OpenBSD.org/acme-client.1
    +Let's Encrypt with OpenBSD and Rex
    +
    +

    Monitoring


    +
    +CRON is sending me an E-Mail whenever a failover is performed (or whenever a failover failed). Furthermore, I am monitoring my DNS servers and hosts through Gogios, the monitoring system I have developed.
    +
    +https://codeberg.org/snonux/gogios
    +KISS server monitoring with Gogios
    +
    +Gogios, as I developed it by myself, isn't part of the OpenBSD base system.
    +
    +

    Rex automation


    +
    +I use Rexify, a friendly configuration management system that allows automatic deployment and configuration.
    +
    +https://www.rexify.org
    +codeberg.org/snonux/rexfiles/frontends
    +
    +Rex isn't part of the OpenBSD base system, but I didn't need to install any external software on OpenBSD either as Rex is invoked from my Laptop!
    +
    +

    More HA


    +
    +Other high-available services running on my OpenBSD VMs are my MTAs for mail forwarding (OpenSMTPD - also part of the OpenBSD base system) and the authoritative DNS servers (nsd) for all my domains. No particular HA setup is required, though, as the protocols (SMTP and DNS) already take care of the failover to the next available host!
    +
    +https://www.OpenSMTPD.org/
    +
    +As a password manager, I use geheim, a command-line tool I wrote in Ruby with encrypted files in a git repository (I even have it installed in Termux on my Phone). For HA reasons, I simply updated the client code so that it always synchronises the database with both servers when I run the sync command there.
    +
    +https://codeberg.org/snonux/geheim
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Other *BSD and KISS related posts are:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +2024-04-01 KISS high-availability with OpenBSD (You are currently reading this)
    +2024-01-13 One reason why I love OpenBSD
    +2023-10-29 KISS static web photo albums with photoalbum.sh
    +2023-06-01 KISS server monitoring with Gogios
    +2022-10-30 Installing DTail on OpenBSD
    +2022-07-30 Let's Encrypt with OpenBSD and Rex
    +2016-04-09 Jails and ZFS with Puppet on FreeBSD
    +
    +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 new file mode 100644 index 00000000..032fdb19 --- /dev/null +++ b/gemfeed/2024-05-01-slow-productivity-book-notes.html @@ -0,0 +1,176 @@ + + + + +'Slow Productivity' book notes + + + + + +

    +Home | Markdown | Gemini +

    +

    "Slow Productivity" book notes


    +
    +Published at 2024-04-27T14:18:51+03:00
    +
    +These are my personal takeaways after reading "Slow Productivity - The lost Art of Accomplishment Without Burnout" by Cal Newport.
    +
    +The case studies in this book were a bit long, but they appeared to be well-researched. I will only highlight the interesting, actionable items in the book notes.
    +
    +These notes are mainly for my own use, but you may find them helpful.
    +
    +
    +         ,..........   ..........,
    +     ,..,'          '.'          ',..,
    +    ,' ,'            :            ', ',
    +   ,' ,'             :             ', ',
    +  ,' ,'              :              ', ',
    + ,' ,'............., : ,.............', ',
    +,'  '............   '.'   ............'  ',
    + '''''''''''''''''';''';''''''''''''''''''
    +                    '''
    +
    +
    +

    Table of Contents


    +
    +
    +

    It's not "slow productivity"


    +
    +"Slow productivity" does not mean being less productive. Cal Newport wants to point out that you can be much more productive with "slow productivity" than you would be without it. It is a different way of working than most of us are used to in the modern workplace, which is hyper-connected and always online.
    +
    +

    Pseudo-productivity and Shallow work


    +
    +People use visible activity instead of real productivity because it's easier to measure. This is called pseudo-productivity.
    +Pseudo-productivity is used as a proxy for real productivity. If you don't look busy, you are dismissed as lazy or lacking a work ethic.
    +
    +There is a tendency to perform shallow work because people will otherwise dismiss you as lazy. A lot of shallow work can cause burnout, as multiple things are often being worked on in parallel. The more you have on your plate, the more stressed you will be.
    +
    +Shallow work usually doesn't help you to accomplish big things. Always have the big picture in mind. Shallow work can't be entirely eliminated, but it can be managed—for example, plan dedicated time slots for certain types of shallow work.
    +
    +

    Accomplishments without burnout


    +
    +The overall perception is that if you want to accomplish something, you must put yourself on the verge of burnout. Cal Newport writes about "The lost Art of Accomplishments without Burnouts", where you can accomplish big things without all the stress usually involved.
    +
    +There are three principles for the maintenance of a sustainable work life:
    +
    +
      +
    • Do fewer things
    • +
    • Work at a natural pace
    • +
    • Obsess over quality
    • +

    +

    Do fewer things


    +
    +There will always be more work. The faster you finish it, the quicker you will have something new on your plate.
    +
    +Reduce the overhead tax. The overhead tax is all the administrative work to be done. With every additional project, there will also be more administrative stuff to be done on your work plate. So, doing fewer things leads to more and better output and better quality for the projects you are working on.
    +
    +Limit the things on your plate. Limit your missions (personal goals, professional goals). Reduce your main objectives in life. More than five missions are usually not sustainable very easily, so you have to really prioritise what is important to you and your professional life.
    +
    +A mission is an overall objective/goal that can have multiple projects. Limit the projects as well. Some projects need clear endings (e.g., work in support of a never-ending flow of incoming requests). In this case, set limits (e.g., time box your support hours). You can also plan "office hours" for collaborative work with colleagues to avoid ad hoc distractions.
    +
    +The key point is that after making these commitments, you really deliver on them. This builds trust, and people will leave you alone and not ask for progress all the time.
    +
    +Doing fever things is essential for modern knowledge workers. Breathing space in your work also makes you more creative and happier overall.
    +
    +Pushing workers more work can make them less productive, so the better approach is the pull model, where workers pull in new work when the previous task is finished.
    +
    +If you can quantify how busy you are or how many other projects you already work on, then it is easier to say no to new things. For example, show what you are doing, what's in the roadmap, etc. Transparency is the key here.
    +
    +You can have your own simulated pull system if the company doesn't agree to a global one:
    +
    +
      +
    • State which additional information you would need.
    • +
    • Create a rough estimate of when you will be able to work on it
    • +
    • Estimate how long the project would take. Double that estimate, as humans are very bad estimators.
    • +
    • Respond to the requester and state that you will let him know when the estimates change.
    • +

    +Sometimes, a little friction is all that is needed to combat incoming work, e.g., when your manager starts seeing the reality of your work plate, and you also request additional information for the task. If you already have too much on your plate, then decline the new project or make room for it in your calendar. If you present a large task list, others will struggle to assign more to you.
    +
    +Limit your daily goals. A good measure is to focus on one goal per day. You can time block time for deep work on your daily goal. During that time, you won't be easily available to others.
    +
    +The battle against distractions must be fought to be the master of your time. Nobody will fight this war for you. You have to do it for yourself. (Also, have a look at Cal Newport's "time block planning" method).
    +
    +Put tasks on autopilot (regular recurring tasks).
    +
    +

    Work at a natural pace


    +
    +We suffer from overambitious timelines, task lists, and business. Focus on what matters. Don't rush your most important work to achieve better results.
    +
    +Don't rush. If you rush or are under pressure, you will be less effective and eventually burn out. Our brains work better then not rushy. The stress heuristic usually indicates too much work, and it is generally too late to reduce workload. That's why we all typically have dangerously too much to do.
    +
    +Have the courage to take longer to do things that are important. For example, plan on a yearly and larger scale, like 2 to 5 years.
    +
    +Find a reasonable time for a project and then double the project timeline against overconfident optimism. Humans are not great at estimating. They gravitate towards best-case estimates. If you have planned more than enough time for your project, then you will fall into a natural work pace. Otherwise, you will struggle with rushing and stress.
    +
    +Some days will still be intense and stressful, but those are exceptional cases. After those exceptions (e.g., finalizing that thing, etc.), calmer periods will follow again.
    +
    +Pace yourself over modest results over time. Simplify and reduce the daily task lists. Meetings: Certain hours are protected for work. For each meeting, add a protected block to your calendar, so you attend meetings only half a day max.
    +
    +Schedule slow seasons (e.g., when on vacation). Disconnect in the slow season. Doing nothing will not satisfy your mind, though. You could read a book on your subject matter to counteract that.
    +
    +

    Obsess over quality


    +
    +Obsess over quality even if you lose short-term opportunities by rejecting other projects. Quality demands you slow down. The two previous two principles (do fewer things and work at a natural pace) are mandatory for this principle to work:
    +
    +
      +
    • Focus on the core activities of your work for your obsession - you will only have the time to obsess over some things.
    • +
    • Deliver solid work with good quality.
    • +
    • Sharpen the focus to do the best work possible.
    • +

    +Go pro to save time, and don't squeeze everything out that you can from freemium services. Professional software services eliminate administrative work:
    +
    +
      +
    • Pay people who know what they are doing and focus on your stuff.
    • +
    • For example, don't repair that car if you know the mechanic can do that much better than you.
    • +
    • Or don't use the free version of the music streaming service if it interrupts you with commercials, hindering your ability to concentrate on your work.
    • +
    • Hire an accountant for your yearly tax returns. He knows much more about that stuff than you do. And in the end, he will even be cheaper as he knows all the tax laws.
    • +
    • ...
    • +

    +Adjust your workplace to what you want to accomplish. You could have dedicated places in your home for different things, e.g., a place where you read and think (armchair) and a place where you collaborate (your desk or whiteboard). Surround yourself with things that inspire you (e.g., your favourite books on your shelf next to you, etc.).
    +
    +There is the concept of quiet quitting. It doesn't mean quitting your job, but it means that you don't go beyond and above the expectations people have of you. Quiet quitting became popular with modern work, which is often meaningless and full of shallow tasks. If you obsess over quality, you enjoy your craft and want to go beyond and above.
    +
    +Implement rituals and routines which shift you towards your goals:
    +
    +
      +
    • For example, if you want to be a good Software Engineer, you also have to put in the work regularly. For instance, progress a bit every day in your project at hand, even if it is only one hour daily. Also, a little quality daily work will be more satisfying over time than many shallow tasks.
    • +
    • Do you want to be lean and/or healthy? Schedule your daily walks and workouts. They will become habits over time.
    • +
    • There's the compounding effect where every small effort made every day will yield significant results in the long run
    • +

    +Deciding what not to do is as important as deciding what to do.
    +
    +It appears to be money thrown out of the window, but you get a $50 expensive paper notebook (and also a good pen). Unconsciously, it will make you take notes more seriously. You will think about what to put into the notebooks more profoundly and have thought through the ideas more intensively. If you used very cheap notebooks, you would scribble a lot of rubbish and wouldn't even recognise your handwriting after a while anymore. So choosing a high-quality notebook will help you to take higher-quality notes, too.
    +
    +Slow productivity is actionable and can be applied immediately.
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Other book notes of mine are:
    +
    +2024-10-24 "Staff Engineer" book notes
    +2024-07-07 "The Stoic Challenge" book notes
    +2024-05-01 "Slow Productivity" book notes (You are currently reading this)
    +2023-11-11 "Mind Management" book notes
    +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2023-05-06 "The Obstacle is the Way" book notes
    +2023-04-01 "Never split the difference" book notes
    +2023-03-16 "The Pragmatic Programmer" book notes
    +
    +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 new file mode 100644 index 00000000..b587a791 --- /dev/null +++ b/gemfeed/2024-05-03-projects-i-currently-dont-have-time-for.html @@ -0,0 +1,335 @@ + + + + +Projects I currently don't have time for + + + + + +

    +Home | Markdown | Gemini +

    +

    Projects I currently don't have time for


    +
    +Published at 2024-05-03T16:23:03+03:00
    +
    +Over the years, I have collected many ideas for my personal projects and noted them down. I am currently in the process of cleaning up all my notes and reviewing those ideas. I don’t have time for the ones listed here and won’t have any soon due to other commitments and personal projects. So, in order to "get rid of them" from my notes folder, I decided to simply put them in this blog post so that those ideas don't get lost. Maybe I will pick up one or another idea someday in the future, but for now, they are all put on ice in favor of other personal projects or family time.
    +
    +
    +Art by Laura Brown
    +
    +.'`~~~~~~~~~~~`'.
    +(  .'11 12 1'.  )
    +|  :10 \    2:  |
    +|  :9   @-> 3:  |
    +|  :8       4;  |
    +'. '..7 6 5..' .'
    + ~-------------~  ldb
    +
    +
    +
    +

    Table of Contents


    +
    +
    +

    Hardware projects I don't have time for


    +
    +

    I use Arch, btw!


    +
    +The idea was to build the ultimate Arch Linux setup on an old ThinkPad X200 booting with the open-source LibreBoot firmware, complete with a tiling window manager, dmenu, and all the elite tools. This is mainly for fun, as I am pretty happy (and productive) with my Fedora Linux setup. I ran EndeavourOS (close enough to Arch) on an old ThinkPad for a while, but then I switched back to Fedora because the rolling releases were annoying (there were too many updates).
    +
    +

    OpenBSD home router


    +
    +In my student days, I operated a 486DX PC with OpenBSD as my home DSL internet router. I bought the setup from my brother back then. The router's hostname was fishbone, and it performed very well until it became too slow for larger broadband bandwidth after a few years of use.
    +
    +I had the idea to revive this concept, implement fishbone2, and place it in front of my proprietary ISP router to add an extra layer of security and control in my home LAN. It would serve as the default gateway for all of my devices, including a Wi-Fi access point, would run a DNS server, Pi-hole proxy, VPN client, and DynDNS client. I would also implement high availability using OpenBSD's CARP protocol.
    +
    +https://openbsdrouterguide.net
    +https://pi-hole.net/
    +https://www.OpenBSD.org
    +https://www.OpenBSD.org/faq/pf/carp.html
    +
    +However, I am putting this on hold as I have opted for an OpenWRT-based solution, which was much quicker to set up and runs well enough.
    +
    +https://OpenWRT.org/
    +
    +

    Pi-Hole server


    +
    +Install Pi-hole on one of my Pis or run it in a container on Freekat. For now, I am putting this on hold as the primary use for this would be ad-blocking, and I am avoiding surfing ad-heavy sites anyway. So there's no significant use for me personally at the moment.
    +
    +https://pi-hole.net/
    +
    +

    Infodash


    +
    +The idea was to implement my smart info screen using purely open-source software. It would display information such as the health status of my personal infrastructure, my current work tracker balance (I track how much I work to prevent overworking), and my sports balance (I track my workouts to stay within my quotas for general health). The information would be displayed on a small screen in my home office, on my Pine watch, or remotely from any terminal window.
    +
    +I don't have this, and I haven't missed having it, so I guess it would have been nice to have it but not provide any value other than the "fun of tinkering."
    +
    +

    Reading station


    +
    +I wanted to create the most comfortable setup possible for reading digital notes, articles, and books. This would include a comfy armchair, a silent barebone PC or Raspberry Pi computer running either Linux or *BSD, and an e-Ink display mounted on a flexible arm/stand. There would also be a small table for my paper journal for occasional note-taking. There are a bunch of open-source software available for PDF and ePub reading. It would have been neat, but I am currently using the most straightforward solution: a Kobo Elipsa 2E, which I can use on my sofa.
    +
    +

    Retro station


    +
    +I had an idea to build a computer infused with retro elements. It wouldn't use actual retro hardware but would look and feel like a retro machine. I would call this machine HAL or Retron.
    +
    +I would use an old ThinkPad laptop placed on a horizontal stand, running NetBSD, and attaching a keyboard from ModelFkeyboards. I use WindowMaker as a window manager and run terminal applications through Retro Term. For the monitor, I would use an older (black) EIZO model with large bezels.
    +
    +https://www.NetBSD.org
    +https://www.modelfkeyboards.com
    +https://github.com/Swordfish90/cool-retro-term)
    +
    +The computer would occasionally be used to surf the Gemini space, take notes, blog, or do light coding. However, I have abandoned the project for now because there isn't enough space in my apartment, as my daughter will have a room for herself.
    +
    +

    Sound server


    +
    +My idea involved using a barebone mini PC running FreeBSD with the Navidrome sound server software. I could remotely connect to it from my phone, workstation/laptop to listen to my music collection. The storage would be based on ZFS with at least two drives for redundancy. The app would run in a Linux Docker container under FreeBSD via Bhyve.
    +
    +https://github.com/navidrome/navidrome
    +https://wiki.freebsd.org/bhyve
    +
    +

    Project Freekat


    +
    +My idea involved purchasing the Meerkat mini PC from System76 and installing FreeBSD. Like the sound-server idea (see previous idea), it would run Linux Docker through Bhyve. I would self-host a bunch of applications on it:
    +
    +
      +
    • Wallabag
    • +
    • Ankidroid
    • +
    • Miniflux & Postgres
    • +
    • Audiobookshelf
    • +
    • ...
    • +

    +All of this would be within my LAN, but the services would also be accessible from the internet through either Wireguard or SSH reverse tunnels to one of my OpenBSD VMs, for example:
    +
    +
      +
    • wallabag.awesome.buetow.org
    • +
    • ankidroid.awesome.buetow.org
    • +
    • miniflux.awesome.buetow.org
    • +
    • audiobookshelf.awesome.buetow.org
    • +
    • ...
    • +

    +I am abandoning this project for now, as I am currently hosting my apps on AWS ECS Fargate under *.cool.buetow.org, which is "good enough" for the time being and also offers the benefit of learning to use AWS and Terraform, knowledge that can be applied at work.
    +
    +My personal AWS setup
    +
    +

    Programming projects I don't have time for


    +
    +

    CLI-HIVE


    +
    +This was a pet project idea that my brother and I had. The concept was to collect all shell history of all servers at work in a central place, apply ML/AI, and return suggestions for commands to type or allow a fuzzy search on all the commands in the history. The recommendations for the commands on a server could be context-based (e.g., past occurrences on the same server type).
    +
    +You could decide whether to share your command history with others so they would receive better suggestions depending on which server they are on, or you could keep all the history private and secure. The plan was to add hooks into zsh and bash shells so that all commands typed would be pushed to the central location for data mining.
    +
    +

    Enhanced KISS home photo albums


    +
    +I don't use third-party cloud providers such as Google Photos to store/archive my photos. Instead, they are all on a ZFS volume on my home NAS, with regular offsite backups taken. Thus, my project would involve implementing the features I miss most or finding a solution simple enough to host on my LAN:
    +
    +
      +
    • A feature I miss presents me with a random day from the past and some photos from that day. This project would randomly select a day and generate a photo album for me to view and reminisce about memories.
    • +
    • Another feature I miss is the ability to automatically deduplicate all the photos, as I am sure there are tons of duplicates on my NAS.
    • +
    • Auto-enhancing the photos (perhaps using ImageMagick?)
    • +
    • I already have a simple photoalbum.sh script that generates an album based on an input directory. However, it would be great also to have a timeline feature to enable browsing through different dates.
    • +

    +KISS static web photo albums with photoalbum.sh
    +
    +

    KISS file sync server with end-to-end encryption


    +
    +I aimed to have a simple server to which I could sync notes and other documents, ensuring that the data is fully end-to-end encrypted. This way, only the clients could decrypt the data, while an encrypted copy of all the data would be stored on the server side. There are a few solutions (e.g., NextCloud), but they are bloated or complex to set up.
    +
    +I currently use Syncthing for encrypted file sync across all my devices; however, the data is not end-to-end encrypted. It's a good-enough setup, though, as my Syncthing server is in my home LAN on an encrypted file system.
    +
    +https://syncthing.net
    +
    +I also had the idea of using this as a pet project for work and naming it Cryptolake, utilizing post-quantum-safe encryption algorithms and a distributed data store.
    +
    +

    A language that compiles to bash


    +
    +I had an idea to implement a higher-level language with strong typing that could be compiled into native Bash code. This would make all resulting Bash scripts more robust and secure by default. The project would involve developing a parser, lexer, and a Bash code generator. I planned to implement this in Go.
    +
    +I had previously implemented a tiny scripting language called Fype (For Your Program Execution), which could have served as inspiration.
    +
    +The Fype Programming Language
    +
    +

    A language that compiles to sed


    +
    +This is similar to the previous idea, but the difference is that the language would compile into a sed script. Sed has many features, but the brief syntax makes scripts challenging to read. The higher-level language would mimic sed but in a form that is easier for humans to read.
    +
    +

    Renovate VS-Sim


    +
    +VS-Sim is an open-source simulator programmed in Java for distributed systems. VS-Sim stands for "Verteilte Systeme Simulator," the German translation for "Distributed Systems Simulator." The VS-Sim project was my diploma thesis at Aachen University of Applied Sciences.
    +
    +https://codeberg.org/snonux/vs-sim
    +
    +The ideas I had was:
    +
    +
      +
    • Translate the project into English.
    • +
    • Modernise the Java codebase to be compatible with the latest JDK.
    • +
    • Make it compile to native binaries using GraalVM.
    • +
    • Distribute the project using AppImages.
    • +

    +I have put this project on hold for now, as I want to do more things in Go and fewer in Java in my personal time.
    +
    +

    KISS ticketing system


    +
    +My idea was to program a KISS (Keep It Simple, Stupid) ticketing system for my personal use. However, I am abandoning this project because I now use the excellent Taskwarrior software. You can learn more about it at:
    +
    +https://taskwarrior.org/
    +
    +

    A domain-specific language (DSL) for work


    +
    +At work, an internal service allocates storage space for our customers on our storage clusters. It automates many tasks, but many tweaks are accessible through APIs. I had the idea to implement a Ruby-based DSL that would make using all those APIs for ad-hoc changes effortless, e.g.:
    +
    + +
    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.
    +
    +Creative universe (Work pet project contests)
    +
    +

    Self-hosting projects I don't have time for


    +
    +

    My own Matrix server


    +
    +I value privacy. It would be great to run my own Matrix server for communication within my family. I have yet to have time to look into this more closely.
    +
    +https://matrix.org
    +
    +

    Ampache music server


    +
    +Ampache is an open-source music streaming server that allows you to host and manage your music collection online, accessible via a web interface. Setting it up involves configuring a web server, installing Ampache, and organising your music files, which can be time-consuming.
    +
    +

    Librum eBook reader


    +
    +Librum is a self-hostable e-book reader that allows users to manage and read their e-book collection from a web interface. Designed to be a self-contained platform where users can upload, organise, and access their e-books, Librum emphasises privacy and control over one's digital library.
    +
    +https://github.com/Librum-Reader/Librum
    +
    +I am using my Kobo devices or my laptop to read these kinds of things for now.
    +
    +

    Memos - Note-taking service


    +
    +Memos is a note-taking service that simplifies and streamlines information capture and organisation. It focuses on providing users with a minimalistic and intuitive interface, aiming to enhance productivity without the clutter commonly associated with more complex note-taking apps.
    +
    +https://www.usememos.com
    +
    +I am abandoning this idea for now, as I am currently using plain Markdown files for notes and syncing them with Syncthing across my devices.
    +
    +

    Bepasty server


    +
    +Bepasty is like a Pastebin for all kinds of files (text, image, audio, video, documents, binary, etc.). It seems very neat, but I only share a little nowadays. When I do, I upload files via SCP to one of my OpenBSD VMs and serve them via vanilla httpd there, keeping it KISS.
    +
    +https://github.com/bepasty/bepasty-server
    +
    +

    Books I don't have time to read


    +
    +

    Fluent Python


    +
    +I consider myself an advanced programmer in Ruby, Bash, and Perl. However, Python seems to be ubiquitous nowadays, and most of my colleagues prefer Python over any other languages. Thus, it makes sense for me to also learn and use Python. After conducting some research, "Fluent Python" appears to be the best book for this purpose.
    +
    +I don't have time to read this book at the moment, as I am focusing more on Go (Golang) and I know just enough Python to get by (e.g., for code reviews). Additionally, there are still enough colleagues around who can review my Ruby or Bash code.
    +
    +

    Programming Ruby


    +
    +I've read a couple of Ruby books already, but "Programming Ruby," which covers up to Ruby 3.2, was just recently released. I would like to read this to deepen my Ruby knowledge further and to revisit some concepts that I may have forgotten.
    +
    +As stated in this blog post, I am currently more eager to focus on Go, so I've put the Ruby book on hold. Additionally, there wouldn't be enough colleagues who could "understand" my advanced Ruby skills anyway, as most of them are either Java developers or SREs who don't code a lot.
    +
    +

    Peter F. Hamilton science fiction books


    +
    +I am a big fan of science fiction, but my reading list is currently too long anyway. So, I've put the Hamilton books on the back burner for now. You can see all the novels I've read here:
    +
    +https://paul.buetow.org/novels.html
    +gemini://paul.buetow.org/novels.gmi
    +
    +
    +

    New websites I don't have time for


    +
    +

    Create a "Why Raku Rox" site


    +
    +The website "Why Raku Rox" would showcase the unique features and benefits of the Raku programming language and highlight why it is an exceptional choice for developers. Raku, originally known as Perl 6, is a dynamic, expressive language designed for flexible and powerful software development.
    +
    +This would be similar to the "Why OpenBSD rocks" site:
    +
    +https://why-openbsd.rocks
    +https://raku.org
    +
    +I am not working on this for now, as I currently don’t even have time to program in Raku.
    +
    +

    Research projects I don't have time for


    +
    +

    Project secure


    +
    +For work: Implement a PoC that dumps Java heaps to extract secrets from memory. Based on the findings, write a Java program that encrypts secrets in the kernel using the memfd_secret() syscall to make it even more secure.
    +
    +https://lwn.net/Articles/865256/
    +
    +Due to other priorities, I am putting this on hold for now. The software we have built is pretty damn secure already!
    +
    +

    CPU utilisation is all wrong


    +
    +This research project, based on Brendan Gregg's blog post, could potentially significantly impact my work.
    +
    +https://brendangregg.com/blog/2017-05-09/cpu-utilization-is-wrong.html
    +
    +The research project would involve setting up dashboards that display actual CPU usage and the cycles versus waiting time for memory access.
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Related and maybe interesting:
    +
    +Sweating the small stuff - Tiny projects of mine
    +
    +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 new file mode 100644 index 00000000..e39ce96c --- /dev/null +++ b/gemfeed/2024-06-23-terminal-multiplexing-with-tmux.html @@ -0,0 +1,442 @@ + + + + +Terminal multiplexing with `tmux` + + + + + +

    +Home | Markdown | Gemini +

    +

    Terminal multiplexing with tmux


    +
    +Published at 2024-06-23T22:41:59+03:00
    +
    +Tmux (Terminal Multiplexer) is a powerful, terminal-based tool that manages multiple terminal sessions within a single window. Here are some of its primary features and functionalities:
    +
    +
      +
    • Session management
    • +
    • Window and Pane management
    • +
    • Persistent Workspace
    • +
    • Customization
    • +

    +https://github.com/tmux/tmux/wiki
    +
    +
    +         _______
    +        |.-----.|
    +        || Tmux||
    +        ||_.-._||
    +        `--)-(--`
    +       __[=== o]___
    +      |:::::::::::|\
    +jgs   `-=========-`()
    +    mod. by Paul B.
    +
    +
    +

    Table of Contents


    +
    +
    +

    Before continuing...


    +
    +Before continuing to read this post, I encourage you to get familiar with Tmux first (unless you already know the basics). You can go through the official getting started guide:
    +
    +https://github.com/tmux/tmux/wiki/Getting-Started
    +
    +I can also recommend this book (this is the book I got started with with Tmux):
    +
    +https://pragprog.com/titles/bhtmux2/tmux-2/
    +
    +Over the years, I have built a couple of shell helper functions to optimize my workflows. Tmux is extensively integrated into my daily workflows (personal and work). I had colleagues asking me about my Tmux config and helper scripts for Tmux several times. It would be neat to blog about it so that everyone interested in it can make a copy of my configuration and scripts.
    +
    +The configuration and scripts in this blog post are only the non-work-specific parts. There are more helper scripts, which I only use for work (and aren't really useful outside of work due to the way servers and clusters are structured there).
    +
    +Tmux is highly configurable, and I think I am only scratching the surface of what is possible with it. Nevertheless, it may still be useful for you. I also love that Tmux is part of the OpenBSD base system!
    +
    +

    Shell aliases


    +
    +I am a user of the Z-Shell (zsh), but I believe all the snippets mentioned in this blog post also work with Bash.
    +
    +https://www.zsh.org
    +
    +For the most common Tmux commands I use, I have created the following shell aliases:
    +
    + +
    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.
    +
    +The first two are pretty straightforward. tm is simply a shorthand for tmux, so I have to type less, and tl lists all Tmux sessions that are currently open. No magic here.
    +
    +

    The tn alias - Creating a new session


    +
    +The tn alias is referencing this function:
    +
    + +
    # 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.
    +
    +First, a Tmux session name can be passed to the function as a first argument. That session name is only optional. Without it, Tmux will select a session named T$($date +%s) as a default. Which is T followed by the UNIX epoch, e.g. T1717133796.
    +
    +

    Cleaning up default sessions automatically


    +
    +Note also the call to tmux::cleanup_default; it would clean up all already opened default sessions if they aren't attached. Those sessions were only temporary, and I had too many flying around after a while. So, I decided to auto-delete the sessions if they weren't attached. If I want to keep sessions around, I will rename them with the Tmux command prefix-key $. This is the cleanup function:
    +
    + +
    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.
    +
    +

    Renaming sessions


    +
    +Whenever I am in a temporary session (named T....), I may decide that I want to keep this session around. I have to rename the session to prevent the cleanup function from doing its thing. That's, as mentioned already, easily accomplished with the standard prefix-key $ Tmux command.
    +
    +

    The ta alias - Attaching to a session


    +
    +This alias refers to the following function, which tries to attach to an already-running Tmux session.
    +
    + +
    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.
    +
    +

    The tr alias - For a nested remote session


    +
    +This SSHs into the remote server specified and then, remotely on the server itself, starts a nested Tmux session. So we have one Tmux session on the local computer and, inside of it, an SSH connection to a remote server with a Tmux session running again. The benefit of this is that, in case my network connection breaks down, the next time I connect, I can continue my work on the remote server exactly where I left off. The session name is the name of the server being SSHed into. If a session like this already exists, it simply attaches to it.
    +
    + +
    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


    +
    +To make nested Tmux sessions work smoothly, one must change the Tmux prefix key locally or remotely. By default, the Tmux prefix key is Ctrl-b, so Ctrl-b $, for example, renames the current session. To change the prefix key from the standard Ctrl-b to, for example, Ctrl-g, you must add this to the tmux.conf:
    +
    +
    +set-option -g prefix C-g
    +
    +
    +This way, when I want to rename the remote Tmux session, I have to use Ctrl-g $, and when I want to rename the local Tmux session, I still have to use Ctrl-b $. In my case, I have this deployed to all remote servers through a configuration management system (out of scope for this blog post).
    +
    +There might also be another way around this (without reconfiguring the prefix key), but that is cumbersome to use, as far as I remember.
    +
    +

    The ts alias - Searching sessions with fuzzy finder


    +
    +Despite the fact that with tmux::cleanup_default, I don't leave a huge mess with trillions of Tmux sessions flying around all the time, at times, it can become challenging to find exactly the session I am currently interested in. After a busy workday, I often end up with around twenty sessions on my laptop. This is where fuzzy searching for session names comes in handy, as I often don't remember the exact session names.
    +
    + +
    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).
    +
    +You must install the fzf command on your computer for this to work. This is how it looks like:
    +
    +Tmux session fuzzy finder
    +
    +

    The tssh alias - Cluster SSH replacement


    +
    +Before I used Tmux, I was a heavy user of ClusterSSH, which allowed me to log in to multiple servers at once in a single terminal window and type and run commands on all of them in parallel.
    +
    +https://github.com/duncs/clusterssh
    +
    +However, since I started using Tmux, I retired ClusterSSH, as it came with the benefit that Tmux only needs to be run in the terminal, whereas ClusterSSH spawned terminal windows, which aren't easily portable (e.g., from a Linux desktop to macOS). The tmux::cluster_ssh function can have N arguments, where:
    +
    +
      +
    • ...the first argument will be the session name (see tmux::tssh_from_argument helper function), and all remaining arguments will be server hostnames/FQDNs to connect to simultaneously.
    • +
    • ...or, the first argument is a file name, and the file contains a list of hostnames/FQDNs (see tmux::ssh_from_file helper function)
    • +

    +This is the function definition behind the tssh alias:
    +
    + +
    tmux::cluster_ssh () {
    +    if [ -f "$1" ]; then
    +        tmux::tssh_from_file $1
    +        return
    +    fi
    +
    +    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.
    +
    +

    The tmux::tssh_from_argument helper


    +
    +This is the most magic helper function we will cover in this post. It looks like this:
    +
    + +
    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.
    +
    +Sometimes, I don't want the synchronized panes behavior and want to switch it off temporarily. I can do that with prefix-key p and prefix-key P after adding the following to my local tmux.conf:
    +
    +
    +bind-key p setw synchronize-panes off
    +bind-key P setw synchronize-panes on
    +
    +
    +

    The tmux::tssh_from_file helper


    +
    +This one sets the session name to the file name and then reads a list of servers from that file, passing the list of servers to tmux::tssh_from_argument as the arguments. So, this is a neat little wrapper that also enables me to open clustered SSH sessions from an input file.
    +
    + +
    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')
    +}
    +
    +
    +

    tssh examples


    +
    +To open a new session named fish and log in to 4 remote hosts, run this command (Note that it is also possible to specify the remote user):
    +
    +
    +$ tssh fish blowfish.buetow.org fishfinger.buetow.org \
    +    fishbone.buetow.org user@octopus.buetow.org
    +
    +
    +To open a new session named manyservers, put many servers (one FQDN per line) into a file called manyservers.txt and simply run:
    +
    +
    +$ tssh manyservers.txt
    +
    +
    +

    Common Tmux commands I use in tssh


    +
    +These are default Tmux commands that I make heavy use of in a tssh session:
    +
    +
      +
    • Press prefix-key DIRECTION to switch panes. DIRECTION is by default any of the arrow keys, but I also configured Vi keybindings.
    • +
    • Press prefix-key <space> to change the pane layout (can be pressed multiple times to cycle through them).
    • +
    • Press prefix-key z to zoom in and out of the current active pane.
    • +

    +

    Copy and paste workflow


    +
    +As you will see later in this blog post, I have configured a history limit of 1 million items in Tmux so that I can scroll back quite far. One main workflow of mine is to search for text in the Tmux history, select and copy it, and then switch to another window or session and paste it there (e.g., into my text editor to do something with it).
    +
    +This works by pressing prefix-key [ to enter Tmux copy mode. From there, I can browse the Tmux history of the current window using either the arrow keys or vi-like navigation (see vi configuration later in this blog post) and the Pg-Dn and Pg-Up keys.
    +
    +I often search the history backwards with prefix-key [ followed by a ?, which opens the Tmux history search prompt.
    +
    +Once I have identified the terminal text to be copied, I enter visual select mode with v, highlight all the text to be copied (using arrow keys or Vi motions), and press y to yank it (sorry if this all sounds a bit complicated, but Vim/NeoVim users will know this, as it is pretty much how you do it there as well).
    +
    +For v and y to work, the following has to be added to the Tmux configuration file:
    +
    +
    +bind-key -T copy-mode-vi 'v' send -X begin-selection
    +bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
    +
    +
    +Once the text is yanked, I switch to another Tmux window or session where, for example, a text editor is running and paste the yanked text from Tmux into the editor with prefix-key ]. Note that when pasting into a modal text editor like Vi or Helix, you would first need to enter insert mode before prefix-key ] would paste anything.
    +
    +

    Tmux configurations


    +
    +Some features I have configured directly in Tmux don't require an external shell alias to function correctly. Let's walk line by line through my local ~/.config/tmux/tmux.conf:
    +
    +
    +source ~/.config/tmux/tmux.local.conf
    +
    +set-option -g allow-rename off
    +set-option -g history-limit 100000
    +set-option -g status-bg '#444444'
    +set-option -g status-fg '#ffa500'
    +set-option -s escape-time 0
    +
    +
    +There's yet to be much magic happening here. I source a tmux.local.conf, which I sometimes use to override the default configuration that comes from the configuration management system. But it is mostly just an empty file, so it doesn't throw any errors on Tmux startup when I don't use it.
    +
    +I work with many terminal outputs, which I also like to search within Tmux. So, I added a large enough history-limit, enabling me to search backwards in Tmux for any output up to a million lines of text.
    +
    +Besides changing some colours (personal taste), I also set escape-time to 0, which is just a workaround. Otherwise, my Helix text editor's ESC key would take ages to trigger within Tmux. I am trying to remember the gory details. You can leave it out; if everything works fine for you, leave it out.
    +
    +The next lines in the configuration file are:
    +
    +
    +set-window-option -g mode-keys vi
    +bind-key -T copy-mode-vi 'v' send -X begin-selection
    +bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
    +
    +
    +I navigate within Tmux using Vi keybindings, so the mode-keys is set to vi. I use the Helix modal text editor, which is close enough to Vi bindings for simple navigation to feel "native" to me. (By the way, I have been a long-time Vim and NeoVim user, but I eventually switched to Helix. It's off-topic here, but it may be worth another blog post once.)
    +
    +The two bind-key commands make it so that I can use v and y in copy mode, which feels more Vi-like (as already discussed earlier in this post).
    +
    +The next set of lines in the configuration file are:
    +
    +
    +bind-key h select-pane -L
    +bind-key j select-pane -D
    +bind-key k select-pane -U
    +bind-key l select-pane -R
    +
    +bind-key H resize-pane -L 5
    +bind-key J resize-pane -D 5
    +bind-key K resize-pane -U 5
    +bind-key L resize-pane -R 5
    +
    +
    +These allow me to use prefix-key h, prefix-key j, prefix-key k, and prefix-key l for switching panes and prefix-key H, prefix-key J, prefix-key K, and prefix-key L for resizing the panes. If you don't know Vi/Vim/NeoVim, the letters hjkl are commonly used there for left, down, up, and right, which is also the same for Helix, by the way.
    +
    +The next set of lines in the configuration file are:
    +
    +
    +bind-key c new-window -c '#{pane_current_path}'
    +bind-key F new-window -n "session-switcher" "tmux list-sessions | fzf | cut -d: -f1 | xargs tmux switch-client -t"
    +bind-key T choose-tree
    +
    +
    +The first one is that any new window starts in the current directory. The second one is more interesting. I list all open sessions in the fuzzy finder. I rely heavily on this during my daily workflow to switch between various sessions depending on the task. E.g. from a remote cluster SSH session to a local code editor.
    +
    +The third one, choose-tree, opens a tree view in Tmux listing all sessions and windows. This one is handy to get a better overview of what is currently running in any local Tmux session. It looks like this (it also allows me to press a hotkey to switch to a particular Tmux window):
    +
    +Tmux sessiont tree view
    +
    +
    +The last remaining lines in my configuration file are:
    +
    +
    +bind-key p setw synchronize-panes off
    +bind-key P setw synchronize-panes on
    +bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "tmux.conf reloaded"
    +
    +
    +We discussed synchronized panes earlier. I use it all the time in clustered SSH sessions. When enabled, all panes (remote SSH sessions) receive the same keystrokes. This is very useful when you want to run the same commands on many servers at once, such as navigating to a common directory, restarting a couple of services at once, or running tools like htop to quickly monitor system resources.
    +
    +The last one reloads my Tmux configuration on the fly.
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +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 new file mode 100644 index 00000000..128c7552 --- /dev/null +++ b/gemfeed/2024-07-05-random-weird-things.html @@ -0,0 +1,403 @@ + + + + +Random Weird Things - Part Ⅰ + + + + + +

    +Home | Markdown | Gemini +

    +

    Random Weird Things - Part Ⅰ


    +
    +Published at 2024-07-05T10:59:59+03:00; Updated at 2025-02-08
    +
    +Every so often, I come across random, weird, and unexpected things on the internet. I thought it would be neat to share them here from time to time. As a start, here are ten of them.
    +
    +2024-07-05 Random Weird Things - Part Ⅰ (You are currently reading this)
    +2025-02-08 Random Weird Things - Part Ⅱ
    +
    +
    +		       /\_/\
    +WHOA!! 	     ( o.o )
    +		       > ^ <
    +		      /  -  \
    +		    /        \
    +		   /______\  \
    +
    +
    +

    Table of Contents


    +
    +
    +

    1. bad.horse traceroute


    +
    +Run traceroute to get the poem (or song).
    +
    +Update: A reader hinted that by specifying -n 60, there will be even more output!
    +
    + +
    ❯ traceroute -m 60 bad.horse
    +traceroute to bad.horse (162.252.205.157), 60 hops max, 60 byte packets
    + 1  _gateway (192.168.1.1)  5.237 ms  5.264 ms  6.009 ms
    + 2  77-85-0-2.ip.btc-net.bg (77.85.0.2)  8.753 ms  7.112 ms  8.336 ms
    + 3  212-39-69-103.ip.btc-net.bg (212.39.69.103)  9.434 ms  9.268 ms  9.986 ms
    + 4  * * *
    + 5  xe-1-2-0.mpr1.fra4.de.above.net (80.81.194.26)  39.812 ms  39.030 ms  39.772 ms
    + 6  * ae12.cs1.fra6.de.eth.zayo.com (64.125.26.172)  123.576 ms *
    + 7  * * *
    + 8  * * *
    + 9  ae10.cr1.lhr15.uk.eth.zayo.com (64.125.29.17)  119.097 ms  119.478 ms  120.767 ms
    +10  ae2.cr1.lhr11.uk.zip.zayo.com (64.125.24.140)  120.398 ms  121.147 ms  120.948 ms
    +11  * * *
    +12  ae25.mpr1.yyz1.ca.zip.zayo.com (64.125.23.117)  145.072 ms *  181.773 ms
    +13  ae5.mpr1.tor3.ca.zip.zayo.com (64.125.23.118)  168.239 ms  168.158 ms  168.137 ms
    +14  64.124.217.237.IDIA-265104-ZYO.zip.zayo.com (64.124.217.237)  168.026 ms  167.999 ms  165.451 ms
    +15  * * *
    +16  t00.toroc1.on.ca.sn11.net (162.252.204.2)  131.598 ms  131.308 ms  131.482 ms
    +17  bad.horse (162.252.205.130)  131.430 ms  145.914 ms  130.514 ms
    +18  bad.horse (162.252.205.131)  136.634 ms  145.295 ms  135.631 ms
    +19  bad.horse (162.252.205.132)  139.158 ms  148.363 ms  138.934 ms
    +20  bad.horse (162.252.205.133)  145.395 ms  148.054 ms  147.140 ms
    +21  he.rides.across.the.nation (162.252.205.134)  149.687 ms  147.731 ms  150.135 ms
    +22  the.thoroughbred.of.sin (162.252.205.135)  156.644 ms  155.155 ms  156.447 ms
    +23  he.got.the.application (162.252.205.136)  161.187 ms  162.318 ms  162.674 ms
    +24  that.you.just.sent.in (162.252.205.137)  166.763 ms  166.675 ms  164.243 ms
    +25  it.needs.evaluation (162.252.205.138)  172.073 ms  171.919 ms  171.390 ms
    +26  so.let.the.games.begin (162.252.205.139)  175.386 ms  174.180 ms  175.965 ms
    +27  a.heinous.crime (162.252.205.140)  180.857 ms  180.766 ms  180.192 ms
    +28  a.show.of.force (162.252.205.141)  187.942 ms  186.669 ms  186.986 ms
    +29  a.murder.would.be.nice.of.course (162.252.205.142)  191.349 ms  191.939 ms  190.740 ms
    +30  bad.horse (162.252.205.143)  195.425 ms  195.716 ms  196.186 ms
    +31  bad.horse (162.252.205.144)  199.238 ms  200.620 ms  200.318 ms
    +32  bad.horse (162.252.205.145)  207.554 ms  206.729 ms  205.201 ms
    +33  he-s.bad (162.252.205.146)  211.087 ms  211.649 ms  211.712 ms
    +34  the.evil.league.of.evil (162.252.205.147)  212.657 ms  216.777 ms  216.589 ms
    +35  is.watching.so.beware (162.252.205.148)  220.911 ms  220.326 ms  221.961 ms
    +36  the.grade.that.you.receive (162.252.205.149)  225.384 ms  225.696 ms  225.640 ms
    +37  will.be.your.last.we.swear (162.252.205.150)  232.312 ms  230.989 ms  230.919 ms
    +38  so.make.the.bad.horse.gleeful (162.252.205.151)  235.761 ms  235.291 ms  235.585 ms
    +39  or.he-ll.make.you.his.mare (162.252.205.152)  241.350 ms  239.407 ms  238.394 ms
    +40  o_o (162.252.205.153)  246.154 ms  247.650 ms  247.110 ms
    +41  you-re.saddled.up (162.252.205.154)  250.925 ms  250.401 ms  250.619 ms
    +42  there-s.no.recourse (162.252.205.155)  256.071 ms  251.154 ms  255.340 ms
    +43  it-s.hi-ho.silver (162.252.205.156)  260.152 ms  261.775 ms  261.544 ms
    +44  signed.bad.horse (162.252.205.157)  262.430 ms  261.410 ms  261.365 ms
    +
    +
    +

    2. ASCII cinema


    +
    +Fancy watching Star Wars Episode IV in ASCII? Head to the ASCII cinema:
    +
    +https://asciinema.org/a/569727
    +
    +

    3. Netflix's Hello World application


    +
    +Netflix has got the Hello World application run in production 😱
    +
    +
      +
    • https://www.Netflix.com/helloworld
    • +

    +By the time this is posted, it seems that Netflix has taken it offline... I should have created a screenshot!
    +
    +

    C programming


    +
    +

    4. Indexing an array


    +
    +In C, you can index an array like this: array[i] (not surprising). But this works as well and is valid C code: i[array], 🤯 It's because after the spec A[B] is equivalent to *(A + B) and the ordering doesn't matter for the + operator. All 3 loops are producing the same output. Would be funny to use i[array] in a merge request of some code base on April Fool's day!
    +
    + +
    #include <stdio.h>
    +
    +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", i[array]);
    +
    +  for (int i = 0; i < 5; i++)
    +    printf("%d\n", *(i + array));
    +}
    +
    +
    +

    5. Variables with prefix $


    +
    +In C you can prefix variables with $! E.g. the following is valid C code 🫠:
    +
    + +
    #include <stdio.h>
    +
    +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", $i[$array]);
    +
    +  for (int $i = 0; $i < 5; $i++)
    +    printf("%d\n", *($i + $array));
    +}
    +
    +
    +

    6. Object oriented shell scripts using ksh


    +
    +Experienced software developers are aware that scripting languages like Python, Perl, Ruby, and JavaScript support object-oriented programming (OOP) concepts such as classes and inheritance. However, many might be surprised to learn that the latest version of the Korn shell (Version 93t+) also supports OOP. In ksh93, OOP is implemented using user-defined types:
    +
    + +
    #!/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
    +
    +

    7. This works in Go


    +
    +There is no pointer arithmetic in Go like in C, but it is still possible to do some brain teasers with pointers 😧:
    +
    + +
    package main
    +
    +import "fmt"
    +
    +func main() {
    +	var i int
    +	f := func() *int {
    +		return &i
    +	}
    +	*f()++
    +	fmt.Println(i)
    +}
    +
    +
    +Go playground
    +
    +

    8. "I am a Teapot" HTTP response code


    +
    +Defined in 1998 as one of the IETF's traditional April Fools' jokes (RFC 2324), the Hyper Text Coffee Pot Control Protocol specifies an HTTP status code that is not intended for actual HTTP server implementation. According to the RFC, this code should be returned by teapots when asked to brew coffee. This status code also serves as an Easter egg on some websites, such as Google.com's "I'm a teapot" feature. Occasionally, it is used to respond to a blocked request, even though the more appropriate response would be the 403 Forbidden status code.
    +
    +https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#418
    +
    +

    9. jq is a functional programming language


    +
    +Many know of jq, the handy small tool and swiss army knife for JSON parsing.
    +
    +https://github.com/jqlang/jq
    +
    +What many don't know that jq is actually a full blown functional programming language jqlang, have a look at the language description:
    +
    +https://github.com/jqlang/jq/wiki/jq-Language-Description
    +
    +As a matter of fact, the language is so powerful, that there exists an implementation of jq in jq itself:
    +
    +https://github.com/wader/jqjq
    +
    +Here some snipped from jqjq, to get a feel of jqlang:
    +
    +
    +def _token:
    +	def _re($re; f):
    +	  ( . as {$remain, $string_stack}
    +	  | $remain
    +	  | match($re; "m").string
    +	  | f as $token
    +	  | { result: ($token | del(.string_stack))
    +	    , remain: $remain[length:]
    +	    , string_stack:
    +	        ( if $token.string_stack == null then $string_stack
    +	          else $token.string_stack
    +	          end
    +	        )
    +	    }
    +	  );
    +	if .remain == "" then empty
    +	else
    +	  ( . as {$string_stack}
    +	  | _re("^\\s+"; {whitespace: .})
    +	  // _re("^#[^\n]*"; {comment: .})
    +	  // _re("^\\.[_a-zA-Z][_a-zA-Z0-9]*"; {index: .[1:]})
    +	  // _re("^[_a-zA-Z][_a-zA-Z0-9]*"; {ident: .})
    +	  // _re("^@[_a-zA-Z][_a-zA-Z0-9]*"; {at_ident: .})
    +	  // _re("^\\$[_a-zA-Z][_a-zA-Z0-9]*"; {binding: .})
    +	  # 1.23, .123, 123e2, 1.23e2, 123E2, 1.23e+2, 1.23E-2 or 123
    +	  // _re("^(?:[0-9]*\\.[0-9]+|[0-9]+)(?:[eE][-\\+]?[0-9]+)?"; {number: .})
    +	  // _re("^\"(?:[^\"\\\\]|\\\\.)*?\\\\\\(";
    +	      ( .[1:-2]
    +	      | _unescape
    +	      | {string_start: ., string_stack: ($string_stack+["\\("])}
    +	      )
    +	    )
    +	 .
    +	 .
    +	 .
    +
    +
    +

    10. Regular expression to verify email addresses


    +
    +This is a pretty old meme, but still worth posting here (as some may be unaware). The RFC822 Perl regex to validate email addresses is 😱:
    +
    +
    +(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
    +)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
    +\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
    +?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ 
    +\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
    +31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
    +>(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
    +(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
    +(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
    +|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
    +?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
    +r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
    + \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
    +?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
    +)*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
    + \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
    +)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
    +)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
    +*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+
    +|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r
    +\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:
    +\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t
    +>))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031
    +>+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](
    +?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?
    +:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?
    +:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?
    +:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?
    +[ \t]))*"(?:(?:\r\n)?[ \t])*)*:(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] 
    +\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|
    +\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>
    +@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"
    +(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t]
    +)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
    +".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?
    +:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[
    +\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-
    +\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(
    +?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;
    +:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([
    +^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\"
    +.\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\
    +>\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\
    +[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\
    +r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] 
    +\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]
    +|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \0
    +00-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\
    +.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,
    +;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?
    +:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*
    +(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
    +\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[
    +^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]
    +>))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)(?:,\s*(
    +?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
    +".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(
    +?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[
    +\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t
    +>)*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t
    +>)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?
    +:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
    +\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
    +[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
    +>]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
    +?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
    +()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
    +?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
    +@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
    + \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
    +;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
    +)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
    +".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
    +(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
    +\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
    +\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
    +"()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
    +*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
    ++|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
    +.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
    +|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
    +?:\r\n)?[ \t])*))*)?;\s*)
    +
    +
    +https://pdw.ex-parrot.com/Mail-RFC822-Address.html
    +
    +I hope you had some fun. E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +other related posts are:
    +
    +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 new file mode 100644 index 00000000..61312da3 --- /dev/null +++ b/gemfeed/2024-07-07-the-stoic-challenge-book-notes.html @@ -0,0 +1,92 @@ + + + + +'The Stoic Challenge' book notes + + + + + +

    +Home | Markdown | Gemini +

    +

    "The Stoic Challenge" book notes


    +
    +Published at 2024-07-07T12:46:55+03:00
    +
    +These are my personal takeaways after reading "The Stoic Challenge: A Philosopher's Guide to Becoming Tougher, Calmer, and More Resilient" by William B. Irvine.
    +
    +
    +         ,..........   ..........,
    +     ,..,'          '.'          ',..,
    +    ,' ,'            :            ', ',
    +   ,' ,'             :             ', ',
    +  ,' ,'              :              ', ',
    + ,' ,'............., : ,.............', ',
    +,'  '............   '.'   ............'  ',
    + '''''''''''''''''';''';''''''''''''''''''
    +                    '''
    +
    +
    +

    Table of Contents


    +
    +
    +

    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.
    +
    +Put a positive spin on everything. What should you do if someone wrong you? Don't get angry, there is no point in that, it just makes you suffer. Do the best what you got now and keep calm and carry on. A resilient person will refuse to play the role of a victim. You can develop the setback response skills. Turn a setback. e.g. a handycap, into a personal triumph.
    +
    +It is not the things done to you or happen to you what matters but how you take the things and react to these things.
    +
    +Don't row against the other boats but against your own lazy bill. It doesn't matter if you are first or last, as long as you defeat your lazy self.
    +
    +Stoics are thankful that they are mortal. As then you can get reminded of how great it is to be alive at all. In dying we are more alive we have ever been as every thing you do could be the last time you do it. Rather than fighting your death you should embrace it if there are no workarounds. Embrace a good death.
    +
    +

    Negative visualization


    +
    +It is easy what we have to take for granted.
    +
    +
      +
    • Imagine the negative and then think that things are actually much better than they seem to be.
    • +
    • Close your eyes and imagine you are color blind for a minute, then open the eyes again and see all the colours. You will be grateful for being able to see the colours.
    • +
    • Now close your eyes for a minute and imagine you would be blind, so that you will never be able to experience the world again and let it sink in. When you open your eyes again you will feel a lot of gratefulness.
    • +
    • Last time meditation. Lets you appreciate the life as it is now. Life gets vitalised again.
    • +

    +

    Oh, nice trick, you stoic "god"! ;-)


    +
    +Take setbacks as a challenge. Also take it with some humor.
    +
    +
      +
    • A setback in a setback, how Genius :-)
    • +
    • A setback in a setback in a setback: the stoic god's work overtime, eh? :-)
    • +

    +What would the stoic god's do next? This is just a test strategy by them. Don't be frustrated at all but be astonished of what comes next. Thank the stoic gods of testing you. This is comfort zone extension of the stoics aka toughness Training.
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Other book notes of mine are:
    +
    +2024-10-24 "Staff Engineer" book notes
    +2024-07-07 "The Stoic Challenge" book notes (You are currently reading this)
    +2024-05-01 "Slow Productivity" book notes
    +2023-11-11 "Mind Management" book notes
    +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2023-05-06 "The Obstacle is the Way" book notes
    +2023-04-01 "Never split the difference" book notes
    +2023-03-16 "The Pragmatic Programmer" book notes
    +
    +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 new file mode 100644 index 00000000..4daadc6e --- /dev/null +++ b/gemfeed/2024-08-05-typing-127.1-words-per-minute.html @@ -0,0 +1,254 @@ + + + + +Typing `127.1` words per minute (`>100wpm average`) + + + + + +

    +Home | Markdown | Gemini +

    +

    Typing 127.1 words per minute (>100wpm average)


    +
    +Published at 2024-08-05T17:39:30+03:00
    +
    +
    +,---,---,---,---,---,---,---,---,---,---,---,---,---,-------,
    +|1/2| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | + | ' | <-    |
    +|---'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-----|
    +| ->| | Q | W | E | R | T | Y | U | I | O | P | ] | ^ |     |
    +|-----',--',--',--',--',--',--',--',--',--',--',--',--'|    |
    +| Caps | A | S | D | F | G | H | J | K | L | \ | [ | * |    |
    +|----,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'---'----|
    +|    | < | Z | X | C | V | B | N | M | , | . | - |          |
    +|----'-,-',--'--,'---'---'---'---'---'---'-,-'---',--,------|
    +| ctrl |  | alt |                          |altgr |  | ctrl |
    +'------'  '-----'--------------------------'------'  '------'
    +      Nieminen Mika	
    +
    +
    +

    Table of Contents


    +
    +
    +

    Introduction


    +
    +After work one day, I noticed some discomfort in my right wrist. Upon research, it appeared to be a mild case of Repetitive Strain Injury (RSI). Initially, I thought that this would go away after a while, but after a week it became even worse. This led me to consider potential causes such as poor posture or keyboard use habits. As an enthusiast of keyboards, I experimented with ergonomic concave ortholinear split keyboards. Wait, what?...
    +
    +
      +
    • Concave: Some fingers are longer than others. A concave keyboard makes it so that the keycaps meant to be pressed by the longer fingers are further down (e.g., left middle finger for e on a Qwerty layout), and keycaps meant to be pressed by shorter fingers are further up (e.g., right pinky finger for the letter p).
    • +
    • Ortholinear: The keys are arranged in a straight vertical line, unlike most conventional keyboards. The conventional keyboards still resemble the old typewriters, where the placement of the keys was optimized so that the typewriter would not jam. There is no such requirement anymore.
    • +
    • Split: The keyboard is split into two halves (left and right), allowing one to place either hand where it is most ergonomic.
    • +

    +After discovering ThePrimagen (I found him long ago, but I never bothered buying the same keyboard he is on) on YouTube and reading/watching a couple of reviews, I thought that as a computer professional, the equipment could be expensive anyway (laptop, adjustable desk, comfortable chair), so why not invest a bit more into the keyboard? I purchased myself the Kinesis Advantage360 Professional keyboard.
    +
    +

    Kinesis review


    +
    +For an in-depth review, have a look at this great article:
    +
    +Review of the Kinesis Advantage360 Professional keyboard
    +
    +

    Top build quality


    +
    +Overall, the keyboard feels excellent quality and robust. It has got some weight to it. Because of that, it is not ideally suited for travel, though. But I have a different keyboard to solve this (see later in this post). Overall, I love how it is built and how it feels.
    +
    +Kinesis Adv.360 Pro at home
    +
    +

    Bluetooth connectivity


    +
    +Despite encountering concerns about Bluetooth connectivity issues with the Kinesis keyboard during my research, I purchased one anyway as I intended to use it only via USB. However, I discovered that the firmware updates available afterwards had addressed these reported Bluetooth issues, and as a result, I did not experience any difficulties with the Bluetooth functionality. This positive outcome allowed me to enjoy using the keyboard also wirelessly.
    +
    +

    Gateron Brown key switches


    +
    +Many voices on the internet seem to dislike the Gateron Brown switches, the only official choice for non-clicky tactile switches in the Kinesis, so I was also a bit concerned. I almost went with Cherry MX Browns for my Kinesis (a custom build from a 3rd party provider that is partnershipping with Kinesis). Still, I decided on Gateron Browns to try different switches than the Cherry MX Browns I already have on my ZSA Moonlander keyboard (another ortho-linear split keyboard, but without a concave keycap layout).
    +
    +At first, I was disappointed by the Gaterons, as they initially felt a bit meshy compared to the Cherries. Still, over the weeks I grew to prefer them because of their smoothness. Over time, the tactile bumps also became more noticeable (as my perception of them improved). Because of their less pronounced tactile feedback, the Gaterons are less tiring for long typing sessions and better suited for a relaxed typing experience.
    +
    +So, the Cherry MX feel sharper but are more tiring in the long run, and the Gaterons are easier to write on and the tactile Feedback is slightly less pronounced.
    +
    +

    Keycaps


    +
    +If you ever purchase a Kinesis keyboard, go with the PCB keycaps. They upgrade the typing experience a lot. The only thing you will lose is that the backlighting won't shine through them. But that is a reasonable tradeoff. When do I need backlighting? I am supposed to look at the screen and not the keyboard while typing.
    +
    +I went with the blank keycaps, by the way.
    +
    +Kinesis Adv.360 Pro at home
    +
    +

    Keymap editor


    +
    +There is no official keymap editor. You have to edit a configuration file manually, build the firmware from scratch, and upload the firmware with the new keymap to both keyboard halves. The Professional version of his keyboard, by the way, runs on the ZMK open-source firmware.
    +
    +Many users find the need for an easy-to-use keymap editor an issue. But this is the Pro model. You can also go with the non-Pro, which runs on non-open-source firmware and has no Bluetooth (it must be operated entirely on USB).
    +
    +There is a 3rd party solution which is supposed to configure the keymap for the Professional model as bliss, but I have never used it. As a part-time programmer and full-time Site Reliability Engineer, I am okay configuring the keymap in my text editor and building it in a local docker container. This is one of the standard ways of doing it here. You could also use a GitHub pipeline for the firmware build, but I prefer building it locally on my machine. This all seems natural to me, but this may be an issue for "the average Joe" user.
    +
    +

    First steps


    +
    +I didn't measure the usual words per minute (wpm) on my previous keyboard, the ZSA Moonlander, but I guess that it was around 40-50wpm. Once the Kinesis arrived, I started practising. The experience was quite different due to the concave keycaps, so I barely managed 10wpm on the first day.
    +
    +I quickly noticed that I could not continue using the freestyle 6-finger typing system I was used to on my Moonlander or any previous keyboards I worked with. I learned ten-finger touch typing from scratch to be more efficient with the Kinesis keyboard. The keyboard forces you to embrace touch typing.
    +
    +Sometimes, there were brain farts, and I couldn't type at all. The trick was not to freak out about it, but to move on. If your average goes down a bit for a day, it doesn't matter; the long-term trend over several days and weeks matters, not the one-off wpm high score.
    +
    +Although my wrist pain seemed to go away aftre the first week of using the Kinesis, my fingers became tired of adjusting to the new way of typing. My hands were stiff, as if I had been training for the Olympics. Only after three weeks did I start to feel comfortable with it. If it weren't for the comments I read online, I would have sent it back after week 2.
    +
    +I also had a problem with the left pinky finger, where I could not comfortably reach the p key. This involved moving the whole hand. An easy fix was to swap p with ; on the keyboard layout.
    +
    +

    Considering alternate layouts


    +
    +As I was going to learn 10-finger touch typing from scratch, I also played with the thought of switching from the Qwerty to the Dvorak or Colemak keymap, but after reading some comments on the internet, I decided against it:
    +
    +
      +
    • These layouts (Dvorak and Colemak) will minimize the finger travel for the most commonly used English words, but they necessarily don't give you a better wpm score.
    • +
    • One comment on Redit also mentioned that getting stiffer fingers with these layouts is more likely than with Qwerty, as in Qwerty, he had to stretch out his fingers more often, which helps here.
    • +
    • There are also many applications and websites with keyboard shortcuts and are Qwerty-optimized.
    • +
    • You won't be able to use someone else's computer as there will be likely Qwerty. Some report that after using an alternative layout for a while, they forget how to use Qwerty.
    • +

    +

    Training how to type


    +
    +

    Tools


    +
    +One of the most influential tools in my touch typing journey has been keybr.com. This site/app helped me learn 10-finger touch typing, and I practice daily for 30 minutes (in the first two weeks, up to an hour every day). The key is persistence and focus on technique rather than speed; the latter naturally improves with regular practice. Precision matters, too, so I always correct my errors using the backspace key.
    +
    +https://keybr.com
    +
    +I also used a command-line tool called tt, which is written in Go. It has a feature that I found very helpful: the ability to practice typing by piping custom text into it. Additionally, I appreciated its customization options, such as choosing a colour theme and specifying how statistics are displayed.
    +
    +https://github.com/lemnos/tt
    +
    +I wrote myself a small Ruby script that would randomly select a paragraph from one of my eBooks or book notes and pipe it to tt. This helped me remember some of the books I read and also practice touch typing.
    +
    +

    My keybr.com statistics


    +
    +Overall, I trained for around 4 months in more than 5,000 sessions. My top speed in a session was 127.1wpm (up from barely 10wpm at the beginning).
    +
    +All time stats
    +
    +My overall average speed over those 5,000 sessions was 80wpm. The average speed over the last week was over 100wpm. The green line represents the wpm average (increasing trend), the purple line represents the number of keys in the practices (not much movement there, as all keys are unlocked), and the red line represents the average typing accuracy.
    +
    +Typing speed over leson
    +
    +Around the middle, you see a break-in of the wpm average value. This was where I swapped the p and ; keys, but after some retraining, I came back to the previous level and beyond.
    +
    +

    Tips and tricks


    +
    +These are some tips and tricks I learned along the way to improve my typing speed:
    +
    +

    Relax


    +
    +It's easy to get cramped when trying to hit this new wpm mark, but this is just holding you back. Relax and type at a natural pace. Now I also understand why my Katate Sensei back in London kept screaming "RELAAAX" at me during practice.... It didn't help much back then, though, as it is difficult to relax while someone screams at you!
    +
    +

    Focus on accuracy first


    +
    +This goes with the previous point. Instead of trying to speed through sessions as quickly as possible, slow down and try to type the words correctly—so don't rush it. If you aren't fast yet, the reason is that your brain hasn't trained enough. It will come over time, and you will be faster.
    +
    +

    Chording


    +
    +A trick to getting faster is to type by word and pause between each word so you learn the words by chords. From 80wpm and beyond, this makes a real difference.
    +
    +

    Punctuation and Capitalization


    +
    +I included 10% punctuation and 20% capital letters in my keybr.com practice sessions to simulate real typing conditions, which improved my overall working efficiency. I guess I would have gone to 120wpm in average if I didn't include this options...
    +
    +

    Reverse shifting


    +
    +Reverse shifting aka left-right shifting is to...
    +
    +
      +
    • ...use the left shift key for letters on the right keyboard side.
    • +
    • ...use the right shift key for letters on the left keyboard side.
    • +

    +This makes using the shift key a blaze.
    +
    +

    Enter the flow state


    +
    +Listening to music helps me enter a flow state during practice sessions, which makes typing training a bit addictive (which is good, or isn't it?).
    +
    +

    Repeat every word


    +
    +There's a setting on keybr.com that makes it so that every word is always repeated, having you type every word twice in a row. I liked this feature very much, and I think it also helped to improve my practice.
    +
    +

    Don't use the same finger for two consecutive keystrokes


    +
    +Apparently, if you want to type fast, avoid using the same finger for two consecutive keystrokes. This means you don't always need to use the same finger for the same keys.
    +However, there are no hard and fast rules. Thus, everyone develops their system for typing word combinations. An exception would be if you are typing the very same letter in a row (e.g., t in letter)—here, you are using the same finger for both ts.
    +
    +

    Warm-up


    +
    +You can't reach your average typing speed first ting the morning. It would help if you warmed up before the exercise or practice later during the day. Also, some days are good, others not so, e.g., after a bad night's sleep. What matters is the mid- and long-term trend, not the fluctuations here, though.
    +
    +

    Travel keyboard


    +
    +As mentioned, the Kinesis is a great keyboard, but it is not meant for travel.
    +
    +I guess keyboards will always be my expensive hobby, so I also purchased another ergonomic, ortho-linear, concave split keyboard, the Glove80 (with the Red Pro low-profile switches). This keyboard is much lighter and, in my opinion, much better suited for travel than the Kinesis. It also comes with a great travel case.
    +
    +Here is a photo of me using it with my Surface Go 2 (it runs Linux, by the way) while waiting for the baggage drop at the airport:
    +
    +Traveling with the Glove80 using my Surface Go 2
    +
    +For everyday work, I prefer the tactile Browns on the Kinesis over the Red Pro I have on the Glove80 (normal profile vs. low profile). The Kinesis feels much more premium, whereas the Glove80 is much lighter and easier to store away in a rucksack (the official travel case is a bit bulky, so I wrapped it simply in bubble plastic).
    +
    +The F-key row is odd at the Glove80. I would have preferred more keys on the sides like the Kinesis, and I use them for [] {} (), which is pretty handy there. However, I like the thumb cluster of the Glove80 more than the one on the Kinesis.
    +
    +The good thing is that I can switch between both keyboards instantly without retraining my typing memories. I've configured (as much as possible) the same keymaps on both my Kinesis and Glove80, making it easy to switch between them at any occasion.
    +
    +Interested in the Glove80? I suggest also reading this review:
    +
    +Review of the Glove80 keyboard
    +
    +

    Upcoming custom Kinesis build


    +
    +As I mentioned, keyboards will remain an expensive hobby of mine. I don't regret anything here, though. After all, I use keyboards at my day job. I've ordered a Kinesis custom build with the Gateron Kangaroo switches, and I'm excited to see how that compares to my current setup. I'm still deciding whether to keep my Gateron Brown-equipped Kinesis as a secondary keyboard or possibly leave it at my in-laws for use when visiting or to sell it.
    +
    +

    Conclusion


    +
    +When I traveled with the Glove80 for work to the London office, a colleague stared at my keyboard and made jokes that it might be broken (split into two halves). But other than that...
    +
    +Ten-finger touch typing has improved my efficiency and has become a rewarding discipline. Whether it's the keyboards I use, the tools I practice with, or the techniques I've adopted, each step has been a learning experience. I hope sharing my journey provides valuable insights and inspiration for anyone looking to improve their touch typing skills.
    +
    +I also accidentally started using a 10-finger-like system (maybe still 6 fingers, but better than before) on my regular laptop keyboard. I could be more efficient on the laptop keyboard. The form is different there (not ortholinear, not concave keycaps, etc.), but my typing has improved there too (even if it is only by a little bit).
    +
    +I don't want to return to a non-concave keyboard as my default. I will use other keyboards still once in a while but only for short periods or when I have to (e.g. travelling with my Laptop and when there is no space to put an external keyboard)
    +
    +Learning to touch type has been an eye-opening experience for me, not just for work but also for personal projects. Now, writing documentation is so much fun; who could believe that? Furthermore, working with Slack (communicating with colleagues) is more fun now as well.
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +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 new file mode 100644 index 00000000..9fd813e5 --- /dev/null +++ b/gemfeed/2024-09-07-projects-i-support.html @@ -0,0 +1,127 @@ + + + + +Projects I financially support + + + + + +

    +Home | Markdown | Gemini +

    +

    Projects I financially support


    +
    +Published at 2024-09-07T16:04:19+03:00
    +
    +This is the list of projects and initiatives I support/sponsor.
    +
    +
    +||====================================================================||
    +||//$\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\//$\\||
    +||(100)==================| FEDERAL SPONSOR NOTE |================(100)||
    +||\\$//        ~         '------========--------'                \\$//||
    +||<< /        /$\              // ____ \\                         \ >>||
    +||>>|  12    //L\\            // ///..) \\         L38036133B   12 |<<||
    +||<<|        \\ //           || <||  >\  ||                        |>>||
    +||>>|         \$/            ||  $$ --/  ||        One Hundred     |<<||
    +||<<|      L38036133B        *\\  |\_/  //* series                 |>>||
    +||>>|  12                     *\\/___\_//*   1989                  |<<||
    +||<<\      Open Source   ______/Franklin\________     Supporting   />>||
    +||//$\                 ~| SPONSORING AND FUNDING |~               /$\\||
    +||(100)===================  AWESOME OPEN SOURCE =================(100)||
    +||\\$//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\$//||
    +||====================================================================||
    + 
    +
    +
    +

    Table of Contents


    +
    +
    +

    Motivation


    +
    +Sponsoring free and open-source projects, even for personal use, is important to ensure the sustainability, security, and continuous improvement of the software. It supports developers who often maintain these projects without compensation, helping them provide updates, new features, and security patches. By contributing, you recognize their efforts, foster a culture of innovation, and benefit from perks like early access or support, all while ensuring the long-term viability of the tools you rely on.
    +
    +Albeit I am not putting a lot of money into my sponsoring efforts, it still helps the open-source maintainers because the more little sponsors there are, the higher the total sum.
    +
    +

    OSnews


    +
    +I am a silver Patreon member of OSnews. I have been following this site since my student years. It's always been a great source of independent and slightly alternative IT news.
    +
    +https://osnews.com
    +
    +

    Cup o' Go Podcast


    +
    +I am a Patreon of the Cup o' Go Podcast. The podcast helps me stay updated with the Go community for around 15 minutes per week. I am not a full-time software developer, but my long-term ambition is to become better in Go every week by working on personal projects and tools for work.
    +
    +https://cupogo.dev
    +
    +

    Codeberg


    +
    +Codeberg e.V. is a nonprofit organization that provides online resources for software development and collaboration. I am a user and a supporting member, paying an annual membership of €24. I didn't have to pay that membership fee, as Codeberg offers all the services I use for free.
    +
    +https://codeberg.org
    +https://codeberg.org/snonux - My Codeberg page
    +
    +

    GrapheneOS


    +
    +GrapheneOS is an open-source project that improves Android's privacy and security with sandboxing, exploit mitigations, and a permission model. It does not include Google apps or services but offers a sandboxed Google Play compatibility layer and its own apps and services.
    +
    +I've made a one-off €100 donation because I really like this, and I run GrapheneOS on my personal Phone as my main daily driver.
    +
    +https://grapheneos.org/
    +Why GrapheneOS Rox
    +
    +

    AnkiDroid


    +
    +AnkiDroid is an app that lets you learn flashcards efficiently with spaced repetition. It is compatible with Anki software and supports various flashcard content, syncing, statistics, and more.
    +
    +I've been learning vocabulary with this free app, and it is, in my opinion, the best flashcard app I know. I've made a 20$ one-off donation to this project.
    +
    +https://opencollective.com/ankidroid
    +
    +

    OpenBSD through OpenBSD.Amsterdam


    +
    + The OpenBSD project produces a FREE, multi-platform 4.4BSD-based UNIX-like operating system. Our efforts emphasize portability, standardization, correctness, proactive security and integrated cryptography. As an example of the effect OpenBSD has, the popular OpenSSH software comes from OpenBSD. OpenBSD is freely available from their download sites.
    +
    +I implicitly support the OpenBSD project through a VM I have rented at OpenBSD Amsterdam. They donate €10 per VM and €15 per VM for every renewal to the OpenBSD Foundation, with dedicated servers running vmm(4)/vmd(8) to host opinionated VMs.
    +
    +https://www.OpenBSD.org
    +https://OpenBSD.Amsterdam
    +
    +

    ProtonMail


    +
    +I am not directly funding this project, but I am a very happy paying customer, and I am listing it here as an alternative to big tech if you don't want to run your own mail infrastructure. I am listing ProtonMail here as it is a non-profit organization, and I want to emphasize the importance of considering alternatives to big tech.
    +
    +https://proton.me/
    +
    +

    Libro.fm


    +
    +This is the alternative to Audible if you are into audiobooks (like I am). For every book or every month of membership, I am also supporting a local bookstore I selected. Their catalog is not as large as Audible's, but it's still pretty decent.
    +
    +Libro.fm began as a conversation among friends at Third Place Books, a local bookstore in Seattle, Washington, about the growing popularity of audiobooks and the lack of a way for readers to purchase them from independent bookstores. Flash forward, and Libro.fm was founded in 2014.
    +
    +https://libro.fm
    +
    +E-mail your comments to paul@nospam.buetow.org :-)
    +
    +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 new file mode 100644 index 00000000..1e727256 --- /dev/null +++ b/gemfeed/2024-09-07-site-reliability-engineering-part-4.html @@ -0,0 +1,93 @@ + + + + +Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers + + + + + +

    +Home | Markdown | Gemini +

    +

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


    +
    +Published at 2024-09-07T16:27:58+03:00
    +
    +Welcome to Part 4 of my Site Reliability Engineering (SRE) series. I'm currently working as a Site Reliability Engineer, and I’m here to share what SRE is all about in this blog series.
    +
    +2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
    +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance
    +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture
    +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers (You are currently reading this)
    +
    +
    +       __..._   _...__
    +  _..-"      `Y`      "-._
    +  \ Once upon |           /
    +  \\  a time..|          //
    +  \\\         |         ///
    +   \\\ _..---.|.---.._ ///
    +jgs \\`_..---.Y.---.._`//	
    +
    +
    +This time, I want to share some tips on how to onboard software engineers, QA engineers, and Site Reliability Engineers (SREs) to the primary on-call rotation. Traditionally, onboarding might take half a year (depending on the complexity of the infrastructure), but with a bit of strategy and structured sessions, we've managed to reduce it to just six weeks per person. Let's dive in!
    +
    +

    Setting the Scene: Tier-1 On-Call Rotation


    +
    +First things first, let's talk about Tier-1. This is where the magic begins. Tier-1 covers over 80% of the common on-call cases and is the perfect breeding ground for new on-call engineers to get their feet wet. It's designed to be manageable training ground.
    +
    +

    Why Tier-1?


    +
    +
      +
    • Easy to Understand: Every on-call engineer should be familiar with Tier-1 tasks.
    • +
    • Training Ground: This is where engineers start their on-call career. It's purposefully kept simple so that it's not overwhelming right off the bat.
    • +
    • Runbook/recipe driven: Every alert is attached to a comprehensive runbook, making it easy for every engineer to follow.
    • +

    +

    Onboarding Process: From 6 Months to 6 Weeks


    +
    +So how did we cut down the onboarding time so drastically? Here’s the breakdown of our process:
    +
    +Knowledge Transfer (KT) Sessions: We kicked things off with more than 10 KT sessions, complete with video recordings. These sessions are comprehensive and cover everything from the basics to some more advanced topics. The recorded sessions mean that new engineers can revisit them anytime they need a refresher.
    +
    +Shadowing Sessions: Each new engineer undergoes two on-call week shadowing sessions. This hands-on experience is invaluable. They get to see real-time incident handling and resolution, gaining practical knowledge that's hard to get from just reading docs.
    +
    +Comprehensive Runbooks: We created 64 runbooks (by the time writing this probably more than 100) that are composable like Lego bricks. Each runbook covers a specific scenario and guides the engineer step-by-step to resolution. Pairing these with monitoring alerts linked directly to Confluence docs, and from there to the respective runbooks, ensures every alert can be navigated with ease (well, there are always exceptions to the rule...).
    +
    +Self-Sufficiency & Confidence Building: With all these resources at their fingertips, our on-call engineers become self-sufficient for most of the common issues they'll face (new starters can now handle around 80% of the most common issue after 6 weeks they had joined the company). This boosts their confidence and ensures they can handle Tier-1 incidents independently.
    +
    +Documentation and Feedback Loop: Continuous improvement is key. We regularly update our documentation based on feedback from the engineers. This makes our process even more robust and user-friendly.
    +
    +

    It's All About the Tiers


    +
    +Let’s briefly touch on the Tier levels:
    +
    +
      +
    • Tier 1: Easy and foundational tasks. Perfect for getting new engineers started. This covers around 80% of all on-call cases we face. This is what we trained on.
    • +
    • Tier 2: Slightly more complex, requiring more background knowledge. We trained on some of the topics but not all.
    • +
    • Tier 3: Requires a good understanding of the platform/architecture. Likely needs KT sessions with domain experts.
    • +
    • Tier DE (Domain Expert): The heavy hitters. Domain experts are required for these tasks.
    • +

    +

    Growing into Higher Tiers


    +
    +From Tier-1, engineers naturally grow into Tier-2 and beyond. The structured training and gradual increase in complexity help ensure a smooth transition as they gain experience and confidence. The key here is that engineers stay curous and engaged in the on-call, so that they always keep learning.
    +
    +

    Keeping Runbooks Up to Date


    +
    +It is important that runbooks are not a "project to be finished"; runbooks have to be maintained and updated over time. Sections may change, new runbooks need to be added, and old ones can be deleted. So the acceptance criteria of an on-call shift would not just be reacting to alerts and incidents, but also reviewing and updating the current runbooks.
    +
    +

    Conclusion


    +
    +By structuring the onboarding process with KT sessions, shadowing, comprehensive runbooks, and a feedback loop, we've been able to fast-track the process from six months to just six weeks. This not only prepares our engineers for the on-call rotation quicker but also ensures they're confident and capable when handling incidents.
    +
    +If you're looking to optimize your on-call onboarding process, these strategies could be your ticket to a more efficient and effective transition. Happy on-calling!
    +
    +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 new file mode 100644 index 00000000..f789e22c --- /dev/null +++ b/gemfeed/2024-10-02-gemtexter-3.0.0-lets-gemtext-again-4.html @@ -0,0 +1,110 @@ + + + + +Gemtexter 3.0.0 - Let's Gemtext again⁴ + + + + + +

    +Home | Markdown | Gemini +

    +

    Gemtexter 3.0.0 - Let's Gemtext again⁴


    +
    +Published at 2024-10-01T21:46:26+03:00
    +
    +I proudly announce that I've released Gemtexter version 3.0.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash.
    +
    +https://codeberg.org/snonux/gemtexter
    +
    +
    +-=[ typewriters ]=-  1/98
    +                                      .-------.
    +       .-------.                     _|~~ ~~  |_
    +      _|~~ ~~  |_       .-------.  =(_|_______|_)
    +    =(_|_______|_)=    _|~~ ~~  |_   |:::::::::|    .-------.
    +      |:::::::::|    =(_|_______|_)  |:::::::[]|   _|~~ ~~  |_
    +      |:::::::[]|      |:::::::::|   |o=======.| =(_|_______|_)
    +      |o=======.|      |:::::::[]|   `"""""""""`   |:::::::::|
    + jgs  `"""""""""`      |o=======.|                 |:::::::[]|
    +  mod. by Paul Buetow  `"""""""""`                 |o=======.|
    +                                                   `"""""""""`
    +
    +
    +

    Table of Contents


    +
    +
    +

    Why Bash?


    +
    +This project is too complex for a Bash script. Writing it in Bash was to try out how maintainable a "larger" Bash script could be. It's still pretty maintainable and helps me try new Bash tricks here and then!
    +
    +Let's list what's new!
    +
    +

    HTML exact variant is the only variant


    +
    +The last version of Gemtexter introduced the HTML exact variant, which wasn't enabled by default. This version of Gemtexter removes the previous (inexact) variant and makes the exact variant the default. This is a breaking change, which is why there is a major version bump of Gemtexter. Here is a reminder of what the exact variant was:
    +
    +Gemtexter is there to convert your Gemini Capsule into other formats, such as HTML and Markdown. An HTML exact variant can now be enabled in the gemtexter.conf by adding the line declare -rx HTML_VARIANT=exact. The HTML/CSS output changed to reflect a more exact Gemtext appearance and to respect the same spacing as you would see in the Geminispace.
    +
    +

    Table of Contents auto-generation


    +
    +Just add...
    +
    +
    + << template::inline::toc
    +
    +
    +...into a Gemtexter template file and Gemtexter will automatically generate a table of contents for the page based on the headings (see this page's ToC for example). The ToC will also have links to the relevant sections in HTML and Markdown output. The Gemtext format does not support links, so the ToC will simply be displayed as a bullet list.
    +
    +

    Configurable themes


    +
    +It was always possible to customize the style of a Gemtexter's resulting HTML page, but all the config options were scattered across multiple files. Now, the CSS style, web fonts, etc., are all configurable via themes.
    +
    +Simply configure HTML_THEME_DIR in the gemtexter.conf file to the corresponding directory. For example:
    +
    + +
    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.
    +
    +

    No use of webfonts by default


    +
    +The default theme is now "back to the basics" and does not utilize any web fonts. The previous themes are still part of the release and can be easily configured. These are currently the future and business themes. You can check them out from the themes directory.
    +
    +

    More


    +
    +Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Other related posts are:
    +
    +2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴ (You are currently reading this)
    +2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
    +2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
    +2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
    +2021-06-05 Gemtexter - One Bash script to rule it all
    +2021-04-24 Welcome to the Geminispace
    +
    +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 new file mode 100644 index 00000000..7fc61a59 --- /dev/null +++ b/gemfeed/2024-10-24-staff-engineer-book-notes.html @@ -0,0 +1,157 @@ + + + + +'Staff Engineer' book notes + + + + + +

    +Home | Markdown | Gemini +

    +

    "Staff Engineer" book notes


    +
    +Published at 2024-10-24T20:57:44+03:00
    +
    +These are my personal takeaways after reading "Staff Engineer" by Will Larson. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.
    +
    +
    +         ,..........   ..........,
    +     ,..,'          '.'          ',..,
    +    ,' ,'            :            ', ',
    +   ,' ,'             :             ', ',
    +  ,' ,'              :              ', ',
    + ,' ,'............., : ,.............', ',
    +,'  '............   '.'   ............'  ',
    + '''''''''''''''''';''';''''''''''''''''''
    +                    '''
    +
    +
    +

    Table of Contents


    +
    +
    +

    The Four Archetypes of a Staff Engineer


    +
    +Larson breaks down the role of a Staff Engineer into four main archetypes, which can help frame how you approach the role:
    +
    +
      +
    • Tech Lead: Focuses on the technical direction of a team, ensuring high-quality execution, architecture, and aligning the team around shared goals.
    • +
    • Solver: Gets pulled into complex, high-impact problems that often involve many teams or systems, operating as a fixer or troubleshooter.
    • +
    • Architect: Works on the long-term technical vision for an organization, setting standards and designing systems that will scale and last over time.
    • +
    • Right Hand: Functions as a trusted technical advisor to leadership, providing input on strategy, long-term decisions, and navigating organizational politics.
    • +

    +

    Influence and Impact over Authority


    +
    +As a Staff Engineer, influence is often more important than formal authority. You’ll rarely have direct control over teams or projects but will need to drive outcomes by influencing peers, other teams, and leadership. It’s about understanding how to persuade, align, and mentor others to achieve technical outcomes.
    +
    +

    Breadth and Depth of Knowledge


    +
    +Staff Engineers often need to maintain a breadth of knowledge across various areas while maintaining depth in a few. This can mean keeping a high-level understanding of several domains (e.g., infrastructure, security, product development) but being able to dive deep when needed in certain core areas.
    +
    +

    Mentorship and Sponsorship


    +
    +An important part of a Staff Engineer’s role is mentoring others, not just in technical matters but in career development as well. Sponsorship goes a step beyond mentorship, where you actively advocate for others, create opportunities for them, and push them toward growth.
    +
    +

    Managing Up and Across


    +
    +Success as a Staff Engineer often depends on managing up (influencing leadership and setting expectations) and managing across (working effectively with peers and other teams). This is often tied to communication skills, the ability to advocate for technical needs, and fostering alignment across departments or organizations.
    +
    +

    Strategic Thinking


    +
    +While Senior Engineers may focus on execution, Staff Engineers are expected to think strategically, making decisions that will affect the company or product months or years down the line. This means balancing short-term execution needs with long-term architectural decisions, which may require challenging short-term pressures.
    +
    +

    Emotional Intelligence


    +
    +The higher you go in engineering roles, the more soft skills, particularly emotional intelligence (EQ), come into play. Building relationships, resolving conflicts, and understanding the broader emotional dynamics of the team and organization become key parts of your role.
    +
    +
    +
    +Staff Engineers are often placed in situations with high ambiguity—whether in defining the problem space, coming up with a solution, or aligning stakeholders. The ability to operate effectively in these unclear areas is critical to success.
    +
    +

    Visible and Invisible Work


    +
    +Much of the work done by Staff Engineers is invisible. Solving complex problems, creating alignment, or influencing decisions doesn’t always result in tangible code, but it can have a massive impact. Larson emphasizes that part of the role is being comfortable with this type of invisible contribution.
    +
    +

    Scaling Yourself


    +
    +At the Staff Engineer level, you must scale your impact beyond direct contribution. This can involve improving documentation, developing repeatable processes, mentoring others, or automating parts of the workflow. The idea is to enable teams and individuals to be more effective, even when you’re not directly involved.
    +
    +

    Career Progression and Title Inflation


    +
    +Larson touches on how different companies have varying definitions of "Staff Engineer," and titles don’t always correlate directly with responsibility or skill. He emphasizes the importance of focusing more on the work you're doing and the impact you're having, rather than the title itself.
    +
    +These additional points reflect more of the strategic, interpersonal, and leadership aspects that go beyond the technical expertise expected at this level. The role of a Staff Engineer is often about balancing high-level strategy with technical execution, while influencing teams and projects in a sustainable, long-term way.
    +
    +

    Not a faster Senior Engineer


    +
    +
      +
    • A Staff engineer is more than just a faster Senior.
    • +
    • A staff engineer is not a senior engineer but a bit better.
    • +

    +It's important to know what work or which role most energizes you. A Staff engineer is not a more senior engineer. A Staff engineer also fits into another archetype.
    +
    +As a staff engineer, you are always expected to go beyond your comfort zone and learn new things.
    +
    +Your job sometimes will feel like an SEM and sometimes strangely similar to your senior roles.
    +
    +A Staff engineer is, like a Manager, a leader. However, being a Manager is a specific job. Leaders can apply to any job, especially to Staff engineers.
    +
    +

    The Balance


    +
    +The more senior you become, the more responsibility you will have to cope with them in less time. Balance your speed of progress with your personal life, don't work late hours and don't skip these personal care events.
    +
    +Do fewer things but do them better. Everything done will accelerate the organization. Everything else will drag it down—quality over quantity.
    +
    +Don't work at ten things and progress slowly; focus on one thing and finish it.
    +
    +Only spend some of the time firefighting. Have time for deep thinking. Only deep think some of the time. Otherwise, you lose touch with reality.
    +
    +Sebactical: Take at least six months. Otherwise, it won't be as restored.
    +
    +

    More things


    +
    +
      +
    • Provide simple but widely used tools. Complex and powerful tools will have power users but only a very few. All others will not use the tool.
    • +
    • In meetings, when someone is inactive, try to pull him in. Pull in max one person at a time. Don't open the discussion to multiple people.
    • +
    • Get used to writing things down and repeating yourself. You will scale yourself much more.
    • +
    • Title inflation: skills correspond to work, but the titles don't.
    • +

    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Other book notes of mine are:
    +
    +2024-10-24 "Staff Engineer" book notes (You are currently reading this)
    +2024-07-07 "The Stoic Challenge" book notes
    +2024-05-01 "Slow Productivity" book notes
    +2023-11-11 "Mind Management" book notes
    +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
    +2023-05-06 "The Obstacle is the Way" book notes
    +2023-04-01 "Never split the difference" book notes
    +2023-03-16 "The Pragmatic Programmer" book notes
    +
    +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 new file mode 100644 index 00000000..5468cd1d --- /dev/null +++ b/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html @@ -0,0 +1,196 @@ + + + + +f3s: Kubernetes with FreeBSD - Part 1: Setting the stage + + + + + +

    +Home | Markdown | Gemini +

    +

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


    +
    +Published at 2024-11-16T23:20:14+02:00
    +
    +This is the first blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution I will use on FreeBSD-based physical machines.
    +
    +I will post a new entry every month or so (there are too many other side projects for more frequent updates—I bet you can understand).
    +
    +These are all the posts so far:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage (You are currently reading this)
    +
    +f3s logo
    +
    +Logo was generated by ChatGPT.
    +
    +Let's begin...
    +
    +

    Table of Contents


    +
    +
    +

    Why this setup?


    +
    +My previous setup was great for learning Terraform and AWS, but it is too expensive. Costs are under control there, but only because I am shutting down all containers after use (so they are offline ninety percent of the time and still cost around $20 monthly). With the new setup, I could run all containers 24/7 at home, which would still be cheaper in terms of electricity consumption. I have a 50 MBit/s uplink (I could have more if I wanted, but it is plenty for my use case already).
    +
    +From babylon5.buetow.org to .cloud
    +
    +Migrating off all my containers from AWS ECS means I need a reliable and scalable environment to host my workloads. I wanted something:
    +
    +
      +
    • To self-host all my open-source apps (Docker containers).
    • +
    • Fully under my control (goodbye cloud vendor lock-in).
    • +
    • Secure and redundant.
    • +
    • Cost-efficient (after the initial hardware investment).
    • +
    • Something I can poke around with and also pick up new skills.
    • +

    +

    The infrastructure


    +
    +This is still in progress, and I need to own the hardware. But in this first part of the blog series, I will outline what I intend to do.
    +
    +Diagram
    +
    +

    Physical FreeBSD nodes and Linux VMs


    +
    +The setup starts with three physical FreeBSD nodes deployed into my home LAN. On these, I'm going to run Rocky Linux virtual machines with bhyve. Why Linux VMs in FreeBSD and not Linux directly? I want to leverage the great ZFS integration in FreeBSD (among other features), and I have been using FreeBSD for a while in my home lab. And with bhyve, there is a very performant hypervisor available which makes the Linux VMs de-facto run at native speed (another use case of mine would be maybe running a Windows bhyve VM on one of the nodes - but out of scope for this blog series).
    +
    +https://www.freebsd.org/
    +https://wiki.freebsd.org/bhyve
    +
    +I selected Rocky Linux because it comes with long-term support (I don't want to upgrade the VMs every 6 months). Rocky Linux 9 will reach its end of life in 2032, which is plenty of time! Of course, there will be minor upgrades, but nothing will significantly break my setup.
    +
    +https://rockylinux.org/
    +https://wiki.rockylinux.org/rocky/version/
    +
    +Furthermore, I am already using "RHEL-family" related distros at work and Fedora on my main personal laptop. Rocky Linux belongs to the same type of Linux distribution family, so I already feel at home here. I also used Rocky 9 before I switched to AWS ECS. Now, I am switching back in one sense or another ;-)
    +
    +

    Kubernetes with k3s


    +
    +These Linux VMs form a three-node k3s Kubernetes cluster, where my containers will reside moving forward. The 3-node k3s cluster will be highly available (in etcd mode), and all apps will probably be deployed with Helm. Prometheus will also be running in k3s, collecting time-series metrics and handling monitoring. Additionally, a private Docker registry will be deployed into the k3s cluster, where I will store some of my self-created Docker images. k3s is the perfect distribution of Kubernetes for homelabbers due to its simplicity and the inclusion of the most useful features out of the box!
    +
    +https://k3s.io/
    +
    +

    HA volumes for k3s with HAST/ZFS and NFS


    +
    +Persistent storage for the k3s cluster will be handled by highly available (HA) NFS shares backed by ZFS on the FreeBSD hosts.
    +
    +On two of the three physical FreeBSD nodes, I will add a second SSD drive to each and dedicate it to a zhast ZFS pool. With HAST (FreeBSD's solution for highly available storage), this pool will be replicated at the byte level to a standby node.
    +
    +A virtual IP (VIP) will point to the master node. When the master node goes down, the VIP will failover to the standby node, where the ZFS pool will be mounted. An NFS server will listen to both nodes. k3s will use the VIP to access the NFS shares.
    +
    +FreeBSD Wiki: Highly Available Storage
    +
    +You can think of DRBD being the Linux equivalent to FreeBSD's HAST.
    +
    +

    OpenBSD/relayd to the rescue for external connectivity


    +
    +All apps should be reachable through the internet (e.g., from my phone or computer when travelling). For external connectivity and TLS management, I've got two OpenBSD VMs (one hosted by OpenBSD Amsterdam and another hosted by Hetzner) handling public-facing services like DNS, relaying traffic, and automating Let's Encrypt certificates.
    +
    +All of this (every Linux VM to every OpenBSD box) will be connected via WireGuard tunnels, keeping everything private and secure. There will be 6 WireGuard tunnels (3 k3s nodes times two OpenBSD VMs).
    +
    +https://en.wikipedia.org/wiki/WireGuard
    +
    +So, when I want to access a service running in k3s, I will hit an external DNS endpoint (with the authoritative DNS servers being the OpenBSD boxes). The DNS will resolve to the master OpenBSD VM (see my KISS highly-available with OpenBSD blog post), and from there, the relayd process (with a Let's Encrypt certificate—see my Let's Encrypt with OpenBSD and Rex blog post) will accept the TCP connection and forward it through the WireGuard tunnel to a reachable node port of one of the k3s nodes, thus serving the traffic.
    +
    +KISS high-availability with OpenBSD
    +Let's Encrypt with OpenBSD and Rex
    +
    +The OpenBSD setup described here already exists and is ready to use. The only thing that does not yet exist is the configuration of relayd to forward requests to k3s through the WireGuard tunnel(s).
    +
    +

    Data integrity


    +
    +

    Periodic backups


    +
    +Let's face it, backups are non-negotiable.
    +
    +On the HAST master node, incremental and encrypted ZFS snapshots are created daily and automatically backed up to AWS S3 Glacier Deep Archive via CRON. I have a bunch of scripts already available, which I currently use for a similar purpose on my FreeBSD Home NAS server (an old ThinkPad T440 with an external USB drive enclosure, which I will eventually retire when the HAST setup is ready). I will copy them and slightly modify them to fit the purpose.
    +
    +There's also zfstools in the ports, which helps set up an automatic snapshot regime:
    +
    +https://www.freshports.org/sysutils/zfstools
    +
    +The backup scripts also perform some zpool scrubbing now and then. A scrub once in a while keeps the trouble away.
    +
    +

    Power protection


    +
    +Power outages are regularly in my area, so a UPS keeps the infrastructure running during short outages and protects the hardware. I'm still trying to decide which hardware to get, and I still need one, as my previous NAS is simply an older laptop that already has a battery for power outages. However, there are plenty of options to choose from. My main criterion is that the UPS should be silent, as the whole setup will be installed in an upper shelf unit in my daughter's room. ;-)
    +
    +

    Monitoring: Keeping an eye on everything


    +
    +Robust monitoring is vital to any infrastructure, especially one as distributed as mine. I've thought about a setup that ensures I'll always be aware of what's happening in my environment.
    +
    +

    Prometheus and Grafana


    +
    +Inside the k3s cluster, Prometheus will be deployed to handle metrics collection. It will be configured to scrape data from my Kubernetes workloads, nodes, and any services I monitor. Prometheus also integrates with Alertmanager to generate alerts based on predefined thresholds or conditions.
    +
    +https://prometheus.io
    +
    +For visualization, Grafana will be deployed alongside Prometheus. Grafana lets me build dynamic, customizable dashboards that provide a real-time view of everything from resource utilization to application performance. Whether it's keeping track of CPU load, memory usage, or the health of Kubernetes pods, Grafana has it covered. This will also make troubleshooting easier, as I can quickly pinpoint where issues are arising.
    +
    +https://grafana.com
    +
    +

    Gogios: My custom alerting system


    +
    +Alerts generated by Prometheus are forwarded to Alertmanager, which I will configure to work with Gogios, a lightweight monitoring and alerting system I wrote myself. Gogios runs on one of my OpenBSD VMs. At regular intervals, Gogios scrapes the alerts generated in the k3s cluster and notifies me via Email.
    +
    +KISS server monitoring with Gogios
    +
    +Ironically, I implemented Gogios to avoid using more complex alerting systems like Prometheus, but here we go—it integrates well now.
    +
    +

    What's after this all?


    +
    +This setup may be just the beginning. Some ideas I'm thinking about for the future:
    +
    +
      +
    • Adding more FreeBSD nodes (in different physical locations, maybe at my wider family's places? WireGuard would make it possible!) for better redundancy. (HA storage then might be trickier)
    • +
    • Deploying more Docker apps (data-intensive ones, like a picture gallery, my entire audiobook catalogue, or even a music server) to k3s.
    • +

    +For now, though, I'm focused on completing the migration from AWS ECS and getting all my Docker containers running smoothly in k3s.
    +
    +What's your take on self-hosting? Are you planning to move away from managed cloud services? Stay tuned for the second part of this series, where I will likely write about the hardware and the OS setups.
    +
    +Read the next post of this series:
    +
    +f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +
    +Other *BSD-related posts:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage (You are currently reading this)
    +2024-04-01 KISS high-availability with OpenBSD
    +2024-01-13 One reason why I love OpenBSD
    +2022-10-30 Installing DTail on OpenBSD
    +2022-07-30 Let's Encrypt with OpenBSD and Rex
    +2016-04-09 Jails and ZFS with Puppet on FreeBSD
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +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 new file mode 100644 index 00000000..1ecf2f2c --- /dev/null +++ b/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html @@ -0,0 +1,375 @@ + + + + +f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation + + + + + +

    +Home | Markdown | Gemini +

    +

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


    +
    +Published at 2024-12-02T23:48:21+02:00
    +
    +This is the second blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution I will use on FreeBSD-based physical machines.
    +
    +We set the stage last time; this time, we will set up the hardware for this project.
    +
    +These are all the posts so far:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation (You are currently reading this)
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +
    +f3s logo
    +
    +Logo was generated by ChatGPT.
    +
    +Let's continue...
    +
    +

    Table of Contents


    +
    +
    +

    Deciding on the hardware


    +
    +Note that the OpenBSD VMs included in the f3s setup (which will be used later in this blog series for internet ingress - as you know from the first part of this blog series) are already there. These are virtual machines that I rent at OpenBSD Amsterdam and Hetzner.
    +
    +https://openbsd.amsterdam
    +https://hetzner.cloud
    +
    +This means that the FreeBSD boxes need to be covered, which will later be running k3s in Linux VMs via bhyve hypervisor.
    +
    +I've been considering whether to use Raspberry Pis or look for alternatives. It turns out that complete N100-based mini-computers aren't much more expensive than Raspberry Pi 5s, and they don't require assembly. Furthermore, I like that they are AMD64 and not ARM-based, which increases compatibility with some applications (e.g., I might want to virtualize Windows (via bhyve) on one of those, though that's out of scope for this blog series).
    +
    +

    Not ARM but Intel N100


    +
    +I needed something compact, efficient, and capable enough to handle the demands of a small-scale Kubernetes cluster and preferably something I don't have to assemble a lot. After researching, I decided on the Beelink S12 Pro with Intel N100 CPUs.
    +
    +Beelink Mini S12 Pro N100 official page
    +
    +The Intel N100 CPUs are built on the "Alder Lake-N" architecture. These chips are designed to balance performance and energy efficiency well. With four cores, they're more than capable of running multiple containers, even with moderate workloads. Plus, they consume only around 8W of power (ok, that's more than the Pis...), keeping the electricity bill low enough and the setup quiet - perfect for 24/7 operation.
    +
    +Beelink preparation
    +
    +The Beelink comes with the following specs:
    +
    +
      +
    • 12th Gen Intel N100 processor, with four cores and four threads, and a maximum frequency of up to 3.4 GHz.
    • +
    • 16 GB of DDR4 RAM, with a maximum (official) size of 16 GB (but people could install 32 GB on it).
    • +
    • 500 GB M.2 SSD, with the option to install a 2nd 2.5 SSD drive (which I want to make use of later in this blog series).
    • +
    • GBit ethernet
    • +
    • Four USB 3.2 Gen2 ports (maybe I want to mount something externally at some point)
    • +
    • Dimensions and weight: 115*102*39mm, 280g
    • +
    • Silent cooling system.
    • +
    • HDMI output (needed only for the initial installation and maybe for troubleshooting later)
    • +
    • Auto power on via WoL (may make use of it)
    • +
    • Wi-Fi (not going to use it)
    • +

    +I bought three (3) of them for the cluster I intend to build.
    +
    +
    +
    +Unboxing was uneventful. Every Beelink PC came with:
    +
    +
      +
    • An AC power adapter
    • +
    • An HDMI cable
    • +
    • A VESA mount with screws (not using it as of now)
    • +
    • Some manuals
    • +
    • The pre-assembled Beelink PC itself.
    • +
    • A "Hello" post card (??)
    • +

    +Overall, I love the small form factor.
    +
    +

    Network switch


    +
    +I went with the tp-link mini 5-port switch, as I had a spare one available. That switch will be plugged into my wall ethernet port, which connects directly to my fiber internet router with 100 Mbit/s down and 50 Mbit/s upload speed.
    +
    +Switch
    +
    +

    Installing FreeBSD


    +
    +

    Base install


    +
    +First, I downloaded the boot-only ISO of the latest FreeBSD release and dumped it on a USB stick via my Fedora laptop:
    +
    + +
    [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.
    +
    +The installation was uneventful. I selected:
    +
    +
      +
    • Guided ZFS on root (pool zroot)
    • +
    • Unencrypted ZFS (I will encrypt separate datasets later; I want it to be able to boot without manual interaction)
    • +
    • Static IP configuration (to ensure that the boxes always have the same IPs, even after switching the router/DHCP server)
    • +
    • I decided to enable the SSH daemon, NTP server, and NTP time synchronization at boot, and I also enabled powerd for automatic CPU frequency scaling.
    • +
    • In addition to root, I added a personal user, paul, whom I placed in the wheel group.
    • +

    +After doing all that three times (once for each Beelink PC), I had three ready-to-use FreeBSD boxes! Their hostnames are f0, f1 and f2!
    +
    +Beelink installation
    +
    +

    Latest patch level and customizing /etc/hosts


    +
    +After the first boot, I upgraded to the latest FreeBSD patch level as follows:
    +
    + +
    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:
    +
    + +
    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
    +
    +
    +You might wonder why bother using the hosts file? Why not use DNS properly? The reason is simplicity. I don't manage 100 hosts, only a few here and there. Having an OpenWRT router in my home, I could also configure everything there, but maybe I'll do that later. For now, keep it simple and straightforward.
    +
    +

    After install


    +
    +After that, I installed the following additional packages:
    +
    + +
    root@f0:~ # pkg install helix doas zfs-periodic uptimed
    +
    +
    +

    Helix editor


    +
    +Helix? It's my favourite text editor. I have nothing against vi but like hx (Helix) more!
    +
    +https://helix-editor.com/
    +
    +

    doas


    +
    +doas? It's a pretty neat (and KISS) replacement for sudo. It has far fewer features than sudo, which is supposed to make it more secure. Its origin is the OpenBSD project. For doas, I accepted the default configuration (where users in the wheel group are allowed to run commands as root):
    +
    + +
    root@f0:~ # cp /usr/local/etc/doas.conf.sample /usr/local/etc/doas.conf
    +
    +
    +https://man.openbsd.org/doas
    +
    +

    Periodic ZFS snapshotting


    +
    +zfs-periodic is a nifty tool for automatically creating ZFS snapshots. I decided to go with the following configuration here:
    +
    + +
    root@f0:~ # cat <<END >>/etc/periodic.conf
    +daily_zfs_snapshot_enable="YES"
    +daily_zfs_snapshot_pools="zroot"
    +daily_zfs_snapshot_keep="7"
    +weekly_zfs_snapshot_enable="YES"
    +weekly_zfs_snapshot_pools="zroot"
    +weekly_zfs_snapshot_keep="5"
    +monthly_zfs_snapshot_enable="YES"
    +monthly_zfs_snapshot_pools="zroot"
    +monthly_zfs_snapshot_keep="6"
    +END
    +
    +
    +https://github.com/ross/zfs-periodic
    +
    +

    Uptime tracking


    +
    +uptimed? I like to track my uptimes. This is how I configured the daemon:
    +
    + +
    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:
    +
    + +
    root@f0:~ # service uptimed enable
    +root@f0:~ # service uptimed start
    +
    +
    +To check the current uptime stats, I can now run uprecords:
    +
    + +
     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:
    +
    +Unveiling guprecords.raku: Global Uptime Records with Raku-
    +https://github.com/rpodgorny/uptimed
    +
    +

    Hardware check


    +
    +

    Ethernet


    +
    +Works. Nothing eventful, really. It's a cheap Realtek chip, but it will do what it is supposed to do.
    +
    + +
    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


    +
    +All there:
    +
    + +
    paul@f0:~ % sysctl hw.physmem
    +hw.physmem: 16902905856
    +
    +
    +
    +

    CPUs


    +
    +They work:
    +
    + +
    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


    +
    +With powerd running, CPU freq is dowthrottled when the box isn't jam-packed. To stress it a bit, I run ubench to see the frequencies being unthrottled again:
    +
    + +
    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.
    +
    +Idle consumption.
    +
    +

    Conclusion


    +
    +The Beelink S12 Pro with Intel N100 CPUs checks all the boxes for a k3s project: Compact, efficient, expandable, and affordable. Its compatibility with both Linux and FreeBSD makes it versatile for other use cases, whether as part of your cluster or as a standalone system. If you’re looking for hardware that punches above its weight for Kubernetes, this little device deserves a spot on your shortlist.
    +
    +Beelinks stacked
    +
    +To ease cable management, I need to get shorter ethernet cables. I will place the tower on my shelf, where most of the cables will be hidden (together with a UPS, which will also be added to the setup).
    +
    +Read the next post of this series:
    +
    +f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +
    +Other *BSD-related posts:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation (You are currently reading this)
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +2024-04-01 KISS high-availability with OpenBSD
    +2024-01-13 One reason why I love OpenBSD
    +2022-10-30 Installing DTail on OpenBSD
    +2022-07-30 Let's Encrypt with OpenBSD and Rex
    +2016-04-09 Jails and ZFS with Puppet on FreeBSD
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +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 new file mode 100644 index 00000000..4f9e7e84 --- /dev/null +++ b/gemfeed/2024-12-15-random-helix-themes.html @@ -0,0 +1,121 @@ + + + + +Random Helix Themes + + + + + +

    +Home | Markdown | Gemini +

    +

    Random Helix Themes


    +
    +Published at 2024-12-15T13:55:05+02:00; Last updated 2024-12-18
    +
    +I thought it would be fun to have a random Helix theme every time I open a new shell. Helix is the text editor I use.
    +
    +https://helix-editor.com/
    +
    +So I put this into my zsh dotfiles (in some editor.zsh.source in my ~ directory):
    +
    + +
    export EDITOR=hx
    +export VISUAL=$EDITOR
    +export GIT_EDITOR=$EDITOR
    +export HELIX_CONFIG_DIR=$HOME/.config/helix
    +
    +editor::helix::random_theme () {
    +    # May add more theme search paths based on OS. This one is
    +    # for Fedora Linux, but there is also MacOS, etc.
    +    local -r theme_dir=/usr/share/helix/runtime/themes
    +    if [ ! -d $theme_dir ]; then
    +        echo "Helix theme dir $theme_dir doesnt exist"
    +        return 1
    +    fi
    +
    +    local -r config_file=$HELIX_CONFIG_DIR/config.toml
    +    local -r random_theme="$(basename "$(ls $theme_dir \
    +        | grep -v random.toml | grep .toml | sort -R \
    +        | head -n 1)" | cut -d. -f1)"
    +
    +    sed "/^theme =/ { s/.*/theme = \"$random_theme\"/; }" \
    +        $config_file > $config_file.tmp && 
    +        mv $config_file.tmp $config_file
    +}
    +
    +if [ -f $HELIX_CONFIG_DIR/config.toml ]; then
    +    editor::helix::random_theme
    +fi
    +
    +
    +So every time I open a new terminal or shell, editor::helix::random_theme gets called, which randomly selects a theme from all installed ones and updates the helix config accordingly.
    +
    + +
    [paul@earth] ~ % editor::helix::random_theme
    +[paul@earth] ~ % head -n 1 ~/.config/helix/config.toml
    +theme = "jellybeans"
    +[paul@earth] ~ % editor::helix::random_theme
    +[paul@earth] ~ % head -n 1 ~/.config/helix/config.toml
    +theme = "rose_pine"
    +[paul@earth] ~ % editor::helix::random_theme
    +[paul@earth] ~ % head -n 1 ~/.config/helix/config.toml
    +theme = "noctis"
    +[paul@earth] ~ %
    +
    +
    +

    A better version


    +
    +Update 2024-12-18: This is an improved version, which works cross platform (e.g., also on MacOS) and multiple theme directories:
    +
    + +
    export EDITOR=hx
    +export VISUAL=$EDITOR
    +export GIT_EDITOR=$EDITOR
    +export HELIX_CONFIG_DIR=$HOME/.config/helix
    +
    +editor::helix::theme::get_random () {
    +    for dir in $(hx --health \
    +        | awk '/^Runtime directories/ { print $3 }' | tr ';' ' '); do
    +        if [ -d $dir/themes ]; then
    +            ls $dir/themes
    +        fi
    +    done | grep -F .toml | sort -R | head -n 1 | cut -d. -f1
    +}
    +
    +editor::helix::theme::set () {
    +    local -r theme="$1"; shift
    +
    +    local -r config_file=$HELIX_CONFIG_DIR/config.toml
    +
    +    sed "/^theme =/ { s/.*/theme = \"$theme\"/; }" \
    +        $config_file > $config_file.tmp && 
    +        mv $config_file.tmp $config_file
    +}
    +
    +if [ -f $HELIX_CONFIG_DIR/config.toml ]; then
    +    editor::helix::theme::set $(editor::helix::theme::get_random)
    +fi
    +
    +
    +I hope you had some fun. E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Back to the main site
    + + + diff --git a/gemfeed/2025-01-01-posts-from-october-to-december-2024.html b/gemfeed/2025-01-01-posts-from-october-to-december-2024.html new file mode 100644 index 00000000..e8cf61fc --- /dev/null +++ b/gemfeed/2025-01-01-posts-from-october-to-december-2024.html @@ -0,0 +1,358 @@ + + + + +Posts from October to December 2024 + + + + + +

    +Home | Markdown | Gemini +

    +

    Posts from October to December 2024


    +
    +Published at 2024-12-31T18:09:58+02:00
    +
    +Happy new year!
    +
    +These are my social media posts from the last three months. I keep them here to reflect on them and also to not lose them. Social media networks come and go and are not under my control, but my domain is here to stay.
    +
    +These are from Mastodon and LinkedIn. Have a look at my about page for my social media profiles. This list is generated with Gos, my social media platform sharing tool.
    +
    +My about page
    +https://codeberg.org/snonux/gos
    +
    +

    Table of Contents


    +
    +
    +

    Posts for 202410 202411 202412


    +
    +

    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
    +
    +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.
    +
    +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.
    +
    +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?
    +
    +firehydrant.com/blog/hot-take-dont-provide-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.
    +
    +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?
    +
    +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
    +
    +blog.cloudflare.com/nl-nl/improving-platform-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:
    +
    +foo.zone/gemfeed/2024-09-07-projects-i-support.gmi (Gemini)
    +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
    +
    +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.
    +
    +foo.zone/gemfeed/2024-10-24-staff-engineer-book-notes.gmi (Gemini)
    +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!
    +
    +foo.zone/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.gmi (Gemini)
    +foo.zone/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html
    +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
    +
    +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.
    +
    +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
    +
    +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:
    +
    +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
    +
    +www.calhoun.io/using-functional-options-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 #kubernetes #wireguard #zfs #nfs #ha #relayd #k8s #selfhosting #homelab
    +
    +foo.zone/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.gmi (Gemini)
    +foo.zone/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html
    +
    +

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


    +
    +Wondering to which #web #browser I should switch now personally ...
    +
    +www.osnews.com/story/141100/mozilla-fo..-..dvocacy-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.
    +
    +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
    +
    +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
    +
    +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:
    +
    +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
    +
    +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
    +
    +unexpected-go.com/you-cant-remove-a-nan-key-from-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
    +
    +foo.zone/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.gmi (Gemini)
    +foo.zone/gemfeed/2024-12-03-f3s-kubernetes-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...
    +
    +newsletter.pragmaticengineer.com/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!
    +
    +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
    +
    +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"
    +
    +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
    +
    +www.osnews.com/story/140941/go-plan9-memo-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
    +
    +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
    +
    +crys.site/blog/2024/reinventint-the-weel/
    +dtail.dev
    +
    +

    Quick trick to get Helix themes selected ...


    +
    +Quick trick to get Helix themes selected randomly #HelixEditor
    +
    +foo.zone/gemfeed/2024-12-15-random-helix-themes.gmi (Gemini)
    +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
    +
    +surfingcomplexity.blog/2024/12/14/quic..-..ecent-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.
    +
    +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
    +
    +testdouble.com/insights/why-product-ma..-..s-accelerate-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
    +
    +cpu.land/
    +
    +

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


    +
    +Indeed, useful to know this stuff! #sre
    +
    +biriukov.dev/docs/resolver-dual-stack-..-..resolvers-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:
    +
    +xeiaso.net/notes/2024/pop-quiz-tar/
    +
    +

    My New Year's resolution is not to start any ...


    +
    +My New Year's resolution is not to start any new non-fiction books (or only very few) but to re-read and listen to my favorites, which I read to reflect on and see things from different perspectives. Every time you re-read a book, you gain new insights.<nil>17491
    +
    +Other related posts:
    +
    +2025-01-01 Posts from October to December 2024 (You are currently reading this)
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Back to the main site
    + + + diff --git a/gemfeed/2025-01-15-working-with-an-sre-interview.html b/gemfeed/2025-01-15-working-with-an-sre-interview.html new file mode 100644 index 00000000..8956fa9b --- /dev/null +++ b/gemfeed/2025-01-15-working-with-an-sre-interview.html @@ -0,0 +1,201 @@ + + + + +Working with an SRE Interview + + + + + +

    +Home | Markdown | Gemini +

    +

    Working with an SRE Interview


    +
    +Published at 2025-01-15T00:16:04+02:00
    +
    +I have been interviewed by Florian Buetow on cracking-ai-engineering.com about what it's like working with a Site Reliability Engineer from the point of view of a Software Engineer, Data Scientist, and AI Engineer.
    +
    +See original interview here
    +Cracking AI Engineering
    +
    +Below, I am posting the interview here on my blog as well.
    +
    +

    Table of Contents


    +
    +
    +

    Preamble


    +
    +In this insightful interview, Paul Bütow, a Principal Site Reliability Engineer at Mimecast, shares over a decade of experience in the field. Paul highlights the role of an Embedded SRE, emphasizing the importance of automation, observability, and effective incident management. We also focused on the key question of how you can work effectively with an SRE weather you are an individual contributor or a manager, a software engineer or data scientist. And how you can learn more about site reliability engineering.
    +
    +

    Introducing Paul


    +
    +Hi Paul, please introduce yourself briefly to the audience. Who are you, what do you do for a living, and where do you work?
    +
    +My name is Paul Bütow, I work at Mimecast, and I’m a Principal Site Reliability Engineer there. I’ve been with Mimecast for almost ten years now. The company specializes in email security, including things like archiving, phishing detection, malware protection, and spam filtering.
    +
    +You mentioned that you’re an ‘Embedded SRE.’ What does that mean exactly?
    +
    +It means that I’m directly part of the software engineering team, not in a separate Ops department. I ensure that nothing is deployed manually, and everything runs through automation. I also set up monitoring and observability. These are two distinct aspects: monitoring alerts us when something breaks, while observability helps us identify trends. I also create runbooks so we know what to do when specific incidents occur frequently.
    +
    +Infrastructure SREs on the other hand handle the foundational setup, like providing the Kubernetes cluster itself or ensuring the operating systems are installed. They don't work on the application directly but ensure the base infrastructure is there for others to use. This works well when a company has multiple teams that need shared infrastructure.
    +
    +

    How did you get started?


    +
    +How did your interest in Linux or FreeBSD start?
    +
    +It began during my school days. We had a PC with DOS at home, and I eventually bought Suse Linux 5.3. Shortly after, I discovered FreeBSD because I liked its handbook so much. I wanted to understand exactly how everything worked, so I also tried Linux from Scratch. That involves installing every package manually to gain a better understanding of operating systems.
    +
    +https://www.FreeBSD.org
    +https://linuxfromscratch.org/
    +
    +And after school, you pursued computer science, correct?
    +
    +Exactly. I wasn’t sure at first whether I wanted to be a software developer or a system administrator. I applied for both and eventually accepted an offer as a Linux system administrator. This was before 'SRE' became a buzzword, but much of what I did back then-automation, infrastructure as code, monitoring-is now considered part of the typical SRE role.
    +
    +

    Roles and Career Progression


    +
    +Tell us about how you joined Mimecast. When did you fully embrace the SRE role?
    +
    +I started as a Linux sysadmin at 1&1. I managed an ad server farm with hundreds of systems and later handled load balancers. Together with an architect, we managed F5 load balancers distributing around 2,000 services, including for portals like web.de and GMX. I also led the operations team technically for a while before moving to London to join Mimecast.
    +
    +At Mimecast, the job title was explicitly 'Site Reliability Engineer.' The biggest difference was that I was no longer in a separate Ops department but embedded directly within the storage and search backend team. I loved that because we could plan features together-from automation to measurability and observability. Mimecast also operates thousands of physical servers for email archiving, which was fascinating since I already had experience with large distributed systems at 1&1. It was the right step for me because it allowed me to work close to the code while remaining hands-on with infrastructure.
    +
    +What are the differences between SRE, DevOps, SysAdmin, and Architects?
    +
    +SREs are like the next step after SysAdmins. A SysAdmin might manually install servers, replace disks, or use simple scripts for automation, while SREs use infrastructure as code and focus on reliability through SLIs, SLOs, and automation. DevOps isn’t really a job-it’s more of a way of working, where developers are involved in operations tasks like setting up CI/CD pipelines or on-call shifts. Architects focus on designing systems and infrastructures, such as load balancers or distributed systems, working alongside SREs to ensure the systems meet the reliability and scalability requirements. The specific responsibilities of each role depend on the company, and there is often overlap.
    +
    +What are the most important reliability lessons you’ve learned so far?
    +
    +
      +
    • Don’t leave SRE aspects as an afterthought. It’s much better to discuss automation, monitoring, SLIs, and SLOs early on. Traditional sysadmins often installed systems manually, but today, we do everything via infrastructure as code-using tools like Terraform or Puppet.
    • +
    • I also distinguish between monitoring and observability. Monitoring tells us, 'The server is down, alarm!' Observability dives deeper, showing trends like increasing latency so we can act proactively.
    • +
    • SLI, SLO, and SLA are core elements. We focus on what users actually experience-for example, how quickly an email is sent-and set our goals accordingly.
    • +
    • Runbooks are also crucial. When something goes wrong at night, you don’t want to start from scratch. A runbook outlines how to debug and resolve specific problems, saving time and reducing downtime.
    • +

    +

    Anecdotes and Best Practices


    +
    +Runbooks sound very practical. Can you explain how they’re used day-to-day?
    +
    +Runbooks are essentially guides for handling specific incidents. For instance, if a service won’t start, the runbook will specify where the logs are and which commands to use. Observability takes it a step further, helping us spot changes early-like rising error rates or latency-so we can address issues before they escalate.
    +
    +When should you decide to put something into a runbook, and when is it unnecessary?
    +
    +If an issue happens frequently, it should be documented in a runbook so that anyone, even someone new, can follow the steps to fix it. The idea is that 90% of the common incidents should be covered. For example, if a service is down, the runbook would specify where to find logs, which commands to check, and what actions to take. On the other hand, rare or complex issues, where the resolution depends heavily on context or varies each time, don’t make sense to include in detail. For those, it’s better to focus on general troubleshooting steps.
    +
    +How do you search for and find the correct runbooks?
    +
    +Runbooks should be linked directly in the alert you receive. For example, if you get an alert about a service not running, the alert will have a link to the runbook that tells you what to check, like logs or commands to run. Runbooks are best stored in an internal wiki, so if you don’t find the link in the alert, you know where to search. The important thing is that runbooks are easy to find and up to date because that’s what makes them useful during incidents.
    +
    +Do you have an interesting war story you can share with us?
    +
    +Sure. At 1&1, we had a proprietary ad server software that ran a SQL query during startup. The query got slower over time, eventually timing out and preventing the server from starting. Since we couldn’t access the source code, we searched the binary for the SQL and patched it. By pinpointing the issue, a developer was able to adjust the SQL. This collaboration between sysadmin and developer perspectives highlights the value of SRE work.
    +
    +

    Working with Different Teams


    +
    +You’re embedded in a team-how does collaboration with developers work practically?
    +
    +We plan everything together from the start. If there’s a new feature, we discuss infrastructure, automated deployments, and monitoring right away. Developers are experts in the code, and I bring the infrastructure expertise. This avoids unpleasant surprises before going live.
    +
    +How about working with data scientists or ML engineers? Are there differences?
    +
    +The principles are the same. ML models also need to be deployed and monitored. You deal with monitoring, resource allocation, and identifying performance drops. Whether it’s a microservice or an ML job, at the end of the day, it’s all running on servers or clusters that must remain stable.
    +
    +What about working with managers or the FinOps team?
    +
    +We often discuss costs, especially in the cloud, where scaling up resources is easy. It’s crucial to know our metrics: do we have enough capacity? Do we need all instances? Or is the CPU only at 5% utilization? This data helps managers decide whether the budget is sufficient or if optimizations are needed.
    +
    +Do you have practical tips for working with SREs?
    +
    +Yes, I have a few:
    +
    +
      +
    • Early involvement: Include SREs from the beginning in your project.
    • +
    • Runbooks & documentation: Document recurring errors.
    • +
    • Try first: Try to understand the issue yourself before immediately asking the SRE.
    • +
    • Basic infra knowledge: Kubernetes and Terraform aren’t magic. Some basic understanding helps every developer.
    • +

    +

    Using AI Tools


    +
    +Let’s talk about AI. How do you use it in your daily work?
    +
    +For boilerplate code, like Terraform snippets, I often use ChatGPT. It saves time, although I always review and adjust the output. Log analysis is another exciting application. Instead of manually going through millions of lines, AI can summarize key outliers or errors.
    +
    +Do you think AI could largely replace SREs or significantly change the role?
    +
    +I see AI as an additional tool. SRE requires a deep understanding of how distributed systems work internally. While AI can assist with routine tasks or quickly detect anomalies, human expertise is indispensable for complex issues.
    +
    +

    SRE Learning Resources


    +
    +What resources would you recommend for learning about SRE?
    +
    +The Google SRE book is a classic, though a bit dry. I really like 'Seeking SRE,' as it offers various perspectives on SRE, with many practical stories from different companies.
    +
    +https://sre.google/books/
    +Seeking SRE
    +
    +Do you have a podcast recommendation?
    +
    +The Google SRE prodcast is quite interesting. It offers insights into how Google approaches SRE, along with perspectives from external guests.
    +
    +https://sre.google/prodcast/
    +
    +

    Blogging


    +
    +You also have a blog. What motivates you to write regularly?
    +
    +Writing helps me learn the most. It also serves as a personal reference. Sometimes I look up how I solved a problem a year ago. And of course, others tackling similar projects might find inspiration in my posts.
    +
    +What do you blog about?
    +
    +Mostly technical topics I find exciting, like homelab projects, Kubernetes, or book summaries on IT and productivity. It’s a personal blog, so I write about what I enjoy.
    +
    +

    Wrap-up


    +
    +To wrap up, what are three things every team should keep in mind for stability?
    +
    +First, maintain runbooks and documentation to avoid chaos at night. Second, automate everything-manual installs in production are risky. Third, define SLIs, SLOs, and SLAs early so everyone knows what we’re monitoring and guaranteeing.
    +
    +Is there a motto or mindset that particularly inspires you as an SRE?
    +
    +"Keep it simple and stupid"-KISS. Not everything has to be overly complex. And always stay curious. I’m still fascinated by how systems work under the hood.
    +
    +Where can people find you online?
    +
    +You can find links to my socials on my website paul.buetow.org
    +I regularly post articles and link to everything else I’m working on outside of work.
    +
    +https://paul.buetow.org
    +
    +Thank you very much for your time and this insightful interview into the world of site reliability engineering
    +
    +My pleasure, this was fun.
    +
    +

    Closing comments


    +
    +Dear reader, I hope this conversation with Paul Bütow provided an exciting peak into the world of Site Reliability Engineering. Whether you’re a software developer, data scientist, ML engineer, or manager, reliable systems are always a team effort. Hopefully, you’ve taken some insights or tips from Paul’s experiences for your own team or next project. Thanks for joining us, and best of luck refining your own SRE practices!
    +
    +E-Mail your comments to paul@nospam.buetow.org or contact Florian via the Cracking AI Engineering :-)
    +
    +Back to the main site
    + + + diff --git a/gemfeed/2025-02-01-f3s-kubernetes-with-freebsd-part-3.html b/gemfeed/2025-02-01-f3s-kubernetes-with-freebsd-part-3.html new file mode 100644 index 00000000..b9116a4d --- /dev/null +++ b/gemfeed/2025-02-01-f3s-kubernetes-with-freebsd-part-3.html @@ -0,0 +1,427 @@ + + + + +f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts + + + + + +

    +Home | Markdown | Gemini +

    +

    f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts


    +
    +Published at 2025-01-30T09:22:06+02:00
    +
    +This is the third blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution we will use on FreeBSD-based physical machines.
    +
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts (You are currently reading this)
    +
    +f3s logo
    +
    +

    Table of Contents


    +
    +
    +

    Introduction


    +
    +In this blog post, we are setting up the UPS for the cluster. A UPS, or Uninterruptible Power Supply, safeguards my cluster from unexpected power outages and surges. It acts as a backup battery that kicks in when the electricity cuts out—especially useful in my area, where power cuts are frequent—allowing for a graceful system shutdown and preventing data loss and corruption. This is especially important since I will also store some of my data on the f3s nodes.
    +
    +

    Changes since last time


    +
    +

    FreeBSD upgrade from 14.1 to 14.2


    +
    +There has been a new release since the last blog post in this series. The upgrade from 14.1 was as easy as:
    +
    + +
    paul@f0: ~ % doas freebsd-update fetch
    +paul@f0: ~ % doas freebsd-update install
    +paul@f0: ~ % doas freebsd-update -r 14.2-RELEASE upgrade
    +paul@f0: ~ % doas freebsd-update install
    +paul@f0: ~ % doas shutdown -r now
    +
    +
    +And after rebooting, I ran:
    +
    + +
    paul@f0: ~ % doas freebsd-update install
    +paul@f0: ~ % doas pkg update
    +paul@f0: ~ % doas pkg upgrade
    +paul@f0: ~ % doas shutdown -r now
    +
    +
    +And after another reboot, I was on 14.2:
    +
    + +
    paul@f0:~ % uname -a
    +FreeBSD f0.lan.buetow.org 14.2-RELEASE FreeBSD 14.2-RELEASE 
    + releng/14.2-n269506-c8918d6c7412 GENERIC amd64
    +
    +
    +And, of course, I ran this on all 3 nodes!
    +
    +

    A new home (behind the TV)


    +
    +I've put all the infrastructure behind my TV, as plenty of space is available. The TV hides most of the setup, which drastically improved the SAF (spouse acceptance factor).
    +
    +New hardware placement arrangement
    +
    +I got rid of the mini-switch I mentioned in the previous blog post. I have the TP-Link EAP615-Wall mounted on the wall nearby, which is my OpenWrt-powered Wi-Fi hotspot. It also has 3 Ethernet ports, to which I connected the Beelink nodes. That's the device you see at the very top.
    +
    +The Ethernet cables go downward through the cable boxes to the Beelink nodes. In addition to the Beelink f3s nodes, I connected the TP-Link to the UPS as well (not discussed further in this blog post, but the positive side effect is that my Wi-Fi will still work during a power loss for some time—and during a power cut, the Beelink nodes will still be able to communicate with each other).
    +
    +On the very left (the black box) is the UPS, with four power outlets. Three go to the Beelink nodes, and one goes to the TP-Link. A USB output is also connected to the first Beelink node, f0.
    +
    +On the very right (halfway hidden behind the TV) are the 3 Beelink nodes stacked on top of each other. The only downside (or upside?) is that my 14-month-old daughter is now chaos-testing the Beelink nodes, as the red power buttons (now reachable for her) are very attractive for her to press when passing by randomly. :-) Luckily, that will only cause graceful system shutdowns!
    +
    +

    The UPS hardware


    +
    +I wanted a UPS that I could connect to via FreeBSD, and that would provide enough backup power to operate the cluster for a couple of minutes (it turned out to be around an hour, but this time will likely be shortened after future hardware upgrades, like additional drives and a backup enclosure) and to automatically initiate the shutdown of all the f3s nodes.
    +
    +I decided on the APC Back-UPS BX750MI model because:
    +
    +
      +
    • Zero noise level when there is no power cut (some light noise when the battery is in operation during a power cut).
    • +
    • Cost: It is relatively affordable (not costing thousands).
    • +
    • USB connectivity: Can be connected via USB to one of the FreeBSD hosts to read the UPS status.
    • +
    • A power output of 750VA (or 410 watts), suitable for an hour of runtime for my f3s nodes (plus the Wi-Fi router).
    • +
    • Multiple power outlets: Can connect all 3 f3s nodes directly.
    • +
    • User-replaceable batteries: I can replace the batteries myself after two years or more (depending on usage).
    • +
    • Its compact design. Overall, I like how it looks.
    • +

    +The APC Back-UPS BX750MI in operation.
    +
    +

    Configuring FreeBSD to Work with the UPS


    +
    +

    USB Device Detection


    +
    +Once plugged in via USB on FreeBSD, I could see the following in the kernel messages:
    +
    + +
    paul@f0: ~ % doas dmesg | grep UPS
    +ugen0.2: <American Power Conversion Back-UPS BX750MI> at usbus0
    +
    +
    +

    apcupsd Installation


    +
    +To make use of the USB connection, the apcupsd package had to be installed:
    +
    + +
    paul@f0: ~ % doas install apcupsd
    +
    +
    +I have made the following modifications to the configuration file so that the UPS can be used via the USB interface:
    +
    + +
    paul@f0:/usr/local/etc/apcupsd % diff -u apcupsd.conf.sample  apcupsd.conf
    +--- apcupsd.conf.sample 2024-11-01 16:40:42.000000000 +0200
    ++++ apcupsd.conf        2024-12-03 10:58:24.009501000 +0200
    +@@ -31,7 +31,7 @@
    + #     940-1524C, 940-0024G, 940-0095A, 940-0095B,
    + #     940-0095C, 940-0625A, M-04-02-2000
    + #
    +-UPSCABLE smart
    ++UPSCABLE usb
    +
    + # To get apcupsd to work, in addition to defining the cable
    + # above, you must also define a UPSTYPE, which corresponds to
    +@@ -88,8 +88,10 @@
    + #                            that apcupsd binds to that particular unit
    + #                            (helpful if you have more than one USB UPS).
    + #
    +-UPSTYPE apcsmart
    +-DEVICE /dev/usv
    ++UPSTYPE usb
    ++DEVICE
    +
    + # POLLTIME <int>
    + #   Interval (in seconds) at which apcupsd polls the UPS for status. This
    +
    +
    +I left the remaining settings as the default ones; for example, the following are of main interest:
    +
    +
    +# If during a power failure, the remaining battery percentage
    +# (as reported by the UPS) is below or equal to BATTERYLEVEL,
    +# apcupsd will initiate a system shutdown.
    +BATTERYLEVEL 5
    +
    +# If during a power failure, the remaining runtime in minutes
    +# (as calculated internally by the UPS) is below or equal to MINUTES,
    +# apcupsd, will initiate a system shutdown.
    +MINUTES 3
    +
    +
    +I then enabled and started the daemon:
    +
    + +
    paul@f0:/usr/local/etc/apcupsd % doas sysrc apcupsd_enable=YES
    +apcupsd_enable:  -> YES
    +paul@f0:/usr/local/etc/apcupsd % doas service apcupsd start
    +Starting apcupsd.
    +
    +
    +

    UPS Connectivity Test


    +
    +And voila, I could now access the UPS information via the apcaccess command; how convenient :-) (I also read through the manual page, which provides a good understanding of what else can be done with it!).
    +
    + +
    paul@f0:~ % apcaccess
    +APC      : 001,035,0857
    +DATE     : 2025-01-26 14:43:27 +0200
    +HOSTNAME : f0.lan.buetow.org
    +VERSION  : 3.14.14 (31 May 2016) freebsd
    +UPSNAME  : f0.lan.buetow.org
    +CABLE    : USB Cable
    +DRIVER   : USB UPS Driver
    +UPSMODE  : Stand Alone
    +STARTTIME: 2025-01-26 14:43:25 +0200
    +MODEL    : Back-UPS BX750MI
    +STATUS   : ONLINE
    +LINEV    : 230.0 Volts
    +LOADPCT  : 4.0 Percent
    +BCHARGE  : 100.0 Percent
    +TIMELEFT : 65.3 Minutes
    +MBATTCHG : 5 Percent
    +MINTIMEL : 3 Minutes
    +MAXTIME  : 0 Seconds
    +SENSE    : Medium
    +LOTRANS  : 145.0 Volts
    +HITRANS  : 295.0 Volts
    +ALARMDEL : No alarm
    +BATTV    : 13.6 Volts
    +LASTXFER : Automatic or explicit self test
    +NUMXFERS : 0
    +TONBATT  : 0 Seconds
    +CUMONBATT: 0 Seconds
    +XOFFBATT : N/A
    +SELFTEST : NG
    +STATFLAG : 0x05000008
    +SERIALNO : 9B2414A03599
    +BATTDATE : 2001-01-01
    +NOMINV   : 230 Volts
    +NOMBATTV : 12.0 Volts
    +NOMPOWER : 410 Watts
    +END APC  : 2025-01-26 14:44:06 +0200
    +
    +
    +

    APC Info on Partner Nodes:


    +
    +So far, so good. Host f0 would shut down itself when short on power. But what about the f1 and f2 nodes? They aren't connected directly to the UPS and, therefore, wouldn't know that their power is about to be cut off. For this, apcupsd running on the f1 and f2 nodes can be configured to retrieve UPS information via the network from the apcupsd server running on the f0 node, which is connected directly to the APC via USB.
    +
    +Of course, this won't work when f0 is down. In this case, no operational node would be connected to the UPS via USB; therefore, the current power status would not be known. However, I consider this a rare circumstance. Furthermore, in case of an f0 system crash, sudden power outages on the two other nodes would occur at different times making real data loss (the main concern here) less likely.
    +
    +And if f0 is down and f1 and f2 receive new data and crash midway, it's likely that a client (e.g., an Android app or another laptop) still has the data stored on it, making data recoverable and data loss overall nearly impossible. I'd receive an alert if any of the nodes go down (more on monitoring later in this blog series).
    +
    +

    Installation on partners


    +
    +To do this, I installed apcupsd via doas pkg install apcupsd on f1 and f2, and then I could connect to it this way:
    +
    + +
    paul@f1:~ % apcaccess -h f0.lan.buetow.org | grep Percent
    +LOADPCT  : 12.0 Percent
    +BCHARGE  : 94.0 Percent
    +MBATTCHG : 5 Percent
    +
    +
    +But I want the daemon to be configured and enabled in such a way that it connects to the master UPS node (the one with the UPS connected via USB) so that it can also initiate a system shutdown when the UPS battery reaches low levels. For that, apcupsd itself needs to be aware of the UPS status.
    +
    +On f1 and f2, I changed the configuration to use f0 (where apcupsd is listening) as a remote device. I also changed the MINUTES setting from 3 to 6 and the BATTERYLEVEL setting from 5 to 10 to ensure that the f1 and f2 nodes could still connect to the f0 node for UPS information before f0 decides to shut down itself. So f1 and f2 must shut down earlier than f0:
    +
    + +
    paul@f2:/usr/local/etc/apcupsd % diff -u apcupsd.conf.sample apcupsd.conf
    +--- apcupsd.conf.sample 2024-11-01 16:40:42.000000000 +0200
    ++++ apcupsd.conf        2025-01-26 15:52:45.108469000 +0200
    +@@ -31,7 +31,7 @@
    + #     940-1524C, 940-0024G, 940-0095A, 940-0095B,
    + #     940-0095C, 940-0625A, M-04-02-2000
    + #
    +-UPSCABLE smart
    ++UPSCABLE ether
    +
    + # To get apcupsd to work, in addition to defining the cable
    + # above, you must also define a UPSTYPE, which corresponds to
    +@@ -52,7 +52,6 @@
    + #                            Network Information Server. This is used if the
    + #                            UPS powering your computer is connected to a
    + #                            different computer for monitoring.
    +-#
    + # snmp      hostname:port:vendor:community
    + #                            SNMP network link to an SNMP-enabled UPS device.
    + #                            Hostname is the ip address or hostname of the UPS
    +@@ -88,8 +87,8 @@
    + #                            that apcupsd binds to that particular unit
    + #                            (helpful if you have more than one USB UPS).
    + #
    +-UPSTYPE apcsmart
    +-DEVICE /dev/usv
    ++UPSTYPE net
    ++DEVICE f0.lan.buetow.org:3551
    +
    + # POLLTIME <int>
    + #   Interval (in seconds) at which apcupsd polls the UPS for status. This
    +@@ -147,12 +146,12 @@
    + # If during a power failure, the remaining battery percentage
    + # (as reported by the UPS) is below or equal to BATTERYLEVEL,
    + # apcupsd will initiate a system shutdown.
    +-BATTERYLEVEL 5
    ++BATTERYLEVEL 10
    +
    + # If during a power failure, the remaining runtime in minutes
    + # (as calculated internally by the UPS) is below or equal to MINUTES,
    + # apcupsd, will initiate a system shutdown.
    +-MINUTES 3
    ++MINUTES 6
    +
    + # If during a power failure, the UPS has run on batteries for TIMEOUT
    + # many seconds or longer, apcupsd will initiate a system shutdown.
    +
    +
    +So I also ran the following commands on f1 and f2:
    +
    + +
    paul@f1:/usr/local/etc/apcupsd % doas sysrc apcupsd_enable=YES
    +apcupsd_enable:  -> YES
    +paul@f1:/usr/local/etc/apcupsd % doas service apcupsd start
    +Starting apcupsd.
    +
    +
    +And then I was able to connect to localhost via the apcaccess command:
    +
    + +
    paul@f1:~ % doas apcaccess | grep Percent
    +LOADPCT  : 5.0 Percent
    +BCHARGE  : 95.0 Percent
    +MBATTCHG : 5 Percent
    +
    +
    +

    Power outage simulation


    +
    +

    Pulling the plug


    +
    +I simulated a power outage by removing the power input from the APC. Immediately, the following message appeared on all the nodes:
    +
    +
    +Broadcast Message from root@f0.lan.buetow.org
    +        (no tty) at 15:03 EET...
    +
    +Power failure. Running on UPS batteries.                                              
    +
    +
    +I ran the following command to confirm the available battery time:
    +
    + +
    paul@f0:/usr/local/etc/apcupsd % apcaccess -p TIMELEFT
    +63.9 Minutes
    +
    +
    +And after around one hour (f1 and f2 a bit earlier, f0 a bit later due to the different BATTERYLEVEL and MINUTES settings outlined earlier), the following broadcast was sent out:
    +
    +
    +Broadcast Message from root@f0.lan.buetow.org
    +        (no tty) at 15:08 EET...
    +
    +        *** FINAL System shutdown message from root@f0.lan.buetow.org ***
    +
    +System going down IMMEDIATELY
    +
    +apcupsd initiated shutdown
    +
    +
    +And all the nodes shut down safely before the UPS ran out of battery!
    +
    +

    Restoring power


    +
    +After restoring power, I checked the logs in /var/log/daemon.log and found the following on all 3 nodes:
    +
    +
    +Jan 26 17:36:24 f2 apcupsd[2159]: Power failure.
    +Jan 26 17:36:30 f2 apcupsd[2159]: Running on UPS batteries.
    +Jan 26 17:36:30 f2 apcupsd[2159]: Battery charge below low limit.
    +Jan 26 17:36:30 f2 apcupsd[2159]: Initiating system shutdown!
    +Jan 26 17:36:30 f2 apcupsd[2159]: User logins prohibited
    +Jan 26 17:36:32 f2 apcupsd[2159]: apcupsd exiting, signal 15
    +Jan 26 17:36:32 f2 apcupsd[2159]: apcupsd shutdown succeeded
    +
    +
    +All good :-) See you in the next post of this series!
    +
    +Other BSD related posts are:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts (You are currently reading this)
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +2024-04-01 KISS high-availability with OpenBSD
    +2024-01-13 One reason why I love OpenBSD
    +2022-10-30 Installing DTail on OpenBSD
    +2022-07-30 Let's Encrypt with OpenBSD and Rex
    +2016-04-09 Jails and ZFS with Puppet on FreeBSD
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Back to the main site
    + + + diff --git a/gemfeed/2025-02-08-random-weird-things-ii.html b/gemfeed/2025-02-08-random-weird-things-ii.html new file mode 100644 index 00000000..770e287a --- /dev/null +++ b/gemfeed/2025-02-08-random-weird-things-ii.html @@ -0,0 +1,291 @@ + + + + +Random Weird Things - Part Ⅱ + + + + + +

    +Home | Markdown | Gemini +

    +

    Random Weird Things - Part Ⅱ


    +
    +Published at 2025-02-08T11:06:16+02:00
    +
    +Every so often, I come across random, weird, and unexpected things on the internet. I thought it would be neat to share them here from time to time. This is the second run.
    +
    +2024-07-05 Random Weird Things - Part Ⅰ
    +2025-02-08 Random Weird Things - Part Ⅱ (You are currently reading this)
    +
    +
    +/\_/\           /\_/\
    +( o.o ) WHOA!! ( o.o )
    +> ^ <           > ^ <
    +/   \    MOEEW! /   \
    +/______\       /______\
    +
    +
    +

    Table of Contents


    +
    +
    +

    11. The SQLite codebase is a gem


    +
    +Check this out:
    +
    +SQLite Gem
    +
    +Source:
    +
    +https://wetdry.world/@memes/112717700557038278
    +
    +

    Go Programming


    +
    +

    12. Official Go font


    +
    +The Go programming language has an official font called "Go Font." It was created to complement the aesthetic of the Go language, ensuring clear and legible rendering of code. The font includes a monospace version for code and a proportional version for general text, supporting consistent look and readability in Go-related materials and development environments.
    +
    +Check out some Go code displayed using the Go font:
    +
    +Go font code
    +
    +https://go.dev/blog/go-fonts
    +
    +The design emphasizes simplicity and readability, reflecting Go's philosophy of clarity and efficiency.
    +
    +I found it interesting and/or weird, as Go is a programming language. Why should it bother having its own font? I have never seen another open-source project like Go do this. But I also like it. Maybe I will use it in the future for this blog :-)
    +
    +

    13. Go functions can have methods


    +
    +Functions on struct types? Well, know. Functions on types like int and string? It's also known of, but a bit lesser. Functions on function types? That sounds a bit funky, but it's possible, too! For demonstration, have a look at this snippet:
    +
    + +
    package main
    +
    +import "log"
    +
    +type fun func() string
    +
    +func (f fun) Bar() string {
    +        return "Bar"
    +}
    +
    +func main() {
    +        var f fun = func() string {
    +                return "Foo"
    +        }
    +        log.Println("Example 1: ", f())
    +        log.Println("Example 2: ", f.Bar())
    +        log.Println("Example 3: ", fun(f.Bar).Bar())
    +        log.Println("Example 4: ", fun(fun(f.Bar).Bar).Bar())
    +}
    +
    +
    +It runs just fine:
    +
    + +
    ❯ go run main.go
    +2025/02/07 22:56:14 Example 1:  Foo
    +2025/02/07 22:56:14 Example 2:  Bar
    +2025/02/07 22:56:14 Example 3:  Bar
    +2025/02/07 22:56:14 Example 4:  Bar
    +
    +
    +

    macOS


    +
    +For personal computing, I don't use Apple, but I have to use it for work.
    +
    +

    14. ß and ss are treated the same


    +
    +Know German? In German, the letter "sarp s" is written as ß. ß is treated the same as ss on macOS.
    +
    +On a case-insensitive file system like macOS, not only are uppercase and lowercase letters treated the same, but non-Latin characters like the German "ß" are also considered equivalent to their Latin counterparts (in this case, "ss").
    +
    +So, even though "Maß" and "Mass" are not strictly equivalent, the macOS file system still treats them as the same filename due to its handling of Unicode characters. This can sometimes lead to unexpected behaviour. Check this out:
    +
    + +
    ❯ touch Maß
    +❯ ls -l
    +-rw-r--r--@ 1 paul  wheel  0 Feb  7 23:02 Maß
    +❯ touch Mass
    +❯ ls -l
    +-rw-r--r--@ 1 paul  wheel  0 Feb  7 23:02 Maß
    +❯ rm Mass
    +❯ ls -l
    +
    +❯ touch Mass
    +❯ ls -ltr
    +-rw-r--r--@ 1 paul  wheel  0 Feb  7 23:02 Mass
    +❯ rm Maß
    +❯ ls -l
    +
    +
    +
    +

    15. Colon as file path separator


    +
    +MacOS can use the colon as a file path separator on its ADFS (file system). A typical ADFS file pathname on a hard disc might be:
    +
    +
    +ADFS::4.$.Documents.Techwriter.Myfile
    +
    +
    +I can't reproduce this on my (work) Mac, though, as it now uses the APFS file system. In essence, ADFS is an older file system, while APFS is a contemporary file system optimized for Apple's modern devices.
    +
    +https://social.jvns.ca/@b0rk/113041293527832730
    +
    +

    16. Polyglots - programs written in multiple languages


    +
    +A coding polyglot is a program or script written so that it can be executed in multiple programming languages without modification. This is typically achieved by leveraging syntax overlaps or crafting valid and meaningful code in each targeted language. Polyglot programs are often created as a challenge or for demonstration purposes to showcase language similarities or clever coding techniques.
    +
    +Check out my very own polyglot:
    +
    +The fibonatti.pl.c Polyglot
    +
    +

    17. Languages, where indices start at 1


    +
    +Array indices start at 1 instead of 0 in some programming languages, known as one-based indexing. This can be controversial because zero-based indexing is more common in popular languages like C, C++, Java, and Python. One-based indexing can lead to off-by-one errors when developers switch between languages with different indexing schemes.
    +
    +Languages with One-Based Indexing:
    +
    +
      +
    • Fortran
    • +
    • MATLAB
    • +
    • Lua
    • +
    • R (for vectors and lists)
    • +
    • Smalltalk
    • +
    • Julia (by default, although zero-based indexing is also possible)
    • +

    +foo.lua example:
    +
    + +
    arr = {10, 20, 30, 40, 50}
    +print(arr[1]) -- Accessing the first element
    +
    +
    + +
    ❯ lua foo.lua
    +10
    +
    +
    +One-based indexing is more natural for human-readable, mathematical, and theoretical contexts, where counting traditionally starts from one.
    +
    +

    18. Perl Poetry


    +
    +Perl Poetry is a playful and creative practice within the programming community where Perl code is written as a poem. These poems are crafted to be syntactically valid Perl code and make sense as poetic text, often with whimsical or humorous intent. This showcases Perl's flexibility and expressiveness, as well as the creativity of its programmers.
    +
    +See this Poetry of my own; the Perl interpreter does not yield any syntax error parsing that. But also, the Peom doesn't do anything useful then executed:
    +
    + +
    # (C) 2006 by Paul C. Buetow
    +
    +Christmas:{time;#!!!
    +
    +Children: do tell $wishes;
    +
    +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;
    +
    +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 };
    +
    +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;
    +
    +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__
    +
    +This is perl, v5.8.8 built for i386-freebsd-64int
    +
    +
    +More Perl Poetry of mine
    +
    +

    19. CSS3 is turing complete


    +
    +CSS3 is Turing complete because it can simulate a Turing machine using only CSS animations and styles without any JavaScript or external logic. This is achieved by using keyframe animations to change the styles of HTML elements in a way that encodes computation, performing calculations and state transitions.
    +
    +Is CSS turing complete?
    +
    +It is surprising because CSS is primarily a styling language intended for the presentation layer of web pages, not for computation or logic. Its capability to perform complex computations defies its typical use case and showcases the unintended computational power that can emerge from the creative use of seemingly straightforward technologies.
    +
    +Check out this 100% CSS implementation of the Conways Game of Life:
    +
    +
    +
    +CSS Conways Game of Life
    +
    +Conway's Game of Life is Turing complete because it can simulate a universal Turing machine, meaning it can perform any computation that a computer can, given the right initial conditions and sufficient time and space. Suppose a language can implement Conway's Game of Life. In that case, it demonstrates the language's ability to handle complex state transitions and computations. It has the necessary constructs (like iteration, conditionals, and data manipulation) to simulate any algorithm, thus confirming its Turing completeness.
    +
    +

    20. The biggest shell programs


    +
    +One would think that shell scripts are only suitable for small tasks. Well, I must be wrong, as there are huge shell programs out there (up to 87k LOC) which aren't auto-generated but hand-written!
    +
    +The Biggest Sell Programs in the World
    +
    +My Gemtexter (bash) is only 1329 LOC as of now. So it's tiny.
    +
    +Gemtexter - One Bash script to rule it all
    +
    +I hope you had some fun. E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Back to the main site
    + + + diff --git a/gemfeed/4 b/gemfeed/4 new file mode 100644 index 00000000..f4c59789 --- /dev/null +++ b/gemfeed/4 @@ -0,0 +1,239 @@ +# f3s: Kubernetes with FreeBSD - Rocky Linux Bhyve VMs - Part 3 + +This is the third blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution we will use on FreeBSD-based physical machines. + +<< template::inline::index f3s-kubernetes-with-freebsd-part + +=> ./f3s-kubernetes-with-frhyveeebsd-part-1/f3slogo.png f3s logo + +<< template::inline::toc + +## Introduction + +In this blog post, we are going to install the Bhyve hypervisor. + +The FreeBSD Bhyve hypervisor is a lightweight, modern hypervisor that enables virtualization on FreeBSD systems. Bhyve's strengths include its minimal overhead, which allows it to achieve near-native performance for virtual machines. It is designed to be efficient and lightweight, leveraging the capabilities of the FreeBSD operating system for performance and network management. + +Bhyve supports running a variety of guest operating systems, including FreeBSD, Linux, and Windows, on hardware platforms that support hardware virtualization extensions (such as Intel VT-x or AMD-V). In our case, we are going to virtualize Rocky Linux, which later on in this series will be used to run k3s. + +## Basic Bhyve setup + +For the management of the Bhyve VMs, we are using `vm-bhyve`, a tool not part of the FreeBSD operating system but available as a ready-to-use package. It eases VM management and reduces a lot of the overhead. We also install the required package to make Bhyve work with the UEFI firmware. + +=> https://github.com/churchers/vm-bhyve + +The following commands are executed on all three hosts `f0`, `f1`, and `f2`, where `re0` is the name of the Ethernet interface (which may need to be adjusted if your hardware is different): + +```sh +paul@f0:~ % doas pkg install vm-bhyve bhyve-firmware +paul@f0:~ % doas sysrc vm_enable=YES +vm_enable: -> YES +paul@f0:~ % doas sysrc vm_dir=zfs:zroot/bhyve +vm_dir: -> zfs:zroot/bhyve +paul@f0:~ % doas zfs create zroot/bhyve +paul@f0:~ % doas vm init +paul@f0:~ % doas vm switch create public +paul@f0:~ % doas vm switch add public re0 +``` + +Bhyve stores all it's data in the `/bhyve` of the `zroot` ZFS pool: + +```sh +paul@f0:~ % zfs list | grep bhyve +zroot/bhyve 1.74M 453G 1.74M /zroot/bhyve +``` + +For convenience, we also create this symlink: + +```sh +paul@f0:~ % doas ln -s /zroot/bhyve/ /bhyve + +``` + +Now, Bhyve is ready to rumble, but no VMs are there yet: + +```sh +paul@f0:~ % doas vm list +NAME DATASTORE LOADER CPU MEMORY VNC AUTO STATE +``` + +## Rocky Linux VMs + +### ISO download + +We're going to install the Rocky Linux from the latest minimal iso: + +```sh +paul@f0:~ % doas vm iso \ + https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.5-x86_64-minimal.iso +/zroot/bhyve/.iso/Rocky-9.5-x86_64-minimal.iso 1808 MB 4780 kBps 06m28s +paul@f0:/bhyve % doas vm create rocky +``` +### VM configuration + +The default configuration looks like this now: + +```sh +paul@f0:/bhyve/rocky % cat rocky.conf +loader="bhyveload" +cpu=1 +memory=256M +network0_type="virtio-net" +network0_switch="public" +disk0_type="virtio-blk" +disk0_name="disk0.img" +uuid="1c4655ac-c828-11ef-a920-e8ff1ed71ca0" +network0_mac="58:9c:fc:0d:13:3f" +``` + +Whereas the `uuid` and the `network0_mac` differ on each of the 3 hosts. + +but in order to make Rocky Linux boot it (plus some other adjustments, e.g. as I am intending to run the majority of the workload in the k3s cluster running on those linux VMs, I give them beefy specs like 4 CPU cores and 14GB RAM), I run `doas vm configure rocky` and modified it to: + +``` +guest="linux" +loader="uefi" +uefi_vars="yes" +cpu=4 +memory=14G +network0_type="virtio-net" +network0_switch="public" +disk0_type="virtio-blk" +disk0_name="disk0.img" +graphics="yes" +graphics_vga=io +uuid="1c45400b-c828-11ef-8871-e8ff1ed71cac" +network0_mac="58:9c:fc:0d:13:3f" +``` + +### VM installation + +To start the installer from the downloaded ISO, I run: + +```sh +paul@f0:~ % doas vm install rocky Rocky-9.5-x86_64-minimal.iso +Starting rocky + * found guest in /zroot/bhyve/rocky + * booting... + +paul@f0:/bhyve/rocky % doas vm list +NAME DATASTORE LOADER CPU MEMORY VNC AUTO STATE +rocky default uefi 4 14G 0.0.0.0:5900 No Locked (f0.lan.buetow.org) + +paul@f0:/bhyve/rocky % doas sockstat -4 | grep 5900 +root bhyve 6079 8 tcp4 *:5900 *:* +``` + +Port 5900 now also opened for VNC connections, so I connected to it with a VNC client and run through the installation dialogs. I'm sure this could be done unattended or more automated, there are only 3 VMs to install, and the automation doesn't seem worth it as we are doing it only once in a year or less often. + +### Increase of the disk image + +By default the VMs disk image is only 20G, which is a bit small for my purposes, so I stopped the VMs again and run `truncate` on the image file to enlarge them to 100G, and re-started the installation: + +```sh +paul@f0:/bhyve/rocky % doas vm stop rocky +paul@f0:/bhyve/rocky % doas truncate -s 100G disk0.img +paul@f0:/bhyve/rocky % doas vm install rocky Rocky-9.5-x86_64-minimal.iso +``` + +### Connect to VPN + +For the installation, I opened the VPN client on my Fedora laptop (GNOME comes with a simple VPN client) and ran through the base installation for each of the VMs manually. Again, I am sure this could have been automated a bit more, but there were just 3 VMs, and it wasn't worth the effort. The three VNC addresses of the VMs were: `vnc://f0:5900`, `vnc://f1:5900`, and `vnc://f0:5900`. + +I mostly selected the default settings (auto partitioning on the 100GB drive and a root user password). After the installation, the VMs were rebooted. + +## After install + +I performed the following steps for all 3 VMs. In the following, the examples are all executed on `f0` (bzw the VM `r0` running on `f0`): + +### VM auto-start after host reboot + +To automatically start the VM on the servers I added the following to the `rc.conf` on the FreeBSD hosts: + +```sh + +paul@f0:/bhyve/rocky % cat <>/etc/hosts +192.168.1.120 r0 r0.lan r0.lan.buetow.org +192.168.1.121 r1 r1.lan r1.lan.buetow.org +192.168.1.122 r2 r2.lan r2.lan.buetow.org +END +```` + +Whereas: + +* `192.168.1.120` is the IP of the VM itself (here: `r0.lan.buetow.org`) +* `192.168.1.1` is the address of my home router, which also does DNS. + +### Permitting root login + +As these VMs arent directly reachable via SSH from the internet, I enabled `root` login by adding a line with `PermitRootLogin yes` to `/etc/sshd/sshd_config`. + +Once done, I rebooted the VM by running `reboot` inside of the vm to test whether everything was configured and persisted correctly. + +After reboot, I copied my public key from my Laptop to the 3 VMs: + +```sh +% for i in 0 1 2; do ssh-copy-id root@r$i.lan.buetow.org; done +``` + +And then I edited the `/etc/ssh/sshd_config` file again on all 3 VMs and configured `PasswordAuthentication no`, to only allow SSH key authentication from now on. + +### Install latest updates + +```sh +[root@r0 ~] % dnf update +[root@r0 ~] % dreboot +``` + +CPU STRESS TESTER VM VS NOT VM + +Other *BSD-related posts: + +<< template::inline::index bsd + +E-Mail your comments to `paul@nospam.buetow.org` :-) + +=> ../ Back to the main site diff --git a/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-part-4.html b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-part-4.html new file mode 100644 index 00000000..133ba1d6 --- /dev/null +++ b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-part-4.html @@ -0,0 +1,345 @@ + + + + +f3s: Kubernetes with FreeBSD - Rocky Linux Bhyve VMs - Part 4 + + + + + +

    +Home | Markdown | Gemini +

    +

    f3s: Kubernetes with FreeBSD - Rocky Linux Bhyve VMs - Part 4


    +
    +This is the thourth blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution we will use on FreeBSD-based physical machines.
    +
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +
    +f3s logo
    +
    +

    Table of Contents


    +
    +
    +

    Introduction


    +
    +In this blog post, we are going to install the Bhyve hypervisor.
    +
    +The FreeBSD Bhyve hypervisor is a lightweight, modern hypervisor that enables virtualization on FreeBSD systems. Bhyve's strengths include its minimal overhead, which allows it to achieve near-native performance for virtual machines. It is designed to be efficient and lightweight, leveraging the capabilities of the FreeBSD operating system for performance and network management.
    +
    +Bhyve supports running a variety of guest operating systems, including FreeBSD, Linux, and Windows, on hardware platforms that support hardware virtualization extensions (such as Intel VT-x or AMD-V). In our case, we are going to virtualize Rocky Linux, which later on in this series will be used to run k3s.
    +
    +

    Check for POPCNT CPU support


    +
    +POPCNT is a CPU instruction that counts the number of set bits (ones) in a binary number. In terms of CPU virtualization and Bhyve support for the POPCNT instruction is important because guest operating systems utilize this instruction to perform various tasks more efficiently. If the host CPU supports POPCNT, Bhyve can pass this capability to virtual machines to for better performance. Without POPCNT support, some applications might not run, or they might perform suboptimally in virtualized environments.
    +
    +To check for POPCNT support, I run:
    +
    + +
    paul@f0:~ % dmesg | grep 'Features2=.*POPCNT'
    +  Features2=0x7ffafbbf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,SDBG,
    +	FMA,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,
    +	OSXSAVE,AVX,F16C,RDRAND>
    +
    +
    +So it's there! All good.
    +
    +

    Basic Bhyve setup


    +
    +For the management of the Bhyve VMs, we are using vm-bhyve, a tool not part of the FreeBSD operating system but available as a ready-to-use package. It eases VM management and reduces a lot of the overhead. We also install the required package to make Bhyve work with the UEFI firmware.
    +
    +https://github.com/churchers/vm-bhyve
    +
    +The following commands are executed on all three hosts f0, f1, and f2, where re0 is the name of the Ethernet interface (which may need to be adjusted if your hardware is different):
    +
    + +
    paul@f0:~ % doas pkg install vm-bhyve bhyve-firmware
    +paul@f0:~ % doas sysrc vm_enable=YES
    +vm_enable:  -> YES
    +paul@f0:~ % doas sysrc vm_dir=zfs:zroot/bhyve
    +vm_dir:  -> zfs:zroot/bhyve
    +paul@f0:~ % doas zfs create zroot/bhyve
    +paul@f0:~ % doas vm init
    +paul@f0:~ % doas vm switch create public
    +paul@f0:~ % doas vm switch add public re0
    +
    +
    +Bhyve stores all it's data in the /bhyve of the zroot ZFS pool:
    +
    + +
    paul@f0:~ % zfs list | grep bhyve
    +zroot/bhyve                                   1.74M   453G  1.74M  /zroot/bhyve
    +
    +
    +For convenience, we also create this symlink:
    +
    + +
    paul@f0:~ % doas ln -s /zroot/bhyve/ /bhyve
    +
    +
    +
    +Now, Bhyve is ready to rumble, but no VMs are there yet:
    +
    + +
    paul@f0:~ % doas vm list
    +NAME  DATASTORE  LOADER  CPU  MEMORY  VNC  AUTO  STATE
    +
    +
    +

    Rocky Linux VMs


    +
    +

    ISO download


    +
    +We're going to install the Rocky Linux from the latest minimal iso:
    +
    + +
    paul@f0:~ % doas vm iso \
    + https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.5-x86_64-minimal.iso
    +/zroot/bhyve/.iso/Rocky-9.5-x86_64-minimal.iso        1808 MB 4780 kBps 06m28s
    +paul@f0:/bhyve % doas vm create rocky
    +
    +

    VM configuration


    +
    +The default configuration looks like this now:
    +
    + +
    paul@f0:/bhyve/rocky % cat rocky.conf
    +loader="bhyveload"
    +cpu=1
    +memory=256M
    +network0_type="virtio-net"
    +network0_switch="public"
    +disk0_type="virtio-blk"
    +disk0_name="disk0.img"
    +uuid="1c4655ac-c828-11ef-a920-e8ff1ed71ca0"
    +network0_mac="58:9c:fc:0d:13:3f"
    +
    +
    +Whereas the uuid and the network0_mac differ on each of the 3 hosts.
    +
    +but in order to make Rocky Linux boot it (plus some other adjustments, e.g. as I am intending to run the majority of the workload in the k3s cluster running on those linux VMs, I give them beefy specs like 4 CPU cores and 14GB RAM), I run doas vm configure rocky and modified it to:
    +
    +
    +guest="linux"
    +loader="uefi"
    +uefi_vars="yes"
    +cpu=4
    +memory=14G
    +network0_type="virtio-net"
    +network0_switch="public"
    +disk0_type="virtio-blk"
    +disk0_name="disk0.img"
    +graphics="yes"
    +graphics_vga=io
    +uuid="1c45400b-c828-11ef-8871-e8ff1ed71cac"
    +network0_mac="58:9c:fc:0d:13:3f"
    +
    +
    +

    VM installation


    +
    +To start the installer from the downloaded ISO, I run:
    +
    + +
    paul@f0:~ % doas vm install rocky Rocky-9.5-x86_64-minimal.iso
    +Starting rocky
    +  * found guest in /zroot/bhyve/rocky
    +  * booting...
    +
    +paul@f0:/bhyve/rocky % doas vm list
    +NAME   DATASTORE  LOADER  CPU  MEMORY  VNC           AUTO  STATE
    +rocky  default    uefi    4    14G     0.0.0.0:5900  No    Locked (f0.lan.buetow.org)
    +
    +paul@f0:/bhyve/rocky % doas sockstat -4 | grep 5900
    +root     bhyve       6079 8   tcp4   *:5900                *:*
    +
    +
    +Port 5900 now also opened for VNC connections, so I connected to it with a VNC client and run through the installation dialogs. I'm sure this could be done unattended or more automated, there are only 3 VMs to install, and the automation doesn't seem worth it as we are doing it only once in a year or less often.
    +
    +

    Increase of the disk image


    +
    +By default the VMs disk image is only 20G, which is a bit small for my purposes, so I stopped the VMs again and run truncate on the image file to enlarge them to 100G, and re-started the installation:
    +
    + +
    paul@f0:/bhyve/rocky % doas vm stop rocky
    +paul@f0:/bhyve/rocky % doas truncate -s 100G disk0.img
    +paul@f0:/bhyve/rocky % doas vm install rocky Rocky-9.5-x86_64-minimal.iso
    +
    +
    +

    Connect to VPN


    +
    +For the installation, I opened the VPN client on my Fedora laptop (GNOME comes with a simple VPN client) and ran through the base installation for each of the VMs manually. Again, I am sure this could have been automated a bit more, but there were just 3 VMs, and it wasn't worth the effort. The three VNC addresses of the VMs were: vnc://f0:5900, vnc://f1:5900, and vnc://f0:5900.
    +
    +I mostly selected the default settings (auto partitioning on the 100GB drive and a root user password). After the installation, the VMs were rebooted.
    +
    +

    After install


    +
    +I performed the following steps for all 3 VMs. In the following, the examples are all executed on f0 (bzw the VM r0 running on f0):
    +
    +

    VM auto-start after host reboot


    +
    +To automatically start the VM on the servers I added the following to the rc.conf on the FreeBSD hosts:
    +
    + +
    paul@f0:/bhyve/rocky % cat <<END | doas tee -a /etc/rc.conf
    +vm_list="rocky"
    +vm_delay="5"
    +
    +
    +The vm_delay isn't really required. It is used to wait 5 seconds before starting each VM, but as of now, there is only one VM per host. Maybe later, when there are more, this will be useful to have. After adding, there's now a Yes indicator in the AUTO column.
    +
    + +
    paul@f0:~ % doas vm list
    +NAME   DATASTORE  LOADER  CPU  MEMORY  VNC           AUTO     STATE
    +rocky  default    uefi    4    14G     0.0.0.0:5900  Yes [1]  Running (2063)
    +
    +
    +

    Static IP configuration


    +
    +After that, I changed the network configuration of the VMs to be static (from DHCP) here. As per previous post of this series, the 3 FreeBSD hosts were already in my /etc/hosts file:
    +
    +
    +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
    +
    +
    +For the Rocky VMs I added those to the FreeBSD hosts systems as well:
    +
    + +
    paul@f0:/bhyve/rocky % cat <<END | doas tee -a /etc/hosts
    +192.168.1.120 r0 r0.lan r0.lan.buetow.org
    +192.168.1.121 r1 r1.lan r1.lan.buetow.org
    +192.168.1.122 r2 r2.lan r2.lan.buetow.org
    +END
    +
    +
    +and configured the IPs accordingly on the VMs themselves by opening a root shell via RDP to the VMs and entering the following commands on each of the VMs:
    +
    + +
    [root@r0 ~] % dnmcli connection modify enp0s5 ipv4.address 192.168.1.120/24
    +[root@r0 ~] % dnmcli connection modify enp0s5 ipv4.gateway 192.168.1.1
    +[root@r0 ~] % dnmcli connection modify enp0s5 ipv4.dns 192.168.1.1
    +[root@r0 ~] % dnmcli connection modify enp0s5 ipv4.method manual
    +[root@r0 ~] % dnmcli connection down enp0s5
    +[root@r0 ~] % dnmcli connection up enp0s5
    +[root@r0 ~] % hostnamectl set-hostname r0.lan.buetow.org
    +[root@r0 ~] % cat <<END >>/etc/hosts
    +192.168.1.120 r0 r0.lan r0.lan.buetow.org
    +192.168.1.121 r1 r1.lan r1.lan.buetow.org
    +192.168.1.122 r2 r2.lan r2.lan.buetow.org
    +END
    +
    +
    +Whereas:
    +
    +
      +
    • 192.168.1.120 is the IP of the VM itself (here: r0.lan.buetow.org)
    • +
    • 192.168.1.1 is the address of my home router, which also does DNS.
    • +

    +

    Permitting root login


    +
    +As these VMs arent directly reachable via SSH from the internet, I enabled root login by adding a line with PermitRootLogin yes to /etc/sshd/sshd_config.
    +
    +Once done, I rebooted the VM by running reboot inside of the vm to test whether everything was configured and persisted correctly.
    +
    +After reboot, I copied my public key from my Laptop to the 3 VMs:
    +
    + +
    % for i in 0 1 2; do ssh-copy-id root@r$i.lan.buetow.org; done
    +
    +
    +And then I edited the /etc/ssh/sshd_config file again on all 3 VMs and configured PasswordAuthentication no, to only allow SSH key authentication from now on.
    +
    +

    Install latest updates


    +
    + +
    [root@r0 ~] % dnf update
    +[root@r0 ~] % dreboot
    +
    +
    +CPU STRESS TESTER VM VS NOT VM
    +
    +Other *BSD-related posts:
    +
    +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
    +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
    +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
    +2024-04-01 KISS high-availability with OpenBSD
    +2024-01-13 One reason why I love OpenBSD
    +2022-10-30 Installing DTail on OpenBSD
    +2022-07-30 Let's Encrypt with OpenBSD and Rex
    +2016-04-09 Jails and ZFS with Puppet on FreeBSD
    +
    +E-Mail your comments to paul@nospam.buetow.org :-)
    +
    +Back to the main site
    + + + diff --git a/gemfeed/DRAFT-site-reliability-engineering.html b/gemfeed/DRAFT-site-reliability-engineering.html index fc38aa15..8217bf6a 100644 --- a/gemfeed/DRAFT-site-reliability-engineering.html +++ b/gemfeed/DRAFT-site-reliability-engineering.html @@ -8,7 +8,10 @@ -

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


    +

    +Home | Markdown | Gemini +

    +

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



    A significant portion of the work revolves around system design and incident analysis.

    @@ -28,7 +31,7 @@
    6 minutes to wt.

    -

    The Heroic Facade and Team Dynamics: Rethinking Success in SRE


    +

    The Heroic Facade and Team Dynamics: Rethinking Success in SRE



    The realm of Site Reliability Engineering is punctuated by the constant ebb and flow of system challenges. While individual excellence is commendable, the overarching belief in the SRE culture should be that true success lies in cohesive teamwork and not in individual heroics.

    @@ -79,7 +82,7 @@
    To conclude, while the heroics in SRE can often be the stuff of legends, it's vital to see beyond this facade. The countless hours of teamwork, collaboration, and shared responsibility lie in the shadows of these heroic acts. The future of SRE lies not in individual heroics but in teams that operate like well-oiled machines, with every cog, big or small, playing its part to perfection.

    -

    Monitoring, Observability, and the SRE Arsenal: Navigating the Nuances of System Reliability


    +

    Monitoring, Observability, and the SRE Arsenal: Navigating the Nuances of System Reliability



    Site Reliability Engineering is characterised by a relentless quest for reliability, uptime, and seamless user experiences. Within this universe, the notions of monitoring and observability emerge not as mere tools but as critical lifelines that guide decision-making, error diagnosis, and preventive strategies.

    @@ -93,7 +96,7 @@
    To sum it up, monitoring and observability play pivotal roles in the intricate dance of system reliability. They are the compass and map, guiding SREs through the labyrinthine challenges of modern systems. By leveraging them effectively and in conjunction with other SRE methodologies, organisations can achieve the zenith of reliability, ensuring that their services remain robust, resilient, and remarkably user-centric.

    -

    The Ever-evolving Landscape of SRE


    +

    The Ever-evolving Landscape of SRE



    To begin, the very fabric of SRE is interwoven with organisational culture. Successful SRE adoption transcends the mere automation of software operations—it is deeply cultural. It demands a seismic shift in how organisations perceive failures, value preventative work, and prioritise communication. In such an environment, writing is not just a skill but a critical tool for reliability. Precise communication enhances clarity, mitigates risks, and facilitates collaboration.

    @@ -105,7 +108,7 @@
    In conclusion, as a discipline, SRE is a beacon of continuous evolution. As systems grow more complex and user expectations rise, the SRE landscape will inevitably shift, demanding adaptability, resilience, and foresight from its practitioners. But in this ever-changing terrain, the core tenets remain—balancing innovation with reliability, valuing human well-being, and leveraging tools and data for informed decision-making. In the grand tapestry of engineering, SRE stands out as a dynamic, challenging, yet immensely rewarding realm, ever-responsive to the rhythms of technology and human ingenuity.

    -

    Effective Communication and Collaboration in SRE


    +

    Effective Communication and Collaboration in SRE



    Site Reliability Engineering is not merely a technical discipline. At its core, SRE underscores the importance of effective communication and collaboration as critical tenets of a resilient and efficient system.

    @@ -121,7 +124,7 @@
    In conclusion, while SRE is deeply technical, its efficacy is intertwined with the soft skills of communication and collaboration. As systems grow more intricate and the stakes rise, the ability to communicate clearly and collaborate effectively will distinguish successful SRE teams from the rest. It's a reminder that there are people at the heart of every machine, every line of code, and nurturing human connections is paramount to ensuring machine efficiency.

    -

    Inherent Curiosity and Continual Learning in SRE


    +

    Inherent Curiosity and Continual Learning in SRE



    The realm of Site Reliability Engineering is expansive, dynamic, and deeply integrated with the ever-evolving technological landscape. It's evident that an essential trait underpinning successful SRE practice combines inherent curiosity and an unwavering commitment to continual learning.

    @@ -135,7 +138,7 @@
    In conclusion, the world of Site Reliability Engineering is not for the complacent. It's a domain that rewards the curious, the seekers, and those with an insatiable appetite for knowledge. As systems grow in complexity and the stakes become higher, this inherent curiosity and dedication to continual learning will define the success and resilience of SRE endeavours. The journey of an SRE, thus, is one of perpetual exploration, driven by the quest to know more and do better.

    -

    The Iterative Spirit of SRE


    +

    The Iterative Spirit of SRE



    Site Reliability Engineering is more than just a technical discipline; it embodies a mindset that embraces iteration, proactive problem-solving, and continuous enhancement.

    @@ -149,9 +152,9 @@
    In summary, the essence of Site Reliability Engineering is characterised by an iterative spirit, a recognition that perfection is a journey, not a destination. Whether refining system designs, enhancing tooling or fostering collaborative dialogues, SREs are always looking for the next improvement, refinement, and iteration. It's this spirit that ensures systems are reliable and continually evolving to meet the ever-changing demands of the digital age.

    -

    The role of simplicity Simplicity


    +

    The role of simplicity Simplicity



    -

    Book tips


    +

    Book tips



    • 97 Things Every SRE Should Know: Collective Wisdom from the Experts by Emily Stolarsky and Jaime Woo
    • @@ -162,9 +165,9 @@
      Back to the main site
      diff --git a/gemfeed/a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang/logo-small.png b/gemfeed/a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang/logo-small.png new file mode 100644 index 00000000..dc29011c Binary files /dev/null and b/gemfeed/a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang/logo-small.png differ diff --git a/gemfeed/a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang/screenshot-android.png b/gemfeed/a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang/screenshot-android.png new file mode 100644 index 00000000..a8a604e3 Binary files /dev/null and b/gemfeed/a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang/screenshot-android.png differ diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 440c911a..e8e585c5 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,2262 +1,1938 @@ - 2023-11-11T22:22:05+02:00 + 2025-02-21T11:07:08+02:00 foo.zone feed To be in the .zone! https://foo.zone/ - 'Mind Management' book notes - - https://foo.zone/gemfeed/2023-11-11-mind-management-book-notes.html - 2023-11-11T22:21:47+02:00 + Random Weird Things - Part Ⅱ + + https://foo.zone/gemfeed/2025-02-08-random-weird-things-ii.html + 2025-02-08T11:06:16+02:00 Paul Buetow aka snonux paul@dev.buetow.org - These are my personal takeaways after reading 'Mind Management' by David Kadavy. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too. + Every so often, I come across random, weird, and unexpected things on the internet. I thought it would be neat to share them here from time to time. This is the second run.
      -

      "Mind Management" book notes


      +

      Random Weird Things - Part Ⅱ



      -Published at 2023-11-11T22:21:47+02:00
      +Published at 2025-02-08T11:06:16+02:00

      -These are my personal takeaways after reading "Mind Management" by David Kadavy. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.
      +Every so often, I come across random, weird, and unexpected things on the internet. I thought it would be neat to share them here from time to time. This is the second run.
      +
      +2024-07-05 Random Weird Things - Part Ⅰ
      +2025-02-08 Random Weird Things - Part Ⅱ (You are currently reading this)

      -         ,..........   ..........,
      -     ,..,'          '.'          ',..,
      -    ,' ,'            :            ', ',
      -   ,' ,'             :             ', ',
      -  ,' ,'              :              ', ',
      - ,' ,'............., : ,.............', ',
      -,'  '............   '.'   ............'  ',
      - '''''''''''''''''';''';''''''''''''''''''
      -                    '''
      +/\_/\           /\_/\
      +( o.o ) WHOA!! ( o.o )
      +> ^ <           > ^ <
      +/   \    MOEEW! /   \
      +/______\       /______\
       

      -Productivity isn't about time management - it's about mind management. When you put a lot of effort into something, there are:
      +

      Table of Contents




      -

      Empty slots in the calendar


      +

      11. The SQLite codebase is a gem



      -If we do more things in less time and use all possible slots, speed read, etc., we are more productive. But in reality, that's not the entire truth. You also exchange one thing against everything else.... You cut out too much from your actual life.
      +Check this out:

      -

      When you safe time...


      +SQLite Gem

      -...keep it.
      +Source:

      -
        -
      • stare out of the window; that's good for you.
      • -
      • Creative thinking needs space. It will pay dividends tomorrow.
      • -
      • You will be rewarded with the "Eureka effect" - a sudden new insight.
      • -

      -

      Follow your mood


      +https://wetdry.world/@memes/112717700557038278

      -Ask yourself: what is my mood now? We never have the energy to do anything, so the better strategy is to follow your current mode and energy. E.g.:
      +

      Go Programming



      -
        -
      • Didn't sleep enough today? Then, do simple, non-demanding tasks at work
      • -
      • Had a great sleep, and there is even time before work starts? Pull in a workout...
      • -

      -

      Boosting creativity


      +

      12. Official Go font



      -The morning without coffee is a gift for creativity, but you often get distracted. Minimize distractions, too. I have no window to stare out but a plain blank wall.
      +The Go programming language has an official font called "Go Font." It was created to complement the aesthetic of the Go language, ensuring clear and legible rendering of code. The font includes a monospace version for code and a proportional version for general text, supporting consistent look and readability in Go-related materials and development environments.

      -
        -
      • The busier you are, the less creative you will be.
      • -
      • Event time (divergent thinking) vs clock time (convergent thinking)
      • -
      • Don't race with time but walk alongside it as rough time lines.
      • -
      • Don't judge every day after the harvest, but the seed you lay
      • -

      -

      The right mood for the task at hand


      +Check out some Go code displayed using the Go font:

      -We need to try many different combinations. Limiting ourselves and trying too hard makes us frustrated and burn out. Creativity requires many iterations.
      +Go font code

      -I can only work according to my available brain power.
      +https://go.dev/blog/go-fonts

      -I can also change my mood according to what needs improvement. Just imagine the last time you were in that mood and then try to get into it. It can take several tries to hit a working mood. Try to replicate that mental state. This can also be by location or by another habit, e.g. by a beer.
      +The design emphasizes simplicity and readability, reflecting Go's philosophy of clarity and efficiency.

      -Once you are in a mental state, don't try to change it. It will take a while for your brain to switch to a completely different state.
      +I found it interesting and/or weird, as Go is a programming language. Why should it bother having its own font? I have never seen another open-source project like Go do this. But I also like it. Maybe I will use it in the future for this blog :-)

      -Week of want. For a week, only do what you want and not what you must do. Your ideas will get much more expansive.
      +

      13. Go functions can have methods



      -It gives you pleasure and is in a good mood. This increases creativity if you do what you want to do.
      +Functions on struct types? Well, know. Functions on types like int and string? It's also known of, but a bit lesser. Functions on function types? That sounds a bit funky, but it's possible, too! For demonstration, have a look at this snippet:

      -

      Creativity hacks


      + +
      package main
      +
      +import "log"
      +
      +type fun func() string
      +
      +func (f fun) Bar() string {
      +        return "Bar"
      +}
      +
      +func main() {
      +        var f fun = func() string {
      +                return "Foo"
      +        }
      +        log.Println("Example 1: ", f())
      +        log.Println("Example 2: ", f.Bar())
      +        log.Println("Example 3: ", fun(f.Bar).Bar())
      +        log.Println("Example 4: ", fun(fun(f.Bar).Bar).Bar())
      +}
      +

      -
        -
      • Coffee can cause anxiety.
      • -
      • Take phentermine with coffee to take off the edge and have a relaxed focus
      • -
      • Green tea, which tastes sweet plus supplement boost.
      • -
      • Also wine. But be careful with alcohol. Don't drink a whole bottle.
      • -
      • Have a machine without distractions and internet access for writing.
      • -
      • Go to open spaces for creativity.
      • -
      • Go to closed spaces for polishing.
      • -

      -

      Planning and strategizing


      +It runs just fine:

      -Minds work better in sprints and not in marathons. Have a weekly plan, not a daily one.
      + +
      ❯ go run main.go
      +2025/02/07 22:56:14 Example 1:  Foo
      +2025/02/07 22:56:14 Example 2:  Bar
      +2025/02/07 22:56:14 Example 3:  Bar
      +2025/02/07 22:56:14 Example 4:  Bar
      +

      -
        -
      • Alternating incubation to avoid blocks.
      • -
      • Build on systems that use chaos for growth, e.g. unplanned disasters.
      • -
      • Things don't go after the plan is the plan. Be anti-fragile.
      • -

      -Organize by mental state. In the time management context, the mental state doesn't exist. You schedule as many things as possible by project. In the mind management context, mental state is everything. You could prepare by mental state and not by assignment.
      +

      macOS



      -You could schedule exploratory tasks when you are under grief. Sound systems should create slack for creativity. Plan only for a few minutes.
      +For personal computing, I don't use Apple, but I have to use it for work.

      -

      Fake it until you make it.


      +

      14. ß and ss are treated the same



      -
        -
      • E.g. act calm if you want to be calm.
      • -
      • Talk slowly and deepen your voice a bit to appear more confident. You will also become more confident.
      • -
      • Also, use power positions for better confidence.
      • -

      -Other book notes of mine are:
      +Know German? In German, the letter "sarp s" is written as ß. ß is treated the same as ss on macOS.

      -2023-03-16 "The Pragmatic Programmer" book notes
      -2023-04-01 "Never split the difference" book notes
      -2023-05-06 "The Obstacle is the Way" book notes
      -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      -2023-11-11 "Mind Management" book notes (You are currently reading this)
      +On a case-insensitive file system like macOS, not only are uppercase and lowercase letters treated the same, but non-Latin characters like the German "ß" are also considered equivalent to their Latin counterparts (in this case, "ss").

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +So, even though "Maß" and "Mass" are not strictly equivalent, the macOS file system still treats them as the same filename due to its handling of Unicode characters. This can sometimes lead to unexpected behaviour. Check this out:

      -More books and other resources I found useful.
      -Back to the main site
      -
      -
      -
      - - KISS static web photo albums with `photoalbum.sh` - - https://foo.zone/gemfeed/2023-10-29-kiss-static-web-photo-albums-with-photoalbum.sh.html - 2023-10-29T22:25:04+02:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - Once in a while, I share photos on the inter-web with either family and friends or on my The Irregular Ninja photo site. One hobby of mine is photography (even though I don't have enough time for it - so I am primarily a point-and-shoot photographer). - -
      -

      KISS static web photo albums with photoalbum.sh


      + +
      ❯ touch Maß
      +❯ ls -l
      +-rw-r--r--@ 1 paul  wheel  0 Feb  7 23:02 Maß
      +❯ touch Mass
      +❯ ls -l
      +-rw-r--r--@ 1 paul  wheel  0 Feb  7 23:02 Maß
      +❯ rm Mass
      +❯ ls -l
      +
      +❯ touch Mass
      +❯ ls -ltr
      +-rw-r--r--@ 1 paul  wheel  0 Feb  7 23:02 Mass
      +❯ rm Maß
      +❯ ls -l
      +
      +

      -Published at 2023-10-29T22:25:04+02:00
      +

      15. Colon as file path separator


      +
      +MacOS can use the colon as a file path separator on its ADFS (file system). A typical ADFS file pathname on a hard disc might be:

      -         ___        .---------.._
      -  ______!fsc!_....-' .g8888888p. '-------....._
      -.'          //     .g8:       :8p..---....___ \'.
      -| foo.zone //  ()  d88:       :88b|==========! !|
      -|         //       888:       :888|==========| !|
      -|___      \\_______'T88888888888P''----------'//|   
      -|   \       """"""""""""""""""""""""""""""""""/ |   
      -|    !...._____      .="""=.   .[]    ____...!  |   
      -|   /               ! .g$p. !   .[]          :  |   
      -|  !               :  $$$$$  :  .[]          :  |   
      -|  !irregular.ninja ! 'T$P' !   .[]           '.|   
      -|   \__              "=._.="   .()        __    |   
      -|.--'  '----._______________________.----'  '--.|
      -'._____________________________________________.'   
      +ADFS::4.$.Documents.Techwriter.Myfile
       

      -

      Motivation


      +I can't reproduce this on my (work) Mac, though, as it now uses the APFS file system. In essence, ADFS is an older file system, while APFS is a contemporary file system optimized for Apple's modern devices.

      -Once in a while, I share photos on the inter-web with either family and friends or on my The Irregular Ninja photo site. One hobby of mine is photography (even though I don't have enough time for it - so I am primarily a point-and-shoot photographer).
      +https://social.jvns.ca/@b0rk/113041293527832730

      -I'm not particularly eager to use any photo social sharing platforms such as Flickr, 500px (I used them regularly in the past), etc., anymore. I value self-hosting, DIY and privacy (nobody should data mine my photos), and no third party should have any rights to my pictures.
      +

      16. Polyglots - programs written in multiple languages



      -I value KISS (keep it simple and stupid) and simplicity. All that's required for a web photo album is some simple HTML and spice it up with CSS. No need for JavaScript, no need for a complex dynamic website.
      +A coding polyglot is a program or script written so that it can be executed in multiple programming languages without modification. This is typically achieved by leveraging syntax overlaps or crafting valid and meaningful code in each targeted language. Polyglot programs are often created as a challenge or for demonstration purposes to showcase language similarities or clever coding techniques.

      -

      Introducing photoalbum.sh


      +Check out my very own polyglot:

      -photoalbum.sh is a minimal Bash (Bourne Again Shell) script for Unix-like operating systems (such as Linux) to generate static web photo albums. The resulting static photo album is pure HTML+CSS (without any JavaScript!). It is specially designed to be as simple as possible.
      +The fibonatti.pl.c Polyglot

      -

      Installation


      +

      17. Languages, where indices start at 1



      -Installation is straightforward. All required is a recent version of GNU Bash, GNU Make, Git and ImageMagick. On Fedora, the dependencies are installed with:
      +Array indices start at 1 instead of 0 in some programming languages, known as one-based indexing. This can be controversial because zero-based indexing is more common in popular languages like C, C++, Java, and Python. One-based indexing can lead to off-by-one errors when developers switch between languages with different indexing schemes.

      -
      -% sudo dnf install -y ImageMagick make git
      +Languages with One-Based Indexing:
      +
      +
        +
      • Fortran
      • +
      • MATLAB
      • +
      • Lua
      • +
      • R (for vectors and lists)
      • +
      • Smalltalk
      • +
      • Julia (by default, although zero-based indexing is also possible)
      • +

      +foo.lua example:
      +
      + +
      arr = {10, 20, 30, 40, 50}
      +print(arr[1]) -- Accessing the first element
       

      -Now, clone, make and install the script:
      + +
      ❯ lua foo.lua
      +10
      +

      -
      -% git clone https://codeberg.org/snonux/photoalbum
      -Cloning into 'photoalbum'...
      -remote: Enumerating objects: 1624, done.
      -remote: Total 1624 (delta 0), reused 0 (delta 0), pack-reused 1624
      -Receiving objects: 100% (1624/1624), 193.36 KiB | 1.49 MiB/s, done.
      -Resolving deltas: 100% (1227/1227), done.
      +One-based indexing is more natural for human-readable, mathematical, and theoretical contexts, where counting traditionally starts from one.
      +
      +

      18. Perl Poetry


      +
      +Perl Poetry is a playful and creative practice within the programming community where Perl code is written as a poem. These poems are crafted to be syntactically valid Perl code and make sense as poetic text, often with whimsical or humorous intent. This showcases Perl's flexibility and expressiveness, as well as the creativity of its programmers.
      +
      +See this Poetry of my own; the Perl interpreter does not yield any syntax error parsing that. But also, the Peom doesn't do anything useful then executed:
      +
      + +
      # (C) 2006 by Paul C. Buetow
       
      -% cd photoalbum
      -/home/paul/photoalbum
      +Christmas:{time;#!!!
       
      -% make
      -cut -d' ' -f2 changelog | head -n 1 | sed 's/(//;s/)//' > .version
      -test ! -d ./bin && mkdir ./bin || exit 0
      -sed "s/PHOTOALBUMVERSION/$(cat .version)/" src/photoalbum.sh > ./bin/photoalbum
      -chmod 0755 ./bin/photoalbum
      +Children: do tell $wishes;
       
      -% sudo make install
      -test ! -d /usr/bin && mkdir -p /usr/bin || exit 0
      -cp ./bin/* /usr/bin
      -test ! -d /usr/share/photoalbum/templates && mkdir -p /usr/share/photoalbum/templates || exit 0
      -cp -R ./share/templates /usr/share/photoalbum/
      -test ! -d /etc/default && mkdir -p /etc/default || exit 0
      -cp ./src/photoalbum.default.conf /etc/default/photoalbum
      +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;
      +
      +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 };
      +
      +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;
      +
      +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__
      +
      +This is perl, v5.8.8 built for i386-freebsd-64int
       

      -You should now have the photoalbum command in your $PATH. But wait to use it! First, it needs to be set up!
      +More Perl Poetry of mine

      -
      -% photoalbum version
      -This is Photoalbum Version 0.5.1
      -
      +

      19. CSS3 is turing complete



      -

      Setting it up


      +CSS3 is Turing complete because it can simulate a Turing machine using only CSS animations and styles without any JavaScript or external logic. This is achieved by using keyframe animations to change the styles of HTML elements in a way that encodes computation, performing calculations and state transitions.

      -Now, it's time to set up the Irregular Ninja static web photo album (or any other web photo album you may be setting up!)! Create a directory (here: irregular.ninja for the Irregular Ninja Photo site - or any oter sub-directory reflecting your album's name), and inside of that directory, create an incoming directory. The incoming directory. Copy all photos to be part of the album there.
      +Is CSS turing complete?

      -
      -% mkdir irregular.ninja
      -% cd irregular.ninja
      -% # cp -Rpv ~/Photos/your-photos ./incoming
      -
      +It is surprising because CSS is primarily a styling language intended for the presentation layer of web pages, not for computation or logic. Its capability to perform complex computations defies its typical use case and showcases the unintended computational power that can emerge from the creative use of seemingly straightforward technologies.

      -In this example, I am skipping the cp ... part as I intend to use an alternative incoming directory, as you will see later in the configuration file.
      +Check out this 100% CSS implementation of the Conways Game of Life:

      -The general usage of potoalbum is as follows:
      +

      -
      -photoalbum clean|generate|version [rcfile] photoalbum
      -photoalbum makemake
      -
      +CSS Conways Game of Life

      -Whereas:
      +Conway's Game of Life is Turing complete because it can simulate a universal Turing machine, meaning it can perform any computation that a computer can, given the right initial conditions and sufficient time and space. Suppose a language can implement Conway's Game of Life. In that case, it demonstrates the language's ability to handle complex state transitions and computations. It has the necessary constructs (like iteration, conditionals, and data manipulation) to simulate any algorithm, thus confirming its Turing completeness.
      +
      +

      20. The biggest shell programs


      +
      +One would think that shell scripts are only suitable for small tasks. Well, I must be wrong, as there are huge shell programs out there (up to 87k LOC) which aren't auto-generated but hand-written!
      +
      +The Biggest Sell Programs in the World
      +
      +My Gemtexter (bash) is only 1329 LOC as of now. So it's tiny.
      +
      +Gemtexter - One Bash script to rule it all
      +
      +I hope you had some fun. E-Mail your comments to paul@nospam.buetow.org :-)
      +
      +Back to the main site
      +
      +
      +
      + + f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts + + https://foo.zone/gemfeed/2025-02-01-f3s-kubernetes-with-freebsd-part-3.html + 2025-01-30T09:22:06+02:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + This is the third blog post about my f3s series for my self-hosting demands in my home lab. f3s? The 'f' stands for FreeBSD, and the '3s' stands for k3s, the Kubernetes distribution we will use on FreeBSD-based physical machines. + +
      +

      f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts


      +
      +Published at 2025-01-30T09:22:06+02:00
      +
      +This is the third blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution we will use on FreeBSD-based physical machines.
      +
      +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
      +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
      +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts (You are currently reading this)
      +
      +f3s logo
      +
      +

      Table of Contents




      -So what we will do next is to run the following inside of the irregular.ninja/ directory; it will generate a Makefile and a configuration file photoalbumrc containing a few configurable options:
      +

      Introduction


      +
      +In this blog post, we are setting up the UPS for the cluster. A UPS, or Uninterruptible Power Supply, safeguards my cluster from unexpected power outages and surges. It acts as a backup battery that kicks in when the electricity cuts out—especially useful in my area, where power cuts are frequent—allowing for a graceful system shutdown and preventing data loss and corruption. This is especially important since I will also store some of my data on the f3s nodes.
      +
      +

      Changes since last time


      +
      +

      FreeBSD upgrade from 14.1 to 14.2


      +
      +There has been a new release since the last blog post in this series. The upgrade from 14.1 was as easy as:

      -
      % 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
      +
      paul@f0: ~ % doas freebsd-update fetch
      +paul@f0: ~ % doas freebsd-update install
      +paul@f0: ~ % doas freebsd-update -r 14.2-RELEASE upgrade
      +paul@f0: ~ % doas freebsd-update install
      +paul@f0: ~ % doas shutdown -r now
       

      -In the case for irregular.ninja, I changed the defaults to the following:
      +And after rebooting, I ran:

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

      Generating the static photo album


      -
      -Let's generate it. Depending on the image sizes and count, the following step may take a while.
      -
      -
      -% make
      -photoalbum generate photoalbumrc
      -Processing 1055079_cool-water-wallpapers-hd-hd-desktop-wal.jpg to /home/paul/irregular.ninja/dist/photos/1055079_cool-water-wallpapers-hd-hd-desktop-wal.jpg
      -Processing 11271242324.jpg to /home/paul/irregular.ninja/dist/photos/11271242324.jpg
      -Processing 11271306683.jpg to /home/paul/irregular.ninja/dist/photos/11271306683.jpg
      -Processing 13950707932.jpg to /home/paul/irregular.ninja/dist/photos/13950707932.jpg
      -Processing 14077406487.jpg to /home/paul/irregular.ninja/dist/photos/14077406487.jpg
      -Processing 14859380100.jpg to /home/paul/irregular.ninja/dist/photos/14859380100.jpg
      -Processing 14869239578.jpg to /home/paul/irregular.ninja/dist/photos/14869239578.jpg
      -Processing 14879132910.jpg to /home/paul/irregular.ninja/dist/photos/14879132910.jpg
      -.
      -.
      -.
      -Generating /home/paul/irregular.ninja/dist/html/7-4.html
      -Creating thumb /home/paul/irregular.ninja/dist/thumbs/20211130_091051.jpg
      -Creating blur /home/paul/irregular.ninja/dist/blurs/20211130_091051.jpg
      -Generating /home/paul/irregular.ninja/dist/html/page-7.html
      -Generating /home/paul/irregular.ninja/dist/html/7-5.html
      -Generating /home/paul/irregular.ninja/dist/html/7-5.html
      -Generating /home/paul/irregular.ninja/dist/html/7-5.html
      -Creating thumb /home/paul/irregular.ninja/dist/thumbs/DSCF0188.JPG
      -Creating blur /home/paul/irregular.ninja/dist/blurs/DSCF0188.JPG
      -Generating /home/paul/irregular.ninja/dist/html/page-7.html
      -Generating /home/paul/irregular.ninja/dist/html/7-6.html
      -Generating /home/paul/irregular.ninja/dist/html/7-6.html
      -Generating /home/paul/irregular.ninja/dist/html/7-6.html
      -Creating thumb /home/paul/irregular.ninja/dist/thumbs/P3500897-01.jpg
      -Creating blur /home/paul/irregular.ninja/dist/blurs/P3500897-01.jpg
      -.
      -.
      -.
      -Generating /home/paul/irregular.ninja/dist/html/8-0.html
      -Generating /home/paul/irregular.ninja/dist/html/8-41.html
      -Generating /home/paul/irregular.ninja/dist/html/9-0.html
      -Generating /home/paul/irregular.ninja/dist/html/9-41.html
      -Generating /home/paul/irregular.ninja/dist/html/index.html
      -Generating /home/paul/irregular.ninja/dist/.//index.html
      -
      -
      -The result will be in the distribution directory ./dist. This directory is publishable to the inter-web:
      -
      -
      -% ls ./dist
      -blurs  html  index.html  photos  thumbs
      +
      paul@f0: ~ % doas freebsd-update install
      +paul@f0: ~ % doas pkg update
      +paul@f0: ~ % doas pkg upgrade
      +paul@f0: ~ % doas shutdown -r now
       

      -I usually do that via rsync to my web server (I use OpenBSD with the standard httpd web server, btw.), which is as simple as:
      +And after another reboot, I was on 14.2:

      -
      -% rsync --delete -av ./dist/. admin@blowfish.buetow.org:/var/www/htdocs/irregular.ninja/
      +
      +
      paul@f0:~ % uname -a
      +FreeBSD f0.lan.buetow.org 14.2-RELEASE FreeBSD 14.2-RELEASE 
      + releng/14.2-n269506-c8918d6c7412 GENERIC amd64
       

      -Have a look at the end result here:
      -
      -https://irregular.ninja
      -
      -PS: There's also a server-side synchronisation script mirroring the same content to another server for high availability reasons (out of scope for this blog post).
      -
      -

      Cleaning it up


      -
      -A simple make clean will clean up the ./dist directory and all other (if any) temp files created.
      -
      -

      HTML templates


      -
      -Poke around in this source directory. You will find a bunch of Bash-HTML template files. You could tweak them to your liking.
      -
      -

      Conclusion


      -
      -A decent looking (in my opinion, at least) in less than 500 (273 as of this writing, to be precise) lines of Bash code and with minimal dependencies; what more do you want? How many LOCs would this be in Raku with the same functionality (can it be sub-100?).
      -
      -Also, I like the CSS effects which I recently added. In particular, for the Irregular Ninja site, I randomly shuffled the CSS effects you see. The background blur images are the same but rotated 180 degrees and blurred out.
      -
      -photoalbum.sh source code on Codeberg.
      +And, of course, I ran this on all 3 nodes!

      -Other Bash and KISS-related posts are:
      +

      A new home (behind the TV)



      -2021-05-16 Personal Bash coding style guide
      -2021-06-05 Gemtexter - One Bash script to rule it all
      -2021-09-12 Keep it simple and stupid
      -2021-11-29 Bash Golf Part 1
      -2022-01-01 Bash Golf Part 2
      -2023-06-01 KISS server monitoring with Gogios
      -2023-10-29 KISS static web photo albums with photoalbum.sh (You are currently reading this)
      +I've put all the infrastructure behind my TV, as plenty of space is available. The TV hides most of the setup, which drastically improved the SAF (spouse acceptance factor).

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +New hardware placement arrangement

      -Back to the main site
      -
      -
      -
      - - DTail usage examples - - https://foo.zone/gemfeed/2023-09-25-dtail-usage-examples.html - 2023-09-25T14:57:42+03:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - Hey there. As I am pretty busy this month personally (I am now on Paternity Leave) and as I still want to post once monthly, the blog post of this month will only be some DTail usage examples. They're from the DTail documentation, but not all readers of my blog may be aware of those! - -
      -

      DTail usage examples


      +I got rid of the mini-switch I mentioned in the previous blog post. I have the TP-Link EAP615-Wall mounted on the wall nearby, which is my OpenWrt-powered Wi-Fi hotspot. It also has 3 Ethernet ports, to which I connected the Beelink nodes. That's the device you see at the very top.

      -Published at 2023-09-25T14:57:42+03:00
      +The Ethernet cables go downward through the cable boxes to the Beelink nodes. In addition to the Beelink f3s nodes, I connected the TP-Link to the UPS as well (not discussed further in this blog post, but the positive side effect is that my Wi-Fi will still work during a power loss for some time—and during a power cut, the Beelink nodes will still be able to communicate with each other).

      -Hey there. As I am pretty busy this month personally (I am now on Paternity Leave) and as I still want to post once monthly, the blog post of this month will only be some DTail usage examples. They're from the DTail documentation, but not all readers of my blog may be aware of those!
      +On the very left (the black box) is the UPS, with four power outlets. Three go to the Beelink nodes, and one goes to the TP-Link. A USB output is also connected to the first Beelink node, f0.

      -DTail is a distributed DevOps tool for tailing, grepping, catting logs and other text files on many remote machines at once which I programmed in Go.
      +On the very right (halfway hidden behind the TV) are the 3 Beelink nodes stacked on top of each other. The only downside (or upside?) is that my 14-month-old daughter is now chaos-testing the Beelink nodes, as the red power buttons (now reachable for her) are very attractive for her to press when passing by randomly. :-) Luckily, that will only cause graceful system shutdowns!

      -https://dtail.dev
      +

      The UPS hardware



      -
      -                              ,_---~~~~~----._
      -                        _,,_,*^____      _____``*g*\"*,
      -  ____ _____     _ _   / __/ /'     ^.  /      \ ^@q   f
      - |  _ \_   _|_ _(_) |   @f |      ((@|  |@))    l  0 _/
      - | | | || |/ _` | | |  \`/   \~____ / __ \_____/    \
      - | |_| || | (_| | | |   |           _l__l_           I
      - |____/ |_|\__,_|_|_|   }          [______]           I
      -                        ]            | | |            |
      -                        ]             ~ ~             |
      -                        |   Let's tail those logs!   |
      -                         |                           |
      -
      +I wanted a UPS that I could connect to via FreeBSD, and that would provide enough backup power to operate the cluster for a couple of minutes (it turned out to be around an hour, but this time will likely be shortened after future hardware upgrades, like additional drives and a backup enclosure) and to automatically initiate the shutdown of all the f3s nodes.

      -DTail consists out of a server and several client binaries. In this post, I am showcasing their use!
      +I decided on the APC Back-UPS BX750MI model because:

        -
      • Use dtail to follow logs
      • -
      • Use dtail to aggregate logs while they are followed
      • -
      • Use dcat to display logs and other text files already written
      • -
      • Use dgrep to grep (search) logs and other text files already written
      • -
      • Use dmap to aggregate logs and other text files already written
      • -
      • dserver is the DTail server, where all the clients can connect to
      • +
      • Zero noise level when there is no power cut (some light noise when the battery is in operation during a power cut).
      • +
      • Cost: It is relatively affordable (not costing thousands).
      • +
      • USB connectivity: Can be connected via USB to one of the FreeBSD hosts to read the UPS status.
      • +
      • A power output of 750VA (or 410 watts), suitable for an hour of runtime for my f3s nodes (plus the Wi-Fi router).
      • +
      • Multiple power outlets: Can connect all 3 f3s nodes directly.
      • +
      • User-replaceable batteries: I can replace the batteries myself after two years or more (depending on usage).
      • +
      • Its compact design. Overall, I like how it looks.

      -

      Following logs


      +The APC Back-UPS BX750MI in operation.

      -The following example demonstrates how to follow logs of several servers at once. The server list is provided as a flat text file. The example filters all records containing the string INFO. Any other Go compatible regular expression can also be used instead of INFO.
      +

      Configuring FreeBSD to Work with the UPS


      +
      +

      USB Device Detection


      +
      +Once plugged in via USB on FreeBSD, I could see the following in the kernel messages:

      -
      % dtail --servers serverlist.txt --grep INFO --files "/var/log/dserver/*.log"
      +
      paul@f0: ~ % doas dmesg | grep UPS
      +ugen0.2: <American Power Conversion Back-UPS BX750MI> at usbus0
       

      -Hint: you can also provide a comma separated server list, e.g.: servers server1.example.org,server2.example.org:PORT,...
      -
      -Tail example
      +

      apcupsd Installation



      -Hint: You can also use the shorthand version (omitting the --files)
      +To make use of the USB connection, the apcupsd package had to be installed:

      -
      % dtail --servers serverlist.txt --grep INFO "/var/log/dserver/*.log"
      +
      paul@f0: ~ % doas install apcupsd
       

      -

      Aggregating logs


      -
      -To run ad-hoc map-reduce aggregations on newly written log lines you must add a query. The following example follows all remote log lines and prints out every few seconds the result to standard output.
      -
      -Hint: To run a map-reduce query across log lines written in the past, please use the dmap command instead.
      +I have made the following modifications to the configuration file so that the UPS can be used via the USB interface:

      -
      % dtail --servers serverlist.txt \
      -    --files '/var/log/dserver/*.log' \
      -    --query 'from STATS select sum($goroutines),sum($cgocalls),
      -             last($time),max(lifetimeConnections)'
      +
      paul@f0:/usr/local/etc/apcupsd % diff -u apcupsd.conf.sample  apcupsd.conf
      +--- apcupsd.conf.sample 2024-11-01 16:40:42.000000000 +0200
      ++++ apcupsd.conf        2024-12-03 10:58:24.009501000 +0200
      +@@ -31,7 +31,7 @@
      + #     940-1524C, 940-0024G, 940-0095A, 940-0095B,
      + #     940-0095C, 940-0625A, M-04-02-2000
      + #
      +-UPSCABLE smart
      ++UPSCABLE usb
      +
      + # To get apcupsd to work, in addition to defining the cable
      + # above, you must also define a UPSTYPE, which corresponds to
      +@@ -88,8 +88,10 @@
      + #                            that apcupsd binds to that particular unit
      + #                            (helpful if you have more than one USB UPS).
      + #
      +-UPSTYPE apcsmart
      +-DEVICE /dev/usv
      ++UPSTYPE usb
      ++DEVICE
      +
      + # POLLTIME <int>
      + #   Interval (in seconds) at which apcupsd polls the UPS for status. This
       

      -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.
      +I left the remaining settings as the default ones; for example, the following are of main interest:

      -Tail map-reduce example
      +
      +# If during a power failure, the remaining battery percentage
      +# (as reported by the UPS) is below or equal to BATTERYLEVEL,
      +# apcupsd will initiate a system shutdown.
      +BATTERYLEVEL 5
      +
      +# If during a power failure, the remaining runtime in minutes
      +# (as calculated internally by the UPS) is below or equal to MINUTES,
      +# apcupsd, will initiate a system shutdown.
      +MINUTES 3
      +

      -Hint: You can also use the shorthand version:
      +I then enabled and started the daemon:

      -
      % dtail --servers serverlist.txt \
      -    --files '/var/log/dserver/*.log' \
      -    'from STATS select sum($goroutines),sum($cgocalls),
      -     last($time),max(lifetimeConnections)'
      +
      paul@f0:/usr/local/etc/apcupsd % doas sysrc apcupsd_enable=YES
      +apcupsd_enable:  -> YES
      +paul@f0:/usr/local/etc/apcupsd % doas service apcupsd start
      +Starting apcupsd.
       

      -Here is another example:
      +

      UPS Connectivity Test


      +
      +And voila, I could now access the UPS information via the apcaccess command; how convenient :-) (I also read through the manual page, which provides a good understanding of what else can be done with it!).

      -
      % 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
      -
      -You can also continuously append the results to a CSV file by adding outfile append filename.csv to the query:
      +
      paul@f0:~ % apcaccess
      +APC      : 001,035,0857
      +DATE     : 2025-01-26 14:43:27 +0200
      +HOSTNAME : f0.lan.buetow.org
      +VERSION  : 3.14.14 (31 May 2016) freebsd
      +UPSNAME  : f0.lan.buetow.org
      +CABLE    : USB Cable
      +DRIVER   : USB UPS Driver
      +UPSMODE  : Stand Alone
      +STARTTIME: 2025-01-26 14:43:25 +0200
      +MODEL    : Back-UPS BX750MI
      +STATUS   : ONLINE
      +LINEV    : 230.0 Volts
      +LOADPCT  : 4.0 Percent
      +BCHARGE  : 100.0 Percent
      +TIMELEFT : 65.3 Minutes
      +MBATTCHG : 5 Percent
      +MINTIMEL : 3 Minutes
      +MAXTIME  : 0 Seconds
      +SENSE    : Medium
      +LOTRANS  : 145.0 Volts
      +HITRANS  : 295.0 Volts
      +ALARMDEL : No alarm
      +BATTV    : 13.6 Volts
      +LASTXFER : Automatic or explicit self test
      +NUMXFERS : 0
      +TONBATT  : 0 Seconds
      +CUMONBATT: 0 Seconds
      +XOFFBATT : N/A
      +SELFTEST : NG
      +STATFLAG : 0x05000008
      +SERIALNO : 9B2414A03599
      +BATTDATE : 2001-01-01
      +NOMINV   : 230 Volts
      +NOMBATTV : 12.0 Volts
      +NOMPOWER : 410 Watts
      +END APC  : 2025-01-26 14:44:06 +0200
      +
      +
      +

      APC Info on Partner Nodes:


      +
      +So far, so good. Host f0 would shut down itself when short on power. But what about the f1 and f2 nodes? They aren't connected directly to the UPS and, therefore, wouldn't know that their power is about to be cut off. For this, apcupsd running on the f1 and f2 nodes can be configured to retrieve UPS information via the network from the apcupsd server running on the f0 node, which is connected directly to the APC via USB.
      +
      +Of course, this won't work when f0 is down. In this case, no operational node would be connected to the UPS via USB; therefore, the current power status would not be known. However, I consider this a rare circumstance. Furthermore, in case of an f0 system crash, sudden power outages on the two other nodes would occur at different times making real data loss (the main concern here) less likely.
      +
      +And if f0 is down and f1 and f2 receive new data and crash midway, it's likely that a client (e.g., an Android app or another laptop) still has the data stored on it, making data recoverable and data loss overall nearly impossible. I'd receive an alert if any of the nodes go down (more on monitoring later in this blog series).
      +
      +

      Installation on partners


      +
      +To do this, I installed apcupsd via doas pkg install apcupsd on f1 and f2, and then I could connect to it this way:

      -
      % dtail --servers serverlist.txt \
      -    --files '/var/log/dserver/*.log' \
      -    --query 'from STATS select ... outfile append result.csv'
      +
      paul@f1:~ % apcaccess -h f0.lan.buetow.org | grep Percent
      +LOADPCT  : 12.0 Percent
      +BCHARGE  : 94.0 Percent
      +MBATTCHG : 5 Percent
       

      -

      How to use dcat


      -
      -The following example demonstrates how to cat files (display the full content of the files) on several servers at once.
      +But I want the daemon to be configured and enabled in such a way that it connects to the master UPS node (the one with the UPS connected via USB) so that it can also initiate a system shutdown when the UPS battery reaches low levels. For that, apcupsd itself needs to be aware of the UPS status.

      -As you can see in this example, a DTail client also creates a local log file of all received data in ~/log. You can also use the noColor and -plain flags (this all also work with other DTail commands than dcat).
      +On f1 and f2, I changed the configuration to use f0 (where apcupsd is listening) as a remote device. I also changed the MINUTES setting from 3 to 6 and the BATTERYLEVEL setting from 5 to 10 to ensure that the f1 and f2 nodes could still connect to the f0 node for UPS information before f0 decides to shut down itself. So f1 and f2 must shut down earlier than f0:

      -
      % dcat --servers serverlist.txt --files /etc/hostname
      -
      -
      -Cat example
      -
      -Hint: You can also use the shorthand version:
      +
      paul@f2:/usr/local/etc/apcupsd % diff -u apcupsd.conf.sample apcupsd.conf
      +--- apcupsd.conf.sample 2024-11-01 16:40:42.000000000 +0200
      ++++ apcupsd.conf        2025-01-26 15:52:45.108469000 +0200
      +@@ -31,7 +31,7 @@
      + #     940-1524C, 940-0024G, 940-0095A, 940-0095B,
      + #     940-0095C, 940-0625A, M-04-02-2000
      + #
      +-UPSCABLE smart
      ++UPSCABLE ether
      +
      + # To get apcupsd to work, in addition to defining the cable
      + # above, you must also define a UPSTYPE, which corresponds to
      +@@ -52,7 +52,6 @@
      + #                            Network Information Server. This is used if the
      + #                            UPS powering your computer is connected to a
      + #                            different computer for monitoring.
      +-#
      + # snmp      hostname:port:vendor:community
      + #                            SNMP network link to an SNMP-enabled UPS device.
      + #                            Hostname is the ip address or hostname of the UPS
      +@@ -88,8 +87,8 @@
      + #                            that apcupsd binds to that particular unit
      + #                            (helpful if you have more than one USB UPS).
      + #
      +-UPSTYPE apcsmart
      +-DEVICE /dev/usv
      ++UPSTYPE net
      ++DEVICE f0.lan.buetow.org:3551
      +
      + # POLLTIME <int>
      + #   Interval (in seconds) at which apcupsd polls the UPS for status. This
      +@@ -147,12 +146,12 @@
      + # If during a power failure, the remaining battery percentage
      + # (as reported by the UPS) is below or equal to BATTERYLEVEL,
      + # apcupsd will initiate a system shutdown.
      +-BATTERYLEVEL 5
      ++BATTERYLEVEL 10
      +
      + # If during a power failure, the remaining runtime in minutes
      + # (as calculated internally by the UPS) is below or equal to MINUTES,
      + # apcupsd, will initiate a system shutdown.
      +-MINUTES 3
      ++MINUTES 6
      +
      + # If during a power failure, the UPS has run on batteries for TIMEOUT
      + # many seconds or longer, apcupsd will initiate a system shutdown.
      +
      +
      +So I also ran the following commands on f1 and f2:

      -
      % dcat --servers serverlist.txt /etc/hostname
      +
      paul@f1:/usr/local/etc/apcupsd % doas sysrc apcupsd_enable=YES
      +apcupsd_enable:  -> YES
      +paul@f1:/usr/local/etc/apcupsd % doas service apcupsd start
      +Starting apcupsd.
       

      -

      How to use dgrep


      -
      -The following example demonstrates how to grep files (display only the lines which match a given regular expression) of multiple servers at once. In this example, we look after some entries in /etc/passwd. This time, we don't provide the server list via an file but rather via a comma separated list directly on the command line. We also explore the -before, -after and -max flags (see animation).
      +And then I was able to connect to localhost via the apcaccess command:

      -
      % dgrep --servers server1.example.org:2223 \
      -    --files /etc/passwd \
      -    --regex nologin
      +
      paul@f1:~ % doas apcaccess | grep Percent
      +LOADPCT  : 5.0 Percent
      +BCHARGE  : 95.0 Percent
      +MBATTCHG : 5 Percent
       

      -Generally, dgrep is also a very useful way to search historic application logs for certain content.
      +

      Power outage simulation



      -Grep example
      +

      Pulling the plug



      -Hint: -regex is an alias for -grep.
      +I simulated a power outage by removing the power input from the APC. Immediately, the following message appeared on all the nodes:

      -

      How to use dmap


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

      -To run a map-reduce aggregation over logs written in the past, the dmap command can be used. The following example aggregates all map-reduce fields dmap will print interim results every few seconds. You can also write the result to an CSV file by adding outfile result.csv to the query.
      +I ran the following command to confirm the available battery time:

      -
      % 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)'
      +
      paul@f0:/usr/local/etc/apcupsd % apcaccess -p TIMELEFT
      +63.9 Minutes
       

      -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.
      +And after around one hour (f1 and f2 a bit earlier, f0 a bit later due to the different BATTERYLEVEL and MINUTES settings outlined earlier), the following broadcast was sent out:

      -DMap example
      +
      +Broadcast Message from root@f0.lan.buetow.org
      +        (no tty) at 15:08 EET...
      +
      +        *** FINAL System shutdown message from root@f0.lan.buetow.org ***
      +
      +System going down IMMEDIATELY
      +
      +apcupsd initiated shutdown
      +

      -

      How to use the DTail serverless mode


      +And all the nodes shut down safely before the UPS ran out of battery!

      -Until now, all examples so far required to have remote server(s) to connect to. That makes sense, as after all DTail is a *distributed* tool. However, there are circumstances where you don't really need to connect to a server remotely. For example, you already have a login shell open to the server an all what you want is to run some queries directly on local log files.
      +

      Restoring power



      -The serverless mode does not require any dserver up and running and therefore there is no networking/SSH involved.
      +After restoring power, I checked the logs in /var/log/daemon.log and found the following on all 3 nodes:

      -All commands shown so far also work in a serverless mode. All what needs to be done is to omit a server list. The DTail client then starts in serverless mode.
      +
      +Jan 26 17:36:24 f2 apcupsd[2159]: Power failure.
      +Jan 26 17:36:30 f2 apcupsd[2159]: Running on UPS batteries.
      +Jan 26 17:36:30 f2 apcupsd[2159]: Battery charge below low limit.
      +Jan 26 17:36:30 f2 apcupsd[2159]: Initiating system shutdown!
      +Jan 26 17:36:30 f2 apcupsd[2159]: User logins prohibited
      +Jan 26 17:36:32 f2 apcupsd[2159]: apcupsd exiting, signal 15
      +Jan 26 17:36:32 f2 apcupsd[2159]: apcupsd shutdown succeeded
      +

      -

      Serverless map-reduce query


      +All good :-) See you in the next post of this series!

      -The following dmap example is the same as the previously shown one, but the difference is that it operates on a local log file directly:
      +Other BSD related posts are:

      - -
      % 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)'
      -
      +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts (You are currently reading this)
      +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
      +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
      +2024-04-01 KISS high-availability with OpenBSD
      +2024-01-13 One reason why I love OpenBSD
      +2022-10-30 Installing DTail on OpenBSD
      +2022-07-30 Let's Encrypt with OpenBSD and Rex
      +2016-04-09 Jails and ZFS with Puppet on FreeBSD

      -As a shorthand version the following command can be used:
      +E-Mail your comments to paul@nospam.buetow.org :-)

      - -
      % dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
      -        lifetimeConnections group by $hostname order by max($cgocalls)' \
      -        /var/log/dsever/dserver.log
      -
      +Back to the main site
      +
      +
      +
      + + Working with an SRE Interview + + https://foo.zone/gemfeed/2025-01-15-working-with-an-sre-interview.html + 2025-01-15T00:16:04+02:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + I have been interviewed by Florian Buetow on `cracking-ai-engineering.com` about what it's like working with a Site Reliability Engineer from the point of view of a Software Engineer, Data Scientist, and AI Engineer. + +
      +

      Working with an SRE Interview



      -You can also use a file input pipe as follows:
      +Published at 2025-01-15T00:16:04+02:00

      - -
      % cat /var/log/dserver/dserver.log | \
      -    dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
      -          lifetimeConnections group by $hostname order by max($cgocalls)'
      -
      +I have been interviewed by Florian Buetow on cracking-ai-engineering.com about what it's like working with a Site Reliability Engineer from the point of view of a Software Engineer, Data Scientist, and AI Engineer.

      -

      Aggregating CSV files


      +See original interview here
      +Cracking AI Engineering

      -In essence, this works exactly like aggregating logs. All files operated on must be valid CSV files and the first line of the CSV must be the header. E.g.:
      +Below, I am posting the interview here on my blog as well.

      - -
      % 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
      -
      +

      Table of Contents



      -DMap can also be used to query and aggregate CSV files from remote servers.
      +
      +

      Preamble



      -

      Other serverless commands


      +In this insightful interview, Paul Bütow, a Principal Site Reliability Engineer at Mimecast, shares over a decade of experience in the field. Paul highlights the role of an Embedded SRE, emphasizing the importance of automation, observability, and effective incident management. We also focused on the key question of how you can work effectively with an SRE weather you are an individual contributor or a manager, a software engineer or data scientist. And how you can learn more about site reliability engineering.

      -The serverless mode works transparently with all other DTail commands. Here are some examples:
      +

      Introducing Paul



      - -
      % dtail /var/log/dserver/dserver.log
      -
      +Hi Paul, please introduce yourself briefly to the audience. Who are you, what do you do for a living, and where do you work?

      - -
      % dtail --logLevel trace /var/log/dserver/dserver.log
      -
      +My name is Paul Bütow, I work at Mimecast, and I’m a Principal Site Reliability Engineer there. I’ve been with Mimecast for almost ten years now. The company specializes in email security, including things like archiving, phishing detection, malware protection, and spam filtering.

      - -
      % dcat /etc/passwd
      -
      +You mentioned that you’re an ‘Embedded SRE.’ What does that mean exactly?

      - -
      % dcat --plain /etc/passwd > /etc/test
      -# Should show no differences.
      -diff /etc/test /etc/passwd 
      -
      +It means that I’m directly part of the software engineering team, not in a separate Ops department. I ensure that nothing is deployed manually, and everything runs through automation. I also set up monitoring and observability. These are two distinct aspects: monitoring alerts us when something breaks, while observability helps us identify trends. I also create runbooks so we know what to do when specific incidents occur frequently.

      - -
      % dgrep --regex ERROR --files /var/log/dserver/dsever.log
      -
      +Infrastructure SREs on the other hand handle the foundational setup, like providing the Kubernetes cluster itself or ensuring the operating systems are installed. They don't work on the application directly but ensure the base infrastructure is there for others to use. This works well when a company has multiple teams that need shared infrastructure.

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

      How did you get started?



      -Use --help for more available options. Or go to the DTail page for more information! Hope you find DTail useful!
      +How did your interest in Linux or FreeBSD start?

      -Other related posts are:
      +It began during my school days. We had a PC with DOS at home, and I eventually bought Suse Linux 5.3. Shortly after, I discovered FreeBSD because I liked its handbook so much. I wanted to understand exactly how everything worked, so I also tried Linux from Scratch. That involves installing every package manually to gain a better understanding of operating systems.

      -2021-04-22 DTail - The distributed log tail program
      -2022-03-06 The release of DTail 4.0.0
      -2022-10-30 Installing DTail on OpenBSD
      -2023-09-25 DTail usage examples (You are currently reading this)
      +https://www.FreeBSD.org
      +https://linuxfromscratch.org/

      -I hope you find the tools presented in this post useful!
      +And after school, you pursued computer science, correct?

      -Paul
      +Exactly. I wasn’t sure at first whether I wanted to be a software developer or a system administrator. I applied for both and eventually accepted an offer as a Linux system administrator. This was before 'SRE' became a buzzword, but much of what I did back then-automation, infrastructure as code, monitoring-is now considered part of the typical SRE role.

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +

      Roles and Career Progression



      -Back to the main site
      -
      -
      -
      - - Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect - - https://foo.zone/gemfeed/2023-08-20-site-reliability-engineering-part-3.html - 2023-08-20T12:17:56+03:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - This is the third part of my Site Reliability Engineering (SRE) series. I am currently employed as a Principal Site Reliability Engineer and will try to share what SRE is about in this blog series. - -
      -

      Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect


      +Tell us about how you joined Mimecast. When did you fully embrace the SRE role?

      -Published at 2023-08-20T12:17:56+03:00
      +I started as a Linux sysadmin at 1&1. I managed an ad server farm with hundreds of systems and later handled load balancers. Together with an architect, we managed F5 load balancers distributing around 2,000 services, including for portals like web.de and GMX. I also led the operations team technically for a while before moving to London to join Mimecast.

      -This is the third part of my Site Reliability Engineering (SRE) series. I am currently employed as a Principal Site Reliability Engineer and will try to share what SRE is about in this blog series.
      +At Mimecast, the job title was explicitly 'Site Reliability Engineer.' The biggest difference was that I was no longer in a separate Ops department but embedded directly within the storage and search backend team. I loved that because we could plan features together-from automation to measurability and observability. Mimecast also operates thousands of physical servers for email archiving, which was fascinating since I already had experience with large distributed systems at 1&1. It was the right step for me because it allowed me to work close to the code while remaining hands-on with infrastructure.

      -2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
      -2023-08-19 Site Reliability Engineering - Part 2: Operational Balance in SRE
      -2023-08-20 Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect (You are currently reading this)
      +What are the differences between SRE, DevOps, SysAdmin, and Architects?

      -
      -                    ..--""""----..                 
      -                 .-"   ..--""""--.j-.              
      -              .-"   .-"        .--.""--..          
      -           .-"   .-"       ..--"-. \/    ;         
      -        .-"   .-"_.--..--""  ..--'  "-.  :         
      -      .'    .'  /  `. \..--"" __ _     \ ;         
      -     :.__.-"    \  /        .' ( )"-.   Y          
      -     ;           ;:        ( )     ( ).  \         
      -   .':          /::       :            \  \        
      - .'.-"\._   _.-" ; ;      ( )    .-.  ( )  \       
      -  "    `."""  .j"  :      :      \  ;    ;  \      
      -    bug /"""""/     ;      ( )    "" :.( )   \     
      -       /\    /      :       \         \`.:  _ \    
      -      :  `. /        ;       `( )     (\/ :" \ \   
      -       \   `.        :         "-.(_)_.'   t-'  ;  
      -        \    `.       ;                    ..--":  
      -         `.    `.     :              ..--""     :  
      -           `.    "-.   ;       ..--""           ;  
      -             `.     "-.:_..--""            ..--"   
      -               `.      :             ..--""        
      -                 "-.   :       ..--""              
      -                    "-.;_..--""                    
      -
      -
      +SREs are like the next step after SysAdmins. A SysAdmin might manually install servers, replace disks, or use simple scripts for automation, while SREs use infrastructure as code and focus on reliability through SLIs, SLOs, and automation. DevOps isn’t really a job-it’s more of a way of working, where developers are involved in operations tasks like setting up CI/CD pipelines or on-call shifts. Architects focus on designing systems and infrastructures, such as load balancers or distributed systems, working alongside SREs to ensure the systems meet the reliability and scalability requirements. The specific responsibilities of each role depend on the company, and there is often overlap.

      -

      On-Call Culture and the Human Aspect: Prioritising Well-being in the Realm of Reliability


      +What are the most important reliability lessons you’ve learned so far?

      -Site Reliability Engineering is synonymous with ensuring system reliability, but the human factor is an often-underestimated part of this discipline. Ensuring an healthy on-call culture is as critical as any technical solution. The well-being of the engineers is an important factor.
      +
        +
      • Don’t leave SRE aspects as an afterthought. It’s much better to discuss automation, monitoring, SLIs, and SLOs early on. Traditional sysadmins often installed systems manually, but today, we do everything via infrastructure as code-using tools like Terraform or Puppet.
      • +
      • I also distinguish between monitoring and observability. Monitoring tells us, 'The server is down, alarm!' Observability dives deeper, showing trends like increasing latency so we can act proactively.
      • +
      • SLI, SLO, and SLA are core elements. We focus on what users actually experience-for example, how quickly an email is sent-and set our goals accordingly.
      • +
      • Runbooks are also crucial. When something goes wrong at night, you don’t want to start from scratch. A runbook outlines how to debug and resolve specific problems, saving time and reducing downtime.
      • +

      +

      Anecdotes and Best Practices



      -Firstly, a healthy on-call rotation is about more than just managing and responding to incidents. It's about the entire ecosystem that supports this practice. This involves reducing pain points, offering mentorship, rapid iteration, and ensuring that engineers have the right tools and processes. One ceavat is, that engineers should be willing to learn. Especially in on-call rotation embedding SREs with other engineers (for example Software Engineers or QA Engineers), it's difficult to motivate everyone to engage. QA Engineers want to test the software, Software Engineers want to implement new features; they don't want to troubleshoot and debug production incidents. It can be depressing for the mentoring SRE.
      +Runbooks sound very practical. Can you explain how they’re used day-to-day?

      -Furthermore, the metrics that measure the success of an on-call experience are only sometimes straightforward. While one might assume that fewer pages translate to better on-call expertise (which is true to a degree, as who wants to receive a page out of office hours?), it's not always the volume of pages that matters most. Trust, ownership, accountability, and effective communication play the important roles.
      +Runbooks are essentially guides for handling specific incidents. For instance, if a service won’t start, the runbook will specify where the logs are and which commands to use. Observability takes it a step further, helping us spot changes early-like rising error rates or latency-so we can address issues before they escalate.

      -An important part is giving feedback about the on-call experience to ensure continuous learning. If alerts are mostly noise, they should be tuned or even eliminated. If alerts are actionable, can recurring tasks be automated? If there are knowledge gaps, is the documentation not good enough? Continuous retrospection ensures that not only do systems evolve, but the experience for the on-call engineers becomes progressively better.
      +When should you decide to put something into a runbook, and when is it unnecessary?

      -Onboarding for on-call duties is a crucial aspect of ensuring the reliability and efficiency of systems. This process involves equipping new team members with the knowledge, tools, and support to handle incidents confidently. It begins with an overview of the system architecture and common challenges, followed by training on monitoring tools, alerting mechanisms, and incident response protocols. Shadowing experienced on-call engineers can offer practical exposure. Too often, new engineers are thrown into the cold water without proper onboarding and training because the more experienced engineers are too busy fire-fighting production issues in the first place.
      +If an issue happens frequently, it should be documented in a runbook so that anyone, even someone new, can follow the steps to fix it. The idea is that 90% of the common incidents should be covered. For example, if a service is down, the runbook would specify where to find logs, which commands to check, and what actions to take. On the other hand, rare or complex issues, where the resolution depends heavily on context or varies each time, don’t make sense to include in detail. For those, it’s better to focus on general troubleshooting steps.

      -An always-on, always-alert culture can lead to burnout. Engineers should be encouraged to recognise their limits, take breaks, and seek support when needed. This isn't just about individual health; a burnt-out engineer can have cascading effects on the entire team and the systems they manage. A successful on-call culture ensures that while systems are kept running, the engineers are kept happy, healthy, and supported. The more experienced engineers should take time to mentor the junior engineers, but the junior engineers should also be fully engaged, try to investigate and learn new things by themselves.
      +How do you search for and find the correct runbooks?

      -For the junior engineer, it's too easy to fall back and ask the experts in the team every time an issue arises. This seems reasonable, but serving recipes for solving production issues on a silver tablet won't scale forever, as there are infinite scenarios of how production systems can break. So every engineer should learn to debug, troubleshoot and resolve production incidents independently. The experts will still be there for guidance and step in when the junior gets stuck after trying, but the experts should also learn to step down so that lesser experienced engineers can step up and learn. But mistakes can always happen here; that's why having a blameless on-call culture is essential.
      +Runbooks should be linked directly in the alert you receive. For example, if you get an alert about a service not running, the alert will have a link to the runbook that tells you what to check, like logs or commands to run. Runbooks are best stored in an internal wiki, so if you don’t find the link in the alert, you know where to search. The important thing is that runbooks are easy to find and up to date because that’s what makes them useful during incidents.

      -A blameless on-call culture is a must for a safe and collaborative environment where engineers can effectively respond to incidents without fear of retribution. This approach acknowledges that mistakes are a natural part of the learning and innovation process. When individuals are assured they won't be punished for errors, they're more likely to openly discuss mistakes, allowing the entire team to learn and grow from each incident. Furthermore, a blameless culture promotes psychological safety, enhances job satisfaction, reduces burnout, and ensures that talent remains committed and engaged.
      +Do you have an interesting war story you can share with us?

      -The fourth part of this blog series will be published soon :-)
      +Sure. At 1&1, we had a proprietary ad server software that ran a SQL query during startup. The query got slower over time, eventually timing out and preventing the server from starting. Since we couldn’t access the source code, we searched the binary for the SQL and patched it. By pinpointing the issue, a developer was able to adjust the SQL. This collaboration between sysadmin and developer perspectives highlights the value of SRE work.

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +

      Working with Different Teams



      -Back to the main site
      -
      -
      -
      - - Site Reliability Engineering - Part 2: Operational Balance in SRE - - https://foo.zone/gemfeed/2023-08-19-site-reliability-engineering-part-2.html - 2023-08-19T00:18:18+03:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - This is the second part of my Site Reliability Engineering (SRE) series. I am currently employed as a Principal Site Reliability Engineer and will try to share what SRE is about in this blog series. - -
      -

      Site Reliability Engineering - Part 2: Operational Balance in SRE


      +You’re embedded in a team-how does collaboration with developers work practically?

      -Published at 2023-08-19T00:18:18+03:00
      +We plan everything together from the start. If there’s a new feature, we discuss infrastructure, automated deployments, and monitoring right away. Developers are experts in the code, and I bring the infrastructure expertise. This avoids unpleasant surprises before going live.

      -This is the second part of my Site Reliability Engineering (SRE) series. I am currently employed as a Principal Site Reliability Engineer and will try to share what SRE is about in this blog series.
      +How about working with data scientists or ML engineers? Are there differences?

      -2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
      -2023-08-19 Site Reliability Engineering - Part 2: Operational Balance in SRE (You are currently reading this)
      -2023-08-20 Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect
      +The principles are the same. ML models also need to be deployed and monitored. You deal with monitoring, resource allocation, and identifying performance drops. Whether it’s a microservice or an ML job, at the end of the day, it’s all running on servers or clusters that must remain stable.

      -
      -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      -⠀⠀⠀⠀⣾⠿⠿⠿⠶⠾⠿⠿⣿⣿⣿⣿⣿⣿⠿⠿⠶⠶⠿⠿⠿⣷⠀⠀⠀⠀
      -⠀⠀⠀⣸⢿⣆⠀⠀⠀⠀⠀⠀⠀⠙⢿⡿⠉⠀⠀⠀⠀⠀⠀⠀⣸⣿⡆⠀⠀⠀
      -⠀⠀⢠⡟⠀⢻⣆⠀⠀⠀⠀⠀⠀⠀⣾⣧⠀⠀⠀⠀⠀⠀⠀⣰⡟⠀⢻⡄⠀⠀
      -⠀⢀⣾⠃⠀⠀⢿⡄⠀⠀⠀⠀⠀⢠⣿⣿⡀⠀⠀⠀⠀⠀⢠⡿⠀⠀⠘⣷⡀⠀
      -⠀⣼⣏⣀⣀⣀⣈⣿⡀⠀⠀⠀⠀⣸⣿⣿⡇⠀⠀⠀⠀⢀⣿⣃⣀⣀⣀⣸⣧⠀
      -⠀⢻⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⣿⣿⣿⣿⠀⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⡿⠀
      -⠀⠀⠉⠛⠛⠛⠋⠁⠀⠀⠀⠀⢸⣿⣿⣿⣿⡆⠀⠀⠀⠀⠈⠙⠛⠛⠛⠉⠀⠀
      -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      -⠀⠀⠀⠀⠀⠀⠴⠶⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠶⠦⠀⠀
      -
      +What about working with managers or the FinOps team?

      -

      Operational Balance in SRE: Finding the Equilibrium in Reliability and Velocity


      +We often discuss costs, especially in the cloud, where scaling up resources is easy. It’s crucial to know our metrics: do we have enough capacity? Do we need all instances? Or is the CPU only at 5% utilization? This data helps managers decide whether the budget is sufficient or if optimizations are needed.

      -Site Reliability Engineering has established itself as more than just a set of best practices or methodologies. Instead, it stands as a beacon of operational excellence, which guides engineering teams through the turbulent waters of modern software development and system management.
      +Do you have practical tips for working with SREs?

      -In the universe of software production, two fundamental forces are often at odds: The drive for rapid feature release (velocity) and the need for system reliability. Traditionally, the faster teams moved, the more risk was introduced into systems. SRE offers a approach to mitigate these conflicting drives through concepts like error budgets and SLIs/SLOs. These mechanisms offer a tangible metric, allowing teams to quantify how much they can push changes while ensuring they don't compromise system health. Thus, the error budget becomes a balancing act, where teams weigh the trade-offs between innovation and reliability.
      +Yes, I have a few:

      -An important part of this balance is the dichotomy between operations and coding. According to SRE principles, an engineer should ideally spend an equal amount of time on operations work and coding - 50% on each. This isn't just a random metric; it's a reflection of the value SRE places on both maintaining operational excellence and progressing forward with innovations. This balance ensures that while SREs are solving today's problems, they are also preparing for tomorrow's challenges.
      +
        +
      • Early involvement: Include SREs from the beginning in your project.
      • +
      • Runbooks & documentation: Document recurring errors.
      • +
      • Try first: Try to understand the issue yourself before immediately asking the SRE.
      • +
      • Basic infra knowledge: Kubernetes and Terraform aren’t magic. Some basic understanding helps every developer.
      • +

      +

      Using AI Tools



      -However, not all operational tasks are equal. SRE differentiates between "ops work" and "toil". While ops work is integral to system maintenance and can provide value, toil represents repetitive, mundane tasks which offer little value in the long run. Recognising and minimising toil is crucial. A culture that allows engineers to drown in toil stifles innovation and growth. Hence, an organisation's approach to toil indicates its operational health and commitment to balance.
      +Let’s talk about AI. How do you use it in your daily work?

      -A cornerstone of achieving operational balance lies in the tools and processes SREs use. Effective monitoring, observability tools, and ensuring that tools can handle high cardinality data are foundational. These aren't just technical requisites but reflective of an organisational culture prioritising proactive problem-solving. By having systems that effectively flag potential issues before they escalate, SREs can maintain the balance between system stability and forward momentum.
      +For boilerplate code, like Terraform snippets, I often use ChatGPT. It saves time, although I always review and adjust the output. Log analysis is another exciting application. Instead of manually going through millions of lines, AI can summarize key outliers or errors.

      -Moreover, operational balance isn't just a technological or process challenge; it's a human one. The health of on-call engineers is as crucial as the health of the services they manage. On-call postmortems, continuous feedback loops, and recognising gaps (be it tooling, operational expertise, or resources) ensure that the human elements of operations are noticed.
      +Do you think AI could largely replace SREs or significantly change the role?

      -In conclusion, operational balance in SRE isn't static thing but an ongoing journey. It requires organisations to constantly evaluate their practices, tools, and, most importantly, their culture. By achieving this balance, organisations can ensure that they have time for innovation while maintaining the robustness and reliability of their systems, resulting in sustainable long-term success.
      +I see AI as an additional tool. SRE requires a deep understanding of how distributed systems work internally. While AI can assist with routine tasks or quickly detect anomalies, human expertise is indispensable for complex issues.

      -That all sounds very romantic. The truth is, it's brutal to archive the perfect balance. No system will ever be perfect. But at least we should aim for it!
      +

      SRE Learning Resources



      -Continue with the third part of this series:
      +What resources would you recommend for learning about SRE?

      -2023-08-20 Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect
      +The Google SRE book is a classic, though a bit dry. I really like 'Seeking SRE,' as it offers various perspectives on SRE, with many practical stories from different companies.

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +https://sre.google/books/
      +Seeking SRE

      -Back to the main site
      -
      -
      -
      - - Site Reliability Engineering - Part 1: SRE and Organizational Culture - - https://foo.zone/gemfeed/2023-08-18-site-reliability-engineering-part-1.html - 2023-08-18T22:43:47+03:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - The universe of Site Reliability Engineering (SRE) is like an intricate tapestry woven with diverse technology, culture, and personal grit threads. Site Reliability Engineering is one of the most demanding jobs. With all the facets, it's impossible to get bored. There is always a new challenge to master, and there is always a new technology to tinker with. It's not just technical; it's also about communication, collaboration and teamwork. I am currently employed as a Principal Site Reliability Engineer and will try to share what SRE is about in this blog series. - -
      -

      Site Reliability Engineering - Part 1: SRE and Organizational Culture


      +Do you have a podcast recommendation?

      -Published at 2023-08-18T22:43:47+03:00
      +The Google SRE prodcast is quite interesting. It offers insights into how Google approaches SRE, along with perspectives from external guests.

      -The universe of Site Reliability Engineering (SRE) is like an intricate tapestry woven with diverse technology, culture, and personal grit threads. Site Reliability Engineering is one of the most demanding jobs. With all the facets, it's impossible to get bored. There is always a new challenge to master, and there is always a new technology to tinker with. It's not just technical; it's also about communication, collaboration and teamwork. I am currently employed as a Principal Site Reliability Engineer and will try to share what SRE is about in this blog series.
      +https://sre.google/prodcast/

      -2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture (You are currently reading this)
      -2023-08-19 Site Reliability Engineering - Part 2: Operational Balance in SRE
      -2023-08-20 Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect
      +

      Blogging



      -
      -▓▓▓▓░░                                                                                  
      -                                                                                          
      -DC on fire:
      -                                                                                          
      -                ▓▓                                    ▓▓                ▓▓                
      -      ░░  ░░    ▓▓▓▓                  ██                  ░░            ▓▓▓▓        ▓▓    
      -    ▓▓░░░░  ░░  ▓▓▓▓                              ▓▓░░                  ▓▓▓▓              
      -    ░░░░      ▓▓▓▓▓▓        ▓▓      ▓▓            ▓▓                  ▓▓▓▓▓▓      ▓▓      
      -    ▓▓░░    ▓▓▒▒▒▒▓▓▓▓    ▓▓        ▓▓▓▓        ▓▓▓▓▓▓              ▓▓▒▒▒▒▓▓▓▓    ▓▓▓▓    
      -  ██▓▓      ▓▓▒▒░░▒▒▓▓  ▓▓██      ▓▓▓▓▓▓        ▓▓▒▒▓▓              ▓▓▒▒░░▒▒▓▓  ██▓▓▓▓    
      -  ▓▓▓▓██  ▓▓▒▒░░░░▒▒▓▓  ▓▓▓▓      ▓▓▒▒▒▒▓▓    ▓▓▒▒░░▒▒▓▓██▓▓      ▓▓▒▒░░░░▒▒▓▓  ▓▓▒▒▒▒▓▓  
      -  ▓▓▒▒▒▒▓▓▓▓▒▒░░▒▒▓▓▓▓▓▓▒▒▒▒▓▓  ▓▓▓▓░░▒▒▓▓    ▓▓▒▒░░▒▒▓▓▒▒▒▒▓▓    ▓▓▒▒░░▒▒▓▓▓▓▓▓▓▓░░▒▒▓▓  
      -  ▒▒░░▒▒▓▓▓▓▒▒░░▒▒▓▓▓▓▒▒░░▒▒▓▓  ▓▓▒▒░░▒▒▓▓    ▓▓░░░░▒▒▒▒░░░░▒▒██████▒▒░░▒▒██▓▓▓▓▒▒░░▒▒▓▓██
      -  ░░░░▒▒▓▓▒▒░░▒▒▓▓▓▓▓▓▒▒░░▒▒▓▓██▒▒░░░░▒▒▓▓  ▓▓▒▒░░▒▒▓▓▒▒▒▒░░▒▒▓▓▓▓▒▒░░▒▒▓▓▓▓▓▓▒▒░░░░▒▒▓▓▓▓
      -  ░░░░▒▒▓▓▒▒░░░░▓▓██▒▒░░░░▒▒▓▓██▒▒░░░░▒▒██▓▓▓▓▒▒░░▒▒▓▓▓▓▒▒░░░░▒▒▓▓▒▒░░░░██▓▓▓▓▒▒░░░░▒▒████
      -  ▒▒░░▒▒▓▓▓▓░░░░▒▒▓▓▒▒▒▒░░░░▒▒▓▓▓▓▒▒░░░░▒▒▓▓▓▓▒▒░░░░▒▒▓▓▒▒░░▒▒▓▓▓▓▓▓░░░░▒▒▓▓▓▓▓▓▒▒░░░░▒▒▓▓
      -  ▒▒░░▒▒▓▓▒▒▒▒░░▒▒██▒▒▒▒░░▒▒▒▒██▒▒▒▒░░░░░░▒▒▓▓▒▒░░░░▒▒▒▒░░░░▒▒████▒▒▒▒░░▒▒██▓▓▒▒▒▒░░░░░░▒▒
      -  ░░░░░░▒▒░░░░░░░░▒▒▒▒▒▒░░░░▒▒▒▒▒▒░░░░░░░░▒▒▒▒░░░░░░▒▒▒▒░░░░░░▒▒▒▒░░░░░░░░▒▒▒▒▒▒░░░░░░░░▒▒
      -  ░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░
      -
      +You also have a blog. What motivates you to write regularly?

      -

      SRE and Organizational Culture: Navigating the Nexus


      +Writing helps me learn the most. It also serves as a personal reference. Sometimes I look up how I solved a problem a year ago. And of course, others tackling similar projects might find inspiration in my posts.

      -At the heart of SRE lies the proactive mindset of "prevention over cure." Traditional IT models focused predominantly on reactive solutions, but SRE mandates a shift towards foresight. By adopting Service Level Indicators (SLIs) and Service Level Objectives (SLOs), teams are equipped with clear metrics and goals that guide them toward ensuring reliability and user satisfaction. They reflect an organisational culture prioritising user experience and constant system alignment with user needs.
      +What do you blog about?

      -Another defining SRE idea concept the "error budget." This ingenious framework accepts that no system is flawless. Failures are inevitable. However, instead of being punitive, the culture here is to accept, learn, and iterate. By providing teams with a "budget" for errors, organisations create an environment where innovation is encouraged, and failures are viewed as learning opportunities.
      +Mostly technical topics I find exciting, like homelab projects, Kubernetes, or book summaries on IT and productivity. It’s a personal blog, so I write about what I enjoy.

      -But SRE isn't just about technology and metrics; it's deeply human. It challenges the "hero culture" that plagues many IT teams. While individual heroics might occasionally save the day, a sustainable model requires collective expertise. An SRE culture recognises that heroes achieve their best within teams, negating the need for a hero-centric environment. This philosophy promotes a balanced on-call experience, emphasising the importance of trust, ownership, effective communication, and collaboration as cornerstones of team success. I personally have fallen into the hero trap, and know it's unsustainable to be the only go-to person for every problem.
      +

      Wrap-up



      -Additionally, the SRE model requires good documentation. However, it's essential ensuring that this documentation undergoes the same quality checks as code, reinforcing effective onboarding, training and communication.
      +To wrap up, what are three things every team should keep in mind for stability?

      -Organisations might face a significant challenge when adopting SRE. Some might feel SRE principles counter their goals. They might prioritise feature rollouts over reliability or view SRE practices as cumbersome. Hence, creating an SRE culture often demands patient explanations and showcasing benefits, such as increased release velocity and improved user experience.
      +First, maintain runbooks and documentation to avoid chaos at night. Second, automate everything-manual installs in production are risky. Third, define SLIs, SLOs, and SLAs early so everyone knows what we’re monitoring and guaranteeing.

      -Monitoring and observability form another SRE aspect, emphasising the need for high-quality tools to query and analyse data. This ties back to the cultural emphasis on continuous learning and adaptability. SREs, by nature, need to be curious, ready to delve into anomalies, and keen on adopting new tools and practices.
      +Is there a motto or mindset that particularly inspires you as an SRE?

      -The success of SRE within any organisation depends on the broader acceptance of its principles. It demands a move away from siloed operations, where SRE acts as a bandage on flawed systems, to a model where reliability is everyone's responsibility.
      +"Keep it simple and stupid"-KISS. Not everything has to be overly complex. And always stay curious. I’m still fascinated by how systems work under the hood.

      -In essence, the integration of SRE principles transcends technical practices. It paves the way for a shift in organisational culture that values proactive prevention, continuous learning, collaboration, and transparent communication. The successful melding of SRE and corporate culture promises not just reliable systems but also a robust, resilient, and progressive work environment.
      +Where can people find you online?

      -Organisations with the implementation of SLIs, SLOs and error budgets are already advanced in their SRE journey. It takes a lot of communication, convincing, and patience until that point is reached.
      +You can find links to my socials on my website paul.buetow.org
      +I regularly post articles and link to everything else I’m working on outside of work.

      -Continue with the second part of this series:
      +https://paul.buetow.org

      -2023-08-19 Site Reliability Engineering - Part 2: Operational Balance in SRE
      +Thank you very much for your time and this insightful interview into the world of site reliability engineering

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +My pleasure, this was fun.
      +
      +

      Closing comments


      +
      +Dear reader, I hope this conversation with Paul Bütow provided an exciting peak into the world of Site Reliability Engineering. Whether you’re a software developer, data scientist, ML engineer, or manager, reliable systems are always a team effort. Hopefully, you’ve taken some insights or tips from Paul’s experiences for your own team or next project. Thanks for joining us, and best of luck refining your own SRE practices!
      +
      +E-Mail your comments to paul@nospam.buetow.org or contact Florian via the Cracking AI Engineering :-)

      Back to the main site
      - Gemtexter 2.1.0 - Let's Gemtext again³ - - https://foo.zone/gemfeed/2023-07-21-gemtexter-2.1.0-lets-gemtext-again-3.html - 2023-07-21T10:19:31+03:00 + Posts from October to December 2024 + + https://foo.zone/gemfeed/2025-01-01-posts-from-october-to-december-2024.html + 2024-12-31T18:09:58+02:00 Paul Buetow aka snonux paul@dev.buetow.org - I proudly announce that I've released Gemtexter version `2.1.0`. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash. + Happy new year!
      -

      Gemtexter 2.1.0 - Let's Gemtext again³


      +

      Posts from October to December 2024



      -Published at 2023-07-21T10:19:31+03:00
      +Published at 2024-12-31T18:09:58+02:00

      -
      --=[ typewriters ]=-  1/98
      -                                        .-------.
      -       .-------.                       _|~~ ~~  |_
      -      _|~~ ~~  |_       .-------.    =(_|_______|_)
      -    =(_|_______|_)=    _|~~ ~~  |_     |:::::::::|
      -      |:::::::::|    =(_|_______|_)    |:::::::[]|
      -      |:::::::[]|      |:::::::::|     |o=======.|
      -      |o=======.|      |:::::::[]|     `"""""""""`
      - jgs  `"""""""""`      |o=======.|
      -  mod. by Paul Buetow  `"""""""""`
      -
      +Happy new year!

      -I proudly announce that I've released Gemtexter version 2.1.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash.
      +These are my social media posts from the last three months. I keep them here to reflect on them and also to not lose them. Social media networks come and go and are not under my control, but my domain is here to stay.

      -https://codeberg.org/snonux/gemtexter
      +These are from Mastodon and LinkedIn. Have a look at my about page for my social media profiles. This list is generated with Gos, my social media platform sharing tool.

      -

      Why Bash?


      +My about page
      +https://codeberg.org/snonux/gos

      -This project is too complex for a Bash script. Writing it in Bash was to try out how maintainable a "larger" Bash script could be. It's still pretty maintainable and helps me try new Bash tricks here and then!
      +

      Table of Contents



      -Let's list what's new!
      +
      +

      Posts for 202410 202411 202412



      -

      Switch to GPL3 license


      +

      October 2024



      -Many (almost all) of the tools and commands (GNU Bash, GMU Sed, GNU Date, GNU Grep, GNU Source Highlight) used by Gemtexter are licensed under the GPL anyway. So why not use the same? This was an easy switch, as I was the only code contributor so far!
      +

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



      -

      Source code highlighting support


      +First on-call experience in a startup. Doesn't sound a lot of fun! But the lessons were learned! #sre

      -The HTML output now supports source code highlighting, which is pretty neat if your site is about programming. The requirement is to have the source-highlight command, which is GNU Source Highlight, to be installed. Once done, you can annotate a bare block with the language to be highlighted. E.g.:
      +ntietz.com/blog/lessons-from-my-first-on-call/

      -
      - ```bash
      - if [ -n "$foo" ]; then
      -   echo "$foo"
      - fi
      - ```
      -
      +

      Reviewing your own PR or MR before asking ...



      -The result will look like this (you can see the code highlighting only in the Web version, not in the Geminispace version of this site):
      +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.

      - -
      if [ -n "$foo" ]; then
      -  echo "$foo"
      -fi
      -
      +www.jvt.me/posts/2019/01/12/self-code-review/

      -Please run source-highlight --lang-list for a list of all supported languages.
      +

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



      -

      HTML exact variant


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

      -Gemtexter is there to convert your Gemini Capsule into other formats, such as HTML and Markdown. An HTML exact variant can now be enabled in the gemtexter.conf by adding the line declare -rx HTML_VARIANT=exact. The HTML/CSS output changed to reflect a more exact Gemtext appearance and to respect the same spacing as you would see in the Geminispace.
      +victoriametrics.com/blog/defer-in-go/

      -

      Use of Hack webfont by default


      +

      I have been in incidents. Understandably, ...



      -The Hack web font is a typeface designed explicitly for source code. It's a derivative of the Bitstream Vera and DejaVu Mono lineage, but it features many improvements and refinements that make it better suited to reading and writing code.
      +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?

      -The font has distinctive glyphs for every character, which helps to reduce confusion between similar-looking characters. For example, the characters "0" (zero), "O" (capital o), and "o" (lowercase o), or "1" (one), "l" (lowercase L), and "I" (capital i) all have distinct looks in Hack, making it easier to read and understand code at a glance.
      +firehydrant.com/blog/hot-take-dont-provide-incident-resolution-estimates/

      -Hack is open-source and freely available for use and modification under the MIT License.
      +

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



      -

      HTML Mastodon verification support


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

      -The following link explains how URL verification works in Mastodon:
      +www.calhoun.io/6-tips-for-using-strings-in-go/

      -https://joinmastodon.org/verification
      +

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



      -So we have to hyperlink to the Mastodon profile to be verified and also to include a rel='me' into the tag. In order to do that add this to the gemtexter.conf (replace the URI to your Mastodon profile accordingly):
      +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?

      - -
      declare -xr MASTODON_URI='https://fosstodon.org/@snonux'
      -
      +josephg.com/blog/rewriting-rust/

      -and add the following into your index.gmi:
      +

      The opposite of #ChaosMonkey ... ...



      -
      -=> https://fosstodon.org/@snonux Me at Mastodon
      -
      +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

      -The resulting line in the HTML output will be something as follows:
      +blog.cloudflare.com/nl-nl/improving-platform-resilience-at-cloudflare/

      - -
      <a href='https://fosstodon.org/@snonux' rel='me'>Me at Mastodon</a>
      -
      +

      November 2024



      -

      More


      +

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



      -Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.
      +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:

      -Other related posts are:
      +foo.zone/gemfeed/2024-09-07-projects-i-support.html (Gemini)
      +foo.zone/gemfeed/2024-09-07-projects-i-support.html

      -2021-04-24 Welcome to the Geminispace
      -2021-06-05 Gemtexter - One Bash script to rule it all
      -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
      -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
      -2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³ (You are currently reading this)
      +

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



      -E-Mail your comments to paul@nospam.buetow.org :-)
      +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

      -Back to the main site
      -
      -
      -
      - - 'Software Developmers Career Guide and Soft Skills' book notes - - https://foo.zone/gemfeed/2023-07-17-career-guide-and-soft-skills-book-notes.html - 2023-07-17T04:56:20+03:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - These notes are of two books by 'John Sommez' I found helpful. I also added some of my own keypoints to it. These notes are mainly for my own use, but you might find them helpful, too. - -
      -

      "Software Developmers Career Guide and Soft Skills" book notes


      +go.dev/LICENSE

      -Published at 2023-07-17T04:56:20+03:00
      +

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



      -These notes are of two books by "John Sommez" I found helpful. I also added some of my own keypoints to it. These notes are mainly for my own use, but you might find them helpful, too.
      +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.

      -
      -         ,..........   ..........,
      -     ,..,'          '.'          ',..,
      -    ,' ,'            :            ', ',
      -   ,' ,'             :             ', ',
      -  ,' ,'              :              ', ',
      - ,' ,'............., : ,.............', ',
      -,'  '............   '.'   ............'  ',
      - '''''''''''''''''';''';''''''''''''''''''
      -                    '''
      -
      +foo.zone/gemfeed/2024-10-24-staff-engineer-book-notes.html (Gemini)
      +foo.zone/gemfeed/2024-10-24-staff-engineer-book-notes.html

      -

      Improve


      +

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



      -

      Always learn new things


      +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

      -When you learn something new, e.g. a programming language, first gather an overview, learn from multiple sources, play around and learn by doing and not consuming and form your own questions. Don't read too much upfront. A large amount of time is spent in learning technical skills which were never use. You want to have a practical set of skills you are actually using. You need to know 20 percent to get out 80 percent of the results.
      +

      There has been an outage at the upstream ...



      -
        -
      • Learn a technology with a goal, e.g. implement a tool. Practice practise practice.
      • -
      • "I know X can do Y, I don't know exactly how, but I can look it up."
      • -
      • Read what experts are writing, for example follow blogs. Stay up to date and spent half an hour per day trading blogs and books.
      • -
      • Pick an open source application, read the code and try to understand it to get a feel of the syntax of the programming language.
      • -
      • Understand, that the standard library makes you a much better programmer.
      • -
      • Self learning is the top skill a programmer can have and is also useful in other aspects in your life.
      • -
      • Keep learning skills every day. Code every day. Don't be overconfident for job security. Read blogs, read books.
      • -
      • If you want to learn, then do it by exploring. Also teach what you learned (for example write a blog post or hold a presentation).
      • -

      -Fake it until you make it. But be honest about your abilities or lack of. There is however only time between now and until you make it. Refer to your abilities to learn.
      +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!

      -Boot camps: The advantage of a boot camp is to pragmatically learn things fast. We almost always overestimate what we can do in a day. Especially during boot camps. Connect to others during the boot camps
      +foo.zone/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html (Gemini)
      +foo.zone/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html
      +openbsd.amsterdam/

      -

      Set goals


      +

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



      -Your own goals are important but the manager also looks at how the team performs and how someone can help the team perform better. Check whether you are on track with your goals every 2 weeks in order to avoid surprises for the annual review. Make concrete goals for next review. Track and document your progress. Invest in your education. Make your goals known. If you want something, then ask for it. Nobody but you knows what you want.
      +One of the more confusing parts in Go, nil values vs nil errors: #golang

      -

      Ratings


      +unexpected-go.com/nil-errors-that-are-non-nil-errors.html

      -That's a trap: If you have to rate yourself, that's a trap. That never works in an unbiased way. Rate yourself always the best way but rate your weakest part as high as possible minus one point. Rate yourself as good as you can otherwise. Nobody is putting for fun a gun on his own head.
      +

      Agreeably, writing down with Diagrams helps you ...



      -
        -
      • Don't do peer rating, it can fire back on you. What if the colleague becomes your new boss?
      • -
      • Cooperate rankings are unfortunately HR guidelines and politics and only mirror a little your actual performance.
      • -

      -

      Promotions


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

      -The most valuable employees are the ones who make themselves obsolete and automate all away. Keep a safety net of 3 to 6 months of finances. Safe at least 10 percent of your earnings. Also, if you make money it does not mean that you have to spent more money. Is a new car better than a used car which both can bring you from A to B? Liability vs assets.
      +ntietz.com/blog/reasons-to-write-design-docs/

      -
        -
      • Raise or promotion, what's better? Promotion is better as money will follow anyway then.
      • -
      • Take projects no-one wants and make them shine. A promotion will follow.
      • -
      • A promotion is not going to come to you because you deserve it. You have to hunt and ask for it.
      • -
      • Track all kudos (e.g. ask for emails from your colleagues).
      • -
      • Big corporations HRs don't expect a figjit. That's why it's so important to keep track of your accomplishments and kudos'.
      • -
      • If you want a raise be specific how much and know to back your demands. Don't make a thread and no ultimatums.
      • -
      • Best way for a promotion is to switch jobs. You can even switch back with a better salary.
      • -

      -

      Finish things


      +

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



      -Hard work is necessary for accomplish results. However, work smarter not harder. Furthermore, working smart is not a substitute for working hard. Work both, hard and smart.
      +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

      -
        -
      • Learn to finish things without motivation. Things will pay off when you stick to stuff and eventually motivation can also come back.
      • -
      • You will fail if you don't plan realistically. Set also a schedule and follow to it as of life depends on it.
      • -
      • Advances come only of you give more than asked. Consistency, commitment and knowing what you need to do is more key than hard work.
      • -
      • Any action is better than no action. If you get stuck you have gained nothing.
      • -
      • You need to know the unknowns. Identify as many unknown not known things as possible.
      • -

      -Hard vs fun: Both engage the brain (video games vs work). Some work is hard and other is easy. Hard work is boring. The harsh truth is you have to put in hard and boring work in order to accomplish and be successful. Work won't be always boring though, as joy will follow with mastery.
      +github.com/ruby/rbs

      -Defeat is finally give up. Failure is the road to success, embrace it. Failure does not define you but how you respond to it. Events don't make your unhappy, but how you react to events do.
      +

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



      -

      Expand the empire


      +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:

      -The larger your empire is, the larger your circle of influence is. The larger the circle of influence is, the more opportunities you have.
      +chrisdone.com/posts/rust/

      -
        -
      • Do the dirty work if you want to expand the empire. That's there the opportunities are.
      • -
      • SCRUM often fails due to the lack to commitment. The backlog just becomes a wish to get completed.
      • -
      • Apply work on your quality standards. Don't cross the line of compromise. Always improve your skills. Never be happy being good enough.
      • -

      -Become visible, keep track that you accomplishments. E.g. write a weekly summary. Do presentations, be seen. Learn new things and share your learnings. Be the problem solver and not the blamer.
      +

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



      -

      Be pragmatic and also manage your time


      +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

      -Make use of time boxing via the Pomodoro technique: Set a target of rounds and track the rounds. That give you exact focused work time. That's really the trick. For example set a goal of 6 daily pomodores.
      +www.calhoun.io/using-functional-options-instead-of-method-chaining-in-go/

      -
        -
      • Every time you do something question why does it make sense be pragmatic and don't follow because it is best practice.
      • -
      • You can also apply the time boxing technique (Cal Newport) for focused deep work.
      • -

      -You should feel good of the work done even if you don't finished the task. You will feel good about pomodoro wise even you don't finish the task on hand yet. Helps you to enjoy time off more. Working longer may not sell anything.
      +

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



      -

      The quota system


      +Revamping my home lab a little bit. #freebsd #bhyve #rocky #linux #vm #k3s #kubernetes #wireguard #zfs #nfs #ha #relayd #k8s #selfhosting #homelab

      -Defined quota of things done. E.g. N runs per week or M Blog posts per month or O pomodoros per week. This helps with consistency. Truly commit to these quotas. Failure is not an option. Start with small commitments. Don't commit to something you can't fulfill otherwise you set yourself up for failure.
      +foo.zone/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html (Gemini)
      +foo.zone/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html

      -
        -
      • Why does the quota System work? Slow and consistent pace is the key. It also overcomes willpower weaknesses as goals are preset.
      • -
      • Internal motivation is more important over external motivation. Check out Daniels book drive.
      • -
      • Multitasking: Batching is effective. E.g. emails twice daily at pre-set times..
      • -

      -

      Don't waste time


      +

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



      -The biggest time waster is TV watching. The TV is programming you. It's insane that Americans watch so much TV as they work full time. Schedule one show at a time and watch it when you want to watch it. Most movies are crap anyways. The good movies will come to you as people will talk about them.
      +Wondering to which #web #browser I should switch now personally ...

      -
        -
      • Social media is time waster as well. Schedule your Social Media times. For example be on Facebook only for max one hour on Saturdays.
      • -
      • Meetings can waste time as well. Simply don't go to them. Try to cancel meeting if it can be dealt with via email.
      • -
      • Enjoying things is not a waste of time. E.g. you could still play a game once in a while. It is important not to cut away all you enjoy from your life.
      • -

      -

      Habits


      +www.osnews.com/story/141100/mozilla-fo..-..dvocacy-for-open-web-privacy-and-more/

      -Try to have as many good habits as possible. Start with easy habits, and make them a little bit more challenging over time. Set ankers and rewards. Over time the routines will become habits naturally.
      +

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



      -Habit stacking is effective, which is combining multiple habits at the same time. For example you can workout on a circular trainer while while watching a learning video on O'Reilly Safari Online while getting closer to your weekly step goal.
      +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.

      -
        -
      • We don't have control over our habits but our own routines.
      • -
      • Routines help to form the habits, though.
      • -

      -

      Work-life balance


      +github.com/awslabs/eks-node-viewer

      -Avoid overwork hours. That's not as beneficial as you might think and comes only with very small rewards. Invest rather in yourself and not in your employer.
      +

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



      -
        -
      • Work-life balance is a myth. Make it so that you enjoy work and your personal life and not just personal life.
      • -
      • Maintain fewer but good relationships. As a reward, better and integrated your life will be.
      • -
      • Life in the present Moment. Make the best of every moment of your life.
      • -
      • Enjoy every aspect of your life. If you want to take away one thing from this book that is it.
      • -

      -Use your most productive hours to work on you. Make that your priority. Take care of yourself a priority (E.g. do workouts or learn a new language). You can always workout 2 or 1 hour per day, but will you pay the price?
      +Have put more Photos on - On my static photo sites - Generated with a #bash script

      -

      Mental health


      +irregular.ninja

      -
        -
      • Friendships and positive thinking help to have and maintain better health, longer Life, better productivity and increased happiness.
      • -
      • Positive thinking can be trained and be a habit. Read the book "The Power of Positive Thinking".
      • -
      • Stoicism helps. Meditation helps. Playing for fun helps too.
      • -

      -Become the person you want to become (your self image). Program your brain unconsciously. Don't become the person other people want you to be. Embrace yourself, you are you.
      +

      In Go, passing pointers are not automatically ...



      -In most cases burnout is just an illusion. If you don't have motivation push through the wall. People usually don't pass the wall as they feel they are burned out. After pushing through the wall you will have the most fun, for example you will be able playing the guitar greatly.
      +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

      -

      Physical health


      +blog.boot.dev/golang/pointers-faster-than-values/

      -Utilise a standing desk and treadmill (you could walk and type at the same time). Increase the incline in order to burn more calories. Even on the standing desk you burn more calories than sitting. When you use pomodoro then you can use the small breaks for push-ups (maybe won't do as good when you are in a fasted state).
      +

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



      -
        -
      • You can only do one thing, lose fat or gain muscles. Not both at the same time.
      • -
      • Train your strength by heavy lifting, but only with a very few repetitions (e.g. 5 max for each exercise, everything over this is body building).
      • -
      • If you want to increase the muscle mass use medium weights but lift them more often. If you want to increase your endurance lift light weights but with even more reps.
      • -
      • Avoid highly processed foods
      • -

      -Intermittent fasting is an effective method to maintain weight and health. But it does not mean that you can only eat junk food in the feeding windows. Also, diet and nutrition is the most important for health and fitness. They make it also easier to stay focused and positive.
      +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:

      -

      No drama


      +ntietz.com/blog/what-i-tell-people-new-to-oncall/

      -Avoid drama at work. Where are humans there is drama. You can decide where to spent your energy in. But don't avoid conflict. Conflict is healthy in any kind of relationship. Be tactful and state your opinion. The goal is to find the best solution to the problem.
      +

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



      -Don't worry about other people what they do and don't do. You only worry about you. Shut up and get your own things done. But you could help to inspire a not working colleague.
      +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

      -
        -
      • During an argument, take the opponent's position and see how your opinion changes.
      • -
      • If you they to convince someone else it's an argument. Of you try to find the best solution it is a good resolution.
      • -
      • If someone is hurting the team let the manager know but phrase it nicely.
      • -
      • How to get rid of a never ending talking person? Set up focus hours officially where you don't want to be interrupted. Present as if it is your defect that you get interrupted easily.
      • -
      • TOXIC PEOPLE: AVOID THEM. RUN.
      • -
      • Boss likes if you get shit done without getting asked all the time about things and also without drama.
      • -

      -You have to learn how to work in a team. Be honest but tactful. It's not too be the loudest but about selling your ideas. Don't argue otherwise you won't sell anything. Be persuasive by finding the common ground. Or lead the colleagues to your idea and don't sell it upfront. Communicate clearly.
      +

      This is an interactive summary of the Go ...



      -

      Personal brand


      +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

      -
        -
      • Invest your value outside the company. Build your personal brand. Show how valuable you are, also to other companies. Become an asset.
      • -
      • Invest in your education. Make your goals known. If you want something ask for it (see also the sections about goals in this document).
      • -

      -

      Market yourself


      +antonz.org/go-1-23/

      -
        -
      • The best way to market yourself is to make you usable.
      • -
      • Create a brand. Decide your focus. Throw your name out as often as possible.
      • -

      -Have a blog. Schedule your posts. Consistency beats every other factor. E.g. post once a month a new post. Find your voice, you don't have to sound academic. Keep writing, if you keep it long enough the rewards will be coming. Your own blog can take 5 years to take off. Most people give up too soon.
      +

      December 2024



      -
        -
      • Consistency of your blog is key. Also write quality content. Don't try to be a man of success but try to be a man of value.
      • -
      • Have an elevator pitch: "buetow.org - Having fun with computers!"
      • -
      • Have social media accounts, especially the ones which are more tech related.
      • -

      -

      Networking


      +

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



      -Ask people so they talk about themselves. They are not really interested in you. Use meetup.com to find groups you are interested and build up the network over time. Don't drink on social networking events even when others do. Talking to other people at events only has upsides. Just saying "hi" and introducing yourself is enough. What worse can happen? If the person rejects you so what, life goes on. Ask open questions and no "yes" and "no" questions. E.g.: "What is your story, why are you here?".
      +Thats unexpected, you cant remove a NaN key from a map without clearing it! #golang

      -

      Public speaking


      +unexpected-go.com/you-cant-remove-a-nan-key-from-a-map-without-clearing-it.html

      -Before your talk go on stage 10 minutes in advance. Introduce yourself to the front row people. During the talk they will smile at you and encourage you during your talk.
      +

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



      -
        -
      • Try at least 5 times before giving up public speaking. You can also start small, e.g. present a topic at work you are learning.
      • -
      • Practise your talk and timing. You can also record your practicing.
      • -

      -Just do it. Just go to conferences. Even if you are not speaking. Sell your boss what you would learn and "this and that" and you would present the learnings to the team afterwards.
      +My second blog post about revamping my home lab a little bit just hit the net. #FreeBSD #ZFS #n100 #k8s #k3s #kubernetes

      -

      New job


      +foo.zone/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html (Gemini)
      +foo.zone/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html

      -

      For the interview


      +

      Very insightful article about tech hiring in ...



      -
        -
      • Build up a network before the interview. E.g., follow and comment blogs. Or go to meet-ups and conferences. Join user groups.
      • -
      • Ask to touch base before the real interview and ask questions about the company. Do "pre-interviews".
      • -
      • Have a blog, a CV can only be 2 pages and an interview only can last only 2 hours. A blog helps you also to be a better communicator.
      • -

      -If you are specialized then there is a better chance to get a fitting job. No one will hire a general lawyer if there are specialized lawyers available. Even if you are specialized, you will have a wide range of skills (T-shape knowledge).
      +Very insightful article about tech hiring in the age of LLMs. As an interviewer, I have experienced some of the scrnarios already first hand...

      -

      Find the right type of company


      +newsletter.pragmaticengineer.com/p/how-genai-changes-tech-hiring

      -Not all companies are equal. They have individual cultures and guidelines.
      +

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



      -
        -
      • Startup: dynamic and larger impact. Many hats on.
      • -
      • Medium size companies: most stable ones. Not cutting edge technologies. No crazy working hours.
      • -
      • Large company: very established with a lot of structure however constant layoffs and restructurings. Less impact you can have. Complex politics.
      • -
      • Working for yourself: This is harder than you think, probably much harder.
      • -

      -Work in a tech. company if you want to work on/with cutting edge technologies.
      +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!

      -

      Apply for the new job


      +github.com/Netflix/bpftop

      -Get a professional resume writer. Get referrals of writers and get samples from there. Get sufficient with algorithm and data structures interview questions. Cracking the coding interview book and blog
      +

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



      -
        -
      • Apply for each job with a specialised CV each. Each CV fits the job better.
      • -
      • Best get a job via a personal referral or inbound marketing. The latter is somehow rare.
      • -
      • Inbound marketing is for example someone responds to your blog and offers you a job.
      • -
      • Interview the interviewer. Be persistent.
      • -
      • Create creative looking resumes, see simple programmer website. Action-result style for a resume.
      • -

      -Invest in your dress code as appearance masters. It does make sense to invest in your style. You could even hire a professional stylist (not my personal way though).
      +89 things he/she knows about Git commits is a neat list of #Git wisdoms

      -

      Negotiation


      +www.jvt.me/posts/2024/07/12/things-know-commits/

      -
        -
      • Whoever names the number first loses. You don't know what someone else is expecting unless told. Low ball number may be an issue but you have to know the market.
      • -
      • Salary is not about what you need but what you are worth. Try to find out what you are worth.
      • -
      • Big tech companies have a pay scale. You can ask for this.
      • -
      • Don't tell your current salary. Only do one counter offer and say "If you do X then I commit today". Be tactful and not rude. Nobody wants to be taken advantage of. Also, don't be arrogant.
      • -
      • If the company wants to know your range, respond: "I would rather learn more about the job and compensation. You have a range in mind, correct?" Be brave and just pause here.
      • -
      • Otherwise, if the company refuses then say "if you tell me what the range is and although I am not yet sure yet what are my exact salary requirements are I can see if the range is of what I am looking for. If they absolute refuse give a high ball range you would expect and make it conditional to the overall compensation package. E.g. 70k to 100k depending on the compensation package. THE LOW END SHOULD BE YOUR REAL LOW END. Play a little bit of hardball here and be brave. Practise it.
      • -
      • Put 10 percent on top of the salary range into a counter offer.
      • -
      • Everything is negotiable, not only the salary.
      • -
      • Job markup rate: Check it regarding the recruitment rate negotiation.
      • -
      • Don't make a rushed decision based on deadlines. Make a fairly high counter offer shortly before deadline.
      • -
      • You should also cope with rejections while selling yourself. There is no such thing as job security.
      • -

      -
        -
      • Never spilt the difference is the best book for learning negotiation techniques..
      • -

      -

      Leaving the old job


      +

      I found that working on multiple side projects ...



      -When leaving a job make a clean and non personal as possible. Never complain and never explain. Don't worry about abandonment of the team. Everybody is replacement and you make a business decision. Don't threaten to quit as you are replaceable.
      +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.

      -

      Other things


      +

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



      -
        -
      • As a leader lead by example and don't lead from the Eiffel tower.
      • -
      • As a leader you are responsible for the team. If the team fails then it's your fault only.
      • -

      -

      Testing


      +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"

      -Unit testing Vs regression testing: Unit tests test the smallest possible unit and get rewritten if the unit gets changed. It's like programming against a specification n. Regression tests test whether the software still works after the change. Now you know more than most software engineers.
      +lucasoshiro.github.io/posts-en/2024-06-17-ruby-shellscript/

      -

      Books to read


      +

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



      -
        -
      • Clean Code
      • -
      • Code Complete
      • -
      • Cracking the Interview - Lessons and Solutions.
      • -
      • Daniels Book "Drive" (about internal and external motivation)
      • -
      • God's degree (inventor of Dilbert)
      • -
      • Head first Design Patterns
      • -
      • How to win Friends and influence People
      • -
      • Never Split the Difference [X]
      • -
      • Structure and programming functional programs
      • -
      • The obstacle is the way [X]
      • -
      • The passionate programmer
      • -
      • The Power of Positive Thinking (Highly religious - I personally don't like it)
      • -
      • The Pragmatic Programmer [X]
      • -
      • The war of Art (to combat procrastination)
      • -
      • Willpower Instinct
      • -

      -Other book notes of mine are:
      +Plan9 assembly format in Go, but wait, it's not the Operating System Plan9! #golang #rabbithole

      -2023-03-16 "The Pragmatic Programmer" book notes
      -2023-04-01 "Never split the difference" book notes
      -2023-05-06 "The Obstacle is the Way" book notes
      -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes (You are currently reading this)
      -2023-11-11 "Mind Management" book notes
      +www.osnews.com/story/140941/go-plan9-memo-speeding-up-calculations-450/

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +

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



      -More books and other resources I found useful.
      -Back to the main site
      -
      -
      -
      - - KISS server monitoring with Gogios - - https://foo.zone/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios.html - 2023-06-01T21:10:17+03:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - Gogios is a minimalistic and easy-to-use monitoring tool I programmed in Google Go designed specifically for small-scale self-hosted servers and virtual machines. The primary purpose of Gogios is to monitor my personal server infrastructure for `foo.zone`, my MTAs, my authoritative DNS servers, my NextCloud, Wallabag and Anki sync server installations, etc. - -
      -

      KISS server monitoring with Gogios


      +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

      -Published at 2023-06-01T21:10:17+03:00
      +jonathan-frere.com/posts/helix/

      -Gogios logo
      +

      This blog post is basically a rant against ...



      -

      Introduction


      +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

      -Gogios is a minimalistic and easy-to-use monitoring tool I programmed in Google Go designed specifically for small-scale self-hosted servers and virtual machines. The primary purpose of Gogios is to monitor my personal server infrastructure for foo.zone, my MTAs, my authoritative DNS servers, my NextCloud, Wallabag and Anki sync server installations, etc.
      +crys.site/blog/2024/reinventint-the-weel/
      +dtail.dev

      -With compatibility with the Nagios Check API, Gogios offers a simple yet effective solution to monitor a limited number of resources. In theory, Gogios scales to a couple of thousand checks, though. You can clone it from Codeberg here:
      +

      Quick trick to get Helix themes selected ...



      -https://codeberg.org/snonux/gogios
      +Quick trick to get Helix themes selected randomly #HelixEditor

      -
      -    _____________________________    ____________________________
      -   /                             \  /                            \
      -  |    _______________________    ||    ______________________    |
      -  |   /                       \   ||   /                      \   |
      -  |   | # Alerts with status c|   ||   | # Unhandled alerts:  |   |
      -  |   | hanged:               |   ||   |                      |   |
      -  |   |                       |   ||   | CRITICAL: Check Pizza|   |
      -  |   | OK->CRITICAL: Check Pi|   ||   | : Late delivery      |   |
      -  |   | zza: Late delivery    |   ||   |                      |   |
      -  |   |                       |   ||   | WARNING: Check Thirst|   |
      -  |   |                       |   ||   | : OutofKombuchaExcept|   |
      -  |   \_______________________/   ||   \______________________/   |
      -  |  /|\ GOGIOS MONITOR 1    _    ||  /|\ GOGIOS MONITOR 2   _    |
      -   \_____________________________/  \____________________________/
      -     !_________________________!      !________________________!
      -
      -------------------------------------------------
      -ASCII art was modified by Paul Buetow
      -The original can be found at
      -https://asciiart.website/index.php?art=objects/computers
      -
      +foo.zone/gemfeed/2024-12-15-random-helix-themes.html (Gemini)
      +foo.zone/gemfeed/2024-12-15-random-helix-themes.html

      -

      Motivation


      +

      Example where complexity attacks you from ...



      -With experience in monitoring solutions like Nagios, Icinga, Prometheus and OpsGenie, these tools often came with many features that I didn't necessarily need for personal use. Contact groups, host groups, check clustering, and the requirement of operating a DBMS and a WebUI added complexity and bloat to my monitoring setup.
      +Example where complexity attacks you from behind #k8s #kubernetes #OpenAI

      -My primary goal was to have a single email address for notifications and a simple mechanism to periodically execute standard Nagios check scripts and notify me of any state changes. I wanted the most minimalistic monitoring solution possible but wasn't satisfied with the available options.
      +surfingcomplexity.blog/2024/12/14/quic..-..ecent-openai-public-incident-write-up/

      -This led me to create Gogios, a lightweight monitoring tool tailored to my specific needs. I chose the Go programming language for this project as it comes, in my opinion, with the best balance of ease to use and performance.
      +

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



      -

      Features


      +LLMs for Ops? Summaries of logs, probabilities about correctness, auto-generating Ansible, some uses cases are there. Wouldn't trust it fully, though.

      -
        -
      • Compatible with Nagios Check scripts: Gogios leverages the widely-used Nagios Check API, allowing to use existing Nagios plugins.
      • -
      • Lightweight and Minimalistic: Gogios is designed to be simple and fairly easy to set up.
      • -
      • Configurable Check Timeout and Concurrency: Gogios allows you to set a timeout for checks and configure the number of concurrent checks, offering flexibility in monitoring your resources.
      • -
      • Configurable check dependency: A check can depend on another check, which enables scenarios like not executing an HTTP check when the server isn't pingable.
      • -
      • Retries: Check retry and retry intervals are configurable per check.
      • -
      • Email Notifications: Gogios can send email notifications regarding the status of monitored services, ensuring you stay informed about potential issues.
      • -
      • CRON-based Execution: Gogios can be quickly scheduled to run periodically via CRON, allowing you to automate monitoring without needing a complex setup.
      • -

      -

      Example alert


      +youtu.be/WodaffxVq-E?si=noY0egrfl5izCSQI

      -This is an example alert report received via E-Mail. Whereas, [C:2 W:0 U:0 OK:51] means that we've got two alerts in status critical, 0 warnings, 0 unknowns and 51 OKs.
      +

      Excellent article about your dream Product ...



      -
      -Subject: GOGIOS Report [C:2 W:0 U:0 OK:51]
      -
      -This is the recent Gogios report!
      -
      -# Alerts with status changed:
      -
      -OK->CRITICAL: Check ICMP4 vulcan.buetow.org: Check command timed out
      -OK->CRITICAL: Check ICMP6 vulcan.buetow.org: Check command timed out
      -
      -# Unhandled alerts:
      -
      -CRITICAL: Check ICMP4 vulcan.buetow.org: Check command timed out
      -CRITICAL: Check ICMP6 vulcan.buetow.org: Check command timed out
      -
      -Have a nice day!
      -
      +Excellent article about your dream Product Manager: Why every software team needs a product manager to thrive via @wallabagapp

      -

      Installation


      +testdouble.com/insights/why-product-ma..-..s-accelerate-improve-software-delivery

      -

      Compiling and installing Gogios


      +

      I just finished reading all chapters of CPU ...



      -This document is primarily written for OpenBSD, but applying the corresponding steps to any Unix-like (e.g. Linux-based) operating system should be easy. On systems other than OpenBSD, you may always have to replace does with the sudo command and replace the /usr/local/bin path with /usr/bin.
      +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

      -To compile and install Gogios on OpenBSD, follow these steps:
      +cpu.land/

      - -
      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
      -
      +

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



      -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:
      +Indeed, useful to know this stuff! #sre

      - -
      export GOOS=openbsd
      -export GOARCH=amd64
      -go build -o gogios cmd/gogios/main.go
      -
      +biriukov.dev/docs/resolver-dual-stack-..-..resolvers-and-dual-stack-applications/

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

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



      -https://www.rexify.org
      +It's the small things, which make Unix like systems, like GNU/Linux, interesting. Didn't know about this #GNU #Tar behaviour yet:

      -

      Setting up user, group and directories


      +xeiaso.net/notes/2024/pop-quiz-tar/

      -It is best to create a dedicated system user and group for Gogios to ensure proper isolation and security. Here are the steps to create the _gogios user and group under OpenBSD:
      +

      My New Year's resolution is not to start any ...



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

      -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.
      +So every time I open a new terminal or shell, editor::helix::random_theme gets called, which randomly selects a theme from all installed ones and updates the helix config accordingly.
      +
      + +
      [paul@earth] ~ % editor::helix::random_theme
      +[paul@earth] ~ % head -n 1 ~/.config/helix/config.toml
      +theme = "jellybeans"
      +[paul@earth] ~ % editor::helix::random_theme
      +[paul@earth] ~ % head -n 1 ~/.config/helix/config.toml
      +theme = "rose_pine"
      +[paul@earth] ~ % editor::helix::random_theme
      +[paul@earth] ~ % head -n 1 ~/.config/helix/config.toml
      +theme = "noctis"
      +[paul@earth] ~ %
      +

      -

      Installing monitoring plugins


      +

      A better version



      -Gogios relies on external Nagios or Icinga monitoring plugin scripts. On OpenBSD, you can install the monitoring-plugins package with Gogios. The monitoring-plugins package is a collection of monitoring plugins, similar to Nagios plugins, that can be used to monitor various services and resources:
      +Update 2024-12-18: This is an improved version, which works cross platform (e.g., also on MacOS) and multiple theme directories:

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

      -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.
      +I hope you had some fun. E-Mail your comments to paul@nospam.buetow.org :-)

      -

      Configuration


      +Back to the main site
      +
      +
      +
      + + f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation + + https://foo.zone/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html + 2024-12-02T23:48:21+02:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + This is the second blog post about my f3s series for my self-hosting demands in my home lab. f3s? The 'f' stands for FreeBSD, and the '3s' stands for k3s, the Kubernetes distribution I will use on FreeBSD-based physical machines. + +
      +

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



      -

      MTA


      +Published at 2024-12-02T23:48:21+02:00

      -Gogios requires a local Mail Transfer Agent (MTA) such as Postfix or OpenBSD SMTPD running on the same server where the CRON job (see about the CRON job further below) is executed. The local MTA handles email delivery, allowing Gogios to send email notifications to monitor status changes. Before using Gogios, ensure that you have a properly configured MTA installed and running on your server to facilitate the sending of emails. Once the MTA is set up and functioning correctly, Gogios can leverage it to send email notifications.
      +This is the second blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution I will use on FreeBSD-based physical machines.

      -You can use the mail command to send an email via the command line on OpenBSD. Here's an example of how to send a test email to ensure that your email server is working correctly:
      +We set the stage last time; this time, we will set up the hardware for this project.

      -
      -echo 'This is a test email from OpenBSD.' | mail -s 'Test Email' your-email@example.com
      -
      +These are all the posts so far:

      -Check the recipient's inbox to confirm the delivery of the test email. If the email is delivered successfully, it indicates that your email server is configured correctly and functioning. Please check your MTA logs in case of issues.
      +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
      +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation (You are currently reading this)
      +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage

      -

      Configuring Gogios


      +f3s logo

      -To configure Gogios, create a JSON configuration file (e.g., /etc/gogios.json). Here's an example configuration:
      +Logo was generated by ChatGPT.

      - -
      {
      -  "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"]
      -    }
      -  }
      -}
      -
      +Let's continue...
      +
      +

      Table of Contents




      -Adjust the configuration file according to your needs, specifying the checks you want Gogios to perform.
      +

      Deciding on the hardware



      -If you want to execute checks only when another check succeeded (status OK), use DependsOn. In the example above, the HTTP checks won't run when the hosts aren't pingable. They will show up as UNKNOWN in the report.
      +Note that the OpenBSD VMs included in the f3s setup (which will be used later in this blog series for internet ingress - as you know from the first part of this blog series) are already there. These are virtual machines that I rent at OpenBSD Amsterdam and Hetzner.

      -Retries and RetryInterval are optional check configuration parameters. In case of failure, Gogios will retry Retries times each RetryInterval seconds.
      +https://openbsd.amsterdam
      +https://hetzner.cloud

      -For remote checks, use the check_nrpe plugin. You also need to have the NRPE server set up correctly on the target host (out of scope for this document).
      +This means that the FreeBSD boxes need to be covered, which will later be running k3s in Linux VMs via bhyve hypervisor.

      -The state.json file mentioned above keeps track of the monitoring state and check results between Gogios runs, enabling Gogios only to send email notifications when there are changes in the check status.
      +I've been considering whether to use Raspberry Pis or look for alternatives. It turns out that complete N100-based mini-computers aren't much more expensive than Raspberry Pi 5s, and they don't require assembly. Furthermore, I like that they are AMD64 and not ARM-based, which increases compatibility with some applications (e.g., I might want to virtualize Windows (via bhyve) on one of those, though that's out of scope for this blog series).

      -

      Running Gogios


      +

      Not ARM but Intel N100



      -Now it is time to give it a first run. On OpenBSD, do:
      +I needed something compact, efficient, and capable enough to handle the demands of a small-scale Kubernetes cluster and preferably something I don't have to assemble a lot. After researching, I decided on the Beelink S12 Pro with Intel N100 CPUs.
      +
      +Beelink Mini S12 Pro N100 official page
      +
      +The Intel N100 CPUs are built on the "Alder Lake-N" architecture. These chips are designed to balance performance and energy efficiency well. With four cores, they're more than capable of running multiple containers, even with moderate workloads. Plus, they consume only around 8W of power (ok, that's more than the Pis...), keeping the electricity bill low enough and the setup quiet - perfect for 24/7 operation.
      +
      +Beelink preparation
      +
      +The Beelink comes with the following specs:
      +
      +
        +
      • 12th Gen Intel N100 processor, with four cores and four threads, and a maximum frequency of up to 3.4 GHz.
      • +
      • 16 GB of DDR4 RAM, with a maximum (official) size of 16 GB (but people could install 32 GB on it).
      • +
      • 500 GB M.2 SSD, with the option to install a 2nd 2.5 SSD drive (which I want to make use of later in this blog series).
      • +
      • GBit ethernet
      • +
      • Four USB 3.2 Gen2 ports (maybe I want to mount something externally at some point)
      • +
      • Dimensions and weight: 115*102*39mm, 280g
      • +
      • Silent cooling system.
      • +
      • HDMI output (needed only for the initial installation and maybe for troubleshooting later)
      • +
      • Auto power on via WoL (may make use of it)
      • +
      • Wi-Fi (not going to use it)
      • +

      +I bought three (3) of them for the cluster I intend to build.
      +
      +
      +
      +Unboxing was uneventful. Every Beelink PC came with:
      +
      +
        +
      • An AC power adapter
      • +
      • An HDMI cable
      • +
      • A VESA mount with screws (not using it as of now)
      • +
      • Some manuals
      • +
      • The pre-assembled Beelink PC itself.
      • +
      • A "Hello" post card (??)
      • +

      +Overall, I love the small form factor.
      +
      +

      Network switch


      +
      +I went with the tp-link mini 5-port switch, as I had a spare one available. That switch will be plugged into my wall ethernet port, which connects directly to my fiber internet router with 100 Mbit/s down and 50 Mbit/s upload speed.
      +
      +Switch
      +
      +

      Installing FreeBSD


      +
      +

      Base install


      +
      +First, I downloaded the boot-only ISO of the latest FreeBSD release and dumped it on a USB stick via my Fedora laptop:

      -
      doas -u _gogios /usr/local/bin/gogios -cfg /etc/gogios.json
      +
      [paul@earth]~/Downloads% sudo dd \
      +  if=FreeBSD-14.1-RELEASE-amd64-bootonly.iso \
      +  of=/dev/sda conv=sync
       

      -To run Gogios via CRON on OpenBSD as the gogios user and check all services once per minute, follow these steps:
      +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.

      -Type doas crontab -e -u _gogios and press Enter to open the crontab file for the _gogios user for editing and add the following lines to the crontab file:
      +The installation was uneventful. I selected:

      -
      -*/5 8-22 * * * /usr/local/bin/gogios -cfg /etc/gogios.json
      -0 7 * * * /usr/local/bin/gogios -renotify -cfg /etc/gogios.json
      -
      +
        +
      • Guided ZFS on root (pool zroot)
      • +
      • Unencrypted ZFS (I will encrypt separate datasets later; I want it to be able to boot without manual interaction)
      • +
      • Static IP configuration (to ensure that the boxes always have the same IPs, even after switching the router/DHCP server)
      • +
      • I decided to enable the SSH daemon, NTP server, and NTP time synchronization at boot, and I also enabled powerd for automatic CPU frequency scaling.
      • +
      • In addition to root, I added a personal user, paul, whom I placed in the wheel group.
      • +

      +After doing all that three times (once for each Beelink PC), I had three ready-to-use FreeBSD boxes! Their hostnames are f0, f1 and f2!

      -Gogios is now configured to run every five minutes from 8 am to 10 pm via CRON as the _gogios user. It will execute the checks and send monitoring status whenever a check status changes via email according to your configuration. Also, Gogios will run once at 7 am every morning and re-notify all unhandled alerts as a reminder.
      +Beelink installation

      -

      High-availability


      +

      Latest patch level and customizing /etc/hosts



      -To create a high-availability Gogios setup, you can install Gogios on two servers that will monitor each other using the NRPE (Nagios Remote Plugin Executor) plugin. By running Gogios in alternate CRON intervals on both servers, you can ensure that even if one server goes down, the other will continue monitoring your infrastructure and sending notifications.
      +After the first boot, I upgraded to the latest FreeBSD patch level as follows:

      -
        -
      • Install Gogios on both servers following the compilation and installation instructions provided earlier.
      • -
      • Install the NRPE server (out of scope for this document) and plugin on both servers. This plugin allows you to execute Nagios check scripts on remote hosts.
      • -
      • Configure Gogios on both servers to monitor each other using the NRPE plugin. Add a check to the Gogios configuration file (/etc/gogios.json) on both servers that uses the NRPE plugin to execute a check script on the other server. For example, if you have Server A and Server B, the configuration on Server A should include a check for Server B, and vice versa.
      • -
      • Set up alternate CRON intervals on both servers. Configure the CRON job on Server A to run Gogios at minutes 0, 10, 20, ..., and on Server B to run at minutes 5, 15, 25, ... This will ensure that if one server goes down, the other server will continue monitoring and sending notifications.
      • -
      • Gogios doesn't support clustering. So it means when both servers are up, unhandled alerts will be notified via E-Mail twice; from each server once. That's the trade-off for simplicity.
      • -

      -There are plans to make it possible to execute certain checks only on certain nodes (e.g. on elected leader or master nodes). This is still in progress (check out my Gorum Git project).
      + +
      root@f0:~ # freebsd-update fetch
      +root@f0:~ # freebsd-update install
      +root@f0:~ # freebsd-update reboot
      +

      -

      Conclusion:


      +I also added the following entries for the three FreeBSD boxes to the /etc/hosts file:

      -Gogios is a lightweight and straightforward monitoring tool that is perfect for small-scale environments. With its compatibility with the Nagios Check API, email notifications, and CRON-based scheduling, Gogios offers an easy-to-use solution for those looking to monitor a limited number of resources. I personally use it to execute around 500 checks on my personal server infrastructure. I am very happy with this solution.
      + +
      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
      +

      -Other KISS-related posts are:
      +You might wonder why bother using the hosts file? Why not use DNS properly? The reason is simplicity. I don't manage 100 hosts, only a few here and there. Having an OpenWRT router in my home, I could also configure everything there, but maybe I'll do that later. For now, keep it simple and straightforward.

      -2021-09-12 Keep it simple and stupid
      -2023-06-01 KISS server monitoring with Gogios (You are currently reading this)
      -2023-10-29 KISS static web photo albums with photoalbum.sh
      +

      After install



      -E-Mail your comments to paul@nospam.buetow.org :-)
      +After that, I installed the following additional packages:

      -Back to the main site
      -
      -
      -
      - - 'The Obstacle is the Way' book notes - - https://foo.zone/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html - 2023-05-06T17:23:16+03:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - These are my personal takeaways after reading 'The Obstacle Is the Way' by Ryan Holiday. This is mainly for my own use, but you might find it helpful too. - -
      -

      "The Obstacle is the Way" book notes


      + +
      root@f0:~ # pkg install helix doas zfs-periodic uptimed
      +

      -Published at 2023-05-06T17:23:16+03:00
      +

      Helix editor



      -These are my personal takeaways after reading "The Obstacle Is the Way" by Ryan Holiday. This is mainly for my own use, but you might find it helpful too.
      +Helix? It's my favourite text editor. I have nothing against vi but like hx (Helix) more!

      +https://helix-editor.com/

      -
      -         ,..........   ..........,
      -     ,..,'          '.'          ',..,
      -    ,' ,'            :            ', ',
      -   ,' ,'             :             ', ',
      -  ,' ,'              :              ', ',
      - ,' ,'............., : ,.............', ',
      -,'  '............   '.'   ............'  ',
      - '''''''''''''''''';''';''''''''''''''''''
      -                    '''
      +

      doas


      +
      +doas? It's a pretty neat (and KISS) replacement for sudo. It has far fewer features than sudo, which is supposed to make it more secure. Its origin is the OpenBSD project. For doas, I accepted the default configuration (where users in the wheel group are allowed to run commands as root):
      +
      + +
      root@f0:~ # cp /usr/local/etc/doas.conf.sample /usr/local/etc/doas.conf
       

      -"The obstacle is the way" is a powerful statement that encapsulates the wisdom of turning challenges into opportunities for growth and success. We will explore using obstacles as fuel, transforming weaknesses into strengths, and adopting a mindset that allows us to be creative and persistent in the face of adversity.
      +https://man.openbsd.org/doas

      -

      Reframe your perspective


      +

      Periodic ZFS snapshotting



      -The obstacle in your path can become your path to success. Instead of being paralyzed by challenges, see them as opportunities to learn and grow. Remember, the things that hurt us often instruct us.
      +zfs-periodic is a nifty tool for automatically creating ZFS snapshots. I decided to go with the following configuration here:

      -We spend a lot of time trying to get things perfect and look at the rules, but what matters is that it works; it doesn't need to be after the book. Focus on results rather than on beautiful methods. In Jujitsu, it does matter that you bring your opponent down, but not how. There are many ways from point A to point B; it doesn't need to be a straight line. So many try to find the best solution but need to catch up on what is in Infront of them. Think progress and not perfection.
      + +
      root@f0:~ # cat <<END >>/etc/periodic.conf
      +daily_zfs_snapshot_enable="YES"
      +daily_zfs_snapshot_pools="zroot"
      +daily_zfs_snapshot_keep="7"
      +weekly_zfs_snapshot_enable="YES"
      +weekly_zfs_snapshot_pools="zroot"
      +weekly_zfs_snapshot_keep="5"
      +monthly_zfs_snapshot_enable="YES"
      +monthly_zfs_snapshot_pools="zroot"
      +monthly_zfs_snapshot_keep="6"
      +END
      +

      -Don't always try to use the front door; a backdoor could open. It's nonsense. Don't fight the judo master with judo. Non-action can be action, exposing the weaknesses of others.
      +https://github.com/ross/zfs-periodic

      +

      Uptime tracking



      -

      Embrace rationality


      +uptimed? I like to track my uptimes. This is how I configured the daemon:

      -It is a superpower to see things rationally when others are fearful. Focus on the reality of the situation without letting emotions, such as anger, cloud your judgment. This ability will enable you to make better decisions in adversity. Ability to see things what they really are. E.g. wine is old fermented grapes, or other people behaving like animals during a fight. Show the middle finger if someone persists on the stupid rules occasionally.
      + +
      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
      +

      -

      Control your response


      +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:

      -You can choose how you respond to obstacles. Focus on what you can control, and don't let yourself feel harmed by external circumstances. Remember, you decide how things affect you; nobody else does. Choose to feel good in response to any situation. Embrace the challenges and obstacles that come your way, as they are opportunities for growth and learning.
      + +
      root@f0:~ # service uptimed enable
      +root@f0:~ # service uptimed start
      +

      -

      Practice emotional and physical resilience


      +To check the current uptime stats, I can now run uprecords:

      -Martial artists know the importance of developing physical and emotional strength. Cultivate the art of not panicking; it will help you avoid making mistakes during high-pressure situations.
      + +
       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
      +

      -Focus on what you can control. Don't choose to feel harmed, and then you won't be harmed. I decide things that affect me; nobody else does. E.g., in prison, your mind stays your own. Don't ignore fear but explain it away, have a different view.
      +This is how I track the uptimes for all of my host:

      -

      Persistence and patience


      +Unveiling guprecords.raku: Global Uptime Records with Raku-
      +https://github.com/rpodgorny/uptimed

      -Practice persistence and patience in your pursuits. Focus on the process rather than the prize and take one step at a time. Remember, the journey is about finishing tasks, projects, or workouts to the best of your ability. Never be in a hurry and never be desperate. There is no reason to be rushed; there are all in the long haul. Follow the process and not the price. Take it one step at a time. The process is about finishing (workout, task, project, etc.).
      +

      Hardware check



      -

      Embrace failure


      +

      Ethernet



      -Failure is a natural part of life and can make us stronger. Treat defeat as a stepping stone to success and education. What is defeat? The first step to education. Failure makes you stronger. If we do our best, we can be proud of it, regardless of the result. Do your job, but do it right. Only an asshole thinks he is too good at the things he does. Also, asking for forgiveness is easier than asking for permission.
      +Works. Nothing eventful, really. It's a cheap Realtek chip, but it will do what it is supposed to do.

      -

      Be adaptable


      + +
      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>
      +

      -There are many ways to achieve your goals; sometimes, unconventional methods are necessary. Feel free to break the rules or go off the beaten path if it will lead to better results. Transform weaknesses into strengths. We have a choice of how to respond to things. It's not about being positive but to be creative. Aim high, but stuff will happen; E.g., surprises will always happen.
      +

      RAM



      -

      Embrace non-action


      +All there:

      -We constantly push to the next thing. Sometimes the best course of action is standing still or even going backwards. Obstacles might resolve by themselves. Or going sideways. Sometimes, the best action is to stand still, go sideways, or even go backwards. Obstacles may resolve themselves or present new opportunities if you're patient and observant. People always want your input before you have all the facts. They want you to play after their rules. The question is, do you let them? The English call it the cool head. Being in control of Stress; requires practice. Appear, the absence of fear (Greek). When all others do it one way, it does not mean it is the correct or best practice.
      + +
      paul@f0:~ % sysctl hw.physmem
      +hw.physmem: 16902905856
      +
      +

      -

      Leverage crisis


      +

      CPUs



      -In times of crisis, seize the chance to do things never done before. Great people use negative situations to their advantage and become the most effective in challenging circumstances.
      +They work:

      -The art of not panicking; otherwise, you will make mistakes. When overs are shocked, you know which way to take due to your thinking of the problem at Hand. A crisis gives you a chance to do things which never done before. Ordinary people shy from negative situations; great people use these for their benefit and are the most effective. The obstacle is not just turned upside down but used as a catapult.
      + +
      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
      +

      -Be prepared for nothing to work. Problems are an opportunity to do your best, not to do miracles. Always manage your expectations. It will suck, but it will be ok. Be prepared to begin from the beginning. Be cheerful and eagerly work on the next obstacle. Each time you become better. Life is not a sprint but a marathon. After each obstacle lies another obstacle, there won't be anything without obstacles. Passing one means you are ready for the next.
      +

      CPU throttling



      -

      Build your inner citadel


      +With powerd running, CPU freq is dowthrottled when the box isn't jam-packed. To stress it a bit, I run ubench to see the frequencies being unthrottled again:

      -Develop your inner strength during good times so you can rely on it in bad times. Always prepare for adversity and face it with calmness and resilience. Be humble enough that things which happen will happen. Build your inner citadel. In good times strengthen it. In bad times rely on it.
      + +
      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
      +

      -We should always prepare for things to get tough. Your house burns down: no worries, we eliminated much rubbish. Imagine what can go wrong before things go wrong. We are prepared for adversity; it's other people who aren't. Phil Jackson's hip problem example. To receive unexpected benefits, you must first accept the unexpected obstacles. Meditate on death. It's a universal obstacle. Use it as a reminder to do your best.
      +Idle, all three Beelinks plus the switch consumed 26.2W. But with ubench stressing all the CPUs, it went up to 38.8W.

      -

      Love everything that happens


      +Idle consumption.

      -Turn an obstacle the other way around for your benefit. Use it at fuel. It's simple but challenging. Most are paralyzed instead. The obstacle in the path becomes the path. Obstacles are neither good nor bad. The things which hurt, instruct.
      +

      Conclusion



      -Should I hate people who hate me? That's their problem and not mine. Be always calm and relaxed during the fight. The story of the battle is the story of the smile. Cheerfulness in all situations, especially the bad ones. Love for everything that happens; if it happens, it was meant to happen. We can choose how we react to things, so why not choose to feel good? I love everything that happens. You must never lower yourself to the person you don't like.
      +The Beelink S12 Pro with Intel N100 CPUs checks all the boxes for a k3s project: Compact, efficient, expandable, and affordable. Its compatibility with both Linux and FreeBSD makes it versatile for other use cases, whether as part of your cluster or as a standalone system. If you’re looking for hardware that punches above its weight for Kubernetes, this little device deserves a spot on your shortlist.

      -

      Conclusion


      +Beelinks stacked

      -Life is a marathon, not a sprint. Each obstacle we overcome prepares us for the next one. Remember, the obstacle is not just a barrier to be turned upside down; it can also be used as a catapult to propel us forward. By embracing challenges and using them as opportunities for growth, we become stronger, more adaptable, and, ultimately, more successful.
      +To ease cable management, I need to get shorter ethernet cables. I will place the tower on my shelf, where most of the cables will be hidden (together with a UPS, which will also be added to the setup).

      -Other book notes of mine are:
      +Read the next post of this series:

      -2023-03-16 "The Pragmatic Programmer" book notes
      -2023-04-01 "Never split the difference" book notes
      -2023-05-06 "The Obstacle is the Way" book notes (You are currently reading this)
      -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      -2023-11-11 "Mind Management" book notes
      +f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
      +
      +Other *BSD-related posts:
      +
      +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
      +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation (You are currently reading this)
      +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
      +2024-04-01 KISS high-availability with OpenBSD
      +2024-01-13 One reason why I love OpenBSD
      +2022-10-30 Installing DTail on OpenBSD
      +2022-07-30 Let's Encrypt with OpenBSD and Rex
      +2016-04-09 Jails and ZFS with Puppet on FreeBSD

      E-Mail your comments to paul@nospam.buetow.org :-)

      -More books and other resources I found useful.
      Back to the main site
      - Unveiling `guprecords.raku`: Global Uptime Records with Raku - - https://foo.zone/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html - 2023-04-30T13:10:26+03:00 + f3s: Kubernetes with FreeBSD - Part 1: Setting the stage + + https://foo.zone/gemfeed/2024-11-17-f3s-kubernetes-with-freebsd-part-1.html + 2024-11-16T23:20:14+02:00 Paul Buetow aka snonux paul@dev.buetow.org - For fun, I am tracking the uptime of various personal machines (servers, laptops, workstations...). I have been doing this for over ten years now, so I have a lot of statistics collected. + This is the first blog post about my f3s series for my self-hosting demands in my home lab. f3s? The 'f' stands for FreeBSD, and the '3s' stands for k3s, the Kubernetes distribution I will use on FreeBSD-based physical machines.
      -

      Unveiling guprecords.raku: Global Uptime Records with Raku


      +

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



      -Published at 2023-04-30T13:10:26+03:00
      +Published at 2024-11-16T23:20:14+02:00

      -
      -+-----+-----------------+-----------------------------+
      -| Pos |            Host |                    Lifespan |
      -+-----+-----------------+-----------------------------+
      -|  1. |        dionysus |  8 years, 6 months, 17 days |
      -|  2. |          uranus |  7 years, 2 months, 16 days |
      -|  3. |   alphacentauri |  6 years, 9 months, 13 days |
      -|  4. |         *vulcan |   4 years, 5 months, 6 days |
      -|  5. |             sun |  3 years, 10 months, 2 days |
      -|  6. |           uugrn |   3 years, 5 months, 5 days |
      -|  7. |       deltavega |  3 years, 1 months, 21 days |
      -|  8. |           pluto | 2 years, 10 months, 30 days |
      -|  9. |         tauceti |  2 years, 3 months, 22 days |
      -| 10. |        callisto |  2 years, 3 months, 13 days |
      -+-----+-----------------+-----------------------------+
      -
      +This is the first blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution I will use on FreeBSD-based physical machines.

      -

      Introduction


      +I will post a new entry every month or so (there are too many other side projects for more frequent updates—I bet you can understand).

      -For fun, I am tracking the uptime of various personal machines (servers, laptops, workstations...). I have been doing this for over ten years now, so I have a lot of statistics collected.
      +These are all the posts so far:

      -As a result of this, I am introducing guprecords.raku, a handy Raku script that helps me combine uptime statistics from multiple servers into one comprehensive report. In this blog post, I'll explore what Guprecords is and some examples of its application. I will also add some notes on Raku.
      +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
      +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
      +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage (You are currently reading this)

      -Guprecords, or global uptime records, is a Raku script designed to generate a consolidated uptime report from multiple hosts:
      +f3s logo

      -https://codeberg.org/snonux/guprecords
      -The Raku Programming Language
      +Logo was generated by ChatGPT.

      -A previous version of Guprecords was actually written in Perl, the older and more established language from which Raku was developed. One of the primary motivations for rewriting Guprecords in Raku was to learn the language and explore its features. Raku is a more modern and powerful language compared to Perl, and working on a real-world project like Guprecords provided a practical and engaging way to learn the language.
      +Let's begin...

      -Over the last years, I have been reading the following books and resources about Raku:
      +

      Table of Contents




      -And I have been following the Raku newsletter, and sometimes I have been lurking around in the IRC channels, too. Watching Raku coding challenges on YouTube was pretty fun, too. However, nothing beats actually using Raku to learn the language. After reading all of these resources, I may have a good idea about the features and paradigms, but I am by far not an expert.
      +

      Why this setup?



      -

      How Guprecords works


      +My previous setup was great for learning Terraform and AWS, but it is too expensive. Costs are under control there, but only because I am shutting down all containers after use (so they are offline ninety percent of the time and still cost around $20 monthly). With the new setup, I could run all containers 24/7 at home, which would still be cheaper in terms of electricity consumption. I have a 50 MBit/s uplink (I could have more if I wanted, but it is plenty for my use case already).

      -Guprecords works in three stages:
      +From babylon5.buetow.org to .cloud
      +
      +Migrating off all my containers from AWS ECS means I need a reliable and scalable environment to host my workloads. I wanted something:

        -
      • 1. Generating uptime statistics using uptimed: First, I need to install and run uptimed on each host to generate uptime statistics. This tool is available for most common Linux and *BSD distributions and macOS via Homebrew.
      • -
      • 2. Collecting uptime records to a central location: The next step involves collecting the raw uptime statistics files generated by uptimed on each host. It's a good idea to store all record files in a central git repository. The records file contains information about the total uptime since boot, boot time, and the operating system and kernel version. Guprecords itself does not do the collection part, but have a look at the README.md in the git repository for some guidance.
      • -
      • 3. Generating global uptime stats: Finally, run the guprecords.raku script with the appropriate flags to create a global uptime report. For example, I can use the following command:
      • +
      • To self-host all my open-source apps (Docker containers).
      • +
      • Fully under my control (goodbye cloud vendor lock-in).
      • +
      • Secure and redundant.
      • +
      • Cost-efficient (after the initial hardware investment).
      • +
      • Something I can poke around with and also pick up new skills.

      - -
      $ raku guprecords.raku --stats=dir=$HOME/git/uprecords/stats --all
      -
      +

      The infrastructure



      -This command will generate a comprehensive uptime report from the collected statistics, making it easy to review and enjoy the data.
      +This is still in progress, and I need to own the hardware. But in this first part of the blog series, I will outline what I intend to do.

      -Guprecords supports the following features:
      +Diagram

      -
        -
      • Supports multiple categories: Host, Kernel, KernelMajor, and KernelName
      • -
      • Supports multiple metrics: Boots, Uptime, Score, Downtime, and Lifespan
      • -
      • Output formats available: Plaintext, Markdown, and Gemtext
      • -
      • Provides top entries based on the specified limit
      • -

      -

      Example


      +

      Physical FreeBSD nodes and Linux VMs



      -You have already seen an example at the very top of this post, where the hosts were grouped by their total lifespans (uptime+downtime). Here's an example of what the global uptime report (grouped by total host uptimes) might look like:
      +The setup starts with three physical FreeBSD nodes deployed into my home LAN. On these, I'm going to run Rocky Linux virtual machines with bhyve. Why Linux VMs in FreeBSD and not Linux directly? I want to leverage the great ZFS integration in FreeBSD (among other features), and I have been using FreeBSD for a while in my home lab. And with bhyve, there is a very performant hypervisor available which makes the Linux VMs de-facto run at native speed (another use case of mine would be maybe running a Windows bhyve VM on one of the nodes - but out of scope for this blog series).

      -
      -Top 20 Uptime's by Host
      -
      -+-----+-----------------+-----------------------------+
      -| Pos |            Host |                      Uptime |
      -+-----+-----------------+-----------------------------+
      -|  1. |         *vulcan |   4 years, 5 months, 6 days |
      -|  2. |          uranus | 3 years, 11 months, 21 days |
      -|  3. |             sun |  3 years, 9 months, 26 days |
      -|  4. |           uugrn |   3 years, 5 months, 5 days |
      -|  5. |       deltavega |  3 years, 1 months, 21 days |
      -|  6. |           pluto | 2 years, 10 months, 29 days |
      -|  7. |         tauceti |  2 years, 3 months, 19 days |
      -|  8. |       tauceti-f |  1 years, 9 months, 18 days |
      -|  9. | *ultramega15289 |  1 years, 8 months, 17 days |
      -| 10. |          *earth |  1 years, 5 months, 22 days |
      -| 11. |       *blowfish |  1 years, 4 months, 20 days |
      -| 12. |   ultramega8477 |  1 years, 3 months, 25 days |
      -| 13. |           host0 |   1 years, 3 months, 9 days |
      -| 14. |       tauceti-e |  1 years, 2 months, 20 days |
      -| 15. |        makemake |   1 years, 1 months, 6 days |
      -| 16. |        callisto | 0 years, 10 months, 31 days |
      -| 17. |   alphacentauri | 0 years, 10 months, 28 days |
      -| 18. |          london |  0 years, 9 months, 16 days |
      -| 19. |         twofish |  0 years, 8 months, 31 days |
      -| 20. |     *fishfinger |  0 years, 8 months, 17 days |
      -+-----+-----------------+-----------------------------+
      -
      +https://www.freebsd.org/
      +https://wiki.freebsd.org/bhyve

      -This table ranks the top 20 hosts based on their total uptime, with the host having the highest uptime at the top. The hosts marked with * are still active, means stats were collected within the last couple of months.
      +I selected Rocky Linux because it comes with long-term support (I don't want to upgrade the VMs every 6 months). Rocky Linux 9 will reach its end of life in 2032, which is plenty of time! Of course, there will be minor upgrades, but nothing will significantly break my setup.

      -My up to date stats can be seen here:
      +https://rockylinux.org/
      +https://wiki.rockylinux.org/rocky/version/

      -My machine uptime stats
      +Furthermore, I am already using "RHEL-family" related distros at work and Fedora on my main personal laptop. Rocky Linux belongs to the same type of Linux distribution family, so I already feel at home here. I also used Rocky 9 before I switched to AWS ECS. Now, I am switching back in one sense or another ;-)

      -Just recently, I decommissioned vulcan (the number one stop from above), which used to be my CentOS 7 (initially CentOS 6) VM hosting my personal NextCloud and Wallabag (which I modernised just recently with a brand new shiny Rocky Linux 9 VM). This was the last uptimed output before shutting it down (it always makes me feel sentimental decommissioning one of my machines :'-():
      +

      Kubernetes with k3s



      -
      -     #               Uptime | System                                     Boot up
      -----------------------------+---------------------------------------------------
      -     1   545 days, 17:58:15 | Linux 3.10.0-1160.15.2.e  Sun Jul 25 19:32:25 2021
      -     2   279 days, 10:12:14 | Linux 3.10.0-957.21.3.el  Sun Jun 30 12:43:41 2019
      -     3   161 days, 06:08:43 | Linux 3.10.0-1160.15.2.e  Sun Feb 14 11:05:38 2021
      -     4   107 days, 01:26:35 | Linux 3.10.0-957.1.3.el7  Thu Dec 20 09:29:13 2018
      -     5    96 days, 21:13:49 | Linux 3.10.0-1127.13.1.e  Sat Jul 25 17:56:22 2020
      -->   6    89 days, 23:05:32 | Linux 3.10.0-1160.81.1.e  Sun Jan 22 12:39:36 2023
      -     7    63 days, 18:30:45 | Linux 3.10.0-957.10.1.el  Sat Apr 27 18:12:43 2019
      -     8    63 days, 06:53:33 | Linux 3.10.0-1127.8.2.el  Sat May 23 10:41:08 2020
      -     9    48 days, 11:44:49 | Linux 3.10.0-1062.18.1.e  Sat Apr  4 22:56:07 2020
      -    10    42 days, 08:00:13 | Linux 3.10.0-1127.19.1.e  Sat Nov  7 11:47:33 2020
      -    11    36 days, 22:57:19 | Linux 3.10.0-1160.6.1.el  Sat Dec 19 19:47:57 2020
      -    12    21 days, 06:16:28 | Linux 3.10.0-957.10.1.el  Sat Apr  6 11:56:01 2019
      -    13    12 days, 20:11:53 | Linux 3.10.0-1160.11.1.e  Mon Jan 25 18:45:27 2021
      -    14     7 days, 21:29:18 | Linux 3.10.0-1127.13.1.e  Fri Oct 30 14:18:04 2020
      -    15     6 days, 20:07:18 | Linux 3.10.0-1160.15.2.e  Sun Feb  7 14:57:35 2021
      -    16     1 day , 21:46:41 | Linux 3.10.0-957.1.3.el7  Tue Dec 18 11:42:19 2018
      -    17     0 days, 01:25:57 | Linux 3.10.0-957.1.3.el7  Tue Dec 18 10:16:08 2018
      -    18     0 days, 00:42:34 | Linux 3.10.0-1160.15.2.e  Sun Jul 25 18:49:38 2021
      -    19     0 days, 00:08:32 | Linux 3.10.0-1160.81.1.e  Sun Jan 22 12:30:52 2023
      -----------------------------+---------------------------------------------------
      -1up in     6 days, 22:08:18 | at                        Sat Apr 29 10:53:25 2023
      -no1 in   455 days, 18:52:44 | at                        Sun Jul 21 07:37:51 2024
      -    up  1586 days, 00:20:28 | since                     Tue Dec 18 10:16:08 2018
      -  down     0 days, 01:08:32 | since                     Tue Dec 18 10:16:08 2018
      -   %up               99.997 | since                     Tue Dec 18 10:16:08 2018
      -
      +These Linux VMs form a three-node k3s Kubernetes cluster, where my containers will reside moving forward. The 3-node k3s cluster will be highly available (in etcd mode), and all apps will probably be deployed with Helm. Prometheus will also be running in k3s, collecting time-series metrics and handling monitoring. Additionally, a private Docker registry will be deployed into the k3s cluster, where I will store some of my self-created Docker images. k3s is the perfect distribution of Kubernetes for homelabbers due to its simplicity and the inclusion of the most useful features out of the box!

      -

      Conclusion


      +https://k3s.io/

      -Guprecords is a small, yet powerful tool for analyzing uptime statistics. While developing Guprecords, I have come to truly appreciate and love Raku's expressiveness. The language is designed to be both powerful and flexible, allowing developers to express their intentions and logic more clearly and concisely.
      +

      HA volumes for k3s with HAST/ZFS and NFS



      -Raku's expressive syntax, support for multiple programming paradigms, and unique features, such as grammars and lazy evaluation, make it a joy to work with.
      +Persistent storage for the k3s cluster will be handled by highly available (HA) NFS shares backed by ZFS on the FreeBSD hosts.

      -Working on Guprecords in Raku has been an enjoyable experience, and I've found that Raku's expressiveness has significantly contributed to the overall quality and effectiveness of the script. The language's ability to elegantly express complex logic and data manipulation tasks makes it an excellent choice for developing tools like these, where expressiveness and productiveness are of the utmost importance.
      +On two of the three physical FreeBSD nodes, I will add a second SSD drive to each and dedicate it to a zhast ZFS pool. With HAST (FreeBSD's solution for highly available storage), this pool will be replicated at the byte level to a standby node.

      -So far, I have only scratched the surface of what Raku can do. I hope to find more time to become a regular Rakoon (a Raku Programmer). I have many Ideas for other small tools like Guprecords, but the challenge is finding the time. I'd love to explore Raku Grammars and also I would love to explore writing concurrent code in Raku (I also love Go (Golang), btw!). Ideas for future Raku personal projects include:
      +A virtual IP (VIP) will point to the master node. When the master node goes down, the VIP will failover to the standby node, where the ZFS pool will be mounted. An NFS server will listen to both nodes. k3s will use the VIP to access the NFS shares.

      -
        -
      • A log file analyzer, for generating anonymized foo.zone visitor stats for both, the Web and Gemini.
      • -
      • A social media sharing scheduler a la buffer.com. I am using Buffer at the moment to share posts on Mastadon, Twitter, Telegram and LinkedIn, but it is proprietary and also it's not really reliable.
      • -
      • Rewrite the static photo album generator of irregular.ninja in Raku (from Bash).
      • -

      -Other related posts are:
      +FreeBSD Wiki: Highly Available Storage

      -2008-06-26 Perl Poetry
      -2011-05-07 Perl Daemon (Service Framework)
      -2022-05-27 Perl is still a great choice
      -2022-06-15 Sweating the small stuff - Tiny projects of mine
      -2023-05-01 Unveiling guprecords.raku: Global Uptime Records with Raku (You are currently reading this)
      +You can think of DRBD being the Linux equivalent to FreeBSD's HAST.

      -E-Mail your comments to hi@foo.zone :-)
      +

      OpenBSD/relayd to the rescue for external connectivity



      -Back to the main site
      -
      -
      -
      - - Algorithms and Data Structures in Go - Part 1 - - https://foo.zone/gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.html - 2023-04-09T22:31:42+03:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - This is the first blog post about my Algorithms and Data Structures in Go series. I am not a Software Developer in my day job. In my current role, programming and scripting skills are desirable but not mandatory. I have been learning about Data Structures and Algorithms many years ago at University. I thought it would be fun to revisit/refresh my knowledge here and implement many of the algorithms in Go. - -
      -

      Algorithms and Data Structures in Go - Part 1


      +All apps should be reachable through the internet (e.g., from my phone or computer when travelling). For external connectivity and TLS management, I've got two OpenBSD VMs (one hosted by OpenBSD Amsterdam and another hosted by Hetzner) handling public-facing services like DNS, relaying traffic, and automating Let's Encrypt certificates.

      -Published at 2023-04-09T22:31:42+03:00
      +All of this (every Linux VM to every OpenBSD box) will be connected via WireGuard tunnels, keeping everything private and secure. There will be 6 WireGuard tunnels (3 k3s nodes times two OpenBSD VMs).

      -
      -         ,_---~~~~~----._         
      -  _,,_,*^____      _____``*g*\"*, 
      - / __/ /'     ^.  /      \ ^@q   f 
      -[  @f | @))    |  | @))   l  0 _/  
      - \`/   \~____ / __ \_____/    \   
      -  |           _l__l_           I   
      -  }          [______]           I  
      -  ]            | | |            |  
      -  ]             ~ ~             |  
      -  |                            |   
      -   |                           |   
      -
      +https://en.wikipedia.org/wiki/WireGuard

      -This is the first blog post about my Algorithms and Data Structures in Go series. I am not a Software Developer in my day job. In my current role, programming and scripting skills are desirable but not mandatory. I have been learning about Data Structures and Algorithms many years ago at University. I thought it would be fun to revisit/refresh my knowledge here and implement many of the algorithms in Go.
      +So, when I want to access a service running in k3s, I will hit an external DNS endpoint (with the authoritative DNS servers being the OpenBSD boxes). The DNS will resolve to the master OpenBSD VM (see my KISS highly-available with OpenBSD blog post), and from there, the relayd process (with a Let's Encrypt certificate—see my Let's Encrypt with OpenBSD and Rex blog post) will accept the TCP connection and forward it through the WireGuard tunnel to a reachable node port of one of the k3s nodes, thus serving the traffic.

      -2023-04-09 Algorithms and Data Structures in Go - Part 1 (You are currently reading this)
      +KISS high-availability with OpenBSD
      +Let's Encrypt with OpenBSD and Rex

      -This post is about setting up some basic data structures and methods for this blog series. I promise, everything will be easy to follow in this post. It will become more interesting later in this series.
      +The OpenBSD setup described here already exists and is ready to use. The only thing that does not yet exist is the configuration of relayd to forward requests to k3s through the WireGuard tunnel(s).

      -

      Type constraints


      +

      Data integrity



      -First, the package ds (data structures) defines the types.go. All examples will either operate on the Integer or Number type:
      +

      Periodic backups



      - -
      package ds
      -
      -import (
      -	"golang.org/x/exp/constraints"
      -)
      -
      -type Integer interface {
      -	constraints.Integer
      -}
      -
      -type Number interface {
      -	constraints.Integer | constraints.Float
      -}
      -
      -
      +Let's face it, backups are non-negotiable.

      -

      ArrayList


      +On the HAST master node, incremental and encrypted ZFS snapshots are created daily and automatically backed up to AWS S3 Glacier Deep Archive via CRON. I have a bunch of scripts already available, which I currently use for a similar purpose on my FreeBSD Home NAS server (an old ThinkPad T440 with an external USB drive enclosure, which I will eventually retire when the HAST setup is ready). I will copy them and slightly modify them to fit the purpose.

      -Next comes the arraylist.go, which defines the underlying data structure all the algorithms of this series will use. ArrayList is just a type alias of a Go array (or slice) with custom methods on it:
      +There's also zfstools in the ports, which helps set up an automatic snapshot regime:

      - -
      package ds
      -
      -import (
      -	"fmt"
      -	"math/rand"
      -	"strings"
      -)
      -
      -type ArrayList[V Number] []V
      -
      -func NewArrayList[V Number](l int) ArrayList[V] {
      -	return make(ArrayList[V], l)
      -}
      -
      +https://www.freshports.org/sysutils/zfstools

      -As you can see, the code uses Go generics, which I refactored recently. Besides the default constructor (which only returns an empty ArrayList with a given capacity), there are also a bunch of special constructors. NewRandomArrayList is returning an ArrayList with random numbers, NewAscendingArrayList and NewDescendingArrayList are returning ArrayLists in either ascending or descending order. They all will be used later on for testing and benchmarking the algorithms.
      +The backup scripts also perform some zpool scrubbing now and then. A scrub once in a while keeps the trouble away.

      - -
      func NewRandomArrayList[V Number](l, max int) ArrayList[V] {
      -	a := make(ArrayList[V], l)
      -	for i := 0; i < l; i++ {
      -		if max > 0 {
      -			a[i] = V(rand.Intn(max))
      -			continue
      -		}
      -		a[i] = V(rand.Int())
      -	}
      -	return a
      -}
      -
      -func NewAscendingArrayList[V Number](l int) ArrayList[V] {
      -	a := make(ArrayList[V], l)
      -	for i := 0; i < l; i++ {
      -		a[i] = V(i)
      -	}
      -	return a
      -}
      -
      -func NewDescendingArrayList[V Number](l int) ArrayList[V] {
      -	a := make(ArrayList[V], l)
      -	j := l - 1
      -	for i := 0; i < l; i++ {
      -		a[i] = V(j)
      -		j--
      -	}
      -	return a
      -}
      -
      -
      -

      Helper methods


      -
      -The FirstN method only returns the first N elements of the ArrayList. This is useful for printing out only parts of the data structure:
      +

      Power protection



      - -
      func (a ArrayList[V]) FirstN(n int) string {
      -	var sb strings.Builder
      -	j := n
      -
      -	l := len(a)
      -	if j > l {
      -		j = l
      -	}
      -
      -	for i := 0; i < j; i++ {
      -		fmt.Fprintf(&sb, "%v ", a[i])
      -	}
      -
      -	if j < l {
      -		fmt.Fprintf(&sb, "... ")
      -	}
      -
      -	return sb.String()
      -}
      -
      +Power outages are regularly in my area, so a UPS keeps the infrastructure running during short outages and protects the hardware. I'm still trying to decide which hardware to get, and I still need one, as my previous NAS is simply an older laptop that already has a battery for power outages. However, there are plenty of options to choose from. My main criterion is that the UPS should be silent, as the whole setup will be installed in an upper shelf unit in my daughter's room. ;-)

      -The Sorted method checks whether the ArrayList is sorted. This will be used by the unit tests later on:
      +

      Monitoring: Keeping an eye on everything



      - -
      func (a ArrayList[V]) Sorted() bool {
      -	for i := len(a) - 1; i > 0; i-- {
      -		if a[i] < a[i-1] {
      -			return false
      -		}
      -	}
      -	return true
      -}
      -
      +Robust monitoring is vital to any infrastructure, especially one as distributed as mine. I've thought about a setup that ensures I'll always be aware of what's happening in my environment.

      -And the last utility method used is Swap, which allows swapping the values of two indices in the ArrayList:
      +

      Prometheus and Grafana



      - -
      func (a ArrayList[V]) Swap(i, j int) {
      -	aux := a[i]
      -	a[i] = a[j]
      -	a[j] = aux
      -}
      -
      -
      +Inside the k3s cluster, Prometheus will be deployed to handle metrics collection. It will be configured to scrape data from my Kubernetes workloads, nodes, and any services I monitor. Prometheus also integrates with Alertmanager to generate alerts based on predefined thresholds or conditions.

      -

      Sleep sort


      +https://prometheus.io

      -Let's implement our first algorithm, sleep sort. Sleep sort is a non-traditional and unconventional sorting algorithm based on the idea of waiting a certain amount of time corresponding to the value of each element in the input ArrayList. It's more of a fun, creative concept rather than an efficient or practical sorting technique. This is not a sorting algorithm you would use in any production code. As you can imagine, it is quite an inefficient sorting algorithm (it's only listed here as a warm-up exercise). This sorting method may also return false results depending on how the Goroutines are scheduled by the Go runtime.
      +For visualization, Grafana will be deployed alongside Prometheus. Grafana lets me build dynamic, customizable dashboards that provide a real-time view of everything from resource utilization to application performance. Whether it's keeping track of CPU load, memory usage, or the health of Kubernetes pods, Grafana has it covered. This will also make troubleshooting easier, as I can quickly pinpoint where issues are arising.

      +https://grafana.com

      - -
      package sort
      -
      -import (
      -	"codeberg.org/snonux/algorithms/ds"
      -	"sync"
      -	"time"
      -)
      -
      -func Sleep[V ds.Integer](a ds.ArrayList[V]) ds.ArrayList[V] {
      -	sorted := ds.NewArrayList[V](len(a))
      -
      -	numCh := make(chan V)
      -	var wg sync.WaitGroup
      -	wg.Add(len(a))
      -
      -	go func() {
      -		wg.Wait()
      -		close(numCh)
      -	}()
      -
      -	for _, num := range a {
      -		go func(num V) {
      -			defer wg.Done()
      -			time.Sleep(time.Duration(num) * time.Second)
      -			numCh <- num
      -		}(num)
      -	}
      -
      -	for num := range numCh {
      -		sorted = append(sorted, num)
      -	}
      -
      -	return sorted
      -}
      -
      +

      Gogios: My custom alerting system



      -This Go code implements the sleep sort algorithm using generics and goroutines. The main function Sleep[V ds.Integer](a ds.ArrayList[V]) ds.ArrayList[V] takes a generic ArrayList as input and returns a sorted ArrayList. The code creates a separate goroutine for each element in the input array, sleeps for a duration proportional to the element's value, and then sends the element to a channel. Another goroutine waits for all the sleeping goroutines to finish and then closes the channel. The sorted result ArrayList is constructed by appending the elements received from the channel in the order they arrive. The sync.WaitGroup is used to synchronize goroutines and ensure that all of them have completed before closing the channel.
      +Alerts generated by Prometheus are forwarded to Alertmanager, which I will configure to work with Gogios, a lightweight monitoring and alerting system I wrote myself. Gogios runs on one of my OpenBSD VMs. At regular intervals, Gogios scrapes the alerts generated in the k3s cluster and notifies me via Email.

      -

      Testing


      +KISS server monitoring with Gogios

      -For testing, we only allow values up to 10, as otherwise, it would take too long to finish:
      +Ironically, I implemented Gogios to avoid using more complex alerting systems like Prometheus, but here we go—it integrates well now.

      - -
      package sort
      -
      -import (
      -	"fmt"
      -	"testing"
      -
      -	"codeberg.org/snonux/algorithms/ds"
      -)
      -
      -func TestSleepSort(t *testing.T) {
      -	a := ds.NewRandomArrayList[int](10, 10)
      -	a = Sleep(a)
      -	if !a.Sorted() {
      -		t.Errorf("Array not sorted: %v", a)
      -	}
      -}
      -
      +

      What's after this all?



      -As you can see, it takes 9s here for the algorithm to finish (which is the highest value in the ArrayList):
      +This setup may be just the beginning. Some ideas I'm thinking about for the future:

      - -
      ❯ go test ./sort -v -run SleepSort
      -=== RUN   TestSleepSort
      ---- PASS: TestSleepSort (9.00s)
      -PASS
      -ok      codeberg.org/snonux/algorithms/sort     9.002s
      -
      +
        +
      • Adding more FreeBSD nodes (in different physical locations, maybe at my wider family's places? WireGuard would make it possible!) for better redundancy. (HA storage then might be trickier)
      • +
      • Deploying more Docker apps (data-intensive ones, like a picture gallery, my entire audiobook catalogue, or even a music server) to k3s.
      • +

      +For now, though, I'm focused on completing the migration from AWS ECS and getting all my Docker containers running smoothly in k3s.

      -I won't write any benchmark for sleep sort; that will be done for the algorithms to come in this series :-).
      +What's your take on self-hosting? Are you planning to move away from managed cloud services? Stay tuned for the second part of this series, where I will likely write about the hardware and the OS setups.
      +
      +Read the next post of this series:
      +
      +f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
      +
      +Other *BSD-related posts:
      +
      +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
      +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
      +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage (You are currently reading this)
      +2024-04-01 KISS high-availability with OpenBSD
      +2024-01-13 One reason why I love OpenBSD
      +2022-10-30 Installing DTail on OpenBSD
      +2022-07-30 Let's Encrypt with OpenBSD and Rex
      +2016-04-09 Jails and ZFS with Puppet on FreeBSD

      E-Mail your comments to paul@nospam.buetow.org :-)

      @@ -2265,22 +1941,22 @@ ok codeberg.org/snonux/algorithms/sort - 'Never split the difference' book notes - - https://foo.zone/gemfeed/2023-04-01-never-split-the-difference-book-notes.html - 2023-04-01T20:00:17+03:00 + 'Staff Engineer' book notes + + https://foo.zone/gemfeed/2024-10-24-staff-engineer-book-notes.html + 2024-10-24T20:57:44+03:00 Paul Buetow aka snonux paul@dev.buetow.org - These are my personal takeaways after reading 'Never split the difference' by Chris Voss. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too. + These are my personal takeaways after reading 'Staff Engineer' by Will Larson. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.
      -

      "Never split the difference" book notes


      +

      "Staff Engineer" book notes



      -Published at 2023-04-01T20:00:17+03:00
      +Published at 2024-10-24T20:57:44+03:00

      -These are my personal takeaways after reading "Never split the difference" by Chris Voss. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.
      +These are my personal takeaways after reading "Staff Engineer" by Will Larson. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.

                ,..........   ..........,
      @@ -2294,2703 +1970,3388 @@ ok      codeberg.org/snonux/algorithms/sort     
       
      -

      Tactical listening, spreading empathy


      -
      -Be a mirror, copy each other to be comfy with each other to build up trust. Mirroring is mainly body language. A mirror is to repeat the words the other just said. Simple but effective.
      +

      Table of Contents




      -Mirror training is like Jedi training. Simple but effective. A mirror needs space. Be silent after "you want this?"
      +

      The Four Archetypes of a Staff Engineer



      -

      Mindset of discovery


      -
      -Try to have multiple realities in your mind and use facts to distinguish between real and false.
      +Larson breaks down the role of a Staff Engineer into four main archetypes, which can help frame how you approach the role:

        -
      • Focus on what the counterpart has to say and what he needs and wants. Understanding him makes him vulnerable.
      • -
      • Empathy understanding the other person from his perspective, but it does not mean agreeing with him.
      • -
      • Detect and label the emotions of others for your powers.
      • -
      • To be understood seems to solve all problems magically.
      • +
      • Tech Lead: Focuses on the technical direction of a team, ensuring high-quality execution, architecture, and aligning the team around shared goals.
      • +
      • Solver: Gets pulled into complex, high-impact problems that often involve many teams or systems, operating as a fixer or troubleshooter.
      • +
      • Architect: Works on the long-term technical vision for an organization, setting standards and designing systems that will scale and last over time.
      • +
      • Right Hand: Functions as a trusted technical advisor to leadership, providing input on strategy, long-term decisions, and navigating organizational politics.

      -Try: to put a label on someone's emotion and then be silent. Wait for the other to reveal himself. "You seem unhappy about this?"
      +

      Influence and Impact over Authority



      -

      More tips


      +As a Staff Engineer, influence is often more important than formal authority. You’ll rarely have direct control over teams or projects but will need to drive outcomes by influencing peers, other teams, and leadership. It’s about understanding how to persuade, align, and mentor others to achieve technical outcomes.

      -
        -
      • Put on a poker face and don't show emotions.
      • -
      • Slow things down. Don't be a problem solver.
      • -
      • Smile while you are talking, even on the phone. Be easy and encouraging.
      • -
      • Being right is not the key to successful negotiation; being mindful is.
      • -
      • Be in the safe zone of empathy and acknowledge bad news.
      • -

      -

      "No" starts the conversation


      +

      Breadth and Depth of Knowledge



      -When the opponent starts with a "no", he feels in control and comfortable. That's why he has to start with "no".
      +Staff Engineers often need to maintain a breadth of knowledge across various areas while maintaining depth in a few. This can mean keeping a high-level understanding of several domains (e.g., infrastructure, security, product development) but being able to dive deep when needed in certain core areas.

      -
        -
      • "Yes" and "maybe" might be worthless, but "no" starts the conversation.
      • -
      • If someone is saying "no" to you, he will be open to what you have to say next.
      • -
      • "No" is not stopping the negotiation but will open up opportunities you were not thinking about before.
      • -
      • Start with "no". Great negotiators seek "no" because that's when the great discussions begin.
      • -
      • A "no" can be scary if you are not used to it. If your biggest fear is "no", then you can't negotiate.
      • -

      -Get a "That's right" when negotiating. Don't get a "you're right". You can summarise the opponent to get a "that's right".
      +

      Mentorship and Sponsorship



      -

      Win-win


      +An important part of a Staff Engineer’s role is mentoring others, not just in technical matters but in career development as well. Sponsorship goes a step beyond mentorship, where you actively advocate for others, create opportunities for them, and push them toward growth.

      -Win-win is a naive approach when encountering the win-lose counterpart, but always cooperate. Don't compromise, and don't split the difference. We don't compromise because it's right; we do it because it is easy. You must embrace the hard stuff; that's where the great deals are.
      +

      Managing Up and Across



      -

      On Deadlines


      +Success as a Staff Engineer often depends on managing up (influencing leadership and setting expectations) and managing across (working effectively with peers and other teams). This is often tied to communication skills, the ability to advocate for technical needs, and fostering alignment across departments or organizations.

      -
        -
      • All deadlines are imaginary.
      • -
      • Most of the time, deadlines unsettle us without a good reason.
      • -
      • They push a deal to a conclusion.
      • -
      • They rush the counterpart to cause pressure and anxiety.
      • -

      -

      Analyse the opponent


      +

      Strategic Thinking



      -
        -
      • Understand the motivation of people behind the table as well.
      • -
      • Ask how affected they will be.
      • -
      • Determine your and the opposite negotiation style. Accommodation, analyst, assertive.
      • -
      • Treat them how they need to be treated.
      • -

      -The person on the other side is never the issue; the problem is the issue. Keep this in mind to avoid emotional issues with the person and focus on the problem, not the person. The bond is essential; never create an enemy.
      +While Senior Engineers may focus on execution, Staff Engineers are expected to think strategically, making decisions that will affect the company or product months or years down the line. This means balancing short-term execution needs with long-term architectural decisions, which may require challenging short-term pressures.

      -

      Use different ways of saying "no."


      +

      Emotional Intelligence



      -I had paid my rent always in time. I had positive experiences with the building and would be sad for the landlord to lose a good tenant. I am looking for a win-win agreement between us. Pulling out the research, other neighbours offer much lower prices even if your building is a better location and services. How can I effort 200 more....
      +The higher you go in engineering roles, the more soft skills, particularly emotional intelligence (EQ), come into play. Building relationships, resolving conflicts, and understanding the broader emotional dynamics of the team and organization become key parts of your role.

      -...then put an extreme anker.
      +

      -You always have to embrace thoughtful confrontation for good negotiation and life. Don't avoid honest, clear conflict. It will give you the best deals. Compromises are mostly bad deals for both sides. Most people don't negotiate a win-win but a win-lose. Know the best and worst outcomes and what is acceptable for you.
      +Staff Engineers are often placed in situations with high ambiguity—whether in defining the problem space, coming up with a solution, or aligning stakeholders. The ability to operate effectively in these unclear areas is critical to success.

      -

      Calibrated question


      +

      Visible and Invisible Work



      -Calibrated questions. Give the opponent a sense of power. Ask open-how questions to get the opponent to solve your problem and move him in your direction. Calibrated questions are the best tools. Summarise everything, and then ask, "how I am supposed to do that?". Asking for help this way with a calibrated question is a powerful tool for joint problem solving
      +Much of the work done by Staff Engineers is invisible. Solving complex problems, creating alignment, or influencing decisions doesn’t always result in tangible code, but it can have a massive impact. Larson emphasizes that part of the role is being comfortable with this type of invisible contribution.

      -Being calm and respectful is essential. Without control of your emotions, it won't work. The counterpart will have no idea how constrained they are with your question. Avoid questions which get a yes or short answers. Use "why?".
      +

      Scaling Yourself



      -Counterparts are more involved if these are their solutions. The counterpart must answer with "that's right", not "you are right". He has to own the problem. If not, then add more why questions.
      +At the Staff Engineer level, you must scale your impact beyond direct contribution. This can involve improving documentation, developing repeatable processes, mentoring others, or automating parts of the workflow. The idea is to enable teams and individuals to be more effective, even when you’re not directly involved.
      +
      +

      Career Progression and Title Inflation


      +
      +Larson touches on how different companies have varying definitions of "Staff Engineer," and titles don’t always correlate directly with responsibility or skill. He emphasizes the importance of focusing more on the work you're doing and the impact you're having, rather than the title itself.
      +
      +These additional points reflect more of the strategic, interpersonal, and leadership aspects that go beyond the technical expertise expected at this level. The role of a Staff Engineer is often about balancing high-level strategy with technical execution, while influencing teams and projects in a sustainable, long-term way.
      +
      +

      Not a faster Senior Engineer



        -
      • Tone and body language need to align with what people are saying.
      • -
      • Deal with it via a labelled question.
      • -
      • Liers tend to talk with "them" and "their" and not with "I".
      • -
      • Also, liars tend to talk in complex sentences.
      • +
      • A Staff engineer is more than just a faster Senior.
      • +
      • A staff engineer is not a senior engineer but a bit better.

      -Prepare 3 to 5 calibrated questions for your counterpart. Be curious what is really motivating the other side. You can get out the "Black Swan".
      +It's important to know what work or which role most energizes you. A Staff engineer is not a more senior engineer. A Staff engineer also fits into another archetype.

      -

      The black swan


      +As a staff engineer, you are always expected to go beyond your comfort zone and learn new things.

      -What we don't know can break our deal. Uncovering it can bring us unexpected success. You get what you ask for in this world, but you must learn to ask correctly. Reveal the black swan by asking questions.
      +Your job sometimes will feel like an SEM and sometimes strangely similar to your senior roles.

      -

      More


      +A Staff engineer is, like a Manager, a leader. However, being a Manager is a specific job. Leaders can apply to any job, especially to Staff engineers.

      -Establish a range at top places like corp. I get... (e.g. remote London on a project basis). Set a high salary range and not a number. Also, check on LinkedIn premium for the salaries.
      +

      The Balance


      +
      +The more senior you become, the more responsibility you will have to cope with them in less time. Balance your speed of progress with your personal life, don't work late hours and don't skip these personal care events.
      +
      +Do fewer things but do them better. Everything done will accelerate the organization. Everything else will drag it down—quality over quantity.
      +
      +Don't work at ten things and progress slowly; focus on one thing and finish it.
      +
      +Only spend some of the time firefighting. Have time for deep thinking. Only deep think some of the time. Otherwise, you lose touch with reality.
      +
      +Sebactical: Take at least six months. Otherwise, it won't be as restored.
      +
      +

      More things



        -
      • Give an unexpected gift, e.g. show them my pet project and publicity for engineering.
      • -
      • Use an odd number, which makes you seem to have thought a lot about the sum and calculated it.
      • -
      • Define success and metrics for your next raise.
      • -
      • What does it take to be successful here? Ask the question, and they will tell you and guide you.
      • -
      • Set an extreme anker. Make the counterpart the illusion of losing something.
      • -
      • Hope-based deals. Hope is not a strategy.
      • -
      • Tactical empathy, listening as a martial art. It is emotional intelligence on steroids.
      • -
      • Being right isn't the key to a successful negotiation, but having the correct mindset is.
      • -
      • Don't shop the groceries when you are hungry.
      • +
      • Provide simple but widely used tools. Complex and powerful tools will have power users but only a very few. All others will not use the tool.
      • +
      • In meetings, when someone is inactive, try to pull him in. Pull in max one person at a time. Don't open the discussion to multiple people.
      • +
      • Get used to writing things down and repeating yourself. You will scale yourself much more.
      • +
      • Title inflation: skills correspond to work, but the titles don't.

      -Slow.... it.... down....
      +E-Mail your comments to paul@nospam.buetow.org :-)

      Other book notes of mine are:

      -2023-03-16 "The Pragmatic Programmer" book notes
      -2023-04-01 "Never split the difference" book notes (You are currently reading this)
      -2023-05-06 "The Obstacle is the Way" book notes
      -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      +2024-10-24 "Staff Engineer" book notes (You are currently reading this)
      +2024-07-07 "The Stoic Challenge" book notes
      +2024-05-01 "Slow Productivity" book notes
      2023-11-11 "Mind Management" book notes
      -
      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      +2023-05-06 "The Obstacle is the Way" book notes
      +2023-04-01 "Never split the difference" book notes
      +2023-03-16 "The Pragmatic Programmer" book notes

      Back to the main site
      - Gemtexter 2.0.0 - Let's Gemtext again² - - https://foo.zone/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html - 2023-03-25T17:50:32+02:00 + Gemtexter 3.0.0 - Let's Gemtext again⁴ + + https://foo.zone/gemfeed/2024-10-02-gemtexter-3.0.0-lets-gemtext-again-4.html + 2024-10-01T21:46:26+03:00 Paul Buetow aka snonux paul@dev.buetow.org - I proudly announce that I've released Gemtexter version `2.0.0`. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash. + I proudly announce that I've released Gemtexter version `3.0.0`. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash.
      -

      Gemtexter 2.0.0 - Let's Gemtext again²


      +

      Gemtexter 3.0.0 - Let's Gemtext again⁴



      -Published at 2023-03-25T17:50:32+02:00
      -
      -
      --=[ typewriters ]=-  1/98
      -
      -       .-------.
      -      _|~~ ~~  |_       .-------.
      -    =(_|_______|_)=    _|~~ ~~  |_
      -      |:::::::::|    =(_|_______|_)
      -      |:::::::[]|      |:::::::::|
      -      |o=======.|      |:::::::[]|
      - jgs  `"""""""""`      |o=======.|
      -  mod. by Paul Buetow  `"""""""""`
      -
      +Published at 2024-10-01T21:46:26+03:00

      -I proudly announce that I've released Gemtexter version 2.0.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.
      +I proudly announce that I've released Gemtexter version 3.0.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash.

      https://codeberg.org/snonux/gemtexter

      -This is a new major release, so it contains a breaking change (see "Meta cache made obsolete").
      -
      -Let's list what's new!
      -
      -

      Minimal template engine


      -
      -Gemtexter now supports templating, enabling dynamically generated content to .gmi files before converting anything to any output format like HTML and Markdown.
      -
      -A template file name must have the suffix gmi.tpl. A template must be put into the same directory as the Gemtext .gmi file to be generated. Gemtexter will generate a Gemtext file index.gmi from a given template index.gmi.tpl. A <<< and >>> encloses a multiline template. All lines starting with << will be evaluated as a single line of Bash code and the output will be written into the resulting Gemtext file.
      -
      -For example, the template index.gmi.tpl:
      -
      -# Hello world
      -
      -<< echo "> This site was generated at $(date --iso-8601=seconds) by \`Gemtexter\`"
      -
      -Welcome to this capsule!
      -
      -<<<
      -  for i in {1..10}; do
      -    echo Multiline template line $i
      -  done
      ->>>
      +-=[ typewriters ]=-  1/98
      +                                      .-------.
      +       .-------.                     _|~~ ~~  |_
      +      _|~~ ~~  |_       .-------.  =(_|_______|_)
      +    =(_|_______|_)=    _|~~ ~~  |_   |:::::::::|    .-------.
      +      |:::::::::|    =(_|_______|_)  |:::::::[]|   _|~~ ~~  |_
      +      |:::::::[]|      |:::::::::|   |o=======.| =(_|_______|_)
      +      |o=======.|      |:::::::[]|   `"""""""""`   |:::::::::|
      + jgs  `"""""""""`      |o=======.|                 |:::::::[]|
      +  mod. by Paul Buetow  `"""""""""`                 |o=======.|
      +                                                   `"""""""""`
       

      -... results into the following index.gmi after running ./gemtexter --generate (or ./gemtexter --template, which instructs to do only template processing and nothing else):
      +

      Table of Contents



      -
      -# Hello world
      -
      -> This site was generated at 2023-03-15T19:07:59+02:00 by `Gemtexter`
      -
      -Welcome to this capsule!
      -
      -Multiline template line 1
      -Multiline template line 2
      -Multiline template line 3
      -Multiline template line 4
      -Multiline template line 5
      -Multiline template line 6
      -Multiline template line 7
      -Multiline template line 8
      -Multiline template line 9
      -Multiline template line 10
      -
      +
      +

      Why Bash?



      -Another thing you can do is insert an index with links to similar blog posts. E.g.:
      +This project is too complex for a Bash script. Writing it in Bash was to try out how maintainable a "larger" Bash script could be. It's still pretty maintainable and helps me try new Bash tricks here and then!

      -
      -See more entries about DTail and Golang:
      -
      -<< template::inline::index dtail golang
      -
      -Blablabla...
      -
      +Let's list what's new!

      -... scans all other post entries with dtail and golang in the file name and generates a link list like this:
      +

      HTML exact variant is the only variant



      -
      -See more entries about DTail and Golang:
      -
      -=> ./2022-10-30-installing-dtail-on-openbsd.html 2022-10-30 Installing DTail on OpenBSD
      -=> ./2022-04-22-programming-golang.html 2022-04-22 The Golang Programming language
      -=> ./2022-03-06-the-release-of-dtail-4.0.0.html 2022-03-06 The release of DTail 4.0.0
      -=> ./2021-04-22-dtail-the-distributed-log-tail-program.html 2021-04-22 DTail - The distributed log tail program (You are currently reading this)
      -
      -Blablabla...
      -
      +The last version of Gemtexter introduced the HTML exact variant, which wasn't enabled by default. This version of Gemtexter removes the previous (inexact) variant and makes the exact variant the default. This is a breaking change, which is why there is a major version bump of Gemtexter. Here is a reminder of what the exact variant was:

      -

      Added hooks


      +Gemtexter is there to convert your Gemini Capsule into other formats, such as HTML and Markdown. An HTML exact variant can now be enabled in the gemtexter.conf by adding the line declare -rx HTML_VARIANT=exact. The HTML/CSS output changed to reflect a more exact Gemtext appearance and to respect the same spacing as you would see in the Geminispace.

      -You can configure PRE_GENERATE_HOOK and POST_PUBLISH_HOOK to point to scripts to be executed before running --generate, or after running --publish. E.g. you could populate some of the content by an external script before letting Gemtexter do its thing or you could automatically deploy the site after running --publish.
      +

      Table of Contents auto-generation



      -The sample config file gemtexter.conf includes this as an example now; these scripts will only be executed when they actually exist:
      +Just add...

      - -
      declare -xr PRE_GENERATE_HOOK=./pre_generate_hook.sh
      -declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh
      +
      + << template::inline::toc
       

      -

      Use of safer Bash options


      -
      -Gemtexter now does set -euf -o pipefile, which helps to eliminate bugs and to catch scripting errors sooner. Previous versions only set -e.
      +...into a Gemtexter template file and Gemtexter will automatically generate a table of contents for the page based on the headings (see this page's ToC for example). The ToC will also have links to the relevant sections in HTML and Markdown output. The Gemtext format does not support links, so the ToC will simply be displayed as a bullet list.

      -

      Meta cache made obsolete


      +

      Configurable themes



      -Here is the breaking change to older versions of Gemtexter. The $BASE_CONTENT_DIR/meta directory was made obsolete. meta was used to store various information about all the blog post entries to make generating an Atom feed in Bash easier. Especially the publishing dates of each post were stored there. Instead, the publishing date is now encoded in the .gmi file. And if it is missing, Gemtexter will set it to the current date and time at first run.
      +It was always possible to customize the style of a Gemtexter's resulting HTML page, but all the config options were scattered across multiple files. Now, the CSS style, web fonts, etc., are all configurable via themes.

      -An example blog post without any publishing date looks like this:
      +Simply configure HTML_THEME_DIR in the gemtexter.conf file to the corresponding directory. For example:

      -
      % cat gemfeed/2023-02-26-title-here.gmi
      -# Title here
      -
      -The remaining content of the Gemtext file...
      +
      declare -xr HTML_THEME_DIR=./extras/html/themes/simple
       

      -Gemtexter will add a line starting with > Published at ... now. Any subsequent Atom feed generation will then use that date.
      -
      - -
      % cat gemfeed/2023-02-26-title-here.gmi
      -# Title here
      -
      -> Published at 2023-02-26T21:43:51+01:00
      -
      -The remaining content of the Gemtext file...
      -
      +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.

      -

      XMLLint support


      +

      No use of webfonts by default



      -Optionally, when the xmllint binary is installed, Gemtexter will perform a simple XML lint check against the Atom feed generated. This is a double-check of whether the Atom feed is a valid XML.
      +The default theme is now "back to the basics" and does not utilize any web fonts. The previous themes are still part of the release and can be easily configured. These are currently the future and business themes. You can check them out from the themes directory.

      -

      More


      +

      More



      Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.

      +E-Mail your comments to paul@nospam.buetow.org :-)
      +
      Other related posts are:

      -2021-04-24 Welcome to the Geminispace
      -2021-06-05 Gemtexter - One Bash script to rule it all
      -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
      -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again² (You are currently reading this)
      +2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴ (You are currently reading this)
      2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
      -
      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
      +2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
      +2021-06-05 Gemtexter - One Bash script to rule it all
      +2021-04-24 Welcome to the Geminispace

      Back to the main site
      - 'The Pragmatic Programmer' book notes - - https://foo.zone/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html - 2023-03-16T00:55:20+02:00 + Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers + + https://foo.zone/gemfeed/2024-09-07-site-reliability-engineering-part-4.html + 2024-09-07T16:27:58+03:00 Paul Buetow aka snonux paul@dev.buetow.org - These are my personal takeaways after reading 'The Pragmatic Programmer' by David Thomas and Andrew Hunt. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too. + Welcome to Part 4 of my Site Reliability Engineering (SRE) series. I'm currently working as a Site Reliability Engineer, and I’m here to share what SRE is all about in this blog series.
      -

      "The Pragmatic Programmer" book notes


      +

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



      -Published at 2023-03-16T00:55:20+02:00
      +Published at 2024-09-07T16:27:58+03:00

      -These are my personal takeaways after reading "The Pragmatic Programmer" by David Thomas and Andrew Hunt. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.
      +Welcome to Part 4 of my Site Reliability Engineering (SRE) series. I'm currently working as a Site Reliability Engineer, and I’m here to share what SRE is all about in this blog series.
      +
      +2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
      +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance
      +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture
      +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers (You are currently reading this)

      -         ,..........   ..........,
      -     ,..,'          '.'          ',..,
      -    ,' ,'            :            ', ',
      -   ,' ,'             :             ', ',
      -  ,' ,'              :              ', ',
      - ,' ,'............., : ,.............', ',
      -,'  '............   '.'   ............'  ',
      - '''''''''''''''''';''';''''''''''''''''''
      -                    '''
      +       __..._   _...__
      +  _..-"      `Y`      "-._
      +  \ Once upon |           /
      +  \\  a time..|          //
      +  \\\         |         ///
      +   \\\ _..---.|.---.._ ///
      +jgs \\`_..---.Y.---.._`//	
       

      -Think about your work while doing it - every day on every project. Have a feeling of continuous improvement.
      -
      -
        -
      • Be a realist.
      • -
      • Smell challenges.
      • -
      • Care about your craft.
      • -
      • Code can always be flawed, but it can meet the requirements.
      • -
      • You should be proud of your code, though.
      • -

      -No one writes perfect code, including you. However:
      -
      -
        -
      • Paranoia is good thinking.
      • -
      • Practice defensive programming and crash early.
      • -
      • Crashing is often the best thing you can do.
      • -
      • Changes should be reversible.
      • -

      -Erlang: Defensive programming is a waste of time. Let it crash. "This can never happen" - don't practise that kind of self-deception when programming.
      +This time, I want to share some tips on how to onboard software engineers, QA engineers, and Site Reliability Engineers (SREs) to the primary on-call rotation. Traditionally, onboarding might take half a year (depending on the complexity of the infrastructure), but with a bit of strategy and structured sessions, we've managed to reduce it to just six weeks per person. Let's dive in!

      -Leave assertions in the code, even in production. Only leave out the assertions causing the performance issues.
      +

      Setting the Scene: Tier-1 On-Call Rotation



      -Take small steps, always. Get feedback, too, for each of the steps the code does. Avoid fortune telling. If you have to involve in it, then the step is too large.
      +First things first, let's talk about Tier-1. This is where the magic begins. Tier-1 covers over 80% of the common on-call cases and is the perfect breeding ground for new on-call engineers to get their feet wet. It's designed to be manageable training ground.

      -Decouple the code (e.g. OOP or functional programming). Prefer interfaces for types and mixins for a class extension over class inheritance.
      +

      Why Tier-1?



        -
      • Refactor now and not later.
      • -
      • Later, it will be even more painful.
      • +
      • Easy to Understand: Every on-call engineer should be familiar with Tier-1 tasks.
      • +
      • Training Ground: This is where engineers start their on-call career. It's purposefully kept simple so that it's not overwhelming right off the bat.
      • +
      • Runbook/recipe driven: Every alert is attached to a comprehensive runbook, making it easy for every engineer to follow.

      -Don't think outside the box. Find the box. The box is more extensive than you think. Think about the hard problem at hand. Do you have to do it a certain way, or do you have to do it at all?
      +

      Onboarding Process: From 6 Months to 6 Weeks



      -Do what works and not what's fashionable. E.g. does SCRUM make sense? The goal is to deliver deliverables and not to "become" agile.
      +So how did we cut down the onboarding time so drastically? Here’s the breakdown of our process:

      -

      Continuous learning


      +Knowledge Transfer (KT) Sessions: We kicked things off with more than 10 KT sessions, complete with video recordings. These sessions are comprehensive and cover everything from the basics to some more advanced topics. The recorded sessions mean that new engineers can revisit them anytime they need a refresher.

      -Add new tools to your repertoire every day and keep the momentum up. Learning new things is your most crucial aspect. Invest regularly in your knowledge portfolio. The learning process extends your thinking. It does not matter if you will never use it.
      +Shadowing Sessions: Each new engineer undergoes two on-call week shadowing sessions. This hands-on experience is invaluable. They get to see real-time incident handling and resolution, gaining practical knowledge that's hard to get from just reading docs.

      -
        -
      • Learn a new programming language every year.
      • -
      • Read a technical book every month.
      • -
      • Take courses.
      • -

      -Think critically about everything you learn. Use paper for your notes. There is something special about it.
      +Comprehensive Runbooks: We created 64 runbooks (by the time writing this probably more than 100) that are composable like Lego bricks. Each runbook covers a specific scenario and guides the engineer step-by-step to resolution. Pairing these with monitoring alerts linked directly to Confluence docs, and from there to the respective runbooks, ensures every alert can be navigated with ease (well, there are always exceptions to the rule...).

      -

      Stay connected


      +Self-Sufficiency & Confidence Building: With all these resources at their fingertips, our on-call engineers become self-sufficient for most of the common issues they'll face (new starters can now handle around 80% of the most common issue after 6 weeks they had joined the company). This boosts their confidence and ensures they can handle Tier-1 incidents independently.

      -It's your life, and you own it. Bruce Lee once said:
      +Documentation and Feedback Loop: Continuous improvement is key. We regularly update our documentation based on feedback from the engineers. This makes our process even more robust and user-friendly.

      -"I am not on the world to life after your expectations, neither are you to life after mine."
      +

      It's All About the Tiers


      +
      +Let’s briefly touch on the Tier levels:

        -
      • Go to meet-ups and actively engage.
      • -
      • Stay current.
      • -
      • Dealing with computers is hard. Dealing with people is harder.
      • +
      • Tier 1: Easy and foundational tasks. Perfect for getting new engineers started. This covers around 80% of all on-call cases we face. This is what we trained on.
      • +
      • Tier 2: Slightly more complex, requiring more background knowledge. We trained on some of the topics but not all.
      • +
      • Tier 3: Requires a good understanding of the platform/architecture. Likely needs KT sessions with domain experts.
      • +
      • Tier DE (Domain Expert): The heavy hitters. Domain experts are required for these tasks.

      -It's your life. Share it, celebrate it, be proud and have fun.
      +

      Growing into Higher Tiers



      -

      The story of stone soup


      -
      -How to motivate others to contribute something (e.g. ideas to a startup):
      +From Tier-1, engineers naturally grow into Tier-2 and beyond. The structured training and gradual increase in complexity help ensure a smooth transition as they gain experience and confidence. The key here is that engineers stay curous and engaged in the on-call, so that they always keep learning.

      -A kindly, old stranger was walking through the land when he came upon a village. As he entered, the villagers moved towards their homes, locking doors and windows. The stranger smiled and asked, why are you all so frightened. I am a simple traveler, looking for a soft place to stay for the night and a warm place for a meal. "There's not a bite to eat in the whole province," he was told. "We are weak and our children are starving. Better keep moving on." "Oh, I have everything I need," he said. "In fact, I was thinking of making some stone soup to share with all of you." He pulled an iron cauldron from his cloak, filled it with water, and began to build a fire under it. Then, with great ceremony, he drew an ordinary-looking stone from a silken bag and dropped it into the water. By now, hearing the rumor of food, most of the villagers had come out of their homes or watched from their windows. As the stranger sniffed the "broth" and licked his lips in anticipation, hunger began to overcome their fear. "Ahh," the stranger said to himself rather loudly, "I do like a tasty stone soup. Of course, stone soup with cabbage -- that's hard to beat." Soon a villager approached hesitantly, holding a small cabbage he'd retrieved from its hiding place, and added it to the pot. "Wonderful!!" cried the stranger. "You know, I once had stone soup with cabbage and a bit of salt beef as well, and it was fit for a king." The village butcher managed to find some salt beef . . . And so it went, through potatoes, onions, carrots, mushrooms, and so on, until there was indeed a delicious meal for everyone in the village to share. The village elder offered the stranger a great deal of money for the magic stone, but he refused to sell it and traveled on the next day. As he left, the stranger came upon a group of village children standing near the road. He gave the silken bag containing the stone to the youngest child, whispering to a group, "It was not the stone, but the villagers that had performed the magic."
      +

      Keeping Runbooks Up to Date



      -By working together, everyone contributes what they can, achieving a greater good together.
      +It is important that runbooks are not a "project to be finished"; runbooks have to be maintained and updated over time. Sections may change, new runbooks need to be added, and old ones can be deleted. So the acceptance criteria of an on-call shift would not just be reacting to alerts and incidents, but also reviewing and updating the current runbooks.

      -Other book notes of mine are:
      +

      Conclusion



      -2023-03-16 "The Pragmatic Programmer" book notes (You are currently reading this)
      -2023-04-01 "Never split the difference" book notes
      -2023-05-06 "The Obstacle is the Way" book notes
      -2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      -2023-11-11 "Mind Management" book notes
      +By structuring the onboarding process with KT sessions, shadowing, comprehensive runbooks, and a feedback loop, we've been able to fast-track the process from six months to just six weeks. This not only prepares our engineers for the on-call rotation quicker but also ensures they're confident and capable when handling incidents.

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +If you're looking to optimize your on-call onboarding process, these strategies could be your ticket to a more efficient and effective transition. Happy on-calling!

      -More books and other resources I found useful.
      Back to the main site
      - How to shut down after work - - https://foo.zone/gemfeed/2023-02-26-how-to-shut-down-after-work.html - 2023-02-26T23:48:01+02:00 + Projects I financially support + + https://foo.zone/gemfeed/2024-09-07-projects-i-support.html + 2024-09-07T16:04:19+03:00 Paul Buetow aka snonux paul@dev.buetow.org - Do you need help fully discharging from work in the evenings or for the weekend? Shutting down from work won't just improve your work-life balance; it will also significantly improve the quality of your personal life and work. After a restful weekend, you will be much more energized and productive the next working day. So it should not just be in your own, but also your employers' interest that you fully relax and shut down after work. + This is the list of projects and initiatives I support/sponsor.
      -

      How to shut down after work


      +

      Projects I financially support



      -Published at 2023-02-26T23:48:01+02:00
      +Published at 2024-09-07T16:04:19+03:00
      +
      +This is the list of projects and initiatives I support/sponsor.

      -    |\   "Music should be heard not only with the ears, but also the soul."
      -|---|--\-----------------------|-----------------------------------------|  
      -|   |   |\                     |                   |@     |\             |
      -|---|---|--\-------------------|-------------/|----|------|--\----|------|     
      -|  @|   |   |\          |O     |        3  /  |    |@     |       |      | 
      -|---|--@|---|--\--------|------|---------/----|----|------|-------|------|      
      -|  @|      @|    \      |O     |       / |    |    |@    @|      @|.     | 
      -|-----------|-----|-----|------|-----/---|---@|----|--------------|------|     
      -|          @|     |     |O     |    |    |         |             @|.     | 
      -|-----------|----@|-----|------|----|---@|------------------------|------|  
      -           @|           |           |        Larry Komro         @|.     
      -                                  -@-        [kom...@uwec.edu]
      +||====================================================================||
      +||//$\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\//$\\||
      +||(100)==================| FEDERAL SPONSOR NOTE |================(100)||
      +||\\$//        ~         '------========--------'                \\$//||
      +||<< /        /$\              // ____ \\                         \ >>||
      +||>>|  12    //L\\            // ///..) \\         L38036133B   12 |<<||
      +||<<|        \\ //           || <||  >\  ||                        |>>||
      +||>>|         \$/            ||  $$ --/  ||        One Hundred     |<<||
      +||<<|      L38036133B        *\\  |\_/  //* series                 |>>||
      +||>>|  12                     *\\/___\_//*   1989                  |<<||
      +||<<\      Open Source   ______/Franklin\________     Supporting   />>||
      +||//$\                 ~| SPONSORING AND FUNDING |~               /$\\||
      +||(100)===================  AWESOME OPEN SOURCE =================(100)||
      +||\\$//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\$//||
      +||====================================================================||
      + 
       

      -Do you need help fully discharging from work in the evenings or for the weekend? Shutting down from work won't just improve your work-life balance; it will also significantly improve the quality of your personal life and work. After a restful weekend, you will be much more energized and productive the next working day. So it should not just be in your own, but also your employers' interest that you fully relax and shut down after work.
      +

      Table of Contents



      -

      Have a shutdown routine


      +
      +

      Motivation



      -Have a routine. Try to finish work around the same time every day. Write any outstanding tasks down for the next day, so you are sure you will remember them. Writing them down brings wonders as you can remove them from your mind for the remainder of the day (or the upcoming weekend) as you know you will surely pick them up the next working day. Tidying up your workplace could also count toward your daily shutdown routine.
      +Sponsoring free and open-source projects, even for personal use, is important to ensure the sustainability, security, and continuous improvement of the software. It supports developers who often maintain these projects without compensation, helping them provide updates, new features, and security patches. By contributing, you recognize their efforts, foster a culture of innovation, and benefit from perks like early access or support, all while ensuring the long-term viability of the tools you rely on.

      -A commute home from the office also greatly helps, as it disconnects your work from your personal life. Don't work on your commute home, though! If you don't commute but work from home, then it helps to walk around the block or in a nearby park to disconnect from work.
      +Albeit I am not putting a lot of money into my sponsoring efforts, it still helps the open-source maintainers because the more little sponsors there are, the higher the total sum.

      -

      Don't work when you officially don't work


      +

      OSnews



      -Unless you are self-employed, you have likely signed an N-hour per week contract with your employer, and your regular working times are from X o'clock in the morning to Y o'clock in the evening (with M minutes lunch break in the middle). And there might be some flexibility in your working times, too. But that kind of flexibility (e.g. extending the lunch break so that there is time to pick up a family member from the airport) will be agreed upon, and you will counteract it, for example, by starting working earlier the next day or working late, that one exception. But overall, your weekly working time will stay N hours.
      +I am a silver Patreon member of OSnews. I have been following this site since my student years. It's always been a great source of independent and slightly alternative IT news.

      -Another exception would be when you are on an on-call schedule and are expected to watch your work notifications out-of-office times. But that is usually only a few days per month and, therefore, not the norm. And it should also be compensated accordingly.
      +https://osnews.com

      -There might be some maintenance work you must carry out, which can only be done over the weekend, but it should be explicitly agreed upon and compensated for. Also, there might be a scenario that a production incident comes up shortly before the end of the work day, requiring you (and your colleagues) to stay a bit longer. But this should be an exceptional case.
      +

      Cup o' Go Podcast



      -Other than that, there is no reason why you should work out-of-office hours. I know many people who suffer "the fear of missing out", so slack messages and E-Mails are checked until late in the evening, during weekends or holidays. I have been improving here personally a lot over the last couple of months, but still, I fall into this trap occasionally.
      +I am a Patreon of the Cup o' Go Podcast. The podcast helps me stay updated with the Go community for around 15 minutes per week. I am not a full-time software developer, but my long-term ambition is to become better in Go every week by working on personal projects and tools for work.

      -Also, when you respond to slack messages and E-Mails, your colleagues can think that you have nothing better to do. They also will take it for granted and keep slacking and messaging you out of regular office times.
      +https://cupogo.dev

      -Checking for your messages constantly outside of regular office times makes it impossible to shut down and relax from work altogether.
      +

      Codeberg



      -

      Distract your mind


      +Codeberg e.V. is a nonprofit organization that provides online resources for software development and collaboration. I am a user and a supporting member, paying an annual membership of €24. I didn't have to pay that membership fee, as Codeberg offers all the services I use for free.

      -Often, your mind goes back to work-related stuff even after work. That's normal as you concentrated highly on your work throughout the day. The brain unconsciously continues to work and will automatically present you with random work-related thoughts. You can counteract this by focusing on non-work stuff, which may include:
      +https://codeberg.org
      +https://codeberg.org/snonux - My Codeberg page

      -
        -
      • Exercise. A half an hour workout or yoga session, followed by some stretching, helps to calm your mind after work.
      • -
      • Play (with your family, pets, friends, or video game)
      • -
      • Mindfully listen to music. When have you ever "really" listened to music? I mean, not just as a background stimulation but really paid attention to the melody, rhythm, voice and lyrics? That requires focused attention and distracts you from other thoughts.
      • -
      • Think of or work on that fun passion project. I currently, for example, like to learn and code a bit in Rakulang.
      • -
      • Read. Nothing beats reading a good Science Fiction Novel (or whatever you prefer) before falling asleep.
      • -

      -Some of these can be habit-stacked: Exercise could be combined with watching videos about your passion project (e.g. watching lectures about that new programming language you are currently learning for fun). With walking, for example, you could combine listening to an Audiobook or music, or you could also think about your passion project during that walk.
      +

      GrapheneOS



      -

      Get a pet


      +GrapheneOS is an open-source project that improves Android's privacy and security with sandboxing, exploit mitigations, and a permission model. It does not include Google apps or services but offers a sandboxed Google Play compatibility layer and its own apps and services.

      -Even if you have children, it helps wonders to get a pet. My cat, for example, will remind me a few times daily to take a few minute's breaks to pet, play or give food. So my cat not only helps me after work but throughout the day.
      +I've made a one-off €100 donation because I really like this, and I run GrapheneOS on my personal Phone as my main daily driver.

      -My neighbour also works from home, and he has dogs, which he regularly has to take out to the park.
      +https://grapheneos.org/
      +Why GrapheneOS Rox

      -

      Journal your day


      +

      AnkiDroid



      -If you are upset about something, making it impossible to shut down from work, write down everything (e.g., with a pen in a paper journal). Writing things down helps you to "get rid" of the negative. Especially after conflicts with colleagues or company decisions, you don't agree on. This kind of self-therapy is excellent. Brainstorm all your emotions and (even if opinionated) opinions so you have everything on paper. Once done, you don't think about it so much anymore, as you know you can access that information if required. But stopping ruminating about it will be much easier now. You will likely never access that information again, though. But at least writing the thoughts down saved your day.
      +AnkiDroid is an app that lets you learn flashcards efficiently with spaced repetition. It is compatible with Anki software and supports various flashcard content, syncing, statistics, and more.

      -Write down three things which went well for the day. This helps you to appreciate the day.
      +I've been learning vocabulary with this free app, and it is, in my opinion, the best flashcard app I know. I've made a 20$ one-off donation to this project.

      -

      Don't stress about what your employer expects from you


      +https://opencollective.com/ankidroid

      -Think about what's fun and motivates you. Maybe the next promotion to Principal or a Manager role isn't for you. Many fall into the trap of stressing themselves out to satisfy the employer so that the next upgrade will happen and think about it constantly, even after work. But it is more important that you enjoy your craftsmanship. Work on what you expect from yourself. Ideally, your goals should be aligned with your employer. I am not saying you should abandon everything what your manager is asking you to do, but it is, after all, your life. And you have to decide where and on what you want to work. But don't sell yourself short. Keep track of your accomplishments.
      +

      OpenBSD through OpenBSD.Amsterdam



      -

      Call it a day


      + The OpenBSD project produces a FREE, multi-platform 4.4BSD-based UNIX-like operating system. Our efforts emphasize portability, standardization, correctness, proactive security and integrated cryptography. As an example of the effect OpenBSD has, the popular OpenSSH software comes from OpenBSD. OpenBSD is freely available from their download sites.

      -Every day you gave your best was good; the day's outcome doesn't matter. What matters is that you know you gave your best and are closer to your goals than the previous day. This gives you a sense of progress and accomplishment.
      +I implicitly support the OpenBSD project through a VM I have rented at OpenBSD Amsterdam. They donate €10 per VM and €15 per VM for every renewal to the OpenBSD Foundation, with dedicated servers running vmm(4)/vmd(8) to host opinionated VMs.

      -There are some days at work you feel drained afterwards and think you didn't progress towards your goals at all. It's more challenging to shut down from work after such a day. A quick hack is to work on a quick win before the end of the day, giving you a sense of accomplishment after all. Another way is to make progress on your fun passion project after work. It must not be work-related, but a sense of accomplishment will still be there.
      -
      -E-Mail your comments to paul@nospam.buetow.org :-)
      +https://www.OpenBSD.org
      +https://OpenBSD.Amsterdam
      +
      +

      ProtonMail


      +
      +I am not directly funding this project, but I am a very happy paying customer, and I am listing it here as an alternative to big tech if you don't want to run your own mail infrastructure. I am listing ProtonMail here as it is a non-profit organization, and I want to emphasize the importance of considering alternatives to big tech.
      +
      +https://proton.me/
      +
      +

      Libro.fm


      +
      +This is the alternative to Audible if you are into audiobooks (like I am). For every book or every month of membership, I am also supporting a local bookstore I selected. Their catalog is not as large as Audible's, but it's still pretty decent.
      +
      +Libro.fm began as a conversation among friends at Third Place Books, a local bookstore in Seattle, Washington, about the growing popularity of audiobooks and the lack of a way for readers to purchase them from independent bookstores. Flash forward, and Libro.fm was founded in 2014.
      +
      +https://libro.fm
      +
      +E-mail your comments to paul@nospam.buetow.org :-)

      Back to the main site
      - Why GrapheneOS rox - - https://foo.zone/gemfeed/2023-01-23-why-grapheneos-rox.html - 2023-01-23T15:31:52+02:00 + Typing `127.1` words per minute (`>100wpm average`) + + https://foo.zone/gemfeed/2024-08-05-typing-127.1-words-per-minute.html + 2024-08-05T17:39:30+03:00 Paul Buetow aka snonux paul@dev.buetow.org - Art by Joan Stark + After work one day, I noticed some discomfort in my right wrist. Upon research, it appeared to be a mild case of Repetitive Strain Injury (RSI). Initially, I thought that this would go away after a while, but after a week it became even worse. This led me to consider potential causes such as poor posture or keyboard use habits. As an enthusiast of keyboards, I experimented with ergonomic concave ortholinear split keyboards. Wait, what?...
      -

      Why GrapheneOS rox


      +

      Typing 127.1 words per minute (>100wpm average)



      -Published at 2023-01-23T15:31:52+02:00
      +Published at 2024-08-05T17:39:30+03:00

      -Art by Joan Stark
      -               _.===========================._
      -            .'`  .-  - __- - - -- --__--- -.  `'.
      -        __ / ,'`     _|--|_________|--|_     `'. \
      -      /'--| ;    _.'\ |  '         '  | /'._    ; |
      -     //   | |_.-' .-'.'      ___      '.'-. '-._| |
      -    (\)   \"` _.-` /     .-'`_ `'-.     \ `-._ `"/
      -    (\)    `-'    |    .' .-'" "'-. '.    |    `-`
      -   (\)            |   / .'(3)(2)(1)'. \   |
      -   (\)            |  / / (4) .-.     \ \  |
      -   (\)            |  | |(5) (   )'==,J |  |
      -  (\)             |  \ \ (6) '-' (0) / /  |
      - (\)              |   \ '.(7)(8)(9).' /   |
      - (\)           ___|    '. '-.._..-' .'    |
      - (\)          /.--|      '-._____.-'      |
      -  (\)        (\)  |\_  _  __   _   __  __/|
      - (\)        (\)   |                       |
      -(\)_._._.__(\)    |                       |
      - (\\\\jgs\\\)      '.___________________.'
      -  '-'-'-'--'
      +,---,---,---,---,---,---,---,---,---,---,---,---,---,-------,
      +|1/2| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | + | ' | <-    |
      +|---'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-----|
      +| ->| | Q | W | E | R | T | Y | U | I | O | P | ] | ^ |     |
      +|-----',--',--',--',--',--',--',--',--',--',--',--',--'|    |
      +| Caps | A | S | D | F | G | H | J | K | L | \ | [ | * |    |
      +|----,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'---'----|
      +|    | < | Z | X | C | V | B | N | M | , | . | - |          |
      +|----'-,-',--'--,'---'---'---'---'---'---'-,-'---',--,------|
      +| ctrl |  | alt |                          |altgr |  | ctrl |
      +'------'  '-----'--------------------------'------'  '------'
      +      Nieminen Mika	
       

      -In 2021 I wrote "On Being Pedantic about Open-Source", and there was a section "What about mobile?" where I expressed the dilemma about the necessity of using proprietary mobile operating systems. With GrapheneOS, I found my perfect solution for personal mobile phone use.
      +

      Table of Contents



      -On Being Pedantic about Open-Source
      +
      +

      Introduction



      -What is GrapheneOS?
      +After work one day, I noticed some discomfort in my right wrist. Upon research, it appeared to be a mild case of Repetitive Strain Injury (RSI). Initially, I thought that this would go away after a while, but after a week it became even worse. This led me to consider potential causes such as poor posture or keyboard use habits. As an enthusiast of keyboards, I experimented with ergonomic concave ortholinear split keyboards. Wait, what?...

      -GrapheneOS is a privacy and security-focused mobile OS with Android app compatibility developed as a non-profit open-source project. It's focused on the research and development of privacy and security technologies, including substantial improvements to sandboxing, exploits mitigations and the permission model.
      +
        +
      • Concave: Some fingers are longer than others. A concave keyboard makes it so that the keycaps meant to be pressed by the longer fingers are further down (e.g., left middle finger for e on a Qwerty layout), and keycaps meant to be pressed by shorter fingers are further up (e.g., right pinky finger for the letter p).
      • +
      • Ortholinear: The keys are arranged in a straight vertical line, unlike most conventional keyboards. The conventional keyboards still resemble the old typewriters, where the placement of the keys was optimized so that the typewriter would not jam. There is no such requirement anymore.
      • +
      • Split: The keyboard is split into two halves (left and right), allowing one to place either hand where it is most ergonomic.
      • +

      +After discovering ThePrimagen (I found him long ago, but I never bothered buying the same keyboard he is on) on YouTube and reading/watching a couple of reviews, I thought that as a computer professional, the equipment could be expensive anyway (laptop, adjustable desk, comfortable chair), so why not invest a bit more into the keyboard? I purchased myself the Kinesis Advantage360 Professional keyboard.

      -GrapheneOS is an independent Android distribution based on the Android Open Source Project (AOSP) but hardened in multiple ways. Other independent Android distributions, like LineageOS, are also based on AOSP, but GrapheneOS takes it further so that it can be my daily driver on my phone.
      +

      Kinesis review



      -https://GrapheneOS.org
      -https://LineageOS.org
      +For an in-depth review, have a look at this great article:

      -

      User Profiles


      +Review of the Kinesis Advantage360 Professional keyboard

      -GrapheneOS allows configuring up to 32 user profiles (including a guest profile) on a single phone. A profile is a completely different environment within the phone, and it is possible to switch between them instantly. Sessions of a profile can continue running in the background or be fully terminated. Each profile can have completely different settings and different applications installed.
      +

      Top build quality



      -I use my default profile with primarily open-source applications installed, which I trust. I use another profile for banking (PayPal, various proprietary bank apps, Amazon store app, etc.) and another profile for various Google services (which I try to avoid, but I have to use once in a while). Furthermore, I have configured a profile for Social Media use (that one isn't in my default profile, as otherwise I am tempted to scroll social media all the time, which I try to avoid and only want to do intentionally when switching to the corresponding profile!).
      +Overall, the keyboard feels excellent quality and robust. It has got some weight to it. Because of that, it is not ideally suited for travel, though. But I have a different keyboard to solve this (see later in this post). Overall, I love how it is built and how it feels.

      -The neat thing about the profiles is that some can run a sandboxed version of Google Play (see later in this post), while others don't. So some profiles can entirely operate without any Google Play, and only some profiles (to which I rarely switch) have Google Play enabled.
      +Kinesis Adv.360 Pro at home

      -You notice how much longer (multiple days) your phone can be on a single charge when Google Play Services isn't running in the background. This tells a lot about the background activities and indicates that using Google Play shouldn't be the norm.
      +

      Bluetooth connectivity



      -

      Proxying some of the Google offerings


      +Despite encountering concerns about Bluetooth connectivity issues with the Kinesis keyboard during my research, I purchased one anyway as I intended to use it only via USB. However, I discovered that the firmware updates available afterwards had addressed these reported Bluetooth issues, and as a result, I did not experience any difficulties with the Bluetooth functionality. This positive outcome allowed me to enjoy using the keyboard also wirelessly.

      -There's also the case that I am using an app from the Google Play store (as the app isn't available from F-Droid), which doesn't require Google Play Services to run in the background. Here's where I use the Aurora Android store. The Aurora store can be installed through F-Droid. Aurora acts as an anonymous proxy from your phone to the Google Play Store and lets you install apps from there. No Google credentials are required for that!
      +

      Gateron Brown key switches



      -https://f-droid.org
      +Many voices on the internet seem to dislike the Gateron Brown switches, the only official choice for non-clicky tactile switches in the Kinesis, so I was also a bit concerned. I almost went with Cherry MX Browns for my Kinesis (a custom build from a 3rd party provider that is partnershipping with Kinesis). Still, I decided on Gateron Browns to try different switches than the Cherry MX Browns I already have on my ZSA Moonlander keyboard (another ortho-linear split keyboard, but without a concave keycap layout).

      -There's a similar solution for watching videos on YouTube. You can use the NewPipe app (also from F-Droid), which acts as an anonymous proxy for watching videos from YouTube. So there isn't any need to install the official YouTube app, and there isn't any need to login to your Google account. What's so bad about the official app? You don't know which data it is sending about you to Google, so it is a privacy concern.
      +At first, I was disappointed by the Gaterons, as they initially felt a bit meshy compared to the Cherries. Still, over the weeks I grew to prefer them because of their smoothness. Over time, the tactile bumps also became more noticeable (as my perception of them improved). Because of their less pronounced tactile feedback, the Gaterons are less tiring for long typing sessions and better suited for a relaxed typing experience.

      -

      Google Play Sandboxing


      +So, the Cherry MX feel sharper but are more tiring in the long run, and the Gaterons are easier to write on and the tactile Feedback is slightly less pronounced.

      -Before switching to GrapheneOS, I had been using LineageOS on one of my phones for a couple of years. Still, I always had to have a secondary personal phone with all of these proprietary apps which (partially) only work with Google Play on the phone (e.g. Banking, Navigation, various travel apps from various Airlines, etc.) somewhere around as I didn't install Google Play on my LineageOS phone due to privacy concerns and only installed apps from the F-Droid store on it. When travelling, I always had to carry around a second phone with Google Play on it, as without it; life would become inconvenient pretty soon.
      +

      Keycaps



      -With GrapheneOS, it is different. Here, I do not just have a separate user profile, "Google", for various Google apps where Google Play runs, but Google Play also runs in a sandbox!!!
      +If you ever purchase a Kinesis keyboard, go with the PCB keycaps. They upgrade the typing experience a lot. The only thing you will lose is that the backlighting won't shine through them. But that is a reasonable tradeoff. When do I need backlighting? I am supposed to look at the screen and not the keyboard while typing.

      -GrapheneOS has a compatibility layer providing the option to install and use the official releases of Google Play in the standard app sandbox. Google Play receives no special access or privileges on GrapheneOS instead of bypassing the app sandbox and receiving a massive amount of highly privileged access. Instead, the compatibility layer teaches it how to work within the full app sandbox. It also isn't used as a backend for the OS services as it would be elsewhere since GrapheneOS doesn't use Google Play even when it's installed.
      +I went with the blank keycaps, by the way.

      -When I need to access Google Play, I can switch to the "Google" profile. Even there, Google is sandboxed to the absolute minimum permissions required to be operational, which gives additional privacy protection.
      +Kinesis Adv.360 Pro at home

      -The sad truth is that Google Maps is still the best navigation app. When driving unknown routes, I can switch to my Google profile to use Google Maps. I don't need to do that when going streets I know about, but it is crucial (for me) to have Google Maps around when driving to a new destination.
      +

      Keymap editor



      -Also, Google Translate and Google Lens are still the best translation apps I know. I just recently relocated to another country, where I am still learning the language, so Google Lens has been proven very helpful on various occasions by ad-hoc translating text into English or German for me.
      +There is no official keymap editor. You have to edit a configuration file manually, build the firmware from scratch, and upload the firmware with the new keymap to both keyboard halves. The Professional version of his keyboard, by the way, runs on the ZMK open-source firmware.

      -The same applies to banking. Many banking apps require Google Play to be available (It might be even more secure to only use banking apps from the Google Play store due to official support and security updates). I rarely need to access my mobile banking app, but once in a while, I need to. As you have guessed by now, I can switch to my banking profile (with Google Play enabled), do what I need to do, and then terminate the session and go back to my default profile, and then my life can go on :-).
      +Many users find the need for an easy-to-use keymap editor an issue. But this is the Pro model. You can also go with the non-Pro, which runs on non-open-source firmware and has no Bluetooth (it must be operated entirely on USB).

      -It is great to have the flexibility to use any proprietary Android app when needed. That only applies to around 1% of my phone usage time, but you often don't always know when you need "that one app now". So it's perfect that it's covered with the phone you always have with you.
      +There is a 3rd party solution which is supposed to configure the keymap for the Professional model as bliss, but I have never used it. As a part-time programmer and full-time Site Reliability Engineer, I am okay configuring the keymap in my text editor and building it in a local docker container. This is one of the standard ways of doing it here. You could also use a GitHub pipeline for the firmware build, but I prefer building it locally on my machine. This all seems natural to me, but this may be an issue for "the average Joe" user.

      -

      The camera and the cloud


      +

      First steps



      -I really want my phone to shoot good looking pictures, so that I can later upload them to the Irregular Ninja:
      +I didn't measure the usual words per minute (wpm) on my previous keyboard, the ZSA Moonlander, but I guess that it was around 40-50wpm. Once the Kinesis arrived, I started practising. The experience was quite different due to the concave keycaps, so I barely managed 10wpm on the first day.

      -https://irregular.ninja
      +I quickly noticed that I could not continue using the freestyle 6-finger typing system I was used to on my Moonlander or any previous keyboards I worked with. I learned ten-finger touch typing from scratch to be more efficient with the Kinesis keyboard. The keyboard forces you to embrace touch typing.

      -The stock camera app of the OASP could be better. Photos usually look washed out, and the app lacks features. With GrapheneOS, there are two options:
      +Sometimes, there were brain farts, and I couldn't type at all. The trick was not to freak out about it, but to move on. If your average goes down a bit for a day, it doesn't matter; the long-term trend over several days and weeks matters, not the one-off wpm high score.
      +
      +Although my wrist pain seemed to go away aftre the first week of using the Kinesis, my fingers became tired of adjusting to the new way of typing. My hands were stiff, as if I had been training for the Olympics. Only after three weeks did I start to feel comfortable with it. If it weren't for the comments I read online, I would have sent it back after week 2.
      +
      +I also had a problem with the left pinky finger, where I could not comfortably reach the p key. This involved moving the whole hand. An easy fix was to swap p with ; on the keyboard layout.
      +
      +

      Considering alternate layouts


      +
      +As I was going to learn 10-finger touch typing from scratch, I also played with the thought of switching from the Qwerty to the Dvorak or Colemak keymap, but after reading some comments on the internet, I decided against it:

        -
      • Use the official Google camera app with sandboxed Google Play Services running. You will get the full Google experience here.
      • -
      • Or, just use the default GrapheneOS camera app.
      • +
      • These layouts (Dvorak and Colemak) will minimize the finger travel for the most commonly used English words, but they necessarily don't give you a better wpm score.
      • +
      • One comment on Redit also mentioned that getting stiffer fingers with these layouts is more likely than with Qwerty, as in Qwerty, he had to stretch out his fingers more often, which helps here.
      • +
      • There are also many applications and websites with keyboard shortcuts and are Qwerty-optimized.
      • +
      • You won't be able to use someone else's computer as there will be likely Qwerty. Some report that after using an alternative layout for a while, they forget how to use Qwerty.

      -The GrapheneOS camera app is much better than the stock OASP camera app. I have been comparing the photo quality of my Pixel phone under LineageOS and GrapheneOS, and the differences are pronounced. I didn't compare the quality with the official Google camera app, but I have seen some comparison videos and the differences seem like they aren't groundbreaking.
      +

      Training how to type



      -For automatic backups of my photos, I am relying on a self-hosted instance of NextCloud (with a client app available via F-Droid). So there isn't any need to rely on any Google apps and services (Google Play Photos or Google Camera app) anymore, and that's great!
      +

      Tools



      -https://nextcloud.com
      +One of the most influential tools in my touch typing journey has been keybr.com. This site/app helped me learn 10-finger touch typing, and I practice daily for 30 minutes (in the first two weeks, up to an hour every day). The key is persistence and focus on technique rather than speed; the latter naturally improves with regular practice. Precision matters, too, so I always correct my errors using the backspace key.

      -I also use NextCloud to synchronize my notes (NextCloud Notes), my RSS news feeds (NextCloud News) and contacts (DAVx5). All apps required are available in the F-Droid store.
      +https://keybr.com

      -

      Fine granular permissions


      +I also used a command-line tool called tt, which is written in Go. It has a feature that I found very helpful: the ability to practice typing by piping custom text into it. Additionally, I appreciated its customization options, such as choosing a colour theme and specifying how statistics are displayed.

      -Another great thing about GrapheneOS is that, besides putting your apps into different profiles, you can also restrict network access and configure storage scopes per app individually.
      +https://github.com/lemnos/tt

      -For example, let's say you are installing that one proprietary app from the Google Play Store through the Aurora store, and then you want to ensure that the app doesn't send data "home" through the internet. Nothing is easier to do than that. Just remove network access permissions from that only app.
      +I wrote myself a small Ruby script that would randomly select a paragraph from one of my eBooks or book notes and pipe it to tt. This helped me remember some of the books I read and also practice touch typing.

      -The app also wants to store and read some data from your phone (e.g. it could be a proprietary app for enhancing photos, and therefore storage access to a photo folder would be required). In GrapheneOS, you can configure a storage scope for that particular app, e.g. only read and write from one folder but still forbid access to all other folders on your phone.
      +

      My keybr.com statistics



      -

      Termux


      +Overall, I trained for around 4 months in more than 5,000 sessions. My top speed in a session was 127.1wpm (up from barely 10wpm at the beginning).

      -Termux can be installed on any Android phone through F-Droid, so it doesn't need to be a GrapheneOS phone. But I have to mention Termux here as it significantly adds value to my phone experience.
      +All time stats

      -Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.
      +My overall average speed over those 5,000 sessions was 80wpm. The average speed over the last week was over 100wpm. The green line represents the wpm average (increasing trend), the purple line represents the number of keys in the practices (not much movement there, as all keys are unlocked), and the red line represents the average typing accuracy.

      -https://termux.dev
      +Typing speed over leson

      -In short, Termux is an entire Linux environment running on your Android phone. Just pair your phone with a Bluetooth keyboard, and you will have the whole Linux experience. I am only using terminal Linux applications with Termux, though. What makes it especially great is that I could write on a new blog post (in Neovim through Termux on my phone) or do some coding whilst travelling (e.g. during a flight), or look up my passwords or some other personal documents (through my terminal-based password manager). All changes I commit to Git can be synced to the server with a simple git push once online (e.g. after the plane landed) again.
      +Around the middle, you see a break-in of the wpm average value. This was where I swapped the p and ; keys, but after some retraining, I came back to the previous level and beyond.

      -There are Pixel phones with a screen size of 6", and that's decent enough for occasional use like that, and everything (the phone, the BT keyboard, maybe an external battery pack) all fit nicely in a small travel pocket.
      +

      Tips and tricks



      -

      So, why not use a pure Linux phone?


      +These are some tips and tricks I learned along the way to improve my typing speed:

      -Strictly speaking, an Android phone is a Linux phone, but it's heavily modified and customized. For me, a "pure" Linux phone is a more streamlined Linux kernel running in a distribution like Ubuntu Touch or Mobian.
      +

      Relax



      -A pure Linux phone, e.g. with Ubuntu Touch installed, e.g. on a PinePhone, Fairphone, the Librem 5 or the Volla phone, is very appealing to me. And they would also provide an even better Linux experience than Termux does. Some support running LineageOS within an Anbox, enabling you to run various proprietary Android apps occasionally within Linux.
      +It's easy to get cramped when trying to hit this new wpm mark, but this is just holding you back. Relax and type at a natural pace. Now I also understand why my Katate Sensei back in London kept screaming "RELAAAX" at me during practice.... It didn't help much back then, though, as it is difficult to relax while someone screams at you!

      -Ubuntu Touch
      -More Linux distributions for mobile devices
      +

      Focus on accuracy first



      -But here, Google Play would not be sandboxed; you could not configure individual network permissions and storage scopes like in GrapheneOS. Pure Linux-compatible phones usually come with a crappy camera, and the battery life is generally pretty bad (only a few hours). Also, no big tech company pushes the development of Linux phones. Everything relies on hobbyists, whereas multiple big tech companies put a lot of effort into the Android project, and a lot of code also goes into the Android Open-Source project.
      +This goes with the previous point. Instead of trying to speed through sessions as quickly as possible, slow down and try to type the words correctly—so don't rush it. If you aren't fast yet, the reason is that your brain hasn't trained enough. It will come over time, and you will be faster.

      -Currently, pure Linux phones are only a nice toy to tinker with but are still not ready (will they ever?) to be the daily driver. SailfishOS may be an exception; I played around with it in the past. It is pretty usable, but it's not an option for me as it is partial a proprietary operating system.
      +

      Chording



      -SailfishOS
      +A trick to getting faster is to type by word and pause between each word so you learn the words by chords. From 80wpm and beyond, this makes a real difference.

      -

      Small GrapheneOS downsides


      +

      Punctuation and Capitalization



      -Sometimes, switching a profile to use a different app is annoying, and you can't copy and paste from the system clipboard from one profile to another. But that's a small price I am willing to pay!
      +I included 10% punctuation and 20% capital letters in my keybr.com practice sessions to simulate real typing conditions, which improved my overall working efficiency. I guess I would have gone to 120wpm in average if I didn't include this options...

      -Another thing is that GrapheneOS can only run on Google Pixel phones, whereas LineageOS can be installed on a much larger variety of hardware. But on the other hand, GrapheneOS works very well on Pixel phones. The GrapheneOS team can concentrate their development efforts on a smaller set of hardware which then improves the software's quality (best example: The camera app).
      +

      Reverse shifting



      -And, of course, GrapheneOS is an open-source project. This is a good thing; however, on the other side, nobody can guarantee that the OS will not break or will not damage your phone. You have to trust the GrapheneOS project and donate to the project so they can keep up with the great work. But I rather trust the GrapheneOS team than big tech.
      +Reverse shifting aka left-right shifting is to...

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +
        +
      • ...use the left shift key for letters on the right keyboard side.
      • +
      • ...use the right shift key for letters on the left keyboard side.
      • +

      +This makes using the shift key a blaze.

      -Back to the main site
      -
      -
      -
      - - (Re)learning Java - My takeaways - - https://foo.zone/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways.html - 2022-12-24T23:18:40+02:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - As a regular participant in the annual Pet Project competition at work, I always try to find a project where I can learn something new. In this post, I would like to share my takeaways after revisiting Java. You can read about my motivations in my 'Creative universe' post: - -
      -

      (Re)learning Java - My takeaways


      +

      Enter the flow state



      -Published at 2022-12-24T23:18:40+02:00
      +Listening to music helps me enter a flow state during practice sessions, which makes typing training a bit addictive (which is good, or isn't it?).

      -
      +

      Repeat every word



      -As a regular participant in the annual Pet Project competition at work, I always try to find a project where I can learn something new. In this post, I would like to share my takeaways after revisiting Java. You can read about my motivations in my "Creative universe" post:
      +There's a setting on keybr.com that makes it so that every word is always repeated, having you type every word twice in a row. I liked this feature very much, and I think it also helped to improve my practice.

      -Creative universe
      +

      Don't use the same finger for two consecutive keystrokes



      -I have been programming in Java back in the days as a university student, and even my Diploma Thesis I implemented in Java (it would require some overhaul so that it is fully compatible with a recent version of Java, though - It still compiles and runs, but with a lot of warnings, though!):
      +Apparently, if you want to type fast, avoid using the same finger for two consecutive keystrokes. This means you don't always need to use the same finger for the same keys.
      +However, there are no hard and fast rules. Thus, everyone develops their system for typing word combinations. An exception would be if you are typing the very same letter in a row (e.g., t in letter)—here, you are using the same finger for both ts.

      -VS-Sim: Distributed systems simulator
      +

      Warm-up



      -However, after that, I became a Linux Sysadmin and mainly continued programming in Perl, Puppet, bash, and a little Python. For personal use, I also programmed a bit in Haskell and C. After my Sysadmin role, I moved to London and became a Site Reliability Engineer (SRE), where I mainly programmed in Ruby, bash, Puppet and Golang and a little bit of C.
      +You can't reach your average typing speed first ting the morning. It would help if you warmed up before the exercise or practice later during the day. Also, some days are good, others not so, e.g., after a bad night's sleep. What matters is the mid- and long-term trend, not the fluctuations here, though.

      -At my workplace, as an SRE, I don't do Java a lot. I have been reading Java code to understand the software better so I can apply and suggest workarounds or fixes to existing issues and bugs. However, most of our stack is in Java, and our Software Engineers use Java as their primary programming language.
      +

      Travel keyboard



      -

      Stuck at Java 1.4


      +As mentioned, the Kinesis is a great keyboard, but it is not meant for travel.

      -Over time, I had been missing out on many new features that were added to the language since Java 1.4, so I decided to implement my next Pet Project in Java and learn every further aspect of the language as my main goal. Of course, I still liked the idea of winning a Pet Project Prize, but my main objective was to level up my Java skills.
      +I guess keyboards will always be my expensive hobby, so I also purchased another ergonomic, ortho-linear, concave split keyboard, the Glove80 (with the Red Pro low-profile switches). This keyboard is much lighter and, in my opinion, much better suited for travel than the Kinesis. It also comes with a great travel case.

      -

      (Re)learning & upskilling to Java 18


      +Here is a photo of me using it with my Surface Go 2 (it runs Linux, by the way) while waiting for the baggage drop at the airport:

      -

      Effective Java


      +Traveling with the Glove80 using my Surface Go 2

      -This book was recommended by my brother and also by at least another colleague at work to be one of the best, if not the best, book about Java programming. I read the whole book from the beginning to the end and immersed myself in it. I fully agree; this is a great book. Every Java developer or Java software engineer should read it!
      +For everyday work, I prefer the tactile Browns on the Kinesis over the Red Pro I have on the Glove80 (normal profile vs. low profile). The Kinesis feels much more premium, whereas the Glove80 is much lighter and easier to store away in a rucksack (the official travel case is a bit bulky, so I wrapped it simply in bubble plastic).

      -
      +The F-key row is odd at the Glove80. I would have preferred more keys on the sides like the Kinesis, and I use them for [] {} (), which is pretty handy there. However, I like the thumb cluster of the Glove80 more than the one on the Kinesis.

      -I recommend reading the 90-part effective Java Series on dev.to. It's a perfect companion to the book as it explains all the chapters again but from a slightly different perspective and helps you to really understand the content.
      +The good thing is that I can switch between both keyboards instantly without retraining my typing memories. I've configured (as much as possible) the same keymaps on both my Kinesis and Glove80, making it easy to switch between them at any occasion.

      -Kyle Carter's 90-part Effective Java Series
      +Interested in the Glove80? I suggest also reading this review:

      -

      Java Pub House


      +Review of the Glove80 keyboard

      -During my lunch breaks, I usually have a walk around the block or in a nearby park. I used that time to listen to the Java Pub House podcast. I listened to *every* episode and learned tons of new stuff. I can highly recommend this podcast. Especially GraalVM, a high-performance JDK distribution written for Java and other JVM languages, captured my attention. GraalVM can compile Java code into native binaries, improving performance and easing the distribution of Java programs. Because of the latter, I should release a VS-Sim GraalVM edition one day through a Linux AppImage ;-).
      +

      Upcoming custom Kinesis build



      -https://www.javapubhouse.com
      -https://www.graalvm.org
      +As I mentioned, keyboards will remain an expensive hobby of mine. I don't regret anything here, though. After all, I use keyboards at my day job. I've ordered a Kinesis custom build with the Gateron Kangaroo switches, and I'm excited to see how that compares to my current setup. I'm still deciding whether to keep my Gateron Brown-equipped Kinesis as a secondary keyboard or possibly leave it at my in-laws for use when visiting or to sell it.

      -

      Java Concurrency course


      +

      Conclusion



      -I also watched a course on O'Reilly Safari Books online about Java Concurrency. That gave an excellent refresher on how the Java thread pools work and what were the concurrency primitives available in the standard library.
      +When I traveled with the Glove80 for work to the London office, a colleague stared at my keyboard and made jokes that it might be broken (split into two halves). But other than that...

      -

      Read a lot of Java code


      +Ten-finger touch typing has improved my efficiency and has become a rewarding discipline. Whether it's the keyboards I use, the tools I practice with, or the techniques I've adopted, each step has been a learning experience. I hope sharing my journey provides valuable insights and inspiration for anyone looking to improve their touch typing skills.

      -First, the source code is often the best documentation (if programmed nicely), and second, it helps to get the hang of the language and standard practices. I started to read more and more Java code at work. I did that whenever I had to understand how something, in particular, worked (e.g. while troubleshooting and debugging an issue).
      +I also accidentally started using a 10-finger-like system (maybe still 6 fingers, but better than before) on my regular laptop keyboard. I could be more efficient on the laptop keyboard. The form is different there (not ortholinear, not concave keycaps, etc.), but my typing has improved there too (even if it is only by a little bit).

      -

      Observed Java code reviews


      +I don't want to return to a non-concave keyboard as my default. I will use other keyboards still once in a while but only for short periods or when I have to (e.g. travelling with my Laptop and when there is no space to put an external keyboard)

      -Another great way to get the hang of Java again was to sneak into the code reviews of the Software Engineer colleagues. They are the expert on the matter and are a great source to copy knowledge. It's OK to stay passive and only follow the reviews. Sometimes, it's OK to step up and take ownership of the review. The developers will also always be happy to answer any naive questions which come up.
      +Learning to touch type has been an eye-opening experience for me, not just for work but also for personal projects. Now, writing documentation is so much fun; who could believe that? Furthermore, working with Slack (communicating with colleagues) is more fun now as well.

      -

      Took ownership of a roadmap-Java project


      +E-Mail your comments to paul@nospam.buetow.org :-)

      -Besides my Pet Project, I also took ownership of a regular roadmap Java project at work, making an internal Java service capable of running in Kubernetes. This was a bunch of minor changes and adding a bunch of classes and unit tests dealing with the statelessness and a persistent job queue in Redis. The job also involved reading and understanding a lot of already existing Java code. It wasn't part of my job description, but it was fun, and I learned a lot. The service runs smoothly in production now. Of course, all of my code got reviewed by my Software Engineering colleagues.
      +Back to the main site
      +
      +
      +
      + + 'The Stoic Challenge' book notes + + https://foo.zone/gemfeed/2024-07-07-the-stoic-challenge-book-notes.html + 2024-07-07T12:46:55+03:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + These are my personal takeaways after reading 'The Stoic Challenge: A Philosopher's Guide to Becoming Tougher, Calmer, and More Resilient' by William B. Irvine. + +
      +

      "The Stoic Challenge" book notes



      -

      The good


      +Published at 2024-07-07T12:46:55+03:00

      -From the new language features and syntaxes, there are many personal takeaways, and I can't possibly list them all, but here are some of my personal highlights:
      +These are my personal takeaways after reading "The Stoic Challenge: A Philosopher's Guide to Becoming Tougher, Calmer, and More Resilient" by William B. Irvine.

      -
        -
      • Static factory methods and public constructors both have their uses, and it pays to understand their relative merits. Often static factories are preferable (cleaner and easier to read), so avoid the reflex to provide public constructors without first considering static factories.
      • -
      • Java streams were utterly new to me. I love how they can help to produce more compact code. But it's challenging to set the line of when enough is enough. Overusing streams can have the opposite effect: Code becomes more complex and challenging to understand. And it is so easy to parallelize the computation of streams by "just" marking the stream as .parallel() (more on that later in this post).
      • -
      • Overall, object-oriented languages tend to include more and more functional paradigms. The functional interfaces, which Java provides now, are fantastic. Their full powers shine in combination with the use of streams. An entire book can be written about Java functional interfaces, so I leave it to you to do any further digging.
      • -
      • Local type inference help to reduce even more boilerplate code. E.g. instead of Hash<String,Hash<String,String>> foo = new Hash<String,Hash<String,String>>(); it's possible to just write var foo = new Hash<String,Hash<String,String>>();
      • -
      • Class inheritance isn't the preferred way anymore to structure reusable code. Now, it's composition over inheritance. E.g. use dependency injection (inject one object to another object through its constructor) or prefer interfaces (which now also support default implementations of methods) over class inheritance. This makes sense to me as I do that already when I program in Ruby.
      • -
      • I learned the try-with-resources pattern. Very useful in ensuring closing resources again correctly. No need anymore for complicated and nested finally-blocks, which used to be almost impossible to get right previously in case of an error condition (e.g. I/O error somewhere deeply nested in an input or output stream).
      • -
      • Optimize only when required. It's considered to be cleaner to prefer immutable variables (declaring them as final). I knew that already, but for Java, it always seemed to be a waste of resources (creating entirely new objects whenever states change), but apparently, it's okay. Java also does many internal tricks for performance optimization here, e.g. interning strings.
      • -
      • I learned about the concept of static member classes and the difference between non-static member classes (also sometimes known as inner classes). Non-static member classes have full access to all members of their outer class (think of closure). In contrast, static member classes act like completely separate classes without such access but provide the benefit of a nested name that can help group functionality in the code.
      • -
      • I learned about the existence of thread-local variables. These are only available to the current thread and aren't shared with other threads.
      • -
      • I learned about the concept of Java modules, which help to structure larger code bases better. The traditional Java packages are different.
      • -
      • I learned to love the new Optional type. I already knew the concept from Haskell, where Maybe would be the corresponding type. Optional helps to avoid null-pointers but comes with some (minimal) performance penalty. So, in the end, you end up with both Optional types and null-pointers in your code (depending on the requirements). But I like to prefer Optional over null-pointer when "no result" is a valid return value from a method.
      • -
      • The enum type is way more powerful than I thought. Initially, I felt an enum could only be used to define a list of constants and then to compare an instance to another instance of the same. An enum is still there to define a list of constants, but it's also almost like a class (you can implement constructors, and methods, inherit from other enums). There are quite a lot of possible use cases.
      • -
      • A small but almost the most helpful thing I learned is always to use the @Override annotation when overriding a method from a parent class. If done, Java helps to detect any typos or type errors when overriding methods. That's useful and spares a lot of time debugging where a method was mistakenly overloaded but not overridden.
      • -
      • Lambdas are much cleaner, shorter and easier to read than anonymous classes. Many Java libraries require passing instances of (anonymous) classes (e.g. in Swing) to other objects. Lambdas are so lovely because they are primarily compatible with the passing of anonymous classes, so they are a 1:1 replacement in many instances. Lambdas also play very nicely together with the Java functional interfaces, as each Lambda got a type, and the type can be an already existing functional interface (or, if you got a particular case, you could define your custom functional interface for your own set of Lambdas, of course).
      • -
      • I love the concept of Java records. You can think of a record as an immutable object holding some data (as members). They are ideal for pipe and stream processing. They are much easier to define (with much less boilerplate) and come with write protection out of the box.
      • -

      -

      The bad and the ugly


      +
      +         ,..........   ..........,
      +     ,..,'          '.'          ',..,
      +    ,' ,'            :            ', ',
      +   ,' ,'             :             ', ',
      +  ,' ,'              :              ', ',
      + ,' ,'............., : ,.............', ',
      +,'  '............   '.'   ............'  ',
      + '''''''''''''''''';''';''''''''''''''''''
      +                    '''
      +

      -There are also many ugly corners in Java. Many are doomed to stay there forever due to historical decisions and ensuring backward compatibility with older versions of the Java language and the Java standard library.
      +

      Table of Contents



        -
      • Finalizers and cleaners seem obsolete, fragile and still, you can use them.
      • -
      • In many cases, extreme caution needs to be taken to minimize the accessibility of class members. You might think that Java provides the best "out-of-the-box" solution for proper encapsulation, but the language has many loopholes.
      • -
      • In the early days, Java didn't support generics yet. So what you would use is to cast everything to Object. Java now fully supports generics (for a while already), but you can still cast everything to Object and back to whatever type you want. That can lead to nasty runtime errors. Also, there's a particular case to convert between an Array of Object to an Array of String or from an Array of String to a List of String. Java can't convert between these types automatically, and extreme caution needs to be taken when enforcing so (e.g. through explicit type casts). In many of these cases, Java would print out warnings that need to be manually suppressed via annotations. Programming that way, converting data between old and new best practices, is clunky.
      • -
      • If you don't know what you do, Java streams can be all wrong. Side effects in functions used in streams can be nasty to debug. Also, don't just blindly add a .parallel() to your stream. You need to understand what the stream does and how it exactly works; otherwise, parallelizing a stream can impact the performance drastically (in a negative way). There need to be language constructs preventing you from doing the wrong things. That's so much easier to do it right in a purely functional programming language like Haskell.
      • -
      • Java is a pretty old language (already), so there are many obstacles to consider. There are too many exceptions and different outcomes of how Java code can behave. In most cases, when you write an API, every method you program needs to be documented so the user won't encounter any surprises using your code. Writing and reading a lot of documentation seems to be quite the overhead when the method name is already descriptive.
      • -
      • Java serialization is broken. It works, and the language still supports it, but you better not use Java's native way of object serialization and deserialization. Unbelievable how much can get wrong here, especially regarding security (injecting arbitrary code).
      • -
      • Being a bit spoiled by Golang's Goroutines, I was shocked about the limitations of the Java threads. They are resource hungry, and you can't just spin up millions of them as you would with Goroutines. I knew this limitation of threads already (as it's not a problem of the language but of how threads work in the OS), but still, I was pretty shocked when I got reminded of them again. Of course, there's a workaround: Use asynchronous sockets so that you don't waste a whole thread on a single I/O operation (in my case, waiting for a network response). Golang's runtime does that automatically for you: An OS thread will be re-used for other tasks until the network socket unblocks. Every modern programming language should support lightweight threads or Coroutines like Go's Goroutines.
      • +
      • "The Stoic Challenge" book notes
      • +
      • God sets you up for a challenge
      • +
      • Negative visualization
      • +
      • Oh, nice trick, you stoic "god"! ;-)

      +

      God sets you up for a challenge



      -

      Conclusion


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

      -While (re)learning Java, I felt like a student again and was quite enthusiastic about it initially. I invested around half a year, immersing myself intensively in Java (again). The last time I did that was many years ago as a university student. I even won a Silver Prize at work, implementing a project this year (2022 as of writing this). I feel confident now with understanding, debugging and patching Java code at work, which boosted my debugging and troubleshooting skills.
      +Put a positive spin on everything. What should you do if someone wrong you? Don't get angry, there is no point in that, it just makes you suffer. Do the best what you got now and keep calm and carry on. A resilient person will refuse to play the role of a victim. You can develop the setback response skills. Turn a setback. e.g. a handycap, into a personal triumph.

      -I don't hate Java, but I don't love programming in it, either. I will, I guess, always see Java as the necessary to get stuff done (reading code to understand how the service works, adding a tiny feature to make my life easier, adding a quick bug fix to overcome an obstacle...).
      +It is not the things done to you or happen to you what matters but how you take the things and react to these things.

      -Although Java has significantly improved since 1.4, its code still tends to be more boilerplate. Not mainly because due to lines of code (Golang code tends to be quite repetitive, primarily when no generics are used), but due to the levels of abstractions it uses. Class hierarchies can be ten classes or deeper, and it is challenging to understand what the code is doing. Good test coverage and much documentation can mitigate the problem partially. Big enterprises use Java, and that also reflects to the language. There are too many libraries and too many abstractions that are bundled with too many legacy abstractions and interfaces and too many exceptions in the library APIs. There's even an external library named Lombok, which aims to reduce Java boilerplate code. Why is there a need for an external library? It should be all part of Java itself.
      +Don't row against the other boats but against your own lazy bill. It doesn't matter if you are first or last, as long as you defeat your lazy self.

      -https://projectlombok.org/
      +Stoics are thankful that they are mortal. As then you can get reminded of how great it is to be alive at all. In dying we are more alive we have ever been as every thing you do could be the last time you do it. Rather than fighting your death you should embrace it if there are no workarounds. Embrace a good death.

      -Java needs a clean cut. The clean cut shall be incompatible with previous versions of Java and only promote modern best practices without all the legacy burden carried around. The same can be said for other languages, e.g. Perl, but in Perl, they already attack the problem with the use of flags which change the behaviour of the language to more modern standards. Or do it like Python, where they had a hard (incompatible) cut from version 2 to version 3. It will be painful, for sure. But that would be the only way I would enjoy using that language as one of my primary languages to code new stuff regularly. Currently, my Java will stay limited to very few projects and the more minor things already mentioned in this post.
      +

      Negative visualization



      -Am I a Java expert now? No, by far not. But I am better now than before :-).
      +It is easy what we have to take for granted.
      +
      +
        +
      • Imagine the negative and then think that things are actually much better than they seem to be.
      • +
      • Close your eyes and imagine you are color blind for a minute, then open the eyes again and see all the colours. You will be grateful for being able to see the colours.
      • +
      • Now close your eyes for a minute and imagine you would be blind, so that you will never be able to experience the world again and let it sink in. When you open your eyes again you will feel a lot of gratefulness.
      • +
      • Last time meditation. Lets you appreciate the life as it is now. Life gets vitalised again.
      • +

      +

      Oh, nice trick, you stoic "god"! ;-)


      +
      +Take setbacks as a challenge. Also take it with some humor.
      +
      +
        +
      • A setback in a setback, how Genius :-)
      • +
      • A setback in a setback in a setback: the stoic god's work overtime, eh? :-)
      • +

      +What would the stoic god's do next? This is just a test strategy by them. Don't be frustrated at all but be astonished of what comes next. Thank the stoic gods of testing you. This is comfort zone extension of the stoics aka toughness Training.

      E-Mail your comments to paul@nospam.buetow.org :-)

      +Other book notes of mine are:
      +
      +2024-10-24 "Staff Engineer" book notes
      +2024-07-07 "The Stoic Challenge" book notes (You are currently reading this)
      +2024-05-01 "Slow Productivity" book notes
      +2023-11-11 "Mind Management" book notes
      +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      +2023-05-06 "The Obstacle is the Way" book notes
      +2023-04-01 "Never split the difference" book notes
      +2023-03-16 "The Pragmatic Programmer" book notes
      +
      Back to the main site
      - I tried (Doom) Emacs, but I switched back to (Neo)Vim - - https://foo.zone/gemfeed/2022-11-24-i-tried-emacs-but-i-switched-back-to-neovim.html - 2022-11-24T11:17:15+02:00 + Random Weird Things - Part Ⅰ + + https://foo.zone/gemfeed/2024-07-05-random-weird-things.html + 2024-07-05T10:59:59+03:00 Paul Buetow aka snonux paul@dev.buetow.org - Art by \ \_! / __! + Every so often, I come across random, weird, and unexpected things on the internet. I thought it would be neat to share them here from time to time. As a start, here are ten of them.
      -

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


      +

      Random Weird Things - Part Ⅰ



      -Published at 2022-11-24T11:17:15+02:00; Updated at 2022-11-26
      +Published at 2024-07-05T10:59:59+03:00; Updated at 2025-02-08
      +
      +Every so often, I come across random, weird, and unexpected things on the internet. I thought it would be neat to share them here from time to time. As a start, here are ten of them.
      +
      +2024-07-05 Random Weird Things - Part Ⅰ (You are currently reading this)
      +2025-02-08 Random Weird Things - Part Ⅱ

      -             _/  \    _(\(o
      -             /     \  /  _  ^^^o
      -            /   !   \/  ! '!!!v'
      -           !  !  \ _' ( \____
      -           ! . \ _!\   \===^\)
      -Art by      \ \_!  / __!
      - Gunnar Z.   \!   /    \    <--- Emacs is a giant dragon
      -       (\_      _/   _\ )
      -        \ ^^--^^ __-^ /(__ 
      -         ^^----^^    "^--v'
      +		       /\_/\
      +WHOA!! 	     ( o.o )
      +		       > ^ <
      +		      /  -  \
      +		    /        \
      +		   /______\  \
       

      -As a long-lasting user of Vim (and NeoVim), I always wondered what GNU Emacs is really about, so I decided to try it. I didn't try vanilla GNU Emacs, but Doom Emacs. I chose Doom Emacs as it is a neat distribution of Emacs with Evil mode enabled by default. Evil mode allows Vi(m) key bindings (so to speak, it's emulating Vim within Emacs), and I am pretty sure I won't be ready to give up all the muscle memory I have built over more than a decade.
      -
      -GNU Emacs
      -Doom Emacs
      +

      Table of Contents



      -I used Doom Emacs for around two months. Still, ultimately I decided to switch back to NeoVim as my primary editor and IDE and Vim (usually pre-installed on Linux-based systems) and Nvi (usually pre-installed on *BSD systems) as my "always available editor" for quick edits. (It is worth mentioning that I don't have a high opinion on whether Vim or NeoVim is the better editor, I prefer NeoVim as it comes with better defaults out of the box, but there is no real blocker to use Vim instead).
      +
      +

      1. bad.horse traceroute



      -Vim
      -NeoVim
      +Run traceroute to get the poem (or song).

      -So why did I switch back to the Vi-family?
      +Update: A reader hinted that by specifying -n 60, there will be even more output!

      -

      Emacs is a giant dragon


      + +
      ❯ traceroute -m 60 bad.horse
      +traceroute to bad.horse (162.252.205.157), 60 hops max, 60 byte packets
      + 1  _gateway (192.168.1.1)  5.237 ms  5.264 ms  6.009 ms
      + 2  77-85-0-2.ip.btc-net.bg (77.85.0.2)  8.753 ms  7.112 ms  8.336 ms
      + 3  212-39-69-103.ip.btc-net.bg (212.39.69.103)  9.434 ms  9.268 ms  9.986 ms
      + 4  * * *
      + 5  xe-1-2-0.mpr1.fra4.de.above.net (80.81.194.26)  39.812 ms  39.030 ms  39.772 ms
      + 6  * ae12.cs1.fra6.de.eth.zayo.com (64.125.26.172)  123.576 ms *
      + 7  * * *
      + 8  * * *
      + 9  ae10.cr1.lhr15.uk.eth.zayo.com (64.125.29.17)  119.097 ms  119.478 ms  120.767 ms
      +10  ae2.cr1.lhr11.uk.zip.zayo.com (64.125.24.140)  120.398 ms  121.147 ms  120.948 ms
      +11  * * *
      +12  ae25.mpr1.yyz1.ca.zip.zayo.com (64.125.23.117)  145.072 ms *  181.773 ms
      +13  ae5.mpr1.tor3.ca.zip.zayo.com (64.125.23.118)  168.239 ms  168.158 ms  168.137 ms
      +14  64.124.217.237.IDIA-265104-ZYO.zip.zayo.com (64.124.217.237)  168.026 ms  167.999 ms  165.451 ms
      +15  * * *
      +16  t00.toroc1.on.ca.sn11.net (162.252.204.2)  131.598 ms  131.308 ms  131.482 ms
      +17  bad.horse (162.252.205.130)  131.430 ms  145.914 ms  130.514 ms
      +18  bad.horse (162.252.205.131)  136.634 ms  145.295 ms  135.631 ms
      +19  bad.horse (162.252.205.132)  139.158 ms  148.363 ms  138.934 ms
      +20  bad.horse (162.252.205.133)  145.395 ms  148.054 ms  147.140 ms
      +21  he.rides.across.the.nation (162.252.205.134)  149.687 ms  147.731 ms  150.135 ms
      +22  the.thoroughbred.of.sin (162.252.205.135)  156.644 ms  155.155 ms  156.447 ms
      +23  he.got.the.application (162.252.205.136)  161.187 ms  162.318 ms  162.674 ms
      +24  that.you.just.sent.in (162.252.205.137)  166.763 ms  166.675 ms  164.243 ms
      +25  it.needs.evaluation (162.252.205.138)  172.073 ms  171.919 ms  171.390 ms
      +26  so.let.the.games.begin (162.252.205.139)  175.386 ms  174.180 ms  175.965 ms
      +27  a.heinous.crime (162.252.205.140)  180.857 ms  180.766 ms  180.192 ms
      +28  a.show.of.force (162.252.205.141)  187.942 ms  186.669 ms  186.986 ms
      +29  a.murder.would.be.nice.of.course (162.252.205.142)  191.349 ms  191.939 ms  190.740 ms
      +30  bad.horse (162.252.205.143)  195.425 ms  195.716 ms  196.186 ms
      +31  bad.horse (162.252.205.144)  199.238 ms  200.620 ms  200.318 ms
      +32  bad.horse (162.252.205.145)  207.554 ms  206.729 ms  205.201 ms
      +33  he-s.bad (162.252.205.146)  211.087 ms  211.649 ms  211.712 ms
      +34  the.evil.league.of.evil (162.252.205.147)  212.657 ms  216.777 ms  216.589 ms
      +35  is.watching.so.beware (162.252.205.148)  220.911 ms  220.326 ms  221.961 ms
      +36  the.grade.that.you.receive (162.252.205.149)  225.384 ms  225.696 ms  225.640 ms
      +37  will.be.your.last.we.swear (162.252.205.150)  232.312 ms  230.989 ms  230.919 ms
      +38  so.make.the.bad.horse.gleeful (162.252.205.151)  235.761 ms  235.291 ms  235.585 ms
      +39  or.he-ll.make.you.his.mare (162.252.205.152)  241.350 ms  239.407 ms  238.394 ms
      +40  o_o (162.252.205.153)  246.154 ms  247.650 ms  247.110 ms
      +41  you-re.saddled.up (162.252.205.154)  250.925 ms  250.401 ms  250.619 ms
      +42  there-s.no.recourse (162.252.205.155)  256.071 ms  251.154 ms  255.340 ms
      +43  it-s.hi-ho.silver (162.252.205.156)  260.152 ms  261.775 ms  261.544 ms
      +44  signed.bad.horse (162.252.205.157)  262.430 ms  261.410 ms  261.365 ms
      +
      +
      +

      2. ASCII cinema


      +
      +Fancy watching Star Wars Episode IV in ASCII? Head to the ASCII cinema:
      +
      +https://asciinema.org/a/569727
      +
      +

      3. Netflix's Hello World application


      +
      +Netflix has got the Hello World application run in production 😱

      -Emacs feels like a giant dragon as it is much more than an editor or an integrated development environment. Emacs is a whole platform on its own. There's an E-Mail client, an IRC client, or even games you can run within Emacs. And you can also change Emacs within Emacs using its own Lisp dialect, Emacs Lisp (Emacs is programmed in Emacs Lisp). Therefore, Emacs is also its own programming language. You can change every aspect of Emacs within Emacs itself. People jokingly state Emacs is an operating system and that you should directly use it as the init 1 process (if you don't know what the init 1 process is: Under UNIX and similar operating systems, it's the very first userland processed launched. That's usually systemd on Linux-based systems, launchd on macOS, or any other init script or init system used by the OS)!
      +
        +
      • https://www.Netflix.com/helloworld
      • +

      +By the time this is posted, it seems that Netflix has taken it offline... I should have created a screenshot!

      -In many aspects, Emacs is like shooting at everything with a bazooka! However, I prefer it simple. I only wanted Emacs to be a good editor (which it is, too), but there's too much other stuff in Emacs that I don't need to care about! Vim and NeoVim do one thing excellent: Being great text editors and, when loaded with plugins, decent IDEs, too.
      +

      C programming



      -

      Magit love


      +

      4. Indexing an array



      -I almost fell in love with Magit, an integrated Git client for Emacs. But I think the best way to interact with Git is to use the git command line directly. I don't worry about typing out all the commands, as the most commonly used commands are in my shell history. Other useful Git programs I use frequently are bit and tig. Also, get a mechanical keyboard that makes hammering whole commands into the terminal even more enjoyable.
      +In C, you can index an array like this: array[i] (not surprising). But this works as well and is valid C code: i[array], 🤯 It's because after the spec A[B] is equivalent to *(A + B) and the ordering doesn't matter for the + operator. All 3 loops are producing the same output. Would be funny to use i[array] in a merge request of some code base on April Fool's day!

      -Magit
      -Tig
      -
      -Magit is pretty neat for basic Git operations, but I found myself searching the internet for the correct sub-commands to do the things I wanted to do in Git. Mainly, the way how branches are managed is confusing. Often, I fell back to the command line to fix up the mess I produced with Magit (e.g. accidentally pushing to the wrong remote branch, so I found myself fixing things manually on the terminal with the git command with forced pushes....). Magit is hotkey driven, and common commands are quickly explorable through built-in hotkey menus. Still, I found it challenging to navigate to more advanced Git sub-commands that way which was much easier accomplished by using the git command directly.
      -
      -

      Graphical UI


      + +
      #include <stdio.h>
      +
      +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", i[array]);
      +
      +  for (int i = 0; i < 5; i++)
      +    printf("%d\n", *(i + array));
      +}
      +

      -If there is one thing I envy about Emacs is that it's a graphical program, whereas the Vi-family of editors are purely terminal-based. I see the benefits of being a graphical program as this enables the use of multiple fonts simultaneously to embed pictures and graphs (that would be neat as a Markdown preview, for example). There's also GVim (Vim with GTK UI), but that's more of an afterthought.
      +

      5. Variables with prefix $



      -There are now graphical front-end clients for NeoVim, but I still need to dig into them. Let me know your experience if you have one. Luckily, I don't rely on something graphical in my text editor, but it would improve how the editor looks and feels. UTF8 can already do a lot in the terminal, and terminal emulators also allow you to use TrueType fonts. Still, you will always be limited to one TTF font for the whole terminal, and it isn't possible to have, for example, a different font for headings, paragraphs, etc... you get the idea. TTF+UTF8 can't beat authentic graphics.
      +In C you can prefix variables with $! E.g. the following is valid C code 🫠:

      -

      Scripting it


      + +
      #include <stdio.h>
      +
      +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", $i[$array]);
      +
      +  for (int $i = 0; $i < 5; $i++)
      +    printf("%d\n", *($i + $array));
      +}
      +

      -It is possible to customize every aspect of Emacs through Emacs Lisp. I have done some Elk Scheme programming in the past (a dialect of Lisp), but that was a long time ago, and I am not willing to dive here again to customize my environment. I would instead take the pragmatic approach and script what I need in VimScript (a terrible language, but it gets the job done!). I watched Damian Conway's VimScript course on O'Reilly Safari Books Online, which I greatly recommend. Yes, VimScript feels clunky, funky and weird and is far less elegant than Lisp, but it gets its job done - in most cases! (That reminds me that the Vim team has announced a new major version of VimScript with improvements and language changes made - I haven't gotten to it yet - but I assume that VimScript will always stay VimScript).
      +

      6. Object oriented shell scripts using ksh



      -Emacs Lisp
      -Elk Scheme
      -VimScript
      -Scripting Vim by Damian Conway
      +Experienced software developers are aware that scripting languages like Python, Perl, Ruby, and JavaScript support object-oriented programming (OOP) concepts such as classes and inheritance. However, many might be surprised to learn that the latest version of the Korn shell (Version 93t+) also supports OOP. In ksh93, OOP is implemented using user-defined types:

      -NeoVim is also programmable with Lua, which seems to be a step up and Vim comes with a Perl plugin API (which was removed from NeoVim, but that is a different story - why would someone remove the most potent mature text manipulation programming language from one of the most powerful text editors?).
      + +
      #!/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
      +

      -NeoVim Lua API
      +Using types to create object oriented Korn shell 93 scripts

      -One example is my workflow of how I compose my blog articles (e.g. this one you are currently reading): I am writing everything in NeoVim, but I also want to have every paragraph checked against Grammarly (as English is not my first language). So I write a whole paragraph, then I select the entire paragraph via visual selection with SHIFT+v, and then I press ,y to yank the paragraph to the systems clipboard, then I paste the paragraph to Grammarly's browser window with CTRL+v, let Grammarly suggest the improvements, and then I copy the result back with CTRL+c to the system clipboard and in NeoVim I type ,i to insert the result back overriding the old paragraph (which is still selected in visual mode) with the new content. That all sounds a bit complicated, but it's surprisingly natural and efficient.
      +

      7. This works in Go



      -To come back to the example, for the clipboard integration, I use this small VimScript snippet, and I didn't have to dig into any Lisp or Perl for this:
      +There is no pointer arithmetic in Go like in C, but it is still possible to do some brain teasers with pointers 😧:

      -
      " Clipboard
      -vnoremap ,y !pbcopy<CR>ugv
      -vnoremap ,i !pbpaste<CR>
      -nmap ,i !wpbpaste<CR>
      +
      package main
      +
      +import "fmt"
      +
      +func main() {
      +	var i int
      +	f := func() *int {
      +		return &i
      +	}
      +	*f()++
      +	fmt.Println(i)
      +}
       

      -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.
      +Go playground
      +
      +

      8. "I am a Teapot" HTTP response code


      +
      +Defined in 1998 as one of the IETF's traditional April Fools' jokes (RFC 2324), the Hyper Text Coffee Pot Control Protocol specifies an HTTP status code that is not intended for actual HTTP server implementation. According to the RFC, this code should be returned by teapots when asked to brew coffee. This status code also serves as an Easter egg on some websites, such as Google.com's "I'm a teapot" feature. Occasionally, it is used to respond to a blocked request, even though the more appropriate response would be the 403 Forbidden status code.
      +
      +https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#418
      +
      +

      9. jq is a functional programming language


      +
      +Many know of jq, the handy small tool and swiss army knife for JSON parsing.
      +
      +https://github.com/jqlang/jq
      +
      +What many don't know that jq is actually a full blown functional programming language jqlang, have a look at the language description:
      +
      +https://github.com/jqlang/jq/wiki/jq-Language-Description
      +
      +As a matter of fact, the language is so powerful, that there exists an implementation of jq in jq itself:
      +
      +https://github.com/wader/jqjq
      +
      +Here some snipped from jqjq, to get a feel of jqlang:
      +
      +
      +def _token:
      +	def _re($re; f):
      +	  ( . as {$remain, $string_stack}
      +	  | $remain
      +	  | match($re; "m").string
      +	  | f as $token
      +	  | { result: ($token | del(.string_stack))
      +	    , remain: $remain[length:]
      +	    , string_stack:
      +	        ( if $token.string_stack == null then $string_stack
      +	          else $token.string_stack
      +	          end
      +	        )
      +	    }
      +	  );
      +	if .remain == "" then empty
      +	else
      +	  ( . as {$string_stack}
      +	  | _re("^\\s+"; {whitespace: .})
      +	  // _re("^#[^\n]*"; {comment: .})
      +	  // _re("^\\.[_a-zA-Z][_a-zA-Z0-9]*"; {index: .[1:]})
      +	  // _re("^[_a-zA-Z][_a-zA-Z0-9]*"; {ident: .})
      +	  // _re("^@[_a-zA-Z][_a-zA-Z0-9]*"; {at_ident: .})
      +	  // _re("^\\$[_a-zA-Z][_a-zA-Z0-9]*"; {binding: .})
      +	  # 1.23, .123, 123e2, 1.23e2, 123E2, 1.23e+2, 1.23E-2 or 123
      +	  // _re("^(?:[0-9]*\\.[0-9]+|[0-9]+)(?:[eE][-\\+]?[0-9]+)?"; {number: .})
      +	  // _re("^\"(?:[^\"\\\\]|\\\\.)*?\\\\\\(";
      +	      ( .[1:-2]
      +	      | _unescape
      +	      | {string_start: ., string_stack: ($string_stack+["\\("])}
      +	      )
      +	    )
      +	 .
      +	 .
      +	 .
      +
      +
      +

      10. Regular expression to verify email addresses


      +
      +This is a pretty old meme, but still worth posting here (as some may be unaware). The RFC822 Perl regex to validate email addresses is 😱:
      +
      +
      +(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
      +)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
      +\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
      +?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ 
      +\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
      +31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
      +>(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
      +(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
      +(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
      +|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
      +?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
      +r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
      + \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
      +?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
      +)*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
      + \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
      +)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
      +)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
      +*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+
      +|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r
      +\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:
      +\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t
      +>))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031
      +>+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](
      +?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?
      +:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?
      +:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?
      +:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?
      +[ \t]))*"(?:(?:\r\n)?[ \t])*)*:(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] 
      +\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|
      +\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>
      +@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"
      +(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t]
      +)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
      +".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?
      +:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[
      +\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-
      +\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(
      +?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;
      +:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([
      +^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\"
      +.\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\
      +>\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\
      +[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\
      +r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] 
      +\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]
      +|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \0
      +00-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\
      +.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,
      +;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?
      +:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*
      +(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
      +\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[
      +^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]
      +>))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)(?:,\s*(
      +?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
      +".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(
      +?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[
      +\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t
      +>)*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t
      +>)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?
      +:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
      +\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
      +[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
      +>]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
      +?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
      +()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
      +?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
      +@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
      + \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
      +;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
      +)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
      +".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
      +(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
      +\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
      +\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
      +"()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
      +*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
      ++|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
      +.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
      +|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
      +?:\r\n)?[ \t])*))*)?;\s*)
      +
      +
      +https://pdw.ex-parrot.com/Mail-RFC822-Address.html
      +
      +I hope you had some fun. E-Mail your comments to paul@nospam.buetow.org :-)
      +
      +other related posts are:

      -

      The famous Emacs Org mode


      +Back to the main site
      +
      +
      +
      + + Terminal multiplexing with `tmux` + + https://foo.zone/gemfeed/2024-06-23-terminal-multiplexing-with-tmux.html + 2024-06-23T22:41:59+03:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + Tmux (Terminal Multiplexer) is a powerful, terminal-based tool that manages multiple terminal sessions within a single window. Here are some of its primary features and functionalities: + +
      +

      Terminal multiplexing with tmux



      -Org-mode is an Emacs mode for keeping notes, authoring documents, computational notebooks, literate programming, maintaining to-do lists, planning projects, and more — in a fast and effective plain-text system. There's even a dedicated website for it:
      +Published at 2024-06-23T22:41:59+03:00

      -https://orgmode.org/
      +Tmux (Terminal Multiplexer) is a powerful, terminal-based tool that manages multiple terminal sessions within a single window. Here are some of its primary features and functionalities:

      -In short, Org-mode is an "interactive markup language" that helps you organize everything mentioned above. I rarely touched the surface during my two-month experiment with Emacs, and I am impressed by it, so I see the benefits of having that. But it's not for me.
      +
        +
      • Session management
      • +
      • Window and Pane management
      • +
      • Persistent Workspace
      • +
      • Customization
      • +

      +https://github.com/tmux/tmux/wiki

      -I use "Dead Tree Mode" to organize my work and notes. Dead tree? Yeah, I use an actual pen and a real paper journal (Leuchtturm or a Moleskine and a set of coloured 0.5 Muji Pens are excellent choices). That's far more immersive and flexible than a computer program can ever be. Yes, some automation and interaction with the computer (like calendar scheduling etc.) are missing. Still, an actual paper journal forces you to stay simple and focus on the actual work rather than tinkering with your computer program. (But I could not resist, and I wrote a VimScript which parses a table of contents page in Markdown format of my scanned paper journals, and NeoVim allows me to select a topic so that the corresponding PDF scan on the right journal page gets opened in an external PDF viewer (the PDF viewer is zathura, it uses Vi-keybindings, of course) :-). (See the appendix of this blog post for that script).
      +
      +         _______
      +        |.-----.|
      +        || Tmux||
      +        ||_.-._||
      +        `--)-(--`
      +       __[=== o]___
      +      |:::::::::::|\
      +jgs   `-=========-`()
      +    mod. by Paul B.
      +

      -Zathura
      +

      Table of Contents



      -On the road, I also write some of my notes in Markdown format to NextCloud Notes, which is editable from my phone and via NeoVim on my computers. Markdown is much less powerful than Org-mode, but I prefer it the simple way. There's a neat terminal application, ranger, which I use to browse my NextCloud Notes when they are synced to a local folder on my machine. ranger is a file manager inspired by Vim and therefore makes use of Vim keybindings and it feels just natural to me.
      +
      +

      Before continuing...



      -Ranger - A Vim inspired file manager
      -Did I mention that I also use my zsh (my default shell) and my tmux (terminal multiplexer) in Vi-mode?
      +Before continuing to read this post, I encourage you to get familiar with Tmux first (unless you already know the basics). You can go through the official getting started guide:

      -Z shell
      -tmux terminal multiplexer
      +https://github.com/tmux/tmux/wiki/Getting-Started

      -

      Seeking simplicity


      +I can also recommend this book (this is the book I got started with with Tmux):

      -I am not ready to dive deep into the whole world of Emacs. I prefer small and simple tools as opposed to complex tools. Emacs comes with many features out of the box, whereas in Vim/NeoVim, you would need to install many plugins to replicate some of the behaviour. Yes, I need to invest time managing all the Vim/NeoVim plugins I use, but I feel more in control compared to Doom Emacs, where a framework around vanilla Emacs manages all the plugins. I could use vanilla Emacs and manage all my plugins the vanilla way, but for me, it's not worth the effort to learn and dive into that as all that I want to do I can already do with Vim/NeoVim.
      +https://pragprog.com/titles/bhtmux2/tmux-2/

      -I am not saying that Vim/NeoVim are simple programs, but they are much simpler than Emacs with much smaller footprints; furthermore, they appear to be more straightforward as I am used to them. I only need Vim/NeoVim to be an editor, an IDE (through some plugins), and nothing more.
      +Over the years, I have built a couple of shell helper functions to optimize my workflows. Tmux is extensively integrated into my daily workflows (personal and work). I had colleagues asking me about my Tmux config and helper scripts for Tmux several times. It would be neat to blog about it so that everyone interested in it can make a copy of my configuration and scripts.

      -

      Conclusion


      +The configuration and scripts in this blog post are only the non-work-specific parts. There are more helper scripts, which I only use for work (and aren't really useful outside of work due to the way servers and clusters are structured there).

      -I understand the Emacs users now. Emacs is an incredibly powerful platform for almost everything, not just text editing. With Emacs, you can do nearly everything (Writing, editing, programming, calendar scheduling and note taking, Jira integration, playing games, listening to music, reading/writing emails, browsing the web, using as a calculator, generating HTML pages, configuring interactive menus, jumping around between every feature and every file within one single session, chat on IRC, surf the Gopherspace, ... the options are endless....). If you want to have one piece of software which rules it all and you are happy to invest a large part of your time in your platform: Pick Emacs, and over time Emacs will become "your" Emacs, customized to your own needs and change the way it works, which makes the Emacs users stick even more to it.
      +Tmux is highly configurable, and I think I am only scratching the surface of what is possible with it. Nevertheless, it may still be useful for you. I also love that Tmux is part of the OpenBSD base system!

      -Vim/NeoVim also comes with a very high degree of customization options, but to a lesser extreme than Emacs (but still, a much higher degree than most other editors out there). If you want the best text editor in the world, which can also be tweaked to be a decent IDE, you are only looking for: Pick Vim or NeoVim! You would also need to invest a lot of time in learning, tweaking and customizing Vim/NeoVim, but that's a little more straightforward, and the result is much more lightweight once you get used to the "Vi way of doing things" you never would want to change back. I haven't tried the Emacs vanilla keystrokes, but they are terrible (that's probably one of the reasons why Doom Emacs uses Vim keybindings by default).
      +

      Shell aliases



      -Update: One reader recommended to have a look at NvChad. NvChad is a NeoVim config written in Lua aiming to provide a base configuration with very beautiful UI and blazing fast startuptime (around 0.02 secs ~ 0.07 secs). They tweak UI plugins such as telescope, nvim-tree, bufferline etc well to provide an aesthetic UI experience. That sounds interesting!
      +I am a user of the Z-Shell (zsh), but I believe all the snippets mentioned in this blog post also work with Bash.

      -https://github.com/NvChad/NvChad
      +https://www.zsh.org

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +For the most common Tmux commands I use, I have created the following shell aliases:

      -Back to the main site
      -
      -
      -
      - - Installing DTail on OpenBSD - - https://foo.zone/gemfeed/2022-10-30-installing-dtail-on-openbsd.html - 2022-10-30T11:03:19+02:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - This will be a quick blog post, as I am busy with my personal life now. I have relocated to a different country and am still busy arranging things. So bear with me :-) - -
      -

      Installing DTail on OpenBSD


      + +
      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
      +

      -Published at 2022-10-30T11:03:19+02:00
      +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.

      -
      -       ,_---~~~~~----._
      - _,,_,*^____      _____``*g*\"*,
      -/ __/ /'     ^.  /      \ ^@q   f
      - @f   |       |  |       |  0 _/
      -\`/   \~__((@/ __ \__((@/    \
      - |           _l__l_           I    <--- The Go Gopher
      - }          [______]           I
      - ]            | | |            |
      - ]             ~ ~             |
      - |                            |
      -  |                           |
      -  |                           |       A       ;
      -~~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~,--,-/ \---,-/|~~,~~~~~~~~~~~~~~~~~~~~~~~~~~~
      -                           _|\,'. /|      /|   `/|-.
      -                       \`.'    /|      ,            `;.
      -                      ,'\   A     A         A   A _ /| `.;
      -                    ,/  _              A       _  / _   /|  ;
      -                   /\  / \   ,  ,           A  /    /     `/|
      -                  /_| | _ \         ,     ,             ,/  \
      -                 // | |/ `.\  ,-      ,       ,   ,/ ,/      \/
      -                 / @| |@  / /'   \  \      ,              >  /|    ,--.
      -                |\_/   \_/ /      |  |           ,  ,/        \  ./' __:..
      -                |  __ __  |       |  | .--.  ,         >  >   |-'   /     `
      -              ,/| /  '  \ |       |  |     \      ,           |    /
      -             /  |<--.__,->|       |  | .    `.        >  >    /   (
      -            /_,' \\  ^  /  \     /  /   `.    >--            /^\   |
      -                  \\___/    \   /  /      \__'     \   \   \/   \  |
      -                   `.   |/          ,  ,                  /`\    \  )
      -                     \  '  |/    ,       V    \          /        `-\
      - OpenBSD Puffy --->   `|/  '  V      V           \    \.'            \_
      -                       '`-.       V       V        \./'\
      -                           `|/-.      \ /   \ /,---`\         kat
      -                            /   `._____V_____V'
      -                                       '     '
      +The first two are pretty straightforward. tm is simply a shorthand for tmux, so I have to type less, and tl lists all Tmux sessions that are currently open. No magic here.
      +
      +

      The tn alias - Creating a new session


      +
      +The tn alias is referencing this function:
      +
      + +
      # 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
       

      -This will be a quick blog post, as I am busy with my personal life now. I have relocated to a different country and am still busy arranging things. So bear with me :-)
      +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.

      - In this post, I want to give a quick overview (or how-to) about installing DTail on OpenBSD, as the official documentation only covers Red Hat and Fedora Linux! And this blog post will also be used as my reference!
      +First, a Tmux session name can be passed to the function as a first argument. That session name is only optional. Without it, Tmux will select a session named T$($date +%s) as a default. Which is T followed by the UNIX epoch, e.g. T1717133796.

      -https://dtail.dev
      +

      Cleaning up default sessions automatically



      -I am using Rexify for my OpenBSD automation. Check out the following article covering my Rex setup in a little bit more detail:
      +Note also the call to tmux::cleanup_default; it would clean up all already opened default sessions if they aren't attached. Those sessions were only temporary, and I had too many flying around after a while. So, I decided to auto-delete the sessions if they weren't attached. If I want to keep sessions around, I will rename them with the Tmux command prefix-key $. This is the cleanup function:

      -Let's Encrypt with OpenBSD and Rex
      + +
      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
      +}
      +

      -I will also mention some relevant Rexfile snippets in this post!
      +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.

      -

      Compile it


      +

      Renaming sessions



      -First of all, DTail needs to be downloaded and compiled. For that, git, go, and gmake are required:
      +Whenever I am in a temporary session (named T....), I may decide that I want to keep this session around. I have to rename the session to prevent the cleanup function from doing its thing. That's, as mentioned already, easily accomplished with the standard prefix-key $ Tmux command.

      -
      -$ doas pkg_add git go gmake
      -
      +

      The ta alias - Attaching to a session



      -I am happy that the Go Programming Language is readily available in the OpenBSD packaging system. Once the dependencies got installed, clone DTail and compile it:
      +This alias refers to the following function, which tries to attach to an already-running Tmux session.

      -
      -$ mkdir git
      -$ cd git
      -$ git clone https://github.com/mimecast/dtail
      -$ cd dtail
      -$ gmake 
      +
      +
      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
       

      -You can verify the version by running the following command:
      +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.

      -
      -$ ./dtail --version
      - DTail  4.1.0  Protocol 4.1  Have a lot of fun!
      -$ file dtail
      - dtail: ELF 64-bit LSB executable, x86-64, version 1
      +

      The tr alias - For a nested remote session


      +
      +This SSHs into the remote server specified and then, remotely on the server itself, starts a nested Tmux session. So we have one Tmux session on the local computer and, inside of it, an SSH connection to a remote server with a Tmux session running again. The benefit of this is that, in case my network connection breaks down, the next time I connect, I can continue my work on the remote server exactly where I left off. The session name is the name of the server being SSHed into. If a session like this already exists, it simply attaches to it.
      +
      + +
      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
       

      -Now, there isn't any need anymore to keep git, go and gmake, so they can be deinstalled now:
      +

      Change of the Tmux prefix for better nesting


      +
      +To make nested Tmux sessions work smoothly, one must change the Tmux prefix key locally or remotely. By default, the Tmux prefix key is Ctrl-b, so Ctrl-b $, for example, renames the current session. To change the prefix key from the standard Ctrl-b to, for example, Ctrl-g, you must add this to the tmux.conf:

      -$ doas pkg_delete git go gmake
      +set-option -g prefix C-g
       

      -One day I shall create an official OpenBSD port for DTail.
      +This way, when I want to rename the remote Tmux session, I have to use Ctrl-g $, and when I want to rename the local Tmux session, I still have to use Ctrl-b $. In my case, I have this deployed to all remote servers through a configuration management system (out of scope for this blog post).

      -

      Install it


      +There might also be another way around this (without reconfiguring the prefix key), but that is cumbersome to use, as far as I remember.

      -Installing the binaries is now just a matter of copying them to /usr/local/bin as follows:
      +

      The ts alias - Searching sessions with fuzzy finder



      -
      -$ for bin in dserver dcat dgrep dmap dtail dtailhealth; do
      -  doas cp -p $bin /usr/local/bin/$bin
      -  doas chown root:wheel /usr/local/bin/$bin
      -done
      +Despite the fact that with tmux::cleanup_default, I don't leave a huge mess with trillions of Tmux sessions flying around all the time, at times, it can become challenging to find exactly the session I am currently interested in. After a busy workday, I often end up with around twenty sessions on my laptop. This is where fuzzy searching for session names comes in handy, as I often don't remember the exact session names.
      +
      + +
      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
       

      -Also, we will be creating the _dserver service user:
      +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).

      -
      -$ doas adduser -class nologin -group _dserver -batch _dserver
      -$ doas usermod -d /var/run/dserver/ _dserver
      -
      +You must install the fzf command on your computer for this to work. This is how it looks like:

      -The OpenBSD init script is created from scratch (not part of the official DTail project). Run the following to install the bespoke script:
      +Tmux session fuzzy finder

      -
      -$ cat <<'END' | doas tee /etc/rc.d/dserver
      -#!/bin/ksh
      -
      -daemon="/usr/local/bin/dserver"
      -daemon_flags="-cfg /etc/dserver/dtail.json"
      -daemon_user="_dserver"
      -
      -. /etc/rc.d/rc.subr
      -
      -rc_reload=NO
      +

      The tssh alias - Cluster SSH replacement


      +
      +Before I used Tmux, I was a heavy user of ClusterSSH, which allowed me to log in to multiple servers at once in a single terminal window and type and run commands on all of them in parallel.
      +
      +https://github.com/duncs/clusterssh
      +
      +However, since I started using Tmux, I retired ClusterSSH, as it came with the benefit that Tmux only needs to be run in the terminal, whereas ClusterSSH spawned terminal windows, which aren't easily portable (e.g., from a Linux desktop to macOS). The tmux::cluster_ssh function can have N arguments, where:
      +
      +
        +
      • ...the first argument will be the session name (see tmux::tssh_from_argument helper function), and all remaining arguments will be server hostnames/FQDNs to connect to simultaneously.
      • +
      • ...or, the first argument is a file name, and the file contains a list of hostnames/FQDNs (see tmux::ssh_from_file helper function)
      • +

      +This is the function definition behind the tssh alias:
      +
      + +
      tmux::cluster_ssh () {
      +    if [ -f "$1" ]; then
      +        tmux::tssh_from_file $1
      +        return
      +    fi
       
      -rc_pre() {
      -    install -d -o _dserver /var/log/dserver
      -    install -d -o _dserver /var/run/dserver/cache
      +    tmux::tssh_from_argument $@
       }
      -
      -rc_cmd $1 &
      -END
      -$ doas chmod 755 /etc/rc.d/dserver
      +alias tssh=tmux::cluster_ssh
       

      -

      Rexification


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

      -This is the task for setting it up via Rex. Note the . . . ., that's a placeholder which we will fill up more and more during this blog post:
      +

      The tmux::tssh_from_argument helper


      +
      +This is the most magic helper function we will cover in this post. It looks like this:
      +
      + +
      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.
      +
      +Sometimes, I don't want the synchronized panes behavior and want to switch it off temporarily. I can do that with prefix-key p and prefix-key P after adding the following to my local tmux.conf:

      -desc 'Setup DTail';
      -task 'dtail', group => 'frontends',
      -   sub {
      -      my $restart = FALSE;
      -
      -      file '/etc/rc.d/dserver':
      -        content => template('./etc/rc.d/dserver.tpl'),
      -        owner => 'root',
      -        group => 'wheel',
      -        mode => '755',
      -        on_change => sub { $restart = TRUE };
      -
      -        .
      -        .
      -        .
      -        .
      +bind-key p setw synchronize-panes off
      +bind-key P setw synchronize-panes on
      +
      +
      +

      The tmux::tssh_from_file helper


      +
      +This one sets the session name to the file name and then reads a list of servers from that file, passing the list of servers to tmux::tssh_from_argument as the arguments. So, this is a neat little wrapper that also enables me to open clustered SSH sessions from an input file.
      +
      + +
      tmux::tssh_from_file () {
      +    local -r serverlist=$1; shift
      +    local -r session=$(basename $serverlist | cut -d. -f1)
       
      -      service 'dserver' => 'restart' if $restart;
      -      service 'dserver', ensure => 'started';
      -   };
      +    tmux::tssh_from_argument $session $(awk '{ print $1} ' $serverlist | sed 's/.lan./.lan/g')
      +}
       

      -

      Configure it


      +

      tssh examples



      -Now, DTail is fully installed but still needs to be configured. Grab the default config file from GitHub ...
      +To open a new session named fish and log in to 4 remote hosts, run this command (Note that it is also possible to specify the remote user):

      -$ doas mkdir /etc/dserver
      -$ curl https://raw.githubusercontent.com/mimecast/dtail/master/examples/dtail.json.examples |
      -    doas tee /etc/dserver/dtail.json
      +$ tssh fish blowfish.buetow.org fishfinger.buetow.org \
      +    fishbone.buetow.org user@octopus.buetow.org
       

      -... and then edit it and adjust LogDir in the Common section to /var/log/dserver. The result will look like this:
      +To open a new session named manyservers, put many servers (one FQDN per line) into a file called manyservers.txt and simply run:

      -  "Common": {
      -    "LogDir": "/var/log/dserver",
      -    "Logger": "Fout",
      -    "LogRotation": "Daily",
      -    "CacheDir": "cache",
      -    "SSHPort": 2222,
      -    "LogLevel": "Info"
      -  }
      +$ tssh manyservers.txt
       

      -

      Rexification


      +

      Common Tmux commands I use in tssh



      -That's as simple as adding the following to the Rex task:
      +These are default Tmux commands that I make heavy use of in a tssh session:
      +
      +
        +
      • Press prefix-key DIRECTION to switch panes. DIRECTION is by default any of the arrow keys, but I also configured Vi keybindings.
      • +
      • Press prefix-key <space> to change the pane layout (can be pressed multiple times to cycle through them).
      • +
      • Press prefix-key z to zoom in and out of the current active pane.
      • +

      +

      Copy and paste workflow


      +
      +As you will see later in this blog post, I have configured a history limit of 1 million items in Tmux so that I can scroll back quite far. One main workflow of mine is to search for text in the Tmux history, select and copy it, and then switch to another window or session and paste it there (e.g., into my text editor to do something with it).
      +
      +This works by pressing prefix-key [ to enter Tmux copy mode. From there, I can browse the Tmux history of the current window using either the arrow keys or vi-like navigation (see vi configuration later in this blog post) and the Pg-Dn and Pg-Up keys.
      +
      +I often search the history backwards with prefix-key [ followed by a ?, which opens the Tmux history search prompt.
      +
      +Once I have identified the terminal text to be copied, I enter visual select mode with v, highlight all the text to be copied (using arrow keys or Vi motions), and press y to yank it (sorry if this all sounds a bit complicated, but Vim/NeoVim users will know this, as it is pretty much how you do it there as well).
      +
      +For v and y to work, the following has to be added to the Tmux configuration file:

      -file '/etc/dserver',
      -  ensure => 'directory';
      -
      -file '/etc/dserver/dtail.json',
      -  content => template('./etc/dserver/dtail.json.tpl'),
      -  owner => 'root',
      -  group => 'wheel',
      -  mode => '755',
      -  on_change => sub { $restart = TRUE };
      +bind-key -T copy-mode-vi 'v' send -X begin-selection
      +bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
       

      -

      Update the key cache for it


      +Once the text is yanked, I switch to another Tmux window or session where, for example, a text editor is running and paste the yanked text from Tmux into the editor with prefix-key ]. Note that when pasting into a modal text editor like Vi or Helix, you would first need to enter insert mode before prefix-key ] would paste anything.

      -DTail relies on SSH for secure authentication and communication. However, the system user _dserver has no permission to read the SSH public keys from the user's home directories, so the DTail server also checks for available public keys in an alternative path /var/run/dserver/cache.
      +

      Tmux configurations



      -The following script, populating the DTail server key cache, can be run periodically via CRON:
      +Some features I have configured directly in Tmux don't require an external shell alias to function correctly. Let's walk line by line through my local ~/.config/tmux/tmux.conf:

      -$ cat <<'END' | doas tee /usr/local/bin/dserver-update-key-cache.sh
      -#!/bin/ksh
      -
      -CACHEDIR=/var/run/dserver/cache
      -DSERVER_USER=_dserver
      -DSERVER_GROUP=_dserver
      -
      -echo 'Updating SSH key cache'
      -
      -ls /home/ | while read remoteuser; do
      -    keysfile=/home/$remoteuser/.ssh/authorized_keys
      -
      -    if [ -f $keysfile ]; then
      -        cachefile=$CACHEDIR/$remoteuser.authorized_keys
      -        echo "Caching $keysfile -> $cachefile"
      -
      -        cp $keysfile $cachefile
      -        chown $DSERVER_USER:$DSERVER_GROUP $cachefile
      -        chmod 600 $cachefile
      -    fi
      -done
      +source ~/.config/tmux/tmux.local.conf
       
      -# Cleanup obsolete public SSH keys
      -find $CACHEDIR -name \*.authorized_keys -type f |
      -while read cachefile; do
      -    remoteuser=$(basename $cachefile | cut -d. -f1)
      -    keysfile=/home/$remoteuser/.ssh/authorized_keys
      -
      -    if [ ! -f $keysfile ]; then
      -        echo 'Deleting obsolete cache file $cachefile'
      -        rm $cachefile
      -    fi
      -done
      -
      -echo 'All set...'
      -END
      -$ doas chmod 500 /usr/local/bin/dserver-update-key-cache.sh
      +set-option -g allow-rename off
      +set-option -g history-limit 100000
      +set-option -g status-bg '#444444'
      +set-option -g status-fg '#ffa500'
      +set-option -s escape-time 0
       

      -Note that the script above is a slight variation of the official DTail script. The official DTail one is a bash script, but on OpenBSD, there's ksh. I run it once daily by adding it to the daily.local:
      +There's yet to be much magic happening here. I source a tmux.local.conf, which I sometimes use to override the default configuration that comes from the configuration management system. But it is mostly just an empty file, so it doesn't throw any errors on Tmux startup when I don't use it.
      +
      +I work with many terminal outputs, which I also like to search within Tmux. So, I added a large enough history-limit, enabling me to search backwards in Tmux for any output up to a million lines of text.
      +
      +Besides changing some colours (personal taste), I also set escape-time to 0, which is just a workaround. Otherwise, my Helix text editor's ESC key would take ages to trigger within Tmux. I am trying to remember the gory details. You can leave it out; if everything works fine for you, leave it out.
      +
      +The next lines in the configuration file are:

      -$ echo /usr/local/bin/dserver-update-key-cache.sh | doas tee -a /etc/daily.local
      -/usr/local/bin/dserver-update-key-cache.sh
      +set-window-option -g mode-keys vi
      +bind-key -T copy-mode-vi 'v' send -X begin-selection
      +bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
       

      -

      Rexification


      +I navigate within Tmux using Vi keybindings, so the mode-keys is set to vi. I use the Helix modal text editor, which is close enough to Vi bindings for simple navigation to feel "native" to me. (By the way, I have been a long-time Vim and NeoVim user, but I eventually switched to Helix. It's off-topic here, but it may be worth another blog post once.)

      -That's done by adding ...
      +The two bind-key commands make it so that I can use v and y in copy mode, which feels more Vi-like (as already discussed earlier in this post).
      +
      +The next set of lines in the configuration file are:

      -file '/usr/local/bin/dserver-update-key-cache.sh',
      -  content => template('./scripts/dserver-update-key-cache.sh.tpl'),
      -  owner => 'root',
      -  group => 'wheel',
      -  mode => '500';
      +bind-key h select-pane -L
      +bind-key j select-pane -D
      +bind-key k select-pane -U
      +bind-key l select-pane -R
       
      -append_if_no_such_line '/etc/daily.local', '/usr/local/bin/dserver-update-key-cache.sh';
      +bind-key H resize-pane -L 5
      +bind-key J resize-pane -D 5
      +bind-key K resize-pane -U 5
      +bind-key L resize-pane -R 5
       

      -... to the Rex task!
      -
      -

      Start it


      +These allow me to use prefix-key h, prefix-key j, prefix-key k, and prefix-key l for switching panes and prefix-key H, prefix-key J, prefix-key K, and prefix-key L for resizing the panes. If you don't know Vi/Vim/NeoVim, the letters hjkl are commonly used there for left, down, up, and right, which is also the same for Helix, by the way.

      -Now, it's time to enable and start the DTail server:
      +The next set of lines in the configuration file are:

      -$ sudo rcctl enable dserver
      -$ sudo rcctl start dserver
      -$ tail -f /var/log/dserver/*.log
      -INFO|1022-090634|Starting scheduled job runner after 2s
      -INFO|1022-090634|Starting continuous job runner after 2s
      -INFO|1022-090644|24204|stats.go:53|2|11|7|||MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=0
      -INFO|1022-090654|24204|stats.go:53|2|11|7|||MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=0
      -INFO|1022-090719|Starting server|DTail 4.1.0 Protocol 4.1 Have a lot of fun!
      -INFO|1022-090719|Generating private server RSA host key
      -INFO|1022-090719|Starting server
      -INFO|1022-090719|Binding server|0.0.0.0:2222
      -INFO|1022-090719|Starting scheduled job runner after 2s
      -INFO|1022-090719|Starting continuous job runner after 2s
      -INFO|1022-090729|86050|stats.go:53|2|11|7|||MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=0
      -INFO|1022-090739|86050|stats.go:53|2|11|7|||MAPREDUCE:STATS|currentConnections=0|lifetimeConnect
      -.
      -.
      -.
      -Ctr+C
      +bind-key c new-window -c '#{pane_current_path}'
      +bind-key F new-window -n "session-switcher" "tmux list-sessions | fzf | cut -d: -f1 | xargs tmux switch-client -t"
      +bind-key T choose-tree
       

      -As we don't want to wait until tomorrow, let's populate the key cache manually:
      +The first one is that any new window starts in the current directory. The second one is more interesting. I list all open sessions in the fuzzy finder. I rely heavily on this during my daily workflow to switch between various sessions depending on the task. E.g. from a remote cluster SSH session to a local code editor.
      +
      +The third one, choose-tree, opens a tree view in Tmux listing all sessions and windows. This one is handy to get a better overview of what is currently running in any local Tmux session. It looks like this (it also allows me to press a hotkey to switch to a particular Tmux window):

      +Tmux sessiont tree view
      +
      +
      +The last remaining lines in my configuration file are:
      +
      -$ doas /usr/local/bin/dserver-update-key-cache.sh
      -Updating SSH key cache
      -Caching /home/_dserver/.ssh/authorized_keys -> /var/cache/dserver/_dserver.authorized_keys
      -Caching /home/admin/.ssh/authorized_keys -> /var/cache/dserver/admin.authorized_keys
      -Caching /home/failunderd/.ssh/authorized_keys -> /var/cache/dserver/failunderd.authorized_keys
      -Caching /home/git/.ssh/authorized_keys -> /var/cache/dserver/git.authorized_keys
      -Caching /home/paul/.ssh/authorized_keys -> /var/cache/dserver/paul.authorized_keys
      -Caching /home/rex/.ssh/authorized_keys -> /var/cache/dserver/rex.authorized_keys
      -All set...
      +bind-key p setw synchronize-panes off
      +bind-key P setw synchronize-panes on
      +bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "tmux.conf reloaded"
       

      -

      Use it


      +We discussed synchronized panes earlier. I use it all the time in clustered SSH sessions. When enabled, all panes (remote SSH sessions) receive the same keystrokes. This is very useful when you want to run the same commands on many servers at once, such as navigating to a common directory, restarting a couple of services at once, or running tools like htop to quickly monitor system resources.

      -The DTail server is now ready to serve connections. You can use any DTail commands, such as dtail, dgrep, dmap, dcat, dtailhealth, to do so. Checkout out all the usage examples on the official DTail page.
      +The last one reloads my Tmux configuration on the fly.

      -I have installed DTail server this way on my personal OpenBSD frontends blowfish, and fishfinger, and the following command connects as user rex to both machines and greps the file /etc/fstab for the string local:
      +E-Mail your comments to paul@nospam.buetow.org :-)
      +
      +Back to the main site
      +
      +
      +
      + + Projects I currently don't have time for + + https://foo.zone/gemfeed/2024-05-03-projects-i-currently-dont-have-time-for.html + 2024-05-03T16:23:03+03:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + Over the years, I have collected many ideas for my personal projects and noted them down. I am currently in the process of cleaning up all my notes and reviewing those ideas. I don’t have time for the ones listed here and won’t have any soon due to other commitments and personal projects. So, in order to 'get rid of them' from my notes folder, I decided to simply put them in this blog post so that those ideas don't get lost. Maybe I will pick up one or another idea someday in the future, but for now, they are all put on ice in favor of other personal projects or family time. + +
      +

      Projects I currently don't have time for


      +
      +Published at 2024-05-03T16:23:03+03:00
      +
      +Over the years, I have collected many ideas for my personal projects and noted them down. I am currently in the process of cleaning up all my notes and reviewing those ideas. I don’t have time for the ones listed here and won’t have any soon due to other commitments and personal projects. So, in order to "get rid of them" from my notes folder, I decided to simply put them in this blog post so that those ideas don't get lost. Maybe I will pick up one or another idea someday in the future, but for now, they are all put on ice in favor of other personal projects or family time.

      -❯ ./dgrep -user rex -servers blowfish.buetow.org,fishfinger.buetow.org --regex local /etc/fstab
      -CLIENT|earth|WARN|Encountered unknown host|{blowfish.buetow.org:2222 0xc0000a00f0 0xc0000a61e0 [blowfish.buetow.org]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9ZnF/LAk14SgqCzk38yENVTNfqibcluMTuKx1u53cKSp2xwHWzy0Ni5smFPpJDIQQljQEJl14ZdXvhhjp1kKHxJ79ubqRtIXBlC0PhlnP8Kd+mVLLHYpH9VO4rnaSfHE1kBjWkI7U6lLc6ks4flgAgGTS5Bb7pLAjwdWg794GWcnRh6kSUEQd3SftANqQLgCunDcP2Vc4KR9R78zBmEzXH/OPzl/ANgNA6wWO2OoKKy2VrjwVAab6FW15h3Lr6rYIw3KztpG+UMmEj5ReexIjXi/jUptdnUFWspvAmzIl6kwzzF8ExVyT9D75JRuHvmxXKKjyJRxqb8UnSh2JD4JN [23.88.35.144]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9ZnF/LAk14SgqCzk38yENVTNfqibcluMTuKx1u53cKSp2xwHWzy0Ni5smFPpJDIQQljQEJl14ZdXvhhjp1kKHxJ79ubqRtIXBlC0PhlnP8Kd+mVLLHYpH9VO4rnaSfHE1kBjWkI7U6lLc6ks4flgAgGTS5Bb7pLAjwdWg794GWcnRh6kSUEQd3SftANqQLgCunDcP2Vc4KR9R78zBmEzXH/OPzl/ANgNA6wWO2OoKKy2VrjwVAab6FW15h3Lr6rYIw3KztpG+UMmEj5ReexIjXi/jUptdnUFWspvAmzIl6kwzzF8ExVyT9D75JRuHvmxXKKjyJRxqb8UnSh2JD4JN 0xc0000a2180}
      -CLIENT|earth|WARN|Encountered unknown host|{fishfinger.buetow.org:2222 0xc0000a0150 0xc000460110 [fishfinger.buetow.org]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNiikdL7+tWSN0rCaw1tOd9aQgeUFgb830V9ejkyJ5h93PKLCWZSMMCtiabc1aUeUZR//rZjcPHFLuLq/YC+Y3naYtGd6j8qVrcfG8jy3gCbs4tV9SZ9qd5E24mtYqYdGlee6JN6kEWhJxFkEwPfNlG+YAr3KC8lvEAE2JdWvaZavqsqMvHZtAX3b25WCBf2HGkyLZ+d9cnimRUOt+/+353BQFCEct/2mhMVlkr4I23CY6Tsufx0vtxx25nbFdZias6wmhxaE9p3LiWXygPWGU5iZ4RSQSImQz4zyOc9rnJeP1rwGk0OWDJhdKNXuf0kIPdzMfwxv2otgY32/DJj6L [46.23.94.99]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNiikdL7+tWSN0rCaw1tOd9aQgeUFgb830V9ejkyJ5h93PKLCWZSMMCtiabc1aUeUZR//rZjcPHFLuLq/YC+Y3naYtGd6j8qVrcfG8jy3gCbs4tV9SZ9qd5E24mtYqYdGlee6JN6kEWhJxFkEwPfNlG+YAr3KC8lvEAE2JdWvaZavqsqMvHZtAX3b25WCBf2HGkyLZ+d9cnimRUOt+/+353BQFCEct/2mhMVlkr4I23CY6Tsufx0vtxx25nbFdZias6wmhxaE9p3LiWXygPWGU5iZ4RSQSImQz4zyOc9rnJeP1rwGk0OWDJhdKNXuf0kIPdzMfwxv2otgY32/DJj6L 0xc0000a2240}
      -Encountered 2 unknown hosts: 'blowfish.buetow.org:2222,fishfinger.buetow.org:2222'
      -Do you want to trust these hosts?? (y=yes,a=all,n=no,d=details): a
      -CLIENT|earth|INFO|STATS:STATS|cgocalls=11|cpu=8|connected=2|servers=2|connected%=100|new=2|throttle=0|goroutines=19
      -CLIENT|earth|INFO|Added hosts to known hosts file|/home/paul/.ssh/known_hosts
      -REMOTE|blowfish|100|7|fstab|31bfd9d9a6788844.h /usr/local ffs rw,wxallowed,nodev 1 2
      -REMOTE|fishfinger|100|7|fstab|093f510ec5c0f512.h /usr/local ffs rw,wxallowed,nodev 1 2
      +Art by Laura Brown
      +
      +.'`~~~~~~~~~~~`'.
      +(  .'11 12 1'.  )
      +|  :10 \    2:  |
      +|  :9   @-> 3:  |
      +|  :8       4;  |
      +'. '..7 6 5..' .'
      + ~-------------~  ldb
      +
       

      -Running it the second time, and given that you trusted the keys the first time, it won't prompt you for the host keys anymore:
      +

      Table of Contents


      +
      +
      +

      Hardware projects I don't have time for


      +
      +

      I use Arch, btw!


      +
      +The idea was to build the ultimate Arch Linux setup on an old ThinkPad X200 booting with the open-source LibreBoot firmware, complete with a tiling window manager, dmenu, and all the elite tools. This is mainly for fun, as I am pretty happy (and productive) with my Fedora Linux setup. I ran EndeavourOS (close enough to Arch) on an old ThinkPad for a while, but then I switched back to Fedora because the rolling releases were annoying (there were too many updates).
      +
      +

      OpenBSD home router


      +
      +In my student days, I operated a 486DX PC with OpenBSD as my home DSL internet router. I bought the setup from my brother back then. The router's hostname was fishbone, and it performed very well until it became too slow for larger broadband bandwidth after a few years of use.
      +
      +I had the idea to revive this concept, implement fishbone2, and place it in front of my proprietary ISP router to add an extra layer of security and control in my home LAN. It would serve as the default gateway for all of my devices, including a Wi-Fi access point, would run a DNS server, Pi-hole proxy, VPN client, and DynDNS client. I would also implement high availability using OpenBSD's CARP protocol.
      +
      +https://openbsdrouterguide.net
      +https://pi-hole.net/
      +https://www.OpenBSD.org
      +https://www.OpenBSD.org/faq/pf/carp.html
      +
      +However, I am putting this on hold as I have opted for an OpenWRT-based solution, which was much quicker to set up and runs well enough.
      +
      +https://OpenWRT.org/
      +
      +

      Pi-Hole server


      +
      +Install Pi-hole on one of my Pis or run it in a container on Freekat. For now, I am putting this on hold as the primary use for this would be ad-blocking, and I am avoiding surfing ad-heavy sites anyway. So there's no significant use for me personally at the moment.
      +
      +https://pi-hole.net/
      +
      +

      Infodash


      +
      +The idea was to implement my smart info screen using purely open-source software. It would display information such as the health status of my personal infrastructure, my current work tracker balance (I track how much I work to prevent overworking), and my sports balance (I track my workouts to stay within my quotas for general health). The information would be displayed on a small screen in my home office, on my Pine watch, or remotely from any terminal window.
      +
      +I don't have this, and I haven't missed having it, so I guess it would have been nice to have it but not provide any value other than the "fun of tinkering."
      +
      +

      Reading station


      +
      +I wanted to create the most comfortable setup possible for reading digital notes, articles, and books. This would include a comfy armchair, a silent barebone PC or Raspberry Pi computer running either Linux or *BSD, and an e-Ink display mounted on a flexible arm/stand. There would also be a small table for my paper journal for occasional note-taking. There are a bunch of open-source software available for PDF and ePub reading. It would have been neat, but I am currently using the most straightforward solution: a Kobo Elipsa 2E, which I can use on my sofa.
      +
      +

      Retro station


      +
      +I had an idea to build a computer infused with retro elements. It wouldn't use actual retro hardware but would look and feel like a retro machine. I would call this machine HAL or Retron.
      +
      +I would use an old ThinkPad laptop placed on a horizontal stand, running NetBSD, and attaching a keyboard from ModelFkeyboards. I use WindowMaker as a window manager and run terminal applications through Retro Term. For the monitor, I would use an older (black) EIZO model with large bezels.
      +
      +https://www.NetBSD.org
      +https://www.modelfkeyboards.com
      +https://github.com/Swordfish90/cool-retro-term)
      +
      +The computer would occasionally be used to surf the Gemini space, take notes, blog, or do light coding. However, I have abandoned the project for now because there isn't enough space in my apartment, as my daughter will have a room for herself.
      +
      +

      Sound server


      +
      +My idea involved using a barebone mini PC running FreeBSD with the Navidrome sound server software. I could remotely connect to it from my phone, workstation/laptop to listen to my music collection. The storage would be based on ZFS with at least two drives for redundancy. The app would run in a Linux Docker container under FreeBSD via Bhyve.
      +
      +https://github.com/navidrome/navidrome
      +https://wiki.freebsd.org/bhyve
      +
      +

      Project Freekat


      +
      +My idea involved purchasing the Meerkat mini PC from System76 and installing FreeBSD. Like the sound-server idea (see previous idea), it would run Linux Docker through Bhyve. I would self-host a bunch of applications on it:
      +
      +
        +
      • Wallabag
      • +
      • Ankidroid
      • +
      • Miniflux & Postgres
      • +
      • Audiobookshelf
      • +
      • ...
      • +

      +All of this would be within my LAN, but the services would also be accessible from the internet through either Wireguard or SSH reverse tunnels to one of my OpenBSD VMs, for example:
      +
      +
        +
      • wallabag.awesome.buetow.org
      • +
      • ankidroid.awesome.buetow.org
      • +
      • miniflux.awesome.buetow.org
      • +
      • audiobookshelf.awesome.buetow.org
      • +
      • ...
      • +

      +I am abandoning this project for now, as I am currently hosting my apps on AWS ECS Fargate under *.cool.buetow.org, which is "good enough" for the time being and also offers the benefit of learning to use AWS and Terraform, knowledge that can be applied at work.
      +
      +My personal AWS setup
      +
      +

      Programming projects I don't have time for


      +
      +

      CLI-HIVE


      +
      +This was a pet project idea that my brother and I had. The concept was to collect all shell history of all servers at work in a central place, apply ML/AI, and return suggestions for commands to type or allow a fuzzy search on all the commands in the history. The recommendations for the commands on a server could be context-based (e.g., past occurrences on the same server type).
      +
      +You could decide whether to share your command history with others so they would receive better suggestions depending on which server they are on, or you could keep all the history private and secure. The plan was to add hooks into zsh and bash shells so that all commands typed would be pushed to the central location for data mining.
      +
      +

      Enhanced KISS home photo albums


      +
      +I don't use third-party cloud providers such as Google Photos to store/archive my photos. Instead, they are all on a ZFS volume on my home NAS, with regular offsite backups taken. Thus, my project would involve implementing the features I miss most or finding a solution simple enough to host on my LAN:
      +
      +
        +
      • A feature I miss presents me with a random day from the past and some photos from that day. This project would randomly select a day and generate a photo album for me to view and reminisce about memories.
      • +
      • Another feature I miss is the ability to automatically deduplicate all the photos, as I am sure there are tons of duplicates on my NAS.
      • +
      • Auto-enhancing the photos (perhaps using ImageMagick?)
      • +
      • I already have a simple photoalbum.sh script that generates an album based on an input directory. However, it would be great also to have a timeline feature to enable browsing through different dates.
      • +

      +KISS static web photo albums with photoalbum.sh
      +
      +

      KISS file sync server with end-to-end encryption


      +
      +I aimed to have a simple server to which I could sync notes and other documents, ensuring that the data is fully end-to-end encrypted. This way, only the clients could decrypt the data, while an encrypted copy of all the data would be stored on the server side. There are a few solutions (e.g., NextCloud), but they are bloated or complex to set up.
      +
      +I currently use Syncthing for encrypted file sync across all my devices; however, the data is not end-to-end encrypted. It's a good-enough setup, though, as my Syncthing server is in my home LAN on an encrypted file system.
      +
      +https://syncthing.net
      +
      +I also had the idea of using this as a pet project for work and naming it Cryptolake, utilizing post-quantum-safe encryption algorithms and a distributed data store.
      +
      +

      A language that compiles to bash


      +
      +I had an idea to implement a higher-level language with strong typing that could be compiled into native Bash code. This would make all resulting Bash scripts more robust and secure by default. The project would involve developing a parser, lexer, and a Bash code generator. I planned to implement this in Go.
      +
      +I had previously implemented a tiny scripting language called Fype (For Your Program Execution), which could have served as inspiration.
      +
      +The Fype Programming Language
      +
      +

      A language that compiles to sed


      +
      +This is similar to the previous idea, but the difference is that the language would compile into a sed script. Sed has many features, but the brief syntax makes scripts challenging to read. The higher-level language would mimic sed but in a form that is easier for humans to read.
      +
      +

      Renovate VS-Sim


      +
      +VS-Sim is an open-source simulator programmed in Java for distributed systems. VS-Sim stands for "Verteilte Systeme Simulator," the German translation for "Distributed Systems Simulator." The VS-Sim project was my diploma thesis at Aachen University of Applied Sciences.
      +
      +https://codeberg.org/snonux/vs-sim
      +
      +The ideas I had was:
      +
      +
        +
      • Translate the project into English.
      • +
      • Modernise the Java codebase to be compatible with the latest JDK.
      • +
      • Make it compile to native binaries using GraalVM.
      • +
      • Distribute the project using AppImages.
      • +

      +I have put this project on hold for now, as I want to do more things in Go and fewer in Java in my personal time.
      +
      +

      KISS ticketing system


      +
      +My idea was to program a KISS (Keep It Simple, Stupid) ticketing system for my personal use. However, I am abandoning this project because I now use the excellent Taskwarrior software. You can learn more about it at:
      +
      +https://taskwarrior.org/
      +
      +

      A domain-specific language (DSL) for work


      +
      +At work, an internal service allocates storage space for our customers on our storage clusters. It automates many tasks, but many tweaks are accessible through APIs. I had the idea to implement a Ruby-based DSL that would make using all those APIs for ad-hoc changes effortless, e.g.:
      +
      + +
      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.
      +
      +Creative universe (Work pet project contests)
      +
      +

      Self-hosting projects I don't have time for


      +
      +

      My own Matrix server


      +
      +I value privacy. It would be great to run my own Matrix server for communication within my family. I have yet to have time to look into this more closely.
      +
      +https://matrix.org
      +
      +

      Ampache music server


      +
      +Ampache is an open-source music streaming server that allows you to host and manage your music collection online, accessible via a web interface. Setting it up involves configuring a web server, installing Ampache, and organising your music files, which can be time-consuming.
      +
      +

      Librum eBook reader


      +
      +Librum is a self-hostable e-book reader that allows users to manage and read their e-book collection from a web interface. Designed to be a self-contained platform where users can upload, organise, and access their e-books, Librum emphasises privacy and control over one's digital library.
      +
      +https://github.com/Librum-Reader/Librum
      +
      +I am using my Kobo devices or my laptop to read these kinds of things for now.
      +
      +

      Memos - Note-taking service


      +
      +Memos is a note-taking service that simplifies and streamlines information capture and organisation. It focuses on providing users with a minimalistic and intuitive interface, aiming to enhance productivity without the clutter commonly associated with more complex note-taking apps.
      +
      +https://www.usememos.com
      +
      +I am abandoning this idea for now, as I am currently using plain Markdown files for notes and syncing them with Syncthing across my devices.
      +
      +

      Bepasty server


      +
      +Bepasty is like a Pastebin for all kinds of files (text, image, audio, video, documents, binary, etc.). It seems very neat, but I only share a little nowadays. When I do, I upload files via SCP to one of my OpenBSD VMs and serve them via vanilla httpd there, keeping it KISS.
      +
      +https://github.com/bepasty/bepasty-server
      +
      +

      Books I don't have time to read


      +
      +

      Fluent Python


      +
      +I consider myself an advanced programmer in Ruby, Bash, and Perl. However, Python seems to be ubiquitous nowadays, and most of my colleagues prefer Python over any other languages. Thus, it makes sense for me to also learn and use Python. After conducting some research, "Fluent Python" appears to be the best book for this purpose.
      +
      +I don't have time to read this book at the moment, as I am focusing more on Go (Golang) and I know just enough Python to get by (e.g., for code reviews). Additionally, there are still enough colleagues around who can review my Ruby or Bash code.
      +
      +

      Programming Ruby


      +
      +I've read a couple of Ruby books already, but "Programming Ruby," which covers up to Ruby 3.2, was just recently released. I would like to read this to deepen my Ruby knowledge further and to revisit some concepts that I may have forgotten.
      +
      +As stated in this blog post, I am currently more eager to focus on Go, so I've put the Ruby book on hold. Additionally, there wouldn't be enough colleagues who could "understand" my advanced Ruby skills anyway, as most of them are either Java developers or SREs who don't code a lot.
      +
      +

      Peter F. Hamilton science fiction books


      +
      +I am a big fan of science fiction, but my reading list is currently too long anyway. So, I've put the Hamilton books on the back burner for now. You can see all the novels I've read here:
      +
      +https://paul.buetow.org/novels.html
      +https://paul.buetow.org/novels.gmi
      +
      +
      +

      New websites I don't have time for


      +
      +

      Create a "Why Raku Rox" site


      +
      +The website "Why Raku Rox" would showcase the unique features and benefits of the Raku programming language and highlight why it is an exceptional choice for developers. Raku, originally known as Perl 6, is a dynamic, expressive language designed for flexible and powerful software development.
      +
      +This would be similar to the "Why OpenBSD rocks" site:
      +
      +https://why-openbsd.rocks
      +https://raku.org
      +
      +I am not working on this for now, as I currently don’t even have time to program in Raku.
      +
      +

      Research projects I don't have time for


      +
      +

      Project secure


      +
      +For work: Implement a PoC that dumps Java heaps to extract secrets from memory. Based on the findings, write a Java program that encrypts secrets in the kernel using the memfd_secret() syscall to make it even more secure.
      +
      +https://lwn.net/Articles/865256/
      +
      +Due to other priorities, I am putting this on hold for now. The software we have built is pretty damn secure already!
      +
      +

      CPU utilisation is all wrong


      +
      +This research project, based on Brendan Gregg's blog post, could potentially significantly impact my work.
      +
      +https://brendangregg.com/blog/2017-05-09/cpu-utilization-is-wrong.html
      +
      +The research project would involve setting up dashboards that display actual CPU usage and the cycles versus waiting time for memory access.
      +
      +E-Mail your comments to paul@nospam.buetow.org :-)
      +
      +Related and maybe interesting:
      +
      +Sweating the small stuff - Tiny projects of mine
      +
      +Back to the main site
      +
      +
      +
      + + 'Slow Productivity' book notes + + https://foo.zone/gemfeed/2024-05-01-slow-productivity-book-notes.html + 2024-04-27T14:18:51+03:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + These are my personal takeaways after reading 'Slow Productivity - The lost Art of Accomplishment Without Burnout' by Cal Newport. + +
      +

      "Slow Productivity" book notes


      +
      +Published at 2024-04-27T14:18:51+03:00
      +
      +These are my personal takeaways after reading "Slow Productivity - The lost Art of Accomplishment Without Burnout" by Cal Newport.
      +
      +The case studies in this book were a bit long, but they appeared to be well-researched. I will only highlight the interesting, actionable items in the book notes.
      +
      +These notes are mainly for my own use, but you may find them helpful.

      -❯ ./dgrep -user rex -servers blowfish.buetow.org,fishfinger.buetow.org --regex local /etc/fstab
      -REMOTE|blowfish|100|7|fstab|31bfd9d9a6788844.h /usr/local ffs rw,wxallowed,nodev 1 2
      -REMOTE|fishfinger|100|7|fstab|093f510ec5c0f512.h /usr/local ffs rw,wxallowed,nodev 1 2
      +         ,..........   ..........,
      +     ,..,'          '.'          ',..,
      +    ,' ,'            :            ', ',
      +   ,' ,'             :             ', ',
      +  ,' ,'              :              ', ',
      + ,' ,'............., : ,.............', ',
      +,'  '............   '.'   ............'  ',
      + '''''''''''''''''';''';''''''''''''''''''
      +                    '''
       

      -

      Conclusions


      +

      Table of Contents



      -It's a bit of manual work, but it's ok on this small scale! I shall invest time in creating an official OpenBSD port, though. That would render most of the manual steps obsolete, as outlined in this post!
      +
      +

      It's not "slow productivity"



      -Check out the following for more information:
      +"Slow productivity" does not mean being less productive. Cal Newport wants to point out that you can be much more productive with "slow productivity" than you would be without it. It is a different way of working than most of us are used to in the modern workplace, which is hyper-connected and always online.

      -https://dtail.dev
      -https://github.com/mimecast/dtail
      -https://www.rexify.org
      +

      Pseudo-productivity and Shallow work



      -Other related posts are:
      +People use visible activity instead of real productivity because it's easier to measure. This is called pseudo-productivity.
      +Pseudo-productivity is used as a proxy for real productivity. If you don't look busy, you are dismissed as lazy or lacking a work ethic.

      -2021-04-22 DTail - The distributed log tail program
      -2022-03-06 The release of DTail 4.0.0
      -2022-10-30 Installing DTail on OpenBSD (You are currently reading this)
      -2023-09-25 DTail usage examples
      +There is a tendency to perform shallow work because people will otherwise dismiss you as lazy. A lot of shallow work can cause burnout, as multiple things are often being worked on in parallel. The more you have on your plate, the more stressed you will be.
      +
      +Shallow work usually doesn't help you to accomplish big things. Always have the big picture in mind. Shallow work can't be entirely eliminated, but it can be managed—for example, plan dedicated time slots for certain types of shallow work.
      +
      +

      Accomplishments without burnout


      +
      +The overall perception is that if you want to accomplish something, you must put yourself on the verge of burnout. Cal Newport writes about "The lost Art of Accomplishments without Burnouts", where you can accomplish big things without all the stress usually involved.
      +
      +There are three principles for the maintenance of a sustainable work life:
      +
      +
        +
      • Do fewer things
      • +
      • Work at a natural pace
      • +
      • Obsess over quality
      • +

      +

      Do fewer things


      +
      +There will always be more work. The faster you finish it, the quicker you will have something new on your plate.
      +
      +Reduce the overhead tax. The overhead tax is all the administrative work to be done. With every additional project, there will also be more administrative stuff to be done on your work plate. So, doing fewer things leads to more and better output and better quality for the projects you are working on.
      +
      +Limit the things on your plate. Limit your missions (personal goals, professional goals). Reduce your main objectives in life. More than five missions are usually not sustainable very easily, so you have to really prioritise what is important to you and your professional life.
      +
      +A mission is an overall objective/goal that can have multiple projects. Limit the projects as well. Some projects need clear endings (e.g., work in support of a never-ending flow of incoming requests). In this case, set limits (e.g., time box your support hours). You can also plan "office hours" for collaborative work with colleagues to avoid ad hoc distractions.
      +
      +The key point is that after making these commitments, you really deliver on them. This builds trust, and people will leave you alone and not ask for progress all the time.
      +
      +Doing fever things is essential for modern knowledge workers. Breathing space in your work also makes you more creative and happier overall.
      +
      +Pushing workers more work can make them less productive, so the better approach is the pull model, where workers pull in new work when the previous task is finished.
      +
      +If you can quantify how busy you are or how many other projects you already work on, then it is easier to say no to new things. For example, show what you are doing, what's in the roadmap, etc. Transparency is the key here.
      +
      +You can have your own simulated pull system if the company doesn't agree to a global one:
      +
      +
        +
      • State which additional information you would need.
      • +
      • Create a rough estimate of when you will be able to work on it
      • +
      • Estimate how long the project would take. Double that estimate, as humans are very bad estimators.
      • +
      • Respond to the requester and state that you will let him know when the estimates change.
      • +

      +Sometimes, a little friction is all that is needed to combat incoming work, e.g., when your manager starts seeing the reality of your work plate, and you also request additional information for the task. If you already have too much on your plate, then decline the new project or make room for it in your calendar. If you present a large task list, others will struggle to assign more to you.
      +
      +Limit your daily goals. A good measure is to focus on one goal per day. You can time block time for deep work on your daily goal. During that time, you won't be easily available to others.
      +
      +The battle against distractions must be fought to be the master of your time. Nobody will fight this war for you. You have to do it for yourself. (Also, have a look at Cal Newport's "time block planning" method).
      +
      +Put tasks on autopilot (regular recurring tasks).
      +
      +

      Work at a natural pace


      +
      +We suffer from overambitious timelines, task lists, and business. Focus on what matters. Don't rush your most important work to achieve better results.
      +
      +Don't rush. If you rush or are under pressure, you will be less effective and eventually burn out. Our brains work better then not rushy. The stress heuristic usually indicates too much work, and it is generally too late to reduce workload. That's why we all typically have dangerously too much to do.
      +
      +Have the courage to take longer to do things that are important. For example, plan on a yearly and larger scale, like 2 to 5 years.
      +
      +Find a reasonable time for a project and then double the project timeline against overconfident optimism. Humans are not great at estimating. They gravitate towards best-case estimates. If you have planned more than enough time for your project, then you will fall into a natural work pace. Otherwise, you will struggle with rushing and stress.
      +
      +Some days will still be intense and stressful, but those are exceptional cases. After those exceptions (e.g., finalizing that thing, etc.), calmer periods will follow again.
      +
      +Pace yourself over modest results over time. Simplify and reduce the daily task lists. Meetings: Certain hours are protected for work. For each meeting, add a protected block to your calendar, so you attend meetings only half a day max.
      +
      +Schedule slow seasons (e.g., when on vacation). Disconnect in the slow season. Doing nothing will not satisfy your mind, though. You could read a book on your subject matter to counteract that.
      +
      +

      Obsess over quality


      +
      +Obsess over quality even if you lose short-term opportunities by rejecting other projects. Quality demands you slow down. The two previous two principles (do fewer things and work at a natural pace) are mandatory for this principle to work:
      +
      +
        +
      • Focus on the core activities of your work for your obsession - you will only have the time to obsess over some things.
      • +
      • Deliver solid work with good quality.
      • +
      • Sharpen the focus to do the best work possible.
      • +

      +Go pro to save time, and don't squeeze everything out that you can from freemium services. Professional software services eliminate administrative work:
      +
      +
        +
      • Pay people who know what they are doing and focus on your stuff.
      • +
      • For example, don't repair that car if you know the mechanic can do that much better than you.
      • +
      • Or don't use the free version of the music streaming service if it interrupts you with commercials, hindering your ability to concentrate on your work.
      • +
      • Hire an accountant for your yearly tax returns. He knows much more about that stuff than you do. And in the end, he will even be cheaper as he knows all the tax laws.
      • +
      • ...
      • +

      +Adjust your workplace to what you want to accomplish. You could have dedicated places in your home for different things, e.g., a place where you read and think (armchair) and a place where you collaborate (your desk or whiteboard). Surround yourself with things that inspire you (e.g., your favourite books on your shelf next to you, etc.).
      +
      +There is the concept of quiet quitting. It doesn't mean quitting your job, but it means that you don't go beyond and above the expectations people have of you. Quiet quitting became popular with modern work, which is often meaningless and full of shallow tasks. If you obsess over quality, you enjoy your craft and want to go beyond and above.
      +
      +Implement rituals and routines which shift you towards your goals:
      +
      +
        +
      • For example, if you want to be a good Software Engineer, you also have to put in the work regularly. For instance, progress a bit every day in your project at hand, even if it is only one hour daily. Also, a little quality daily work will be more satisfying over time than many shallow tasks.
      • +
      • Do you want to be lean and/or healthy? Schedule your daily walks and workouts. They will become habits over time.
      • +
      • There's the compounding effect where every small effort made every day will yield significant results in the long run
      • +

      +Deciding what not to do is as important as deciding what to do.
      +
      +It appears to be money thrown out of the window, but you get a $50 expensive paper notebook (and also a good pen). Unconsciously, it will make you take notes more seriously. You will think about what to put into the notebooks more profoundly and have thought through the ideas more intensively. If you used very cheap notebooks, you would scribble a lot of rubbish and wouldn't even recognise your handwriting after a while anymore. So choosing a high-quality notebook will help you to take higher-quality notes, too.
      +
      +Slow productivity is actionable and can be applied immediately.

      E-Mail your comments to paul@nospam.buetow.org :-)

      +Other book notes of mine are:
      +
      +2024-10-24 "Staff Engineer" book notes
      +2024-07-07 "The Stoic Challenge" book notes
      +2024-05-01 "Slow Productivity" book notes (You are currently reading this)
      +2023-11-11 "Mind Management" book notes
      +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      +2023-05-06 "The Obstacle is the Way" book notes
      +2023-04-01 "Never split the difference" book notes
      +2023-03-16 "The Pragmatic Programmer" book notes
      +
      Back to the main site
      - After a bad night's sleep - - https://foo.zone/gemfeed/2022-09-30-after-a-bad-nights-sleep.html - 2022-09-30T09:53:23+03:00 + KISS high-availability with OpenBSD + + https://foo.zone/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html + 2024-03-30T22:12:56+02:00 Paul Buetow aka snonux paul@dev.buetow.org - Everyone has it once in a while: A bad night's sleep. Here I attempt to list valuable tips on how to deal with it. + I have always wanted a highly available setup for my personal websites. I could have used off-the-shelf hosting solutions or hosted my sites in an AWS S3 bucket. I have used technologies like (in unsorted and slightly unrelated order) BGP, LVS/IPVS, ldirectord, Pacemaker, STONITH, scripted VIP failover via ARP, heartbeat, heartbeat2, Corosync, keepalived, DRBD, and commercial F5 Load Balancers for high availability at work.
      -

      After a bad night's sleep


      +

      KISS high-availability with OpenBSD


      +
      +Published at 2024-03-30T22:12:56+02:00
      +
      +I have always wanted a highly available setup for my personal websites. I could have used off-the-shelf hosting solutions or hosted my sites in an AWS S3 bucket. I have used technologies like (in unsorted and slightly unrelated order) BGP, LVS/IPVS, ldirectord, Pacemaker, STONITH, scripted VIP failover via ARP, heartbeat, heartbeat2, Corosync, keepalived, DRBD, and commercial F5 Load Balancers for high availability at work.
      +
      +But still, my personal sites were never highly available. All those technologies are great for professional use, but I was looking for something much more straightforward for my personal space - something as KISS (keep it simple and stupid) as possible.
      +
      +It would be fine if my personal website wasn't highly available, but the geek in me wants it anyway.
      +
      +PS: ASCII-art below reflects an OpenBSD under-water world with all the tools available in the base system.
      +
      +
      +Art by Michael J. Penick (mod. by Paul B.)
      +                                               ACME-sky
      +        __________
      +       / nsd tower\                                             (
      +      /____________\                                           (\) awk-ward
      +       |:_:_:_:_:_|                                             ))   plant
      +       |_:_,--.:_:|                       dig-bubble         (\//   )
      +       |:_:|__|_:_|  relayd-castle          _               ) ))   ((
      +    _  |_   _  :_:|   _   _   _            (_)             ((((   /)\`
      +   | |_| |_| |   _|  | |_| |_| |             o              \\)) (( (
      +    \_:_:_:_:/|_|_|_|\:_:_:_:_/             .                ((   ))))
      +     |_,-._:_:_:_:_:_:_:_.-,_|                                )) ((//
      +     |:|_|:_:_:,---,:_:_:|_|:|                               ,-.  )/
      +     |_:_:_:_,'puffy `,_:_:_:_|           _  o               ,;'))((
      +     |:_:_:_/  _ | _  \_:_:_:|          (_O                   ((  ))
      +_____|_:_:_|  (o)-(o)  |_:_:_|--'`-.     ,--. ksh under-water (((\'/
      + ', ;|:_:_:| -( .-. )- |:_:_:| ', ; `--._\  /,---.~  goat     \`))
      +.  ` |_:_:_|   \`-'/   |_:_:_|.  ` .  `  /()\.__( ) .,-----'`-\(( sed-root
      + ', ;|:_:_:|    `-'    |:_:_:| ', ; ', ; `--'|   \ ', ; ', ; ',')).,--
      +.  ` MJP ` .  ` .  ` .  ` . httpd-soil ` .    .  ` .  ` .  ` .  ` .  `
      + ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ; ', ;
      +
      +
      +
      +

      Table of Contents


      +
      +
      +

      My auto-failover requirements


      +
      +
        +
      • Be OpenBSD-based (I prefer OpenBSD because of the cleanliness and good documentation) and rely on as few external packages as possible.
      • +
      • Don't rely on the hottest and newest tech (don't want to migrate everything to a new and fancier technology next month already!).
      • +
      • It should be reasonably cheap. I want to avoid paying a premium for floating IPs or fancy Elastic Load Balancers.
      • +
      • It should be geo-redundant.
      • +
      • It's fine if my sites aren't reachable for five or ten minutes every other month. Due to their static nature, I don't care if there's a split-brain scenario where some requests reach one server and other requests reach another server.
      • +
      • Failover should work for both HTTP/HTTPS and Gemini protocols. My self-hosted MTAs and DNS servers should also be highly available.
      • +
      • Let's Encrypt TLS certificates should always work (before and after a failover).
      • +
      • Have good monitoring in place so I know when a failover was performed and when something went wrong with the failover.
      • +
      • Don't configure everything manually. The configuration should be automated and reproducible.
      • +

      +

      My HA solution


      +
      +

      Only OpenBSD base installation required


      +
      +My HA solution for Web and Gemini is based on DNS (OpenBSD's nsd) and a simple shell script (OpenBSD's ksh and some little sed and awk and grep). All software used here is part of the OpenBSD base system and no external package needs to be installed - OpenBSD is a complete operating system.
      +
      +https://man.OpenBSD.org/nsd.8
      +https://man.OpenBSD.org/ksh
      +https://man.OpenBSD.org/awk
      +https://man.OpenBSD.org/sed
      +https://man.OpenBSD.org/dig
      +https://man.OpenBSD.org/ftp
      +https://man.OpenBSD.org/cron
      +
      +I also used the dig (for DNS checks) and ftp (for HTTP/HTTPS checks) programs.
      +
      +The DNS failover is performed automatically between the two OpenBSD VMs involved (my setup doesn't require any quorum for a failover, so there isn't a need for a 3rd VM). The ksh script, executed once per minute via CRON (on both VMs), performs a health check to determine whether the current master node is available. If the current master isn't available (no HTTP response as expected), a failover is performed to the standby VM:
      +
      + +
      #!/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:
      +
      + +
      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/;
      +	}
      +  '
      +}
      +
      +
      +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:
      +
      + +
      #! 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
      +

      -Published at 2022-09-30T09:53:23+03:00; Updated at 2022-10-12
      +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.

      -
      -               z
      -                z
      -                 Z
      -       .--.  Z Z
      -      / _(c\   .-.     __
      -     | / /  '-;   \'-'`  `\______
      -     \_\/'/ __/ )  /  )   |      \--,
      -     | \`""`__-/ .'--/   /--------\  \
      -      \\`  ///-\/   /   /---;-.    '-'
      -jgs                (________\  \
      -                             '-'
      -
      +The authorative nameserver for my domains runs on both VMs, and both are configured to be a "master" DNS server so that they have their own individual zone files, which can be changed independently. Otherwise, my setup wouldn't work. The side effect is that under a split-brain scenario (both VMs cannot see each other), both would promote themselves to master via their local DNS entries. More about that later, but that's fine in my use case.

      -Everyone has it once in a while: A bad night's sleep. Here I attempt to list valuable tips on how to deal with it.
      +Check out the whole script here:

      -

      Don't take the day off.


      +dns-failover.ksh

      -Don't take a day off after not sleeping enough the previous night. That would be wasting the holiday allowance. It wouldn't be possible to enjoy my free time anyway, so why not just work? There's still a way for an IT Engineer to be productive (sometimes even more) with half or less of the concentration power available!
      +

      Fairly cheap and geo-redundant



      -

      Start work early


      +I am renting two small OpenBSD VMs: One at OpenBSD Amsterdam and the other at Hetzner Cloud. So, both VMs are hosted at another provider, in different IP subnets, and in different countries (the Netherlands and Germany).

      -Probably I am already awake early and am unable to fall asleep again. My strategy here is to "attack" the day: Start work early and finish early. The early bird will also encounter fewer distractions from colleagues.
      +https://OpenBSD.Amsterdam
      +https://www.Hetzner.cloud

      -

      Sweat the small stuff


      +I only have a little traffic on my sites. I could always upload the static content to AWS S3 if I suddenly had to. But this will never be required.

      -There's never a shortage of small items to hook off my list. Most of these items don't require my full concentration power, and I will be happy to get them off my list so that the next day, after a good night's sleep, I can immerse myself again in focused, deep work with all concentration powers at hand.
      +A DNS-based failover is cheap, as there isn't any BGP or fancy load balancer to pay for. Small VMs also cost less than millions.

      -Examples of "small work items" are:
      +

      Failover time and split-brain



      -
        -
      • Tidying up the workspace.
      • -
      • Installing pending computer software updates.
      • -
      • Going through the work backlog: Create new tickets, close obsolete ones, and roughly pre-plan upcoming work.
      • -
      • Finishing off the easy tickets from the current sprint.
      • -
      • Going through any tedious paperwork.
      • -
      • Catch up with the journal and mark off all trivial action items.
      • -

      -

      Enter the flow state


      +A DNS failover doesn't happen immediately. I've configured a DNS TTL of 300 seconds, and the failover script checks once per minute whether to perform a failover or not. So, in total, a failover can take six minutes (not including other DNS caching servers somewhere in the interweb, but that's fine - eventually, all requests will resolve to the new master after a failover).

      -I find it easy to enter the "flow state" after a bad night's sleep. All I need to do is to put on some ambient music (preferably instrumental chill house) and start to work on a not-too-difficult ticket.
      +A split-brain scenario between the old master and the new master might happen. That's OK, as my sites are static, and there's no database to synchronise other than HTML, CSS, and images when the site is updated.

      -Usually, the "flow state" is associated with deep-focused work, but deep-focused work isn't easily possible under sleep deprivation. It's still possible to be in the flow by working on more manageable tasks and leaving the difficult ones for the next day.
      +

      Failover support for multiple protocols



      -

      Reschedule meetings


      +With the DNS failover, HTTP, HTTPS, and Gemini protocols are failovered. This works because all domain virtual hosts are configured on either VM's httpd (OpenBSD's HTTP server) and relayd (it's also part of OpenBSD and I use it to TLS offload the Gemini protocol). So, both VMs accept requests for all the hosts. It's just a matter of the DNS entries, which VM receives the requests.

      -I find engaging in discussions and demanding meetings challenging after a lousy night's sleep. I still attend the sessions I am invited to as "only" a participant, but I prefer to reschedule all meetings I am the primary driver of.
      +https://man.OpenBSD.org/httpd.8
      +https://man.OpenBSD.org/relayd.8

      -This, unfortunately, also includes interviews. Interviews require full concentration power. So for interviews, I would find a colleague to step in for me or ask to reschedule the interview altogether. Everything else wouldn't make it justice and would waste everyone's time!
      +For example, the master is responsible for the https://www.foo.zone and https://foo.zone hosts, whereas the standby can be reached via https://standby.foo.zone (port 80 for plain HTTP works as well). The same principle is followed with all the other hosts, e.g. irregular.ninja, paul.buetow.org and so on. The same applies to my Gemini capsules for https://foo.zone, https://standby.foo.zone, https://paul.buetow.org and https://standby.paul.buetow.org.

      -

      Invent


      +On DNS failover, master and standby swap roles without config changes other than the DNS entries. That's KISS (keep it simple and stupid)!

      -The mind works differently under sleep deprivation: It's easier to invent new stuff as it's easier to have a look at things from different perspectives. Until an hour ago, I didn't know yet what I would be blogging about for this month, and then I just started writing this, and it took me only half an hour to write the first draft of this blog post!
      +

      Let's encrypt TLS certificates



      -

      Fast


      +All my hosts use TLS certificates from Let's Encrypt. The ACME automation for requesting and keeping the certificates valid (up to date) requires that the host requesting a certificate from Let's Encrypt is also the host using that certificate.

      -I don't eat breakfast, and I don't eat lunch on these days. I only have dinner. Not eating means my mind doesn't get foggy, and I keep up the work momentum. This is called intermittent fasting, which not only generally helps to keep the weight under control and boosts the concentration power. Furthermore, intermittent fasting is healthy. You should include it in your routine, even after a good night's sleep.
      +If the master always serves foo.zone and the standby always standby.foo.zone, then there would be a problem after the failover, as the new master wouldn't have a valid certificate for foo.zone and the new standby wouldn't have a valid certificate for standby.foo.zone which would lead to TLS errors on the clients.

      -

      Stretch


      +As a solution, the CRON job responsible for the DNS failover also checks for the current week number of the year so that:

      -I won't have enough energy for strenuous physical exercise on those days, but a 30 to a 60-minute stretching session can make the day. Stretching will even hurt less under sleep deprivation! The stretching could also be substituted with a light Yoga session.
      +
        +
      • In an odd week number, the first server is the default master
      • +
      • In an even week number, the second server is the default master.
      • +

      +Which translates to:

      -

      Walk


      + +
      # 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
      +

      -Walking is healthy, and the time can be used to listen to interesting podcasts. The available concentration power might not be enough for more sophisticated audio literature. I will have enough energy for one or two daily walks (~10k steps for the day in total). Sometimes, I listen to music during walks. I also try to catch the bright sunlight.
      +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.

      -

      Red Bull


      +The ACME automation is yet another daily CRON script /usr/local/bin/acme.sh. It iterates over all of my Let's Encrypt hosts, checks whether they resolve to the same IP address as the current VM, and only then invokes the ACME client to request or renew the TLS certificates. So, there are always correct requests made to Let's Encrypt.

      -I don't think that Red Bull is a healthy drink. But once in a while, a can in the early afternoon brings wonders, and productivity will skyrocket. Other than Red Bull, drink a lot of water throughout the day. Don't forget to drink the sugar-free version; otherwise, your intermittent fast will be broken.
      +Let's encrypt certificates usually expire after 3 months, so a weekly failover of my VMs is plenty.

      -

      Power nap


      +acme.sh.tpl - Rex template for the acme.sh script of mine.
      +https://man.OpenBSD.org/acme-client.1
      +Let's Encrypt with OpenBSD and Rex

      -I don't know how to "enforce" a nap, but sometimes I manage to power nap, and it helps wonders. A 30-minute nap sometimes brings me back to normal. If you don't tend to fast as you are too hungry, it helps to try to nap approximately 30 minutes after eating something.
      +

      Monitoring



      -

      Don't take anything personally.


      +CRON is sending me an E-Mail whenever a failover is performed (or whenever a failover failed). Furthermore, I am monitoring my DNS servers and hosts through Gogios, the monitoring system I have developed.

      -It's much more challenging to keep the mind "under control" in this state. Every annoyance can potentially upset, which could reflect on the work colleagues. It is wise to attempt to go with a positive attitude into the day, always smile and be polite to the family and colleagues at work. Don't let anything drop out to the people next; they don't deserve it as they didn't do anything wrong! Also, remember, it can't be controlled at all. It's time to let go of the annoyances for the day.
      +https://codeberg.org/snonux/gogios
      +KISS server monitoring with Gogios

      -

      Meditate


      +Gogios, as I developed it by myself, isn't part of the OpenBSD base system.

      -To keep the good vibe, it helps to meditate for 10 minutes. Meditation must nothing be fancy. It can be just lying on the sofa and observing your thoughts as they come and go. Don't judge your thoughts, as that could put you in a negative mood. It's not necessary to sit in an uncomfortable Yoga pose, and it is not required to chant "Ohhmmmmm".
      +

      Rex automation



      -

      Write things down


      +I use Rexify, a friendly configuration management system that allows automatic deployment and configuration.

      -Sometimes something requiring more concentration power demands time. This is where it helps to write a note in a journal and return to it another day. This doesn't mean slacking off but managing the rarely available concentration power for the day. I might repeat myself: Today, sweat all the small stuff. Tomorrow, do the deep-focused work on that crucial project again.
      +https://www.rexify.org
      +codeberg.org/snonux/rexfiles/frontends

      -It's easier to forget things on those days, so everything should be written down so that it can be worked off later. Things written down will not be overlooked!
      +Rex isn't part of the OpenBSD base system, but I didn't need to install any external software on OpenBSD either as Rex is invoked from my Laptop!

      -

      Social media


      +

      More HA



      -I wouldn't say I like checking social media, as it can consume a lot of time and can become addictive. But once in a while, I want to catch up with my "networks". After a bad night's sleep, it's the perfect time to check your social media. Once done, you don't have to do it anymore for the next couple of days!
      +Other high-available services running on my OpenBSD VMs are my MTAs for mail forwarding (OpenSMTPD - also part of the OpenBSD base system) and the authoritative DNS servers (nsd) for all my domains. No particular HA setup is required, though, as the protocols (SMTP and DNS) already take care of the failover to the next available host!
      +
      +https://www.OpenSMTPD.org/
      +
      +As a password manager, I use geheim, a command-line tool I wrote in Ruby with encrypted files in a git repository (I even have it installed in Termux on my Phone). For HA reasons, I simply updated the client code so that it always synchronises the database with both servers when I run the sync command there.
      +
      +https://codeberg.org/snonux/geheim

      E-Mail your comments to paul@nospam.buetow.org :-)

      +Other *BSD and KISS related posts are:
      +
      +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
      +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
      +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
      +2024-04-01 KISS high-availability with OpenBSD (You are currently reading this)
      +2024-01-13 One reason why I love OpenBSD
      +2023-10-29 KISS static web photo albums with photoalbum.sh
      +2023-06-01 KISS server monitoring with Gogios
      +2022-10-30 Installing DTail on OpenBSD
      +2022-07-30 Let's Encrypt with OpenBSD and Rex
      +2016-04-09 Jails and ZFS with Puppet on FreeBSD
      +
      Back to the main site
      - Gemtexter 1.1.0 - Let's Gemtext again - - https://foo.zone/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html - 2022-08-27T18:25:57+01:00 + A fine Fyne Android app for quickly logging ideas programmed in Go + + https://foo.zone/gemfeed/2024-03-03-a-fine-fyne-android-app-for-quickly-logging-ideas-programmed-in-golang.html + 2024-03-03T00:07:21+02:00 Paul Buetow aka snonux paul@dev.buetow.org - I proudly announce that I've released Gemtexter version `1.1.0`. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash. + I am an ideas person. I find myself frequently somewhere on the streets with an idea in my head but no paper journal noting it down.
      -

      Gemtexter 1.1.0 - Let's Gemtext again


      -
      -Published at 2022-08-27T18:25:57+01:00
      -
      -
      --=[ typewriter ]=-  1/98
      -
      -       .-------.
      -      _|~~ ~~  |_
      -    =(_|_______|_)=
      -      |:::::::::|
      -      |:::::::[]|
      -      |o=======.|
      - jgs  `"""""""""`
      -
      +

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



      -I proudly announce that I've released Gemtexter version 1.1.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.
      +Published at 2024-03-03T00:07:21+02:00

      -https://codeberg.org/snonux/gemtexter
      -
      -It has been around a year since I released the first version 1.0.0. Although, there aren't any groundbreaking changes, there have been a couple of smaller commits and adjustments. I was quite surprised that I received a bunch of feedback and requests about Gemtexter so it means that I am not the only person in the universe actually using it.
      -
      -

      What's new?


      -
      -

      Automatic check for GNU version requirements


      +I am an ideas person. I find myself frequently somewhere on the streets with an idea in my head but no paper journal noting it down.

      -Gemtexter relies on the GNU versions of the tools grep, sed and date and it also requires the Bash shell in version 5 at least. That's now done in the check_dependencies() function:
      -
      - -
      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
      -}
      -
      +I have tried many note apps for my Android (I use GrapheneOS) phone. Most of them either don't do what I want, are proprietary software, require Google Play services (I have the main profile on my phone de-googled) or are too bloated. I was never into mobile app development, as I'm not too fond of the complexity of the developer toolchains. I don't want to use Android Studio (as a NeoVim user), and I don't want to use Java or Kotlin. I want to use a language I know (and like) for mobile app development. Go would be one of those languages.

      -Especially macOS users didn't read the README carefully enough to install GNU Grep, GNU Sed and GNU Date before using Gemtexter.
      +Quick logger Logo

      -

      Backticks now produce inline code blocks in the HTML output


      +

      Table of Contents



      -The Gemtext format doesn't support inline code blocks, but Gemtexter now produces inline code blocks (means, small code fragments can be placed in the middle of a paragraph) in the HTML output when the code block is enclosed with Backticks. There were no adjustments required for the Markdown output format, because Markdown supports it already out of the box.
      +
      +

      Enter Quick logger



      -

      Cache for Atom feed generation


      +Enter Quick logger – a compact GUI Android (well, cross-platform due to Fyne) app I've crafted using Go and the nifty Fyne framework. With Fyne, the app can be compiled easily into an Android APK. As of this writing, this app's whole Go source code is only 75 lines short!! This little tool is designed for spontaneous moments, allowing me to quickly log my thoughts as plain text files on my Android phone. There are no fancy file formats. Just plain text!

      -The Bash is not the most performant language. Gemtexter already takes a couple of seconds only to generate the Atom feed for around two hand full of articles on my slightly underpowered Surface Go 2 Linux tablet. Therefore, I introduced a cache, so that subsequent Atom feed generation runs finish much quicker. The cache uses a checksum of the Gemtext .gmi file to decide whether anything of the content has changed or not.
      +https://codeberg.org/snonux/quicklogger
      +https://fyne.io
      +https://go.dev

      -

      Input filter support


      +There's no need to navigate complex menus or deal with sync issues. I jot down my Idea, and Quick logger saves it to a plain text file in a designated local folder on my phone. There is one text file per note (timestamp in the file name). Once logged, the file can't be edited anymore (it keeps it simple). If I want to correct or change a note, I simply write a new one. My notes are always small (usually one short sentence each), so there isn't the need for an edit functionality. I can edit them later on my actual computer if I want to.

      -Once your capsule reaches a certain size, it can become annoying to re-generate everything if you only want to preview the HTML or Markdown output of one single content file. The following will add a filter to only generate the files matching a regular expression:
      +With Syncthing, the note files are then synchronised to my home computer to my ~/Notes directory. From there, a small glue Raku script adds them to my Taskwarrior DB so that I can process them later (e.g. take action on that one Idea I had). That then will delete the original note files from my computer and also (through Syncthing) from my phone.

      - -
      ./gemtexter --generate '.*hello.*'
      -
      +https://syncthing.net
      +https://raku.org
      +https://taskwarrior.org

      -

      Revamped git support


      +Quick logger's user interface is as minimal as it gets. When I launch Quick logger, I'm greeted with a simple window where I can type plain text. Hit the "Log text" button, and voilà – the input is timestamped and saved as a file in my chosen directory. If I need to change the directory, the "Preferences" button brings up a window where I can set the notes folder and get back to logging.

      -The Git support has been completely rewritten. It's now more reliable and faster too. Have a look at the README for more information.
      +For the code-savvy folks out there, Quick logger is a neat example of what you can achieve with Go and Fyne. It's a testament to building functional, cross-platform apps without getting bogged down in the nitty-gritty of platform-specific details. Thanks to Fyne, I am pleased with how easy it is to make mobile Android apps in Go.

      -

      Addition of htmlextras and web font support


      +Quick logger running on Android

      -The htmlextras folder now contains all extra files required for the HTML output format such as cascading style sheet (CSS) files and web fonts.
      +My Android apps will never be polished, but they will get the job done, and this is precisely how I want them to be. Minimalistic but functional. I could spend more time polishing Quick logger, but my Quick logger app then may be the same as any other notes app out there (complicated or bloated).

      -

      Sub-section support


      +

      All easy-peasy?



      -It's now possible to define sub-sections within a Gemtexter capsule. For the HTML output, each sub-section can use its own CSS and web font definitions. E.g.:
      +I did have some issues with the app logo for Android, though. Android always showed the default app icon and not my custom icon whenever I used a custom AndroidManifest.xml for custom app storage permissions. Without a custom AndroidAmnifest.xml the app icon would be displayed under Android, but then the app would not have the MANAGE_EXTERNAL_STORAGE permission, which is required for Quick logger to write to a custom directory. I found a workaround, which I commented on here at Github:

      -The foo.zone main site
      -The notes sub-section (with different fonts)
      +https://github.com/fyne-io/fyne/issues/3077#issuecomment-1912697360

      -

      More


      +What worked however (app icon showing up) was to clone the fyne project, change the occurances of android.permission.INTERNET to android.permission.MANAGE_EXTERNAL_STORAGE (as these are all the changes I want in my custom android manifest) in the source tree, re-compile fyne. Now all works. I know, this is more of an hammer approach!

      -Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.
      +Hopefully, I won't need to use this workaround anymore. But for now, it is a fair tradeoff for what I am getting.

      -Overall I think it's a pretty solid 1.1.0 release without anything groundbreaking (therefore no major version jump). But I am happy about it.
      +I hope this will inspire you to write your own small mobile apps in Go using the awesome Fyne framework! PS: The Quick logger logo was generated by ChatGPT.

      -Other related posts are:
      +E-Mail your comments to paul@nospam.buetow.org :-)

      -2021-04-24 Welcome to the Geminispace
      -2021-06-05 Gemtexter - One Bash script to rule it all
      -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again (You are currently reading this)
      -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
      -2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
      +Other Go related posts are:

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2024-03-03 A fine Fyne Android app for quickly logging ideas programmed in Go (You are currently reading this)

      Back to the main site
      - Let's Encrypt with OpenBSD and Rex - - https://foo.zone/gemfeed/2022-07-30-lets-encrypt-with-openbsd-and-rex.html - 2022-07-30T12:14:31+01:00 + From `babylon5.buetow.org` to `*.buetow.cloud` + + https://foo.zone/gemfeed/2024-02-04-from-babylon5.buetow.org-to-.cloud.html + 2024-02-04T00:50:50+02:00 Paul Buetow aka snonux paul@dev.buetow.org - I was amazed at how easy it is to automatically generate and update Let's Encrypt certificates with OpenBSD. + Recently, my employer sent me to a week-long AWS course. After the course, there wasn't any hands-on project I could dive into immediately, so I moved parts of my personal infrastructure to AWS to level up a bit through practical hands-on.
      -

      Let's Encrypt with OpenBSD and Rex


      +

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



      -Published at 2022-07-30T12:14:31+01:00
      +Published at 2024-02-04T00:50:50+02:00

      -
      -                                               /    _    \
      -  The Hebern Machine                            \ ." ". /
      -                                  ___            /     \
      -                              ..""   ""..       |   O   |
      -                             /           \      |       |
      -                            /             \     |       |
      -                          ---------------------------------
      -                        _/  o     (O)     o   _            |
      -                      _/                    ." ".          |
      -                    I/    _________________/     \         |
      -                  _/I   ."                        |        |
      -          =====  /  I  /                         /         |
      -     =====  | | |   \ |       _________________."          |
      -=====  | |  | | |   /  \     /  _|_|__|_|_          __     |
      -  | |  | |  | | |   \   "._."  /  o    o  \       ."  ".   |
      -  |  --|  --|  -|   /          \         _/      /      \  |
      -   \____\____\__|   \  ______   |       /       |        | |
      -               --------      ---       /        |        | |
      -              ( )        (O)          /          \      /  |
      -               -----------------------            ".__."   |
      -               _|__________________________________________|_
      -              /                                              \
      -             /________________________________________________\
      -                                 ASCII Art by John Savard
      -
      +Recently, my employer sent me to a week-long AWS course. After the course, there wasn't any hands-on project I could dive into immediately, so I moved parts of my personal infrastructure to AWS to level up a bit through practical hands-on.

      -I was amazed at how easy it is to automatically generate and update Let's Encrypt certificates with OpenBSD.
      +So, I migrated all of my Docker-based self-hosted services to AWS. Usually, I am not a big fan of big cloud providers and instead use smaller hosters or indie providers and self-made solutions. However, I also must go with the times and try out technologies currently hot on the job market. I don't want to become the old man who yells at cloud :D

      -

      What's Let's Encrypt?


      +Old man yells at cloud

      -Let's Encrypt is a non-profit certificate authority run by Internet Security Research Group that provides X.509 certificates for Transport Layer Security (TLS) encryption at no charge. It is the world's largest certificate authority, used by more than 265 million websites, with the goal of all websites being secure and using HTTPS.
      +

      Table of Contents



      -Source: Wikipedia
      +
      +

      The old *.buetow.org way



      -In short, it gives away TLS certificates for your website - for free! The catch is, that the certificates are only valid for three months. So it is better to automate certificate generation and renewals.
      +Before the migration, all those services were reachable through buetow.org-subdomains (Buetow is my last name) and ran on Docker containers on a single Rocky Linux 9 VM at Hetzner. And there was a Nginx reverse proxy with TLS offloading (with Let's Encrypt certificates). The Rocky Linux 9's hostname was babylon5.buetow.org (based on the Science Fiction series).

      -

      Meet acme-client


      +https://en.wikipedia.org/wiki/Babylon_5

      -acme-client is the default Automatic Certifcate Management Environment (ACME) client on OpenBSD and part of the OpenBSD base system.
      +The downsides of this setup were:
      +
      +
        +
      • Not highly available. If the server goes down, no service is reachable until it's repaired. To be fair, the Hetzner cloud VM is redundant by itself and would have re-spawned on a different worker node, I suppose.
      • +
      • Manual installation.
      • +

      +About the manual installation part: I could have used a configuration management system like Rexify, Puppet, etc. But I decided against it back in time, as setting up Docker containers isn't so complicated through simple start scripts. And it's only a single Linux box where a manual installation is less painful. However, regular backups (which Hetzner can do automatically for you) were a must.

      -When invoked, the client first checks whether certificates actually require to be generated.
      +The benefits of this setup were:

        -
      • It first checks whether a certificate already exists; if not, it will attempt to generate a new one.
      • -
      • If the certificate already exists but expires within the next 30 days, it will renew it.
      • -
      • Otherwise, acme-client won't do anything.
      • +
      • KISS (Keep it Simple Stupid)
      • +
      • Cheap

      -Oversimplified, the following steps are undertaken by acme-client for generating a new certificate:
      +

      I kept my buetow.org OpenBSD boxes alive


      +
      +As pointed out, I only migrated the Docker-based self-hosted services (which run on the Babylon 5 Rocky Linux box) to AWS. Many self-hostable apps come with ready-to-use container images, making deploying them easy.
      +
      +My other two OpenBSD VMs (blowfish.buetow.org, hosted at Hetzner, and fishfinger.buetow.org, hosted at OpenBSD Amsterdam) still run (and they will keep running) the following services:

        -
      • Reading its config file /etc/acme-client.conf for a list of hosts (and their alternative names) to generate certificates. So it means you can also have certificates for arbitrary subdomains!
      • -
      • Automatic generation of the private certificate part (the certificate key) and the certificate signing request (CSR) to /etc/ssl/....
      • -
      • Requesting Let's Encrypt to sign the certificate. This also includes providing a set of temporary files requested by Let's Encrypt in the next step for verification.
      • -
      • Let's Encrypt then will contact the hostname for the certificate through a particular URL (e.g. http://foo.zone/.well-known/acme-challenge/...) to verify that the requester is the valid owner of the host.
      • -
      • Let's Encrypt generates a certificate, which then is downloaded to /etc/ssl/....
      • +
      • HTTP server for my websites (e.g. https://foo.zone, ...)
      • +
      • ACME for Let's Encrypt TLS certificate auto-renewal.
      • +
      • Gemini server for my capsules (e.g. https://foo.zone)
      • +
      • Authoritative DNS servers for my domains (but buetow.cloud, which is on Route 53 now)
      • +
      • Mail transfer agent (MTA)
      • +
      • My Gogios monitoring system.
      • +
      • My IRC bouncer.

      -

      Configuration


      +It is all automated with Rex, aka Rexify. This OpenBSD setup is my "fun" or "for pleasure" setup. Whereas the Rocky Linux 9 one I always considered the "pratical means to the end"-setup to have 3rd party Docker containers up and running with as little work as possible.

      -There is some (but easy) configuration required to make that all work on OpenBSD.
      +(R)?ex, the friendly automation framework
      +KISS server monitoring with Gogios
      +Let's encrypt with OpenBSD and Rex

      -

      acme-client.conf


      +

      The new *.buetow.cloud way



      -This is how my /etc/acme-client.conf looks like (I copied a template from /etc/examples/acme-client.conf to /etc/acme-client.conf and added my domains to the bottom:
      +With AWS, I decided to get myself a new domain name, as I could fully separate my AWS setup from my conventional setup and give Route 53 as an authoritative DNS a spin.

      -
      -#
      -# $OpenBSD: acme-client.conf,v 1.4 2020/09/17 09:13:06 florian Exp $
      -#
      -authority letsencrypt {
      -    api url "https://acme-v02.api.letsencrypt.org/directory"
      -    account key "/etc/acme/letsencrypt-privkey.pem"
      -}
      -
      -authority letsencrypt-staging {
      -    api url "https://acme-staging-v02.api.letsencrypt.org/directory"
      -    account key "/etc/acme/letsencrypt-staging-privkey.pem"
      -}
      -
      -authority buypass {
      -    api url "https://api.buypass.com/acme/directory"
      -    account key "/etc/acme/buypass-privkey.pem"
      -    contact "mailto:me@example.com"
      -}
      -
      -authority buypass-test {
      -    api url "https://api.test4.buypass.no/acme/directory"
      -    account key "/etc/acme/buypass-test-privkey.pem"
      -    contact "mailto:me@example.com"
      -}
      -
      -domain buetow.org {
      -    alternative names { www.buetow.org paul.buetow.org }
      -    domain key "/etc/ssl/private/buetow.org.key"
      -    domain full chain certificate "/etc/ssl/buetow.org.fullchain.pem"
      -    sign with letsencrypt
      -}
      -
      -domain dtail.dev {
      -    alternative names { www.dtail.dev }
      -    domain key "/etc/ssl/private/dtail.dev.key"
      -    domain full chain certificate "/etc/ssl/dtail.dev.fullchain.pem"
      -    sign with letsencrypt
      -}
      -
      -domain foo.zone {
      -    alternative names { www.foo.zone }
      -    domain key "/etc/ssl/private/foo.zone.key"
      -    domain full chain certificate "/etc/ssl/foo.zone.fullchain.pem"
      -    sign with letsencrypt
      -}
      -
      -domain irregular.ninja {
      -    alternative names { www.irregular.ninja }
      -    domain key "/etc/ssl/private/irregular.ninja.key"
      -    domain full chain certificate "/etc/ssl/irregular.ninja.fullchain.pem"
      -    sign with letsencrypt
      -}
      -
      -domain snonux.land {
      -    alternative names { www.snonux.land }
      -    domain key "/etc/ssl/private/snonux.land.key"
      -    domain full chain certificate "/etc/ssl/snonux.land.fullchain.pem"
      -    sign with letsencrypt
      -}
      -
      +I decided to automate everything with Terraform, as I wanted to learn to use it as it appears standard now in the job market.

      -

      httpd.conf


      +All services are installed automatically to AWS ECS Fargate. ECS is AWS's Elastic Container Service, and Fargate automatically manages the underlying hardware infrastructure (e.g., how many CPUs, RAM, etc.) for me. So I don't have to bother about having enough EC2 instances to serve my demands, for example.

      -For ACME to work, you will need to configure the HTTP daemon so that the "special" ACME requests from Let's Encrypt are served correctly. I am using the standard OpenBSD httpd here. These are the snippets I use for the foo.zone host in /etc/httpd.conf (of course, you need a similar setup for all other hosts as well):
      +The authoritative DNS for the buetow.cloud domain is AWS Route 53. TLS certificates are free here at AWS and offloaded through the AWS Application Load Balancer. The LB acts as a proxy to the ECS container instances of the services. A few services I run in ECS Fargate also require the AWS Network Load Balancer.

      -
      -server "foo.zone" {
      -  listen on * port 80
      -  location "/.well-known/acme-challenge/*" {
      -    root "/acme"
      -    request strip 2
      -  }
      -  location * {
      -    block return 302 "https://$HTTP_HOST$REQUEST_URI"
      -  }
      -}
      -
      -server "foo.zone" {
      -  listen on * tls port 443
      -  tls {
      -    certificate "/etc/ssl/foo.zone.fullchain.pem"
      -    key "/etc/ssl/private/foo.zone.key"
      -  }
      -  location * {
      -    root "/htdocs/gemtexter/foo.zone"
      -    directory auto index
      -  }
      -}
      -
      +All services require some persistent storage. For that, I use an encrypted EFS file system, automatically replicated across all AZs (availability zones) of my region of choice, eu-central-1.

      -As you see, plain HTTP only serves the ACME challenge path. Otherwise, it redirects the requests to TLS. The TLS section then attempts to use the Let's Encrypt certificates.
      +In case of an AZ outage, I could re-deploy all the failed containers in another AZ, and all the data would still be there.

      -It is worth noticing that httpd will start without the certificates being present. This will cause a certificate error when you try to reach the HTTPS endpoint, but it helps to bootstrap Let's Encrypt. As you saw in the config snippet above, Let's Encrypt only requests the plain HTTP endpoint for the verification process, so HTTPS doesn't need to be operational yet at this stage. But once the certificates are generated, you will have to reload or restart httpd to use any new certificate.
      +The EFS automatically gets backed up by AWS for me following their standard Backup schedule. The daily backups are kept for 30 days.

      -

      CRON job


      +Domain registration, TLS certificate configuration and configuration of the EFS backup were quickly done through the AWS web interface. These were only one-off tasks, so they weren't fully automated through Terraform.

      -You could now run doas acme-client foo.zone to generate the certificate or to renew it. Or you could automate it with CRON.
      +You can find all Terraform manifests here:

      -I have created a script /usr/local/bin/acme.sh for that for all of my domains:
      +https://codeberg.org/snonux/terraform

      -
      -#!/bin/sh
      -
      -function handle_cert {
      -    host=$1
      -    # Create symlink, so that relayd also can read it.
      -    crt_path=/etc/ssl/$host
      -    if [ -e $crt_path.crt ]; then
      -        rm $crt_path.crt
      -    fi
      -    ln -s $crt_path.fullchain.pem $crt_path.crt
      -    # Requesting and renewing certificate.
      -    /usr/sbin/acme-client -v $host
      -}
      -
      -has_update=no
      -handle_cert www.buetow.org
      -if [ $? -eq 0 ]; then
      -    has_update=yes
      -fi
      -handle_cert www.paul.buetow.org
      -if [ $? -eq 0 ]; then
      -    has_update=yes
      -fi
      -handle_cert www.tmp.buetow.org
      -if [ $? -eq 0 ]; then
      -    has_update=yes
      -fi
      -handle_cert www.dtail.dev
      -if [ $? -eq 0 ]; then
      -    has_update=yes
      -fi
      -handle_cert www.foo.zone
      -if [ $? -eq 0 ]; then
      -    has_update=yes
      -fi
      -handle_cert www.irregular.ninja
      -if [ $? -eq 0 ]; then
      -    has_update=yes
      -fi
      -handle_cert www.snonux.land
      -if [ $? -eq 0 ]; then
      -    has_update=yes
      -fi
      -
      -# Pick up the new certs.
      -if [ $has_update = yes ]; then
      -    /usr/sbin/rcctl reload httpd
      -    /usr/sbin/rcctl reload relayd
      -    /usr/sbin/rcctl restart smtpd
      -fi
      -
      -
      -And added the following line to /etc/daily.local to run the script once daily so that certificates will be renewed fully automatically:
      +Whereas:

      -
      -/usr/local/bin/acme.sh
      -
      +
        +
      • org-buetow-base sets up the bare VPC (IPv4 and IPv6 subnets in 3 AZs, EFS, ECR (the AWS container registry for some self-built containers) and Route 53 zone. It's the requirement for most other Terraform manifests in this repository.
      • +
      • org-buetow-bastion sets up a minimal Amazon Linux EC2 instance where I can manually SSH into and look at the EFS file system (if required).
      • +
      • org-buetow-elb sets up the Elastic Load Balancer, a prerequisite for any service running in ECS Fargate.
      • +
      • org-buetow-ecs finally sets up and deploys all the Docker apps mentioned above. Any apps can be turned on or off via the variables.tf file.
      • +

      +

      The container apps



      -I am receiving a daily output via E-Mail like this now:
      +And here, finally, is the list of all the container apps my Terraform manifests deploy. The FQDNs here may not be reachable. I spin them up only on demand (for cost reasons). All services are fully dual-stacked (IPv4 & IPv6).

      -
      -Running daily.local:
      -acme-client: /etc/ssl/buetow.org.fullchain.pem: certificate valid: 80 days left
      -acme-client: /etc/ssl/paul.buetow.org.fullchain.pem: certificate valid: 80 days left
      -acme-client: /etc/ssl/tmp.buetow.org.fullchain.pem: certificate valid: 80 days left
      -acme-client: /etc/ssl/dtail.dev.fullchain.pem: certificate valid: 80 days left
      -acme-client: /etc/ssl/foo.zone.fullchain.pem: certificate valid: 80 days left
      -acme-client: /etc/ssl/irregular.ninja.fullchain.pem: certificate valid: 80 days left
      -acme-client: /etc/ssl/snonux.land.fullchain.pem: certificate valid: 79 days left
      -
      +

      flux.buetow.cloud



      -

      relayd.conf and smtpd.conf


      +Miniflux is a minimalist and opinionated feed reader. With the move to AWS, I also retired my bloated instance of NextCloud. So, with Miniflux, I retired from NextCloud News.

      -Besides httpd, relayd (mainly for Gemini) and smtpd (for mail, of course) also use TLS certificates. And as you can see in acme.sh, the services are reloaded or restarted (smtpd doesn't support reload) whenever a certificate is generated or updated.
      +Miniflux requires two ECS containers. One is the Miniflux app, and the other is the PostgreSQL DB.

      -

      Rexification


      +https://miniflux.app/

      -I didn't write all these configuration files by hand. As a matter of fact, everything is automated with the Rex configuration management system.

      -https://www.rexify.org
      +

      audiobookshelf.buetow.cloud



      -At the top of the Rexfile I define all my hosts:
      +Audiobookshelf was the first Docker app I installed. It is a Self-hosted audiobook and podcast server. It comes with a neat web interface, and there is also an Android app available, which works also in offline mode. This is great, as I only have the ECS instance sometimes running for cost savings.

      -
      -our @acme_hosts = qw/buetow.org paul.buetow.org tmp.buetow.org dtail.dev foo.zone irregular.ninja snonux.land/;
      -
      +With Audiobookshelf, I replaced my former Audible subscription and my separate Podcast app. For Podcast synchronisation I used to use the Gpodder NextCloud sync app. But that one I retired now with Audiobookshelf as well :-)

      -

      General ACME client configuration


      +https://www.audiobookshelf.org

      -ACME will be installed into the frontend group of hosts. Here, blowfish is the primary, and twofish is the secondary OpenBSD box.
      +

      syncthing.buetow.cloud



      -
      -group frontends => 'blowfish.buetow.org', 'twofish.buetow.org';
      -
      +Syncthing is a continuous file synchronisation program. In real-time, it synchronises files between two or more computers, safely protected from prying eyes. Your data is your own, and you deserve to choose where it is stored, whether it is shared with some third party, and how it's transmitted over the internet.

      -This is my Rex task for the general ACME configuration:
      +With Syncthing, I retired my old NextCloud Files and file sync client on all my devices. I also quit my NextCloud Notes setup. All my Notes are now plain Markdown files in a Notes directory. On Android, I can edit them with any text or Markdown editor (e.g. Obsidian), and they will be synchronised via Syncthing to my other computers, both forward and back.

      -
      -desc 'Configure ACME client';
      -task 'acme', group => 'frontends',
      -  sub {
      -    file '/etc/acme-client.conf',
      -      content => template('./etc/acme-client.conf.tpl',
      -        acme_hosts => \@acme_hosts,
      -        is_primary => $is_primary),
      -      owner => 'root',
      -      group => 'wheel',
      -      mode => '644';
      -
      -    file '/usr/local/bin/acme.sh',
      -      content => template('./scripts/acme.sh.tpl',
      -        acme_hosts => \@acme_hosts,
      -        is_primary => $is_primary),
      -      owner => 'root',
      -      group => 'wheel',
      -      mode => '744';
      -
      -    file '/etc/daily.local',
      -      ensure => 'present',
      -      owner => 'root',
      -      group => 'wheel',
      -      mode => '644';
      -
      -    append_if_no_such_line '/etc/daily.local', '/usr/local/bin/acme.sh';
      -  };
      -
      -
      -And there is also a Rex task just to run the ACME script remotely:
      +I use Syncthing to synchronise some of my Phone's data (e.g. Notes, Pictures and other documents). Initially, I synced all of my pictures, videos, etc., with AWS. But that was pretty expensive. So for now, I use it only whilst travelling. Otherwise, I will use my Syncthing instance here on my LAN (I have a cheap cloud backup in AWS S3 Glacier Deep Archive, but that's for another blog post).

      -
      -desc 'Invoke ACME client';
      -task 'acme_invoke', group => 'frontends',
      -  sub {
      -    say run '/usr/local/bin/acme.sh';
      -  };
      -
      -
      +https://syncthing.net/

      -Furthermore, this snippet (also at the top of the Rexfile) helps to determine whether the current server is the primary server (all hosts will be without the www. prefix) or the secondary server (all hosts will be with the www. prefix):
      +

      radicale.buetow.cloud



      -
      -# Bootstrapping the FQDN based on the server IP as the hostname and domain
      -# facts aren't set yet due to the myname file in the first place.
      -our $fqdns = sub {
      -  my $ipv4 = shift;
      -  return 'blowfish.buetow.org' if $ipv4 eq '23.88.35.144';
      -  return 'twofish.buetow.org' if $ipv4 eq '108.160.134.135';
      -  Rex::Logger::info("Unable to determine hostname for $ipv4", 'error');
      -  return 'HOSTNAME-UNKNOWN.buetow.org';
      -};
      -
      -# To determine whether the server is the primary or the secondary.
      -our $is_primary = sub {
      -  my $ipv4 = shift;
      -  $fqdns->($ipv4) eq 'blowfish.buetow.org';
      -};
      -
      +Radicale is an excellent minimalist WebDAV calendar and contact synchronisation server. It was good enough to replace my NextCloud Calendar and NextCloud Contacts setup. Unfortunately, there wasn't a ready-to-use Docker image. So, I created my own.

      -The following is the acme-client.conf.tpl Rex template file used for the automation. You see that the www. prefix isn't sent for the primary server. E.g. foo.zone will be served by the primary server (in my case, a server located in Germany) and www.foo.zone by the secondary server (in my case, a server located in Japan):
      +On Android, it works great together with the DAVx5 client for synchronisation.

      -
      -#
      -# $OpenBSD: acme-client.conf,v 1.4 2020/09/17 09:13:06 florian Exp $
      -#
      -authority letsencrypt {
      -	api url "https://acme-v02.api.letsencrypt.org/directory"
      -	account key "/etc/acme/letsencrypt-privkey.pem"
      -}
      -
      -authority letsencrypt-staging {
      -	api url "https://acme-staging-v02.api.letsencrypt.org/directory"
      -	account key "/etc/acme/letsencrypt-staging-privkey.pem"
      -}
      -
      -authority buypass {
      -	api url "https://api.buypass.com/acme/directory"
      -	account key "/etc/acme/buypass-privkey.pem"
      -	contact "mailto:me@example.com"
      -}
      -
      -authority buypass-test {
      -	api url "https://api.test4.buypass.no/acme/directory"
      -	account key "/etc/acme/buypass-test-privkey.pem"
      -	contact "mailto:me@example.com"
      -}
      -
      -<%
      -  our $primary = $is_primary->($vio0_ip);
      -  our $prefix = $primary ? '' : 'www.';
      -%>
      -
      -<% for my $host (@$acme_hosts) { %>
      -domain <%= $prefix.$host %> {
      -	domain key "/etc/ssl/private/<%= $prefix.$host %>.key"
      -	domain full chain certificate "/etc/ssl/<%= $prefix.$host %>.fullchain.pem"
      -	sign with letsencrypt
      -}
      -<% } %>
      -
      -
      +https://radicale.org/
      +https://codeberg.org/snonux/docker-radicale-server
      +https://www.davx5.com/

      -And this is the acme.sh.tpl:
      +

      bag.buetow.cloud



      -
      -#!/bin/sh
      -
      -<%
      -  our $primary = $is_primary->($vio0_ip);
      -  our $prefix = $primary ? '' : 'www.';
      --%>
      -
      -function handle_cert {
      -    host=$1
      -    # Create symlink, so that relayd also can read it.
      -    crt_path=/etc/ssl/$host
      -    if [ -e $crt_path.crt ]; then
      -        rm $crt_path.crt
      -    fi
      -    ln -s $crt_path.fullchain.pem $crt_path.crt
      -    # Requesting and renewing certificate.
      -    /usr/sbin/acme-client -v $host
      -}
      -
      -has_update=no
      -<% for my $host (@$acme_hosts) { -%>
      -handle_cert <%= $prefix.$host %>
      -if [ $? -eq 0 ]; then
      -    has_update=yes
      -fi
      -<% } -%>
      -
      -# Pick up the new certs.
      -if [ $has_update = yes ]; then
      -    /usr/sbin/rcctl reload httpd
      -    /usr/sbin/rcctl reload relayd
      -    /usr/sbin/rcctl restart smtpd
      -fi
      -
      +Wallabag is a self-hostable "save now - read later" service, and it also comes with an Android app which also has an offline mode. Think of Getpocket, but open-source!

      -

      Service rexification


      +https://wallabag.org/
      +https://github.com/wallabag/wallabag

      -These are the Rex tasks setting up httpd, relayd and smtpd services:
      +

      anki.buetow.cloud



      -
      -desc 'Setup httpd';
      -task 'httpd', group => 'frontends',
      -  sub {
      -    append_if_no_such_line '/etc/rc.conf.local', 'httpd_flags=';
      -
      -    file '/etc/httpd.conf',
      -      content => template('./etc/httpd.conf.tpl',
      -        acme_hosts => \@acme_hosts,
      -        is_primary => $is_primary),
      -      owner => 'root',
      -      group => 'wheel',
      -      mode => '644',
      -      on_change => sub { service 'httpd' => 'restart' };
      -
      -    service 'httpd', ensure => 'started';
      -  };
      -
      -desc 'Setup relayd';
      -task 'relayd', group => 'frontends',
      -  sub {
      -    append_if_no_such_line '/etc/rc.conf.local', 'relayd_flags=';
      -
      -    file '/etc/relayd.conf',
      -      content => template('./etc/relayd.conf.tpl',
      -        ipv6address => $ipv6address,
      -        is_primary => $is_primary),
      -      owner => 'root',
      -      group => 'wheel',
      -      mode => '600',
      -      on_change => sub { service 'relayd' => 'restart' };
      -
      -    service 'relayd', ensure => 'started';
      -  };
      -
      -desc 'Setup OpenSMTPD';
      -task 'smtpd', group => 'frontends',
      -  sub {
      -    Rex::Logger::info('Dealing with mail aliases');
      -    file '/etc/mail/aliases',
      -      source => './etc/mail/aliases',
      -      owner => 'root',
      -      group => 'wheel',
      -      mode => '644',
      -      on_change => sub { say run 'newaliases' };
      -
      -    Rex::Logger::info('Dealing with mail virtual domains');
      -    file '/etc/mail/virtualdomains',
      -      source => './etc/mail/virtualdomains',
      -      owner => 'root',
      -      group => 'wheel',
      -      mode => '644',
      -      on_change => sub { service 'smtpd' => 'restart' };
      -
      -    Rex::Logger::info('Dealing with mail virtual users');
      -    file '/etc/mail/virtualusers',
      -      source => './etc/mail/virtualusers',
      -      owner => 'root',
      -      group => 'wheel',
      -      mode => '644',
      -      on_change => sub { service 'smtpd' => 'restart' };
      -
      -    Rex::Logger::info('Dealing with smtpd.conf');
      -    file '/etc/mail/smtpd.conf',
      -      content => template('./etc/mail/smtpd.conf.tpl',
      -        is_primary => $is_primary),
      -      owner => 'root',
      -      group => 'wheel',
      -      mode => '644',
      -      on_change => sub { service 'smtpd' => 'restart' };
      -
      -    service 'smtpd', ensure => 'started';
      -  };
      -
      -
      -
      -This is the httpd.conf.tpl:
      +Anki is a great (the greatest) flash-card learning program. I am currently learning Bulgarian as my 3rd language. There is also an Android app that has an offline mode, and advanced users can also self-host the server anki-sync-server. For some reason (not going into the details here), I had to build my own Docker image for the server.

      -
      -<%
      -  our $primary = $is_primary->($vio0_ip);
      -  our $prefix = $primary ? '' : 'www.';
      -%>
      -
      -# Plain HTTP for ACME and HTTPS redirect
      -<% for my $host (@$acme_hosts) { %>
      -server "<%= $prefix.$host %>" {
      -  listen on * port 80
      -  location "/.well-known/acme-challenge/*" {
      -    root "/acme"
      -    request strip 2
      -  }
      -  location * {
      -    block return 302 "https://$HTTP_HOST$REQUEST_URI"
      -  }
      -}
      -<% } %>
      -
      -# Gemtexter hosts
      -<% for my $host (qw/foo.zone snonux.land/) { %>
      -server "<%= $prefix.$host %>" {
      -  listen on * tls port 443
      -  tls {
      -    certificate "/etc/ssl/<%= $prefix.$host %>.fullchain.pem"
      -    key "/etc/ssl/private/<%= $prefix.$host %>.key"
      -  }
      -  location * {
      -    root "/htdocs/gemtexter/<%= $host %>"
      -    directory auto index
      -  }
      -}
      -<% } %>
      -
      -# DTail special host
      -server "<%= $prefix %>dtail.dev" {
      -  listen on * tls port 443
      -  tls {
      -    certificate "/etc/ssl/<%= $prefix %>dtail.dev.fullchain.pem"
      -    key "/etc/ssl/private/<%= $prefix %>dtail.dev.key"
      -  }
      -  location * {
      -    block return 302 "https://github.dtail.dev$REQUEST_URI"
      -  }
      -}
      -
      -# Irregular Ninja special host
      -server "<%= $prefix %>irregular.ninja" {
      -  listen on * tls port 443
      -  tls {
      -    certificate "/etc/ssl/<%= $prefix %>irregular.ninja.fullchain.pem"
      -    key "/etc/ssl/private/<%= $prefix %>irregular.ninja.key"
      -  }
      -  location * {
      -    root "/htdocs/irregular.ninja"
      -    directory auto index
      -  }
      -}
      -
      -# buetow.org special host.
      -server "<%= $prefix %>buetow.org" {
      -  listen on * tls port 443
      -  tls {
      -    certificate "/etc/ssl/<%= $prefix %>buetow.org.fullchain.pem"
      -    key "/etc/ssl/private/<%= $prefix %>buetow.org.key"
      -  }
      -  block return 302 "https://paul.buetow.org"
      -}
      -
      -server "<%= $prefix %>paul.buetow.org" {
      -  listen on * tls port 443
      -  tls {
      -    certificate "/etc/ssl/<%= $prefix %>paul.buetow.org.fullchain.pem"
      -    key "/etc/ssl/private/<%= $prefix %>paul.buetow.org.key"
      -  }
      -  block return 302 "https://foo.zone/contact-information.html"
      -}
      -
      -server "<%= $prefix %>tmp.buetow.org" {
      -  listen on * tls port 443
      -  tls {
      -    certificate "/etc/ssl/<%= $prefix %>tmp.buetow.org.fullchain.pem"
      -    key "/etc/ssl/private/<%= $prefix %>tmp.buetow.org.key"
      -  }
      -  root "/htdocs/buetow.org/tmp"
      -  directory auto index
      -}
      -
      +https://apps.ankiweb.net/
      +https://codeberg.org/snonux/docker-anki-sync-server

      -and this the relayd.conf.tpl:
      +

      vault.buetow.cloud



      -
      -<%
      -  our $primary = $is_primary->($vio0_ip);
      -  our $prefix = $primary ? '' : 'www.';
      -%>
      -
      -log connection
      -
      -tcp protocol "gemini" {
      -    tls keypair <%= $prefix %>foo.zone
      -    tls keypair <%= $prefix %>buetow.org
      -}
      -
      -relay "gemini4" {
      -    listen on <%= $vio0_ip %> port 1965 tls
      -    protocol "gemini"
      -    forward to 127.0.0.1 port 11965
      -}
      -
      -relay "gemini6" {
      -    listen on <%= $ipv6address->($hostname) %> port 1965 tls
      -    protocol "gemini"
      -    forward to 127.0.0.1 port 11965
      -}
      -
      +Vaultwarden is an alternative implementation of the Bitwarden server API written in Rust and compatible with upstream Bitwarden clients, perfect for self-hosted deployment where running the official resource-heavy service might not be ideal. So, this is a great password manager server which can be used with any Bitwarden Android app.
      +
      +I currently don't use it, but I may in the future. I made it available in my ECS Fargate setup anyway for now.
      +
      +https://github.com/dani-garcia/vaultwarden
      +
      +I currently use geheim, a Ruby command line tool I wrote, as my current password manager. You can read a little bit about it here under "More":
      +
      +Sweating the small stuff
      +
      +

      bastion.buetow.cloud


      +
      +This is a tiny ARM-based Amazon Linux EC2 instance, which I sometimes spin up for investigation or manual work on my EFS file system in AWS.
      +
      +

      Conclusion


      +
      +I have learned a lot about AWS and Terraform during this migration. This was actually my first AWS hands-on project with practical use.
      +
      +All of this was not particularly difficult (but at times a bit confusing). I see the use of Terraform managing more extensive infrastructures (it was even helpful for my small setup here). At least I know now what all the buzz is about :-). I don't think Terraform's HCL is a nice language. It get's it's job done, but it could be more elegant IMHO.
      +
      +Deploying updates to AWS are much easier, and some of the manual maintenance burdens of my Rocky Linux 9 VM are no longer needed. So I will have more time for other projects!
      +
      +Will I keep it in the cloud? I don't know yet. But maybe I won't renew the buetow.cloud domain and instead will use *.cloud.buetow.org or *.aws.buetow.org subdomains.
      +
      +Will the AWS setup be cheaper than my old Rocky Linux setup? It might be more affordable as I only turn ECS and the load balancers on or off on-demand. Time will tell! The first forecasts suggest that it will be around the same costs.
      +
      +E-Mail your comments to paul@nospam.buetow.org :-)
      +
      +Back to the main site
      +
      +
      +
      + + One reason why I love OpenBSD + + https://foo.zone/gemfeed/2024-01-13-one-reason-why-i-love-openbsd.html + 2024-01-13T22:55:33+02:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + HKISSFISHKISSFISHKISSFISHKISSFISH KISS + +
      +

      One reason why I love OpenBSD



      -And last but not least, this is the smtpd.conf.tpl:
      +Published at 2024-01-13T22:55:33+02:00

      -<%
      -  our $primary = $is_primary->($vio0_ip);
      -  our $prefix = $primary ? '' : 'www.';
      -%>
      -
      -pki "buetow_org_tls" cert "/etc/ssl/<%= $prefix %>buetow.org.fullchain.pem"
      -pki "buetow_org_tls" key "/etc/ssl/private/<%= $prefix %>buetow.org.key"
      -
      -table aliases file:/etc/mail/aliases
      -table virtualdomains file:/etc/mail/virtualdomains
      -table virtualusers file:/etc/mail/virtualusers
      -
      -listen on socket
      -listen on all tls pki "buetow_org_tls" hostname "<%= $prefix %>buetow.org"
      -#listen on all
      -
      -action localmail mbox alias <aliases>
      -action receive mbox virtual <virtualusers>
      -action outbound relay
      -
      -match from any for domain <virtualdomains> action receive
      -match from local for local action localmail
      -match from local for any action outbound
      +           FISHKISSFISHKIS               
      +       SFISHKISSFISHKISSFISH            F
      +    ISHK   ISSFISHKISSFISHKISS         FI
      +  SHKISS   FISHKISSFISHKISSFISS       FIS
      +HKISSFISHKISSFISHKISSFISHKISSFISH    KISS
      +  FISHKISSFISHKISSFISHKISSFISHKISS  FISHK
      +      SSFISHKISSFISHKISSFISHKISSFISHKISSF
      +  ISHKISSFISHKISSFISHKISSFISHKISSF  ISHKI
      +SSFISHKISSFISHKISSFISHKISSFISHKIS    SFIS
      +  HKISSFISHKISSFISHKISSFISHKISS       FIS
      +    HKISSFISHKISSFISHKISSFISHK         IS
      +       SFISHKISSFISHKISSFISH            K
      +         ISSFISHKISSFISHK               
       

      -

      All pieces together


      +I just upgraded my OpenBSD's from 7.3 to 7.4 by following the unattended upgrade guide:

      -For the complete Rexfile example and all the templates, please look at the Git repository:
      +https://www.openbsd.org/faq/upgrade74.html

      -https://codeberg.org/snonux/rexfiles
      + +
      $ doas installboot sd0 # Update the bootloader (not for every upgrade required)
      +$ doas sysupgrade # Update all binaries (including Kernel)
      +

      -Besides ACME, other things, such as DNS servers, are also rexified. The following command will run all the Rex tasks and configure everything on my frontend machines automatically:
      +sysupgrade downloaded and upgraded to the next release and rebooted the system. After the reboot, I run:

      -
      -rex commons
      +
      +
      $ doas sysmerge # Update system configuration files
      +$ doas pkg_add -u # Update all packages
      +$ doas reboot # Just in case, reboot one more time
       

      -The commons is a group of tasks I specified which combines a set of common tasks I always want to execute on all frontend machines. This also includes the ACME tasks mentioned in this article!
      +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.

      -

      Conclusion


      +I followed the same procedure the previous times and never encountered any difficulties with any OpenBSD upgrades.

      -ACME and Let's Encrypt greatly help reduce recurring manual maintenance work (creating and renewing certificates). Furthermore, all the certificates are free of cost! I love to use OpenBSD and Rex to automate all of this.
      +I have seen upgrades of other Operating Systems either take a long time or break the system (which takes manual steps to repair). That's just one of many reasons why I love OpenBSD! There appear never to be any problems. It just gets its job done!

      -OpenBSD suits perfectly here as all the tools are already part of the base installation. But I like underdogs. Rex is not as powerful and popular as other configuration management systems (e.g. Puppet, Chef, SALT or even Ansible). It is more of an underdog, and the community is small.
      +The OpenBSD Project
      +
      +BTW: are you looking for an opinionated OpenBSD VM hoster? OpenBSD Amsterdam may be for you. They rock (I am having a VM there, too)!
      +
      +https://openbsd.amsterdam
      +
      +E-Mail your comments to paul@nospam.buetow.org :-)

      -Why re-inventing the wheel? I love that a Rexfile is just a Perl DSL. Also, OpenBSD comes with Perl in the base system. So no new programming language had to be added to my mix for the configuration management system. Also, the acme.sh shell script is not a Bash but a standard Bourne shell script, so I didn't have to install an additional shell as OpenBSD does not come with the Bash pre-installed.
      +Other *BSD related posts are:

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2025-02-01 f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
      +2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
      +2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
      +2024-04-01 KISS high-availability with OpenBSD
      +2024-01-13 One reason why I love OpenBSD (You are currently reading this)
      +2022-10-30 Installing DTail on OpenBSD
      +2022-07-30 Let's Encrypt with OpenBSD and Rex
      +2016-04-09 Jails and ZFS with Puppet on FreeBSD

      Back to the main site
      - Sweating the small stuff - Tiny projects of mine - - https://foo.zone/gemfeed/2022-06-15-sweating-the-small-stuff.html - 2022-06-15T08:47:44+01:00 + Site Reliability Engineering - Part 3: On-Call Culture + + https://foo.zone/gemfeed/2024-01-09-site-reliability-engineering-part-3.html + 2024-01-09T18:35:48+02:00 Paul Buetow aka snonux paul@dev.buetow.org - This blog post is a bit different from the others. It consists of multiple but smaller projects worth mentioning. I got inspired by Julia Evan's 'Tiny programs' blog post and the side projects of The Sephist, so I thought I would also write a blog posts listing a couple of small projects of mine: + Welcome to Part 3 of my Site Reliability Engineering (SRE) series. I'm currently working as a Site Reliability Engineer, and I’m here to share what SRE is all about in this blog series.
      -

      Sweating the small stuff - Tiny projects of mine


      -
      -Published at 2022-06-15T08:47:44+01:00; Updated at 2022-06-18
      -
      -
      -         _
      -        /_/_      .'''.
      -     =O(_)))) ...'     `.
      - jgs    \_\              `.    .'''
      -                           `..'
      -
      -
      -This blog post is a bit different from the others. It consists of multiple but smaller projects worth mentioning. I got inspired by Julia Evan's "Tiny programs" blog post and the side projects of The Sephist, so I thought I would also write a blog posts listing a couple of small projects of mine:
      -
      -Tiny programs
      -The Sephist's project list
      -
      -Working on tiny projects is a lot of fun as you don't need to worry about any standards or code reviews and you decide how and when you work on it. There aren't restrictions regarding technologies used. You are likely the only person working on these tiny projects and that means that there is no conflict with any other developers. This is complete freedom :-).
      -
      -But before going through the tiny projects let's take a paragraph for the 1y anniversary retrospective.
      -
      -

      1y anniversary


      -
      -It has been one year since I started posting regularly (at least once monthly) on this blog again. It has been a lot of fun (and work) doing so for various reasons:
      -
      -
        -
      • I practice English writing (I am not a native speaker). I am far from being a novelist, but this blog helps improves my writing skills. I also tried out tools like Grammarly.com and Languagetool.org and also worked with :spell in Vim or the LibreOffice checker. This post was checked with the write-better Node application.
      • -
      • I force myself to "finish" some kind of project worth writing about every month. If its not a project, then its still a topic which requires research and deep thinking. Producing 2k words of text can actually be challenging.
      • -
      • It's fun to rely on KISS (keep it simple & stupid) tools. E.g. use of Gemtexter and not WordPress, use of Vim instead of an office suite or a rich web editor.
      • -

      -Retrospectively, these have been the most popular blog posts of mine over the last year:
      -
      -Keep it simple and stupid
      -Creative universe
      -Bash Golf series
      -How to stay sane as a DevOps person
      -Perl is still a great choice
      +

      Site Reliability Engineering - Part 3: On-Call Culture



      -But now, let's continue with the small projects worth mentioning :-)
      +Published at 2024-01-09T18:35:48+02:00

      -

      Static photo album generator


      +Welcome to Part 3 of my Site Reliability Engineering (SRE) series. I'm currently working as a Site Reliability Engineer, and I’m here to share what SRE is all about in this blog series.

      -photoalbum.sh is a minimal static HTML photo album generator. I use it to drive "The Irregular Ninja" site and for some ad-hoc (personal) albums to share photos with the family and friends.
      +2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
      +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance
      +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture (You are currently reading this)
      +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers

      -https://codeberg.org/snonux/photoalbum
      +
      +                    ..--""""----..                 
      +                 .-"   ..--""""--.j-.              
      +              .-"   .-"        .--.""--..          
      +           .-"   .-"       ..--"-. \/    ;         
      +        .-"   .-"_.--..--""  ..--'  "-.  :         
      +      .'    .'  /  `. \..--"" __ _     \ ;         
      +     :.__.-"    \  /        .' ( )"-.   Y          
      +     ;           ;:        ( )     ( ).  \         
      +   .':          /::       :            \  \        
      + .'.-"\._   _.-" ; ;      ( )    .-.  ( )  \       
      +  "    `."""  .j"  :      :      \  ;    ;  \      
      +    bug /"""""/     ;      ( )    "" :.( )   \     
      +       /\    /      :       \         \`.:  _ \    
      +      :  `. /        ;       `( )     (\/ :" \ \   
      +       \   `.        :         "-.(_)_.'   t-'  ;  
      +        \    `.       ;                    ..--":  
      +         `.    `.     :              ..--""     :  
      +           `.    "-.   ;       ..--""           ;  
      +             `.     "-.:_..--""            ..--"   
      +               `.      :             ..--""        
      +                 "-.   :       ..--""              
      +                    "-.;_..--""                    
      +
      +

      -

      The Irregular Ninja


      +

      Putting Well-being First



      -Photography is one of my casual hobbies. I love to capture interesting perspectives and motifs. I love to walk new streets and neighbourhoods I never walked before so I can capture those unexpected motifs, colours and moments. Unfortunately, because of time constraints (and sometime weather constraints), I do that on a pretty infrequent basis.
      +Site Reliability Engineering is all about keeping systems reliable, but we often forget how important the human side is. A healthy on-call culture is just as crucial as any technical fix. The well-being of the engineers really matters.

      -
      +First off, a healthy on-call rotation is about more than just handling incidents. It's about creating a supportive ecosystem. This means cutting down on pain points, offering mentorship, quickly iterating on processes, and making sure engineers have the right tools. But there's a catch—engineers need to be willing to learn. Especially in on-call rotations where SREs work with Software Engineers or QA Engineers, it can be tough to get everyone motivated. QA Engineers want to test, Software Engineers want to build new features; they don’t want to deal with production issues. This can be really frustrating for the SREs trying to mentor them.

      -More than 10 years ago I wrote the bespoke small static photo album generator in Bash photoalbum.sh which I recently refactored to a modern Bash coding style and also freshened up the Cascading Style Sheets. Last but not least, the new domain name irregular.ninja has been registered.
      +Plus, measuring a good on-call experience isn't always clear-cut. You might think fewer pages mean a better on-call setup—and yeah, no one wants to get paged after hours—but it's not just about the number of pages. Trust, ownership, accountability, and solid communication are what really matter.

      -The thumbnails are presented in a random order and there are also random CSS effects for each preview. There's also a simple background blur for each page generated. And that's all in less than 300 lines of Bash code! The script requires ImageMagick (available for all common Linux and *BSD distributions) to be installed.
      +A key part is giving feedback about the on-call experience to keep learning and improving. If alerts are mostly noise, they need to be tweaked or even ditched. If alerts are helpful, can we automate the repetitive tasks? If there are knowledge gaps, is the documentation lacking? Regular retrospectives ensure that the systems get better over time and the on-call experience improves for the engineers.

      -As you can see, there is a lot of randomization and irregularity going on. Thus, the name "Irregular Ninja" was born.
      +Getting new team members ready for on-call duties is super important for keeping systems reliable and efficient. This means giving them the knowledge, tools, and support they need to handle incidents with confidence. It starts with a rundown of the system architecture and common issues, then training on monitoring tools, alerting systems, and incident response protocols. Watching experienced on-call engineers in action can provide some hands-on learning. Too often, though, new engineers get thrown into the deep end without proper onboarding because the more experienced engineers are too busy dealing with ongoing production issues.

      -https://irregular.ninja
      +A culture where everyone's always on and alert can cause burnout. Engineers need to know their limits, take breaks, and ask for help when they need it. This isn't just about personal health; a burnt-out engineer can drag down the whole team and the systems they manage. A good on-call culture keeps systems running while making sure engineers are happy, healthy, and supported. Experienced engineers should take the time to mentor juniors, but junior engineers should also stay engaged, investigate issues, and learn new things on their own.

      -I only use a digital compact camera or a smartphone to take the photos. I don't like the idea of carrying around a big camera with me "just in case" so I keep it small and simple. The best camera is the camera you have with you. :-)
      +For junior engineers, it's tempting to always ask the experts for help whenever something goes wrong. While that might seem reasonable, constantly handing out solutions doesn't scale—there are endless ways for production systems to break. So, every engineer needs to learn how to debug, troubleshoot, and resolve incidents on their own. The experts should be there for guidance and can step in when a junior gets really stuck, but they also need to give space for less experienced engineers to grow and learn.

      -I hope you like this photo site. It's worth checking it out again around once every other month!
      +A blameless on-call culture is essential for creating a safe and collaborative environment where engineers can handle incidents without worrying about getting blamed. It recognizes that mistakes are just part of learning and innovating. When people know they won’t be punished for errors, they’re more likely to talk openly about what went wrong, which helps the whole team learn and improve. Plus, a blameless culture boosts psychological safety, job satisfaction, and reduces burnout, keeping everyone committed and engaged.

      -

      Random journal page extractor


      +Mistakes are gonna happen, which is why having a blameless on-call culture is so important.

      -I bullet journal. I write my notes into a Leuchtturm paper notebook. Once full, I am scanning it to a PDF file and archive it. As of writing this, I am at journal #7 (each from 123 up to 251 pages in A5). It means that there is a lot of material already.
      +Continue with the fourth part of this series:

      -Once in a while I want to revisit older notes and ideas. For that I have written a simple Bash script randomjournalpage.sh which randomly picks a PDF file from a folder and extracts 42 pages from it at a random page offset and opens them in a PDF viewer (Evince in this case, as I am a GNOME user).
      +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers

      -https://codeberg.org/snonux/randomjournalpage
      +E-Mail your comments to paul@nospam.buetow.org :-)

      -There's also a weekly CRON job on my servers to send me a reminder that I might want to read in my old journals again. My laptop also runs this script each time it boots and saves the output to a NextCloud folder. From there, it's synchronized to the NextCloud server so I can pick it up from there with my smartphone later when I am "on the road".
      +Back to the main site
      +
      +
      +
      + + Bash Golf Part 3 + + https://foo.zone/gemfeed/2023-12-10-bash-golf-part-3.html + 2023-12-10T11:35:54+02:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + This is the third blog post about my Bash Golf series. This series is random Bash tips, tricks, and weirdnesses I have encountered over time. + +
      +

      Bash Golf Part 3



      -

      Global uptime records statistic generator


      +Published at 2023-12-10T11:35:54+02:00

      -guprecords is a Perl script which reads multiple uprecord files (produced by uptimed - a widely available daemon for recording server uptimes) and generates uptime statistics of multiple hosts combined. I keep all the record files of all my personal computers in a Git repository (I even keep the records of the boxes I don't own or use anymore) and there's already quite a collection of it. It looks like this:
      +This is the third blog post about my Bash Golf series. This series is random Bash tips, tricks, and weirdnesses I have encountered over time.

      -
      -❯ perl ~/git/guprecords/src/guprecords --indir=./stats/ --count=20 --all
      -Pos |            System |               Kernel |        Uptime |                Boot time
      -  1 |               sun | FreeBSD 10.1-RELEA.. | 502d 03:29:19 | Sun Aug 16 15:56:40 2015
      -  2 |            vulcan | Linux 3.10.0-1160... | 313d 13:19:39 | Sun Jul 25 18:32:25 2021
      -  3 |             uugrn | FreeBSD 10.2-RELEASE | 303d 15:19:35 | Tue Dec 22 21:33:07 2015
      -  4 |             uugrn | FreeBSD 11.0-RELEA.. | 281d 14:38:04 | Fri Oct 21 15:22:02 2016
      -  5 |         deltavega | Linux 3.10.0-957.2.. | 279d 11:15:00 | Sun Jun 30 11:42:38 2019
      -  6 |            vulcan | Linux 3.10.0-957.2.. | 279d 11:12:14 | Sun Jun 30 11:43:41 2019
      -  7 |         deltavega | Linux 3.10.0-1160... | 253d 04:42:22 | Sat Apr 24 13:34:34 2021
      -  8 |             host0 | FreeBSD 6.2-RELEAS.. | 240d 02:23:23 | Wed Jan 31 20:34:46 2007
      -  9 |             uugrn | FreeBSD 11.1-RELEA.. | 202d 21:12:41 | Sun May  6 18:06:17 2018
      - 10 |           tauceti |  Linux 3.2.0-4-amd64 | 197d 18:45:40 | Mon Dec 16 19:47:54 2013
      - 11 |             pluto | Linux 2.6.32-5-amd64 | 185d 11:53:04 | Wed Aug  1 07:34:10 2012
      - 12 |               sun | FreeBSD 10.3-RELEA.. | 164d 22:31:55 | Sat Jul 22 18:47:21 2017
      - 13 |            vulcan | Linux 3.10.0-1160... | 161d 07:08:43 | Sun Feb 14 10:05:38 2021
      - 14 |               sun | FreeBSD 10.3-RELEA.. | 158d 21:18:36 | Sat Jan 27 10:18:57 2018
      - 15 |             uugrn | FreeBSD 11.1-RELEA.. | 157d 20:57:24 | Fri Nov  3 05:02:54 2017
      - 16 |         tauceti-f |  Linux 3.2.0-3-amd64 | 150d 04:12:38 | Mon Sep 16 09:02:58 2013
      - 17 |           tauceti |  Linux 3.2.0-4-amd64 | 149d 09:21:43 | Mon Aug 11 09:47:50 2014
      - 18 |             pluto |  Linux 3.2.0-4-amd64 | 142d 02:57:31 | Mon Sep  8 01:59:02 2014
      - 19 |         tauceti-f |  Linux 3.2.0-3-amd64 | 132d 22:46:26 | Mon May  6 11:11:35 2013
      - 20 |       keppler-16b |        Darwin 13.4.0 | 131d 08:17:12 | Thu Jun 11 10:44:25 2015
      -
      -
      -It can also sum up all uptimes for each host to generate a total per host uptime top list:
      +2021-11-29 Bash Golf Part 1
      +2022-01-01 Bash Golf Part 2
      +2023-12-10 Bash Golf Part 3 (You are currently reading this)

      -❯ perl ~/git/guprecords/src/guprecords --indir=./stats/ --count=20 --total
      -Pos |            System |               Kernel |        Uptime |
      -  1 |            uranus | Linux 5.4.17-200.f.. | 1419d 19:05:39 |
      -  2 |               sun | FreeBSD 10.1-RELEA.. | 1363d 11:41:14 |
      -  3 |            vulcan | Linux 3.10.0-1160... | 1262d 20:27:48 |
      -  4 |             uugrn | FreeBSD 10.2-RELEASE | 1219d 15:10:16 |
      -  5 |         deltavega | Linux 3.10.0-957.2.. | 1115d 06:33:55 |
      -  6 |             pluto | Linux 2.6.32-5-amd64 | 1086d 10:44:05 |
      -  7 |           tauceti |  Linux 3.2.0-4-amd64 | 846d 12:58:21 |
      -  8 |         tauceti-f |  Linux 3.2.0-3-amd64 | 625d 07:16:39 |
      -  9 |             host0 | FreeBSD 6.2-RELEAS.. | 534d 19:50:13 |
      - 10 |       keppler-16b |        Darwin 13.4.0 | 448d 06:15:00 |
      - 11 |         tauceti-e |  Linux 3.2.0-4-amd64 | 415d 18:14:13 |
      - 12 |              moon |        Darwin 18.7.0 | 326d 11:21:42 |
      - 13 |          callisto | Linux 4.0.4-303.fc.. | 303d 12:18:24 |
      - 14 |     alphacentauri | FreeBSD 10.1-RELEA.. | 300d 20:15:00 |
      - 15 |             earth | Linux 5.13.14-200... | 289d 08:05:05 |
      - 16 |          makemake | Linux 5.11.9-200.f.. | 286d 21:53:03 |
      - 17 |            london |  Linux 3.2.0-4-amd64 | 258d 15:10:38 |
      - 18 |          fishbone | OpenBSD 4.1       .. | 223d 05:55:26 |
      - 19 |       sagittarius |        Darwin 15.6.0 | 198d 23:53:59 |
      - 20 |              mars |  Linux 3.2.0-4-amd64 | 190d 05:44:21 |
      +    '\       '\        '\                   .  .          |>18>>
      +      \        \         \              .         ' .     |
      +     O>>      O>>       O>>         .                 'o  |
      +      \       .\. ..    .\. ..   .                        |
      +      /\    .  /\     .  /\    . .                        |
      +     / /   .  / /  .'.  / /  .'    .                      |
      +jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      +                        Art by Joan Stark, mod. by Paul Buetow
       

      -https://codeberg.org/snonux/guprecords
      -
      -This all is of no real practical use but fun!
      -
      -

      Server configuration management


      -
      -The rexfiles project contains all Rex files for my (personal) server setup automation. A Rexfile is written in a Perl DSL run by the Rex configuration management system. It's pretty much KISS and that's why I love it. It suits my personal needs perfectly.
      +

      Table of Contents



      -https://codeberg.org/snonux/rexfiles
      -https://www.rexify.org
      -
      -This is an E-Mail I posted to the Rex mailing list:
      -
      -Hi there! I was searching for a simple way to automate my personal OpenBSD setup. I found that configuration management systems like Puppet, Salt, Chef, etc.. were too bloated for my personal needs. So for a while I was configuring everything by hand. At one point I got fed up and started writing Shell scripts. But that was not the holy grail so that I looked at Ansible. I found that Ansible had some dependencies on Python on the target machine when you want to use all the features. Furthermore, I am not really familiar with Python. But then I remembered that there was also Rex. It's written in my beloved Perl. Also, OpenBSD comes with Perl in the base system out of the box which makes it integrate better than all my scripts (automation and also scripts deployed via the automation to the system) are all in the same language. Rex may not have all the features like other configuration management systems, but its easy to work-around or extend when you know Perl. Thanks!
      +
      +

      FUNCNAME



      -

      Fancy SSH execution loop


      +FUNCNAME is an array you are looking for a way to dynamically determine the name of the current function (which could be considered the callee in the context of its own execution), you can use the special variable FUNCNAME. This is an array variable that contains the names of all shell functions currently in the execution call stack. The element FUNCNAME[0] holds the name of the currently executing function, FUNCNAME[1] the name of the function that called that, and so on.

      -rubyfy is a fancy SSH loop wrapper written in Ruby for running shell commands on multiple remote servers at once. I also forked this project for work (under a different name) where I added even more features such as automatic server discovery. It's used by many colleagues on a frequent basis. Here are some examples:
      +This is particularly useful for logging when you want to include the callee function in the log output. E.g. look at this log helper:

      -
      -# Run command 'hostname' on server foo.example.com
      -./rubyfy.rb -c 'hostname' <<< foo.example.com
      +
      +
      #!/usr/bin/env bash
       
      -# Run command 'id' as root (via sudo) on all servers listed in the list file
      -# Do it on 10 servers in parallel
      -./rubyfy.rb --parallel 10 --root --command 'id' < serverlist.txt
      +log () {
      +    local -r level="$1"; shift
      +    local -r message="$1"; shift
      +    local -i pid="$$"
       
      -# Run a fancy script in background on 50 servers in parallel
      -./rubyfy.rb -p 50 -r -b -c '/usr/local/scripts/fancy.zsh' < serverlist.txt
      +    local -r callee=${FUNCNAME[1]}
      +    local -r stamp=$(date +%Y%m%d-%H%M%S)
      +
      +    echo "$level|$stamp|$pid|$callee|$message" >&2
      +}
       
      -# Grep for specific process on both servers and write output to ./out/grep.txt
      -echo {foo,bar}.example.com | ./rubyfy.rb -p 10 -c 'pgrep -lf httpd' -n grep.txt
      +at_home_friday_evening () {
      +    log INFO 'One Peperoni Pizza, please'
      +}
       
      -# Reboot server only if file /var/run/maintenance.lock does NOT exist!
      -echo foo.example.com |
      -./rubyfy.rb --root --command reboot --precondition /var/run/maintenance.lock
      +at_home_friday_evening
       

      -https://codeberg.org/snonux/rubyfy
      +The output is as follows:

      -

      A KISS dynamic DNS solution


      + +
      ❯ ./logexample.sh
      +INFO|20231210-082732|123002|at_home_friday_evening|One Peperoni Pizza, please
      +

      -dyndns is a tiny shell script which implements "your" own DynDNS service. It relies on SSH access to the authoritative DNS server and the nsupdate command. There is really no need to use any of the "other" free DynDNS services out there.
      +

      :(){ :|:& };:



      -Syntax (this must run from the client connecting to the DNS server through SSH):
      +This one may be widely known already, but I am including it here as I found a cute image illustrating it. But to break :(){ :|:& };: down:

      -
      -ssh dyndns@dyndnsserver /path/to/dyndns-update \
      -    your.host.name. TYPE new-entry TIMEOUT
      -
      +
        +
      • :(){ } is really a declaration of the function :
      • +
      • The ; is ending the current statement
      • +
      • The : at the end is calling the function :
      • +
      • :|:& is the function body
      • +

      +Let's break down the function body :|:&:

      -This is a real world example:
      +
        +
      • The first : is calling the function recursively
      • +
      • The |: is piping the output to the function : again (parallel recursion)
      • +
      • The & lets it run in the background.
      • +

      +So, it's a fork bomb. If you run it, your computer will run out of resources eventually. (Modern Linux distributions could have reasonable limits configured for your login session, so it won't bring down your whole system anymore unless you run it as root!)

      -
      -ssh dyndns@dyndnsserver /path/to/dyndns-update \
      -  local.buetow.org. A 137.226.50.91 30
      -
      +And here is the cute illustration:

      -https://codeberg.org/snonux/dyndns
      +Bash fork bomb

      -

      CPU information gatherer for Linux


      +

      Inner functions



      -This is a tiny GNU Awk script for Linux which displays information about the CPU. All what it does is presenting /proc/cpuinfo in an easier to read way. The output is somewhat more compact than the standard lscpu command you find commonly on Linux distributions.
      +Bash defines variables as it is interpreting the code. The same applies to function declarations. Let's consider this code:

      -
      -❯ ./cpuinfo
      -cpuinfo (c) 1.0.2 Paul Buetow
      -
      - 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz GenuineIntel 12288 KB cache
      +
      +
      #!/usr/bin/env bash
       
      -p = 001 Physical processors
      -c = 004 Cores
      -s = 008 Siblings (Hyper-Threading enabled if s != c)
      -v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs
      - Hyper-Threading is enabled
      +outer() {
      +  inner() {
      +    echo 'Intel inside!'
      +  }
      +  inner
      +}
       
      -0003000 MHz each core
      -0012000 MHz total
      -0005990 Bogomips each processor (including virtual)
      -0023961 Bogomips total
      +inner
      +outer
      +inner
       

      -https://codeberg.org/snonux/cpuinfo
      +And let's execute it:

      -

      Show differences of two files over the network


      -
      -This is a shell wrapper to use the standard diff tool over the network to compare a file between two computers. It uses NetCat for the network part and also encrypts all traffic using OpenSSL. This is how its used:
      +
      +❯ ./inner.sh
      +/tmp/inner.sh: line 10: inner: command not found
      +Intel inside!
      +Intel inside!
      +

      -1. Open two terminal windows and login to two different hosts (you could use ClusterSSH or tmux here). 2. Run on the first host netdiff otherhost.example.org /file/to/diff.txt and run on the second host netdiff firsthost.example.org /file/to/diff.txt. 3. You then will see the file differences.
      +What happened? The first time inner was called, it wasn't defined yet. That only happens after the outer run. Note that inner will still be globally defined. But functions can be declared multiple times (the last version wins):

      -https://codeberg.org/snonux/netdiff
      + +
      #!/usr/bin/env bash
      +
      +outer1() {
      +  inner() {
      +    echo 'Intel inside!'
      +  }
      +  inner
      +}
      +
      +outer2() {
      +  inner() {
      +    echo 'Wintel inside!'
      +  }
      +  inner
      +}
      +
      +outer1
      +inner
      +outer2
      +inner
      +

      -

      Delay sending out E-Mails with Mutt


      +And let's run it:

      -This is a shell script for the Mutt email client for delaying sending out E-Mails. For example, you want to write an email on Saturday but don't want to bother the recipient earlier than Monday. It relies on CRON.
      +
      +❯ ./inner2.sh
      +Intel inside!
      +Intel inside!
      +Wintel inside!
      +Wintel inside!
      +

      -https://codeberg.org/snonux/muttdelay
      +

      Exporting functions



      -

      Graphical UI for sending text messages


      +Have you ever wondered how to execute a shell function in parallel through xargs? The problem is that this won't work:

      -jsmstrade is a minimalistic graphical Java swing client for sending SMS messages over the SMStrade service.
      + +
      #!/usr/bin/env bash
      +
      +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 "{}"'
      +

      -
      +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:

      -https://codeberg.org/snonux/jsmstrade
      -https://smstrade.de
      +
      +❯ ./xargs.sh
      +bash: line 1: some_expensive_operations: command not found
      +bash: line 1: some_expensive_operations: command not found
      +bash: line 1: some_expensive_operations: command not found
      +bash: line 1: some_expensive_operations: command not found
      +bash: line 1: some_expensive_operations: command not found
      +bash: line 1: some_expensive_operations: command not found
      +bash: line 1: some_expensive_operations: command not found
      +bash: line 1: some_expensive_operations: command not found
      +bash: line 1: some_expensive_operations: command not found
      +bash: line 1: some_expensive_operations: command not found
      +

      -

      IPv6 and IPv4 connectivity testing site


      +There's an easy solution for this. Just export the function! It will then be magically available in any sub-shell!

      -ipv6test is a quick and dirty Perl CGI script for testing whether your browser connects via IPv4 or IPv6. It requires you to setup three sub-domains: One reachable only via IPv4 (e.g. test4.ipv6.buetow.org), another reachable only via IPv6 (e.g. test6.ipv6.buetow.org) and the main one reachable through both protocols (e.g. ipv6.buetow.org).
      + +
      #!/usr/bin/env bash
      +
      +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 "{}"'
      +

      -I don't have it running on any of my servers at the moment. This means that there is no demo to show now. Sorry!
      +When we run this now, we get:

      -

      List open Jira tickets in the terminal


      +
      +❯ ./xargs.sh
      +Doing expensive operations with '0' from pid 132831
      +Doing expensive operations with '1' from pid 132832
      +Doing expensive operations with '2' from pid 132833
      +Doing expensive operations with '3' from pid 132834
      +Doing expensive operations with '4' from pid 132835
      +Doing expensive operations with '5' from pid 132836
      +Doing expensive operations with '6' from pid 132837
      +Doing expensive operations with '7' from pid 132838
      +Doing expensive operations with '8' from pid 132839
      +Doing expensive operations with '9' from pid 132840
      +

      -japi s a small Perl script for listing open Jira issues. It might be broken by now as the Jira APIs may have changed. Sorry! But feel free to fork and modernize it. :-)
      +If some_expensive_function would call another function, the other function must also be exported. Otherwise, there will be a runtime error again. E.g., this won't work:

      -https://codeberg.org/snonux/jsmstrade
      -
      -

      Debian running on "your" Android phone


      + +
      #!/usr/bin/env bash
      +
      +some_other_function() {
      +  echo "$1"
      +}
      +
      +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 "{}"'
      +

      -Debroid is a tutorial and a set of scripts to install and to run a Debian chroot on an Android phone.
      +... because some_other_function isn't exported! You will also need to add an export -f some_other_function!

      -Check out my previous post about it
      +

      Dynamic variables with local



      -I am not using Debroid anymore as I have switched to Termux now.
      +You may know that local is how to declare local variables in a function. Most don't know that those variables actually have dynamic scope. Let's consider the following example:

      -https://termux.com
      + +
      #!/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"
      +

      -

      Perl service framework


      +Let's pause a minute. What do you think the output would be?

      -PerlDaemon is a minimal daemon for Linux and other Unix like operating systems programmed in Perl. It is a minimal but pretty functional and fairly generic service framework. This means that it does not do anything useful other than providing a framework for starting, stopping, configuring and logging. To do something useful, a module (written in Perl) must be provided.
      +Let's run it:

      -Checkout my previous post about it
      +
      +❯ ./dynamic.sh
      +bar
      +baz
      +foo
      +

      -

      More


      +What happened? The variable foo (declared with local) is available in the function it was declared in and in all other functions down the call stack! We can even modify the value of foo, and the change will be visible up the call stack. It's not a global variable; on the last line, echo "$foo" echoes the global variable content.

      -There are more projects on my Codeberg page but they aren't as tiny as the ones mentioned in this post or aren't finished yet so I won't bother listing them here. However, there also a few more scripts used frequently by me (not publicly accessible (yet?)) which I would like to mention here:

      -

      Work time tracker


      +

      if conditionals



      -worktime.rb, for example, is a command line Ruby script I use to track my time spent working. This is to make sure that I don't overwork (in particular useful when working from home). It also generates some daily and weekly stats and carries over work time (surpluses or minuses) to the next work day, week or even year.
      +Consider all variants here more or less equivalent:

      -It has some special features such as tracking time for self-improvement/development, days off and time spent at the lunch break and time spent on Pet Projects.
      + +
      #!/usr/bin/env bash
      +
      +declare -r foo=foo
      +declare -r bar=bar
      +
      +if [ "$foo" = foo ]; then
      +  if [ "$bar" = bar ]; then
      +    echo ok1
      +  fi
      +fi
      +
      +if [ "$foo" = foo ] && [ "$bar" == bar ]; then
      +  echo ok2a
      +fi
      +
      +[ "$foo" = foo ] && [ "$bar" == bar ] && echo ok2b
      +
      +if [[ "$foo" = foo && "$bar" == bar ]]; then
      +  echo ok3a
      +fi
      +
      + [[ "$foo" = foo && "$bar" == bar ]] && echo ok3b
      +
      +if test "$foo" = foo && test "$bar" = bar; then
      +  echo ok4a
      +fi
      +
      +test "$foo" = foo && test "$bar" = bar && echo ok4b
      +

      -An example weekly report looks like this (I often don't track my lunch time but what I do instead I stop the work timer when I go out for lunch and start the work timer once back at the desk):
      +The output we get is:

      -     Mon 20211213 50: work:5.92h
      -     Tue 20211214 50: work:7.47h lunch:0.50h pet:0.42h
      -     Wed 20211215 50: work:8.86h pet:0.50h
      -     Thu 20211216 50: work:8.02h pet:0.50h
      -     Fri 20211217 50: work:9.81h
      -   * Sat 20211218 50: work:0.00h selfdevelopment:1.00h
      -   * Sun 20211219 50: work:2.08h pet:1.00h selfdevelopment:-2.08h
      -================================================
      - balance:0.06h work:42.15h lunch:0.50h pet:2.42h selfdevelopment:-1.08h buffer:8.38h
      +❯ ./if.sh
      +ok1
      +ok2a
      +ok2b
      +ok3a
      +ok3b
      +ok4a
      +ok4b
       

      -All I do when I start work is to run the wtlogin command and after finishing work to run the wtlogout command. My shell will remind me when I work without having logged in. It uses a simple JSON database which is editable with wtedit (this opens the JSON in Vim). The report shown above can be generated with wtreport. Any out-of-bounds reporting can be added with the wtadd command.
      -
      -

      Password and document store


      +

      Multi-line comments



      -geheim.rb is my personal password and document store ("geheim" is the German word for secret). It's written in Ruby and heavily relies on Git, FZF (for search), Vim and standard encryption algorithms. Other than the standard pass Unix password manager, geheim also encrypts the file names and password titles.
      +You all know how to comment. Put a # in front of it. You could use multiple single-line comments or abuse heredocs and redirect it to the : no-op command to emulate multi-line comments.

      -The tool is command line driven but also provides an interactive shell when invoked with geheim shell. It also works on my Android phone via Termux so I have all my documents and passwords always with me.
      + +
      #!/usr/bin/env bash
      +
      +# Single line comment
      +
      +# These are two single line
      +# comments one after another
      +
      +: <<COMMENT
      +This is another way a
      +multi line comment
      +could be written!
      +COMMENT
      +

      -

      Backup procedure


      +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!

      -backup is a Bash script which does run once daily (or every time on boot) on my home FreeBSD NAS server and performs backup related tasks such as creating a local backup of my remote NextCloud instance, creating encrypted (incremental) ZFS snapshots of everything what's stored on the NAS and synchronizes (via rsync) backups to a remote cloud storage. It also can synchronize backups to a local external USB drive.
      +

      Don't change it while it's executed



      -Check out my offsite backup series
      +Consider this script:

      -

      konpeito.media


      + +
      #!/usr/bin/env bash
      +
      +echo foo
      +echo echo baz >> $0
      +echo bar
      +

      -Here's a bonus...
      +When it is run, it will do:

      -                                                           ▄ █ ▄  ▄ █ ▄  ▄ █ ▄
      -                                                           ▄▀█▀▄  ▄▀█▀▄  ▄▀█▀▄
      -  ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                                            ▀      ▀      ▀
      - █   ▄▄     ▄▄   █
      - █  █  █▀▀▀█  █  █  █   ▄▀  ▄▀▀▀▀▄  █▄    █ █▀▀▀▀▀▄  ▄▀▀▀▀▄  █ ▀▀▀█▀▀▀ ▄▀▀▀▀▄
      - █   ▀▀▀▀▀▀▀▀▀   █  █ ▄█   █      █ █ ▀▄  █ █▄▄▄▄▄▀ █▄▄▄▄▄▄█ █    █   █      █
      - █ ▄▀▀▀▀▀▀▀▀▀▀▀▄ █  █▀  ▀▄ ▀▄    ▄▀ █   ▀▄█ █       ▀▄    ▄  █    █   ▀▄    ▄▀
      - ▀▄█▄█▄▄▄▄▄▄▄█▄█▄▀  ▀     ▀  ▀▀▀▀   ▀     ▀ ▀         ▀▀▀▀   ▀    ▀     ▀▀▀
      +❯ ./if.sh
      +foo
      +bar
      +baz
      +❯ cat if.sh
      +#!/usr/bin/env bash
      +
      +echo foo
      +echo echo baz >> $0
      +echo bar
      +echo baz
       

      -*THIS ISN'T MY PROJECT* but I found KONPEITO an interesting Gemini capsule. It's a quarterly released Low-Fi music mix tape distributed only through Gemini (and not the web).
      +So what happened? The echo baz line was appended to the script while it was still executed! And the interpreter also picked it up! It tells us that Bash evaluates each line as it encounters it. This can lead to nasty side effects when editing the script while it is still being executed! You should always keep this in mind!

      -https://konpeito.media
      -
      -If you wonder what Gemini is:
      +E-Mail your comments to paul@nospam.buetow.org :-)

      -Welcome to the Geminispae
      +Other related posts are:

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2023-12-10 Bash Golf Part 3 (You are currently reading this)
      +2022-01-01 Bash Golf Part 2
      +2021-11-29 Bash Golf Part 1
      +2021-06-05 Gemtexter - One Bash script to rule it all
      +2021-05-16 Personal Bash coding style guide

      Back to the main site
      - Perl is still a great choice - - https://foo.zone/gemfeed/2022-05-27-perl-is-still-a-great-choice.html - 2022-05-27T07:50:12+01:00 + Site Reliability Engineering - Part 2: Operational Balance + + https://foo.zone/gemfeed/2023-11-19-site-reliability-engineering-part-2.html + 2023-11-19T00:18:18+03:00 Paul Buetow aka snonux paul@dev.buetow.org - Perl (the Practical Extraction and Report Language) is a battle-tested, mature, multi-paradigm dynamic programming language. Note that it's not called PERL, neither P.E.R.L. nor Pearl. 'Perl' is the name of the language and `perl` the name of the interpreter or the interpreter command. + This is the second part of my Site Reliability Engineering (SRE) series. I am currently employed as a Site Reliability Engineer and will try to share what SRE is about in this blog series.
      -

      Perl is still a great choice


      -
      -Published at 2022-05-27T07:50:12+01:00; Updated at 2023-01-28
      -
      -Comic source: XKCD
      -
      -Perl (the Practical Extraction and Report Language) is a battle-tested, mature, multi-paradigm dynamic programming language. Note that it's not called PERL, neither P.E.R.L. nor Pearl. "Perl" is the name of the language and perl the name of the interpreter or the interpreter command.
      -
      -Unfortunately (it makes me sad), Perl's popularity has been declining over the last years as Google trends shows:
      -
      -
      -
      -So why is that? Once the de-facto standard super-glue language for the web nowadays seems to have a bad reputation. Often, people state:
      -
      -
        -
      • Perl is a write-only language. Nobody can read Perl code.
      • -
      • Perl? Isn't it abandoned? It's still at version 5!
      • -
      • Why use Perl as there are better alternatives?
      • -
      • Why all the sigils? It looks like an exploding ASCII factory!!
      • -

      -

      Write-only language


      -
      -Is Perl really a write-only language? You have to understand that Perl 5 was released in 1994 (28 years ago as of this writing) and when we refer to Perl we usually mean Perl 5. That's many years, and there are many old scripts not following the modern Perl best practices (as they didn't exist yet). So yes, legacy scripts may be difficult to read. Japanese may be difficult to read too if you don't know Japanese, though.
      -
      -To come back to the question: Is Perl a write-only language? I don't think so. Like in any other language, you have to apply best practices in order to keep your code maintainable. Some other programming languages enforce best practices, but that makes these languages less expressive. Perl follows the principles "there is more than one way to do it" (aka TIMTOWDI) and "making easy things easy and hard things possible".
      -
      -Perl gives the programmer more flexibility in how to do things, and this results in a stronger learning curve than for lesser expressive languages like for example Go or Python. But, like in everything in life, common sense has to be applied. You should not take TIMTOWDI to the extreme in a production piece of code. In my personal opinion, it is also more satisfying to program in an expressive language.
      -
      -Some good books on "good" Perl I can recommend are:
      -
      -Modern Perl
      -Higher Order Perl
      -
      -Due to Perl's expressiveness you will find a lot of obscure code in the interweb in form of obfuscation, fancy email signatures (JAPHs), art, polyglots and even poetry in Perl syntax. But that's not what you will find in production code. That's only people having fun with the language which is different to "getting things done". The expressiveness is a bonus. It makes the Perl programmers love Perl.
      -
      -JAPH
      -http://www.cpan.org/misc/japh
      -Perl Poetry
      -
      -Even I personally have written some poetry in Perl and experimented with a polyglot script:
      -
      -My very own Perl Poetry
      -A Perl-Raku-C polyglot generating the Fibonacci sequence
      -
      -This all doesn't mean that you can't "get things done" with Perl. Quite the opposite is the case. Perl is a very pragmatic programming language and is suitable very well for rapid prototyping and any kind of small to medium-sized scripts and programs. You can write large enterprise scale application in Perl too, but that wasn't the original intend of why Perl was invented (more on that later).
      -
      -

      Is Perl abandoned?


      -
      -As I pointed out in the previous section, Perl 5 is around for quite some time without any new major version released. This can lead to the impression that development is not progressing and that the project is abandoned. Nothing can be further from the truth. Perl 5.000 was released in 1994 and the latest version (as of this writing) Perl 5.34.1 was released two months ago in 2022. You can check the version history on Wikipedia. You will notice releases being made regularly:
      -
      -Perl 5 version history
      -
      -As you can see, Perl 5 is under active development. I can also recommend to have a look at the following book, it summarizes all new Perl features which showed up after Perl v5.10:
      -
      -Perl New Features by Joshua McAdams and brian d foy
      +

      Site Reliability Engineering - Part 2: Operational Balance



      -Actually, Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was officially changed to Raku in October 2019 as the differences between Perl 5 and Perl 6 were too groundbreaking. Raku would be a different topic (mostly out of scope of this blog article) but I at least wanted it to mention here. In my opinion, Raku is the "most powerful" programming language out there (I recently started learning it and intend to use it for some of my future personal programming projects):
      +Published at 2023-11-19T00:18:18+03:00

      -The Raku Programming Language
      -
      -So it means that Perl and Raku now exist in parallel. They influence each other, but are different programming languages now. So why not just all use Raku instead of Perl? There are still a couple of reasons of why to choose Perl over Raku:
      -
      -
        -
      • Many programmers already know Perl and many scripts are already written in Perl. It's possible to call Perl code from Raku (either inline or as a library) and it is also possible to auto-convert Perl code into Raku code, but that's either a workaround or involves some kind of additional work.
      • -
      • Perl 5 comes with a great backwards compatibility. Perl scripts from 5.000 will generally still work on a recent version of Perl. New features usually have to be enabled via a so-called "use pragmas". For example, in order to enable sub signatures, use signatures; has to be specified.
      • -
      • Perl is pre-installed almost everywhere. Fancy running a quick one-off script? In almost all cases, there's no need to install Perl first - it's already there on almost any Linux or *BSD or Unix or other Unix like operating system!
      • -
      • Perl has been ported to "zillions" of platforms. One day I found myself on a VMS box. Perl doesn't come installed by default on VMS, but the admin installed Perl there already. The whole operating system was very strange to me, but I was able to write "shell scripts" in Perl and became productive pretty quickly on VMS without knowing almost anything about VMS :-).
      • -
      • Perl is reliable. It has been proven itself "millions" of times, over and over again. Large enterprises, such as booking.com, heavily rely on Perl. Did you know that the package manager of the OpenBSD operating system is programmed in Perl, too?
      • -
      • Perl is a great language to program in (given that you follow the modern best practices). Don't get confused when Perl is doing some things differently than other programming languages.
      • -

      -Perl feature pragmas
      -The OpenBSD Operating System
      -Why does OpenBSD still include Perl in its base installation?
      -
      -The renaming of Perl 6 to Raku has now opened the door for a future Perl 7. As far as I understand, Perl 7 will be Perl 5 but with modern features enabled by default (e.g. pragmas use strict;, use warnings;, use signatures; and so on. Also, the hope is that a Perl 7 with modern standards will attract more beginners. There aren't many Perl jobs out there nowadays. That's mostly due to Perl's bad (bad for no real reasons) reputation.
      -
      -Update 2022-12-10: A reader pointed out, that use v5.36; already turns strict, warnings and signatures pragmas automatically on!
      -
      -Announcing Perl 7
      -What happened to Perl 7? (maybe have to use use v7;)
      -
      -Update 2022-12-10: A reader pointed out, that Perl 7 needs to provide a big improvement to earn and keep the attention for a major version bump.
      -
      -Update 2023-01-28: Meanwhile, I was also reading brian d foy's Perl New Feature book. It nicely presents all new features added to Perl since v5.10.
      -
      -Perl New Features
      -
      -

      Why use Perl as there are better alternatives?


      -
      -Here, common sense must be applied. I don't believe there is anything like "the perfect" programming language. Everyone has got his preferred (or a set of preferred) programming language to chose from. All programming languages come with their own set of strengths and weaknesses. These are the strengths making Perl shine, and you (technically) don't need to bother to look for "better" alternatives:
      -
      -
        -
      • Perl is better than Shell/AWK/SED scripts. There's a point where shell scripts become fairly complex. The next step-up is to switch to Perl. There are many different versions of shells and AWK and SED interpreters. Do you always know which versions (mawk, nawk, gawk, sed, gsed, grep, ggrep...) are currently installed? These commands aren't fully compatible to each other. However, there is only one Perl 5. Simply: Perl is faster, more powerful, more expressive than any shell script can ever be, and it is also extendible through CPAN. Perl can directly talk to databases, which shell scripts can't.
      • -
      • Perl code tends to be compact so that it's much better suitable for "shell scripting" and quick "one-liners" than other languages. In my own experience: Ruby and Python code tends to blow up quickly. It doesn't mean that Ruby and Python are not suitable for this task, but I think Perl does much better.
      • -
      • Perl 5 has proven itself for decades and is a very stable/robust language. It is a battle-tested and mature as something can ever become.
      • -
      • Perl is the reference standard for regular expressions. Even so much that there is a PCRE library (Perl Compatible Regular Expressions) used by many other languages now. Perl fully integrates regular expression syntax into the language, which doesn't feel like an odd add-on like in most other languages.
      • -
      • Perl 5 is the master of text processing (well, maybe after Raku now. But you might not have the latest Raku available everywhere). The chief objective of developing the language was for text processing, and this is where Perl (Practical extraction and report language) really shines.
      • -
      • Perl is a "deep" language. That means Perl got a lot of features and syntactic sugar and magic. Depending on the perspective, this could be interpreted as a downside too. But IMHO mastery of a "deep" language brings big rewards. The code can be very compact, and it is fun to code in it.
      • -
      • Perl is the only language I know which can do "taint checking". Running a script in taint mode makes Perl sanitize all external input and that's a great security feature. Ruby used to have this feature too, but it got removed (as I understand there were some problems with the implementation not completely safe and it was easier just to remove it from the language than to fix it).
      • -

      -About the first point, using Perl for better "shell" scripts was actually the original intend of why Perl was invented in the first place.
      +This is the second part of my Site Reliability Engineering (SRE) series. I am currently employed as a Site Reliability Engineer and will try to share what SRE is about in this blog series.

      -Perl one-liners
      -Mastering Regular Expressions
      -Taint checking
      -
      -Here are some reasons why not to chose Perl and look for "better" alternatives:
      -
      -
        -
      • If performance is your main objectives, then Perl might not be the language to use. Perl is a dynamic interpreted language, and it will generally never be as fast as statically typed languages compiled to native binaries (e.g. C/C++/Rust/Haskell) or statically typed languages run in a VM with JIT (e.g. Java) or languages like Golang (statically typed, compiled to a binary but still with a runtime in the binary). Perl might be still faster than the other language listed here in certain circumstances (e.g. faster startup time than Java or faster regular expressions engine), but usually it's not. It's not a problem of Perl, it's a problem of all dynamic scripting languages including Python, Ruby, ....
      • -
      • Don't use Perl (just yet) if you want to code object-oriented. Perl supports OOP, but it feels clunky and odd to use (blessed references to any data types are objects) and doesn't support real encapsulation out of the box. There are many (many) extensions available on CPAN to make OOP better, but that's totally fragmented. The most popular extension, Moose, comes with a huge dependency tree. But wait for Perl 7. It will maybe come with a new object system (an object system inspired by Raku).
      • -
      • It's possible to write large programs in Perl (make difficult things possible), but it might not be the best choice here. This also leads back to the clunky object system Perl has. You could write your projects in a procedural or functional style (Perl perfectly fits here), but OOP seems to be the gold standard for large projects nowadays. Functional programming requires a different mindset, and pure procedural programming lacks abstractions.
      • -
      • Apply common sense. What is the skill set your team has? What's already widely used and supported at work? Which languages comes with the best modules for the things you want to work on? Maybe Python is the answer (better machine learning modules). Maybe Perl is the better choice (better Bioinformatic modules). Perhaps Ruby is already the de-facto standard at work and everyone knows at least a little Ruby (as it happened to be at my workplace) and Ruby is "good enough" for all the tasks already. But that's not a hindrance to throw in a Perl one-liner once in a while :P.
      • -

      -Cor - Bringing modern OOP to the Perl Core
      +2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture
      +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance (You are currently reading this)
      +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture
      +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers

      -

      Why all the sigils? It looks like an exploding ASCII factory!!


      +
      +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      +⠀⠀⠀⠀⣾⠿⠿⠿⠶⠾⠿⠿⣿⣿⣿⣿⣿⣿⠿⠿⠶⠶⠿⠿⠿⣷⠀⠀⠀⠀
      +⠀⠀⠀⣸⢿⣆⠀⠀⠀⠀⠀⠀⠀⠙⢿⡿⠉⠀⠀⠀⠀⠀⠀⠀⣸⣿⡆⠀⠀⠀
      +⠀⠀⢠⡟⠀⢻⣆⠀⠀⠀⠀⠀⠀⠀⣾⣧⠀⠀⠀⠀⠀⠀⠀⣰⡟⠀⢻⡄⠀⠀
      +⠀⢀⣾⠃⠀⠀⢿⡄⠀⠀⠀⠀⠀⢠⣿⣿⡀⠀⠀⠀⠀⠀⢠⡿⠀⠀⠘⣷⡀⠀
      +⠀⣼⣏⣀⣀⣀⣈⣿⡀⠀⠀⠀⠀⣸⣿⣿⡇⠀⠀⠀⠀⢀⣿⣃⣀⣀⣀⣸⣧⠀
      +⠀⢻⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⣿⣿⣿⣿⠀⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⡿⠀
      +⠀⠀⠉⠛⠛⠛⠋⠁⠀⠀⠀⠀⢸⣿⣿⣿⣿⡆⠀⠀⠀⠀⠈⠙⠛⠛⠛⠉⠀⠀
      +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
      +⠀⠀⠀⠀⠀⠀⠴⠶⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠶⠦⠀⠀
      +

      -The sigils $ @ % & (where Perl is famously known for) serve a purpose. They seem confusing at first, but they actually make the code better readable. $scalar is a scalar variable (holding a single value), @array is an array (holding a list of values), %hash holds a list of key-value pairs and &sub is for subroutines. A given variable $ref can also hold reference to something. @$arrayref dereferences a reference to an array, %$hashref to a hash, $$scalarref to a scalar, &$subref dereferences a referene to a subroutine, etc. That can be encapsulated as deep as you want. (This paragraph only scratched the surface here of what Perl can do, and there is a lot of syntactic sugar not mentioned here).
      +

      Striking the Right Balance Between Reliability and Speed



      -In most other programming languages, you won't know instantly what's the "basic type" of a given variable without looking at the variable declaration or the variable name (If named intelligently, e.g. a variable name containing a list of cats is cat_list). Even Ruby makes some use of sigils (@, @@ and $), but that's for a different purpose than in Perl (in Ruby it is about object scope, class scope and global scope). Raku uses all the sigils Perl uses plus an additional bunch of twigils, e.g. $.foo for a scalar object variable with public accessors, $!foo for a private scalar object variable, @.foo, @!foo, %.foo, %!foo and so on. Sigils (and twigils) are very convenient once you get used to them. Don't let them scare you off - they are there to help you!
      +Site Reliability Engineering is more than just a bunch of best practices or methods. It's a guiding light for engineering teams, helping them navigate the tricky waters of modern software development and system management.
      +In the world of software production, there are two big forces that often clash: the push for fast feature releases (velocity) and the need for reliable systems. Traditionally, moving faster meant more risk. SRE helps balance these opposing goals with things like error budgets and SLIs/SLOs. These tools give teams a clear way to measure how much they can push changes without hurting system health. So, the error budget becomes a balancing act, helping teams trade off between innovation and reliability.

      -https://www.perl.com/article/on-sigils/
      +Finding the right balance in SRE means juggling operations and coding. Ideally, engineers should split their time 50/50 between these tasks. This isn't just a random rule; it highlights how much SRE values both maintaining smooth operations and driving innovation. This way, SREs not only handle today's problems but also prepare for tomorrow's challenges.

      -

      Where do I personally still use perl?


      +But not all operations tasks are the same. SRE makes a clear distinction between "ops work" and "toil." Ops work is essential for maintaining systems and adds value, while toil is the repetitive, boring stuff that doesn’t. It's super important to recognize and minimize toil because a culture that lets engineers get bogged down in it will kill innovation and growth. The way an organization handles toil says a lot about its operational health and commitment to balance.

      -
        -
      • I use Rexify for my OpenBSD server automation. Rexify is a configuration management system developed in Perl with similar features to Ansible but less bloated. It suits my personal needs perfectly.
      • -
      • I have written a couple of smaller to medium-sized Perl scripts which I (mostly) still use regularly. You can find them on my Codeberg page.
      • -
      • My day-to-day workflow heavily relies on "ack-grep". Ack is a tool developed in Perl aimed at programmers and can be used for quick searches on source code at the command line.
      • -
      • I aim to leave my OpenBSD servers as "vanilla" as possible (trying to rely only on the standard/base installation without installing additional software from the packaging system or ports tree). All my scripts are written either Bourne shell or in Perl here. So there is no need to install additional interpreters.
      • -
      • Here and there, I drop a Perl one-liner in order to get stuff done (work and personally). A wise Perl Monk would say: "One one-liner a day keeps the troubles away".
      • -

      -Btw.: Did you know that the first version of PHP was a set of Perl snippets? Only later, PHP became an independent programming language.
      +A key part of finding operational balance is the tools and processes that SREs use. Great monitoring and observability tools, especially those that can handle lots of complex data, are essential. This isn’t just about having the right tech—it shows that the organization values proactive problem-solving. With systems that can spot potential issues early, SREs can keep things stable while still pushing forward.

      -https://www.perl.org
      +Operational balance isn't just about tech or processes; it's also about people. The well-being of on-call engineers is just as important as the health of the services they manage. Doing postmortems after incidents, having continuous feedback loops, and identifying gaps in tools, skills, or resources all help make sure the human side of operations gets the attention it deserves.

      -Update 2022-12-17: The following is another related post. I don't agree to the statement made there, that Python code tends to be shorter than Perl code, though!
      +In the end, finding operational balance in SRE is an ongoing journey, not a one-time thing. Companies need to keep reassessing their practices, tools, and especially their culture. When they get this balance right, they can keep innovating without sacrificing the reliability of their systems, leading to long-term success.

      -Why Perl is still relevant in 2022
      +That all sounds pretty idealistic. The reality is that getting the perfect balance is really tough. No system is ever going to be perfect. But hey, we should still strive for it!

      -Other related posts are:
      +Continue with the third part of this series:

      -2008-06-26 Perl Poetry
      -2011-05-07 Perl Daemon (Service Framework)
      -2022-05-27 Perl is still a great choice (You are currently reading this)
      -2023-05-01 Unveiling guprecords.raku: Global Uptime Records with Raku
      +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture

      E-Mail your comments to paul@nospam.buetow.org :-)

      @@ -4999,3045 +5360,2731 @@ v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs - Creative universe - - https://foo.zone/gemfeed/2022-04-10-creative-universe.html - 2022-04-10T10:09:11+01:00 + 'Mind Management' book notes + + https://foo.zone/gemfeed/2023-11-11-mind-management-book-notes.html + 2023-11-11T22:21:47+02:00 Paul Buetow aka snonux paul@dev.buetow.org - I have been participating in an annual work-internal project contest (we call it Pet Project contest) since I moved to London and switched jobs to my current employer. I am very happy to say that I won a 'silver' prize last week here 🎆. Over the last couple of years I have been a finalist in this contest six times and won some kind of prize five times. Some of my projects were also released as open source software. One had a magazine article published, and for another one I wrote an article on my employer's engineering blog. If you have followed all my posts on this blog (the one you are currently reading), then you have probably figured out what these projects were: + These are my personal takeaways after reading 'Mind Management' by David Kadavy. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.
      -

      Creative universe


      +

      "Mind Management" book notes


      +
      +Published at 2023-11-11T22:21:47+02:00

      -Published at 2022-04-10T10:09:11+01:00; Updated at 2022-04-18
      +These are my personal takeaways after reading "Mind Management" by David Kadavy. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.

      - .              +   .                .   . .     .  .
      -                   .                    .       .     *
      -  .       *                        . . . .  .   .  + .
      -            "You Are Here"            .   .  +  . . .
      -.                 |             .  .   .    .    . .
      -                  |           .     .     . +.    +  .
      -                 \|/            .       .   . .
      -        . .       V          .    * . . .  .  +   .
      -           +      .           .   .      +
      -                            .       . +  .+. .
      -  .                      .     . + .  . .     .      .
      -           .      .    .     . .   . . .        ! /
      -      *             .    . .  +    .  .       - O -
      -          .     .    .  +   . .  *  .       . / |
      -               . + .  .  .  .. +  .
      -.      .  .  .  *   .  *  . +..  .            *
      - .      .   . .   .   .   . .  +   .    .            +
      -                                         - the universe
      +         ,..........   ..........,
      +     ,..,'          '.'          ',..,
      +    ,' ,'            :            ', ',
      +   ,' ,'             :             ', ',
      +  ,' ,'              :              ', ',
      + ,' ,'............., : ,.............', ',
      +,'  '............   '.'   ............'  ',
      + '''''''''''''''''';''';''''''''''''''''''
      +                    '''
       

      -

      Prelude


      -
      -I have been participating in an annual work-internal project contest (we call it Pet Project contest) since I moved to London and switched jobs to my current employer. I am very happy to say that I won a "silver" prize last week here 🎆. Over the last couple of years I have been a finalist in this contest six times and won some kind of prize five times. Some of my projects were also released as open source software. One had a magazine article published, and for another one I wrote an article on my employer's engineering blog. If you have followed all my posts on this blog (the one you are currently reading), then you have probably figured out what these projects were:
      -
      -DTail - The distributed log tail program
      -Realistic load testing with I/O Riot for linux
      -
      -Note that my latest silver prize project isn't open source software and because of that there is no public material I can refer to. Maybe the next one again?
      -
      -I want to point out that I never won the "gold" prize and it's the first time I won "silver", though. I believe, looking at the company's contest history, I am the employee with the most consecutive successful project submissions (my streak broke as I didn't participate last year) and am also the one with the highest successful project count in total. Sorry if this all sounds a bit self-promotional, but I think it is something to be proud of. Consistency beats a one-off success.
      -
      -I often put endless hours and sometimes sleepless nights into such projects and all of that in my own time. I, an engineer whose native tongue is not English, also have to present such a project in front of the CEO, CTO and CPO, the Chief Scientist, the founders of the company, and, if it is not enough, to all other staff of the company too. I usually also demonstrate a working prototype live on a production grid during the presentation. 😓
      -
      -So why would I sign up myself for such side projects? Isn't it a lot of stress and extra work? Besides the prize in form of money (you can not count on that, you may win or you may not win something) and recognition, there are also other motivational points:
      +

      Table of Contents




      -

      How to be creative


      +

      It's not about time management



      -How did I manage to be creative with all these Pet Projects? Unfortunately, there is no step-by-step guide I could point you to. But what I want to do in this blog post is share my personal experience so far.
      -
      -

      Know which problem you want to solve


      -
      -There must be a problem to be solved or a thing to be improved. It makes no sense to have a project without a goal. A problem might be obvious to you, and you don't even need to think about it. In that case, you are all set, and you can immerse yourself with the problem.
      -
      -If, however, you don't know what problem you want to solve: Do you really need to be creative? All problems are solved anyway, correct? In that case, just go on with your work. As you immerse yourself with your daily work, you will find a project naturally after a while. I don't believe you should artificially find a project. It should come naturally to you. You should have an interest in the problem domain and a strong desire to find a proper solution for the problem. Artificially created projects come with the catch that you might give up on it rather sooner than later due to lack of motivation and desire.
      -
      -

      Immerse / deep dive


      -
      -If you want to be creative in a field, you must know a lot about it. The more you know about it, the more dots you can connect. When you are learning a new technology or if you are thinking about a tough problem, do it thoroughly. Don't let anything distract you. Read books, watch lectures, listen to podcasts or audiobooks about the topic, talk to other people working on similar topics. Immerse yourself for multiple hours per day, multiple days per week, multiple weeks and maybe even months. Create your own inner universe.
      -
      -But once a day is over, shut your thoughts down. Hit the off-switch. Stop thinking about this problem for the remainder of the day. This can be difficult, as you didn't solve the problem- or didn't understand everything of the new technology yet, and you really want to get to the point. But be strict to yourself and stop thinking about it for a while.
      -
      -You must understand that you are more than just your conscious thoughts. Your brain does a lot of work in the background that you aren't aware of consciously. What happens when you stop consciously thinking about a problem is that your brain continues processing it. You might have experienced the "AHA"-effect, where suddenly you had an idea out of nowhere (e.g. during a walk, in the shower, or in the morning when you woke up)? This is your conscious self downloading a result from the background thread of your brain. You can elevate this effect by immersing with the problem immensely before giving your conscious self a break.
      -
      -Sometimes, depending on how deeply you were immersed, you may need to let the problem go for a couple of days (e.g. over a weekend) before you can download a new insight.
      -
      -

      Always have a notebook with you


      -
      -Wherever you go, ensure that you always have something to take notes with you. Once you have an idea from nowhere (or from your unconscious but volatile brain), you really want to write it down to persistent storage. It doesn't matter what kind of note-taking device you use here. It can be a paper journal, or it can be your smartphone. 
      -
      -My advice is to have a separate section where you put your notes of all of your ideas. At home or in the office, I write everything in my paper journal. When I am not at home, I use a digital note-taking app on my phone. Later, I copy the digital notes from it into a project-specific section of my paper journal.
      -
      -I prefer taking notes on paper, as it gives you more freedom of how to structure it. You can use any colour, and you can also quickly create diagrams without the use of any complex computer program.
      -
      -

      When you didn't sleep enough


      -
      -I noticed while being sleep-deprived I am (obviously) unable to concentrate so much, and it is difficult to be immersed in a focused way. But on the other hand, I am a lot more creative compared to when I am not sleep-deprived. Then, my brain suddenly presents me with connections I have not thought of before. Here, I usually write any idea I have down on a sheet of paper or in my journal, so I can pick it up later. I then often continue to philosophise about a possible solution. Sometimes to the absurd, and sometimes to something pretty useful.
      -
      -I am not saying that you should skip sleep. By all means, if you can sleep, then sleep. But there are some days when you don't manage to sleep (e.g. think too much about a project and didn't manage to hit the off switch). This is, where you can take advantage of your current state of mind. Disclaimer: Skipping sleep damages your health. So, please don't try this out on purpose. But in case you had a bad night, remember this trick.
      -
      -

      Have regular breaks and relax


      -
      -Have regular breaks. Don't skip your lunch break. Best, have a walk during lunchtime. And after work, do some kind of workout or visit a sports class. Do something completely unrelated to work before going to sleep (e.g. visit a parallel universe and read a Science Fiction novel). In short: Totally hit the off-switch after your work for the day is finished. You will be much more energised and motivated the next time you open your work laptop.
      +Productivity isn't about time management - it's about mind management. When you put a lot of effort into something, there are:

      -I personally love to read Science Fiction novels
      +
        +
      • The point of diminishing returns
      • +
      • The point of negative return
      • +

      +

      Empty slots in the calendar



      -I skip breakfast and lunch during the week. This means that on average, I intermittent fast on average 18-20 hours daily. It may sound odd to most people (who don't intermittent fast), but in a fasted state, I can be even more focused, thus helping me immerse myself in something even more. Not having breakfast and lunch also gives me back some time for other things (e.g. a nice walk, where I listen to podcasts or audiobooks or practise using my camera (street photography)). I relax my routine during the week ends, where I may enjoy a meal at any given time of the day.
      +If we do more things in less time and use all possible slots, speed read, etc., we are more productive. But in reality, that's not the entire truth. You also exchange one thing against everything else.... You cut out too much from your actual life.

      -It also helps a lot eat healthy. Healthy food makes your brain work more efficiently. But I won't go into more details here, as nothing is as contradictory as the health and food industry. Conduct your own research. Your opinion may be different from mine anyway, and everyone's body reacts to certain foods differently. What for one person works may not work for another person. But be aware that you will find a lot of wrong and also conflicting information on the internet. So always use multiple resources for your research.
      +

      When you safe time...



      -

      Upside-down approach


      +...keep it.

      -It's easy to fall into the habit of "boxed" thinking, but creativity is exactly the opposite. Once in a while, make yourself think "Is A really required to do B?". Many assumptions are believed to be true. But are they really? A concrete example: "At work we only use the programming language L and framework F" and therefore, it is the standard we must use.
      +
        +
      • stare out of the window; that's good for you.
      • +
      • Creative thinking needs space. It will pay dividends tomorrow.
      • +
      • You will be rewarded with the "Eureka effect" - a sudden new insight.
      • +

      +

      Follow your mood



      -Another way to think about it is "Is there an alternative way to accomplish the desired result? What if there were no programming language L and framework F? What would I do instead?". Maybe you would use programming language X to implement your own domain-specific language, which does what framework F would have done but in exactly the way you want to + much more flexible than F! And maybe language X would be much better suitable than L to implement a DSL anyway. Conclusion: It never hurts to verify your assumptions.
      +Ask yourself: what is my mood now? We never have the energy to do anything, so the better strategy is to follow your current mode and energy. E.g.:

      -Often, you will also find solutions to problems you never intended to solve and find new problems you never imagined to actually exist. That might not be a bad thing, but it might sidetrack you on your path to finding a solution for a particular problem. So be careful not to get sidetracked too much. In this case, just save a note for later reference (maybe your next Pet Project?) somewhere and go on with your actual problem.
      +
        +
      • Didn't sleep enough today? Then, do simple, non-demanding tasks at work
      • +
      • Had a great sleep, and there is even time before work starts? Pull in a workout...
      • +

      +

      Boosting creativity



      -Don't be afraid to think about weird and unconventional solutions. Sometimes, the most unconventional solution is the best solution to a problem. Also, try to keep to the basics. The best solutions are KISS.
      +The morning without coffee is a gift for creativity, but you often get distracted. Minimize distractions, too. I have no window to stare out but a plain blank wall.

      -Keep it simple and stupid
      +
        +
      • The busier you are, the less creative you will be.
      • +
      • Event time (divergent thinking) vs clock time (convergent thinking)
      • +
      • Don't race with time but walk alongside it as rough time lines.
      • +
      • Don't judge every day after the harvest, but the seed you lay
      • +

      +

      The right mood for the task at hand



      -A small additional trick: you can train yourself to generate new and unconventional ideas. Just write down 20 random ideas every day. It doesn't matter what the ideas are about and whether they are useful or not. The purpose of this exercise is to make your brain think about something new and unconventional. These can be absurd ideas such as "Jump out of the window naked in the morning in order to wake up faster". Of course, you would never do that, but at least you had an idea and made your brain generate something.
      +We need to try many different combinations. Limiting ourselves and trying too hard makes us frustrated and burn out. Creativity requires many iterations.

      -

      Don't be busy all the time


      +I can only work according to my available brain power.

      -Especially as a DevOps Engineer, you could be busy all the time with small, but frequent, ad hoc tasks. Don't lose yourself here. Yes, you should pay attention to your job and those tasks, but you should also make some room for creativity. Don't schedule meeting after ad hoc work after meeting after Jira ticket work after another Jira ticket. There should also be some "free" space in your calendar.
      +I can also change my mood according to what needs improvement. Just imagine the last time you were in that mood and then try to get into it. It can take several tries to hit a working mood. Try to replicate that mental state. This can also be by location or by another habit, e.g. by a beer.

      -Use the "free" time to play around with your tech stack. Try out new options, explore the system metrics, explore new tools, etc. Dividends will pay off with new ideas, which you would have never come up with if you were "just busy" like a machine.
      +Once you are in a mental state, don't try to change it. It will take a while for your brain to switch to a completely different state.

      -Sometimes, I pick a Unix manual page of a random command and start reading it. I have a bash helper function which will pick one for me:
      +Week of want. For a week, only do what you want and not what you must do. Your ideas will get much more expansive.

      -
      -❯ where learn
      -learn () {
      -  man $(ls /bin /sbin /usr/bin /usr/sbin 2>/dev/null | shuf -n 1) |
      -    sed -n "/^NAME/ { n;p;q }"
      -}
      -❯ learn
      -       perltidy - a perl script indenter and reformatter
      -❯ learn
      -       timedatectl - Control the system time and date
      -
      +It gives you pleasure and is in a good mood. This increases creativity if you do what you want to do.

      -

      Conclusion


      +

      Creativity hacks



      -This all summarises advice I have, really.  I hope this was interesting and helpful for you.
      +
        +
      • Coffee can cause anxiety.
      • +
      • Take phentermine with coffee to take off the edge and have a relaxed focus
      • +
      • Green tea, which tastes sweet plus supplement boost.
      • +
      • Also wine. But be careful with alcohol. Don't drink a whole bottle.
      • +
      • Have a machine without distractions and internet access for writing.
      • +
      • Go to open spaces for creativity.
      • +
      • Go to closed spaces for polishing.
      • +

      +

      Planning and strategizing



      -I have one more small tip: I never published a blog post the same day I wrote it. After finishing writing it, I always wait for a couple of days. In all cases so far, I had an additional idea to add or to fine tune the blog post.
      +Minds work better in sprints and not in marathons. Have a weekly plan, not a daily one.

      -Another article I found interesting and relevant is
      +
        +
      • Alternating incubation to avoid blocks.
      • +
      • Build on systems that use chaos for growth, e.g. unplanned disasters.
      • +
      • Things don't go after the plan is the plan. Be anti-fragile.
      • +

      +Organize by mental state. In the time management context, the mental state doesn't exist. You schedule as many things as possible by project. In the mind management context, mental state is everything. You could prepare by mental state and not by assignment.

      -Creative Paradise by The Sephist
      +You could schedule exploratory tasks when you are under grief. Sound systems should create slack for creativity. Plan only for a few minutes.

      -Relevant books I can recommend are:
      +

      Fake it until you make it.



        -
      • Consciousness: A Very Short Introduction; Susan Blackmore; Oxford Uiversity Press
      • -
      • Deep Work; Cal Newport; Piatkus
      • -
      • So Good They Can't Ignore You; Cal Newport; Business Plus
      • -
      • The Off Switch; Mark Cropley; Virgin Books
      • -
      • Ultralearning; Scott Young; Thorsons
      • +
      • E.g. act calm if you want to be calm.
      • +
      • Talk slowly and deepen your voice a bit to appear more confident. You will also become more confident.
      • +
      • Also, use power positions for better confidence.

      E-Mail your comments to paul@nospam.buetow.org :-)

      +Other book notes of mine are:
      +
      +2024-10-24 "Staff Engineer" book notes
      +2024-07-07 "The Stoic Challenge" book notes
      +2024-05-01 "Slow Productivity" book notes
      +2023-11-11 "Mind Management" book notes (You are currently reading this)
      +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      +2023-05-06 "The Obstacle is the Way" book notes
      +2023-04-01 "Never split the difference" book notes
      +2023-03-16 "The Pragmatic Programmer" book notes
      +
      Back to the main site
      - The release of DTail 4.0.0 - - https://foo.zone/gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html - 2022-03-06T18:11:39+00:00 + KISS static web photo albums with `photoalbum.sh` + + https://foo.zone/gemfeed/2023-10-29-kiss-static-web-photo-albums-with-photoalbum.sh.html + 2023-10-29T22:25:04+02:00 Paul Buetow aka snonux paul@dev.buetow.org - I have recently released DTail 4.0.0 and this blog post goes through all the new goodies. If you want to jump directly to DTail, do it here (there are nice animated gifs which demonstrates the usage pretty well): + Once in a while, I share photos on the inter-web with either family and friends or on my The Irregular Ninja photo site. One hobby of mine is photography (even though I don't have enough time for it - so I am primarily a point-and-shoot photographer).
      -

      The release of DTail 4.0.0


      -
      -Published at 2022-03-06T18:11:39+00:00
      -
      -
      -                              ,_---~~~~~----._
      -                        _,,_,*^____      _____``*g*\"*,
      -  ____ _____     _ _   / __/ /'     ^.  /      \ ^@q   f
      - |  _ \_   _|_ _(_) |   @f | @))    |  | @))   l  0 _/
      - | | | || |/ _` | | |  \`/   \~____ / __ \_____/    \
      - | |_| || | (_| | | |   |           _l__l_           I
      - |____/ |_|\__,_|_|_|   }          [______]           I
      -                        ]            | | |            |
      -                        ]             ~ ~             |
      -                        |                            |
      -                         |                           |
      -
      +

      KISS static web photo albums with photoalbum.sh



      -I have recently released DTail 4.0.0 and this blog post goes through all the new goodies. If you want to jump directly to DTail, do it here (there are nice animated gifs which demonstrates the usage pretty well):
      -
      -https://dtail.dev
      -
      -

      So, what's new in 4.0.0?


      -
      -

      Rewritten logging


      -
      -For DTail 4, logging has been completely rewritten. The new package name is "internal/io/dlog". I rewrote the logging because DTail is a special case here: There are logs processed by DTail, there are logs produced by the DTail server itself, there are logs produced by a DTail client itself, there are logs only logged by a DTail client, there are logs only logged by the DTail server, and there are logs logged by both, server and client. There are also different logging levels and outputs involved.
      -
      -As you can imagine, it becomes fairly complex. There is no ready Go off-shelf logging library which suits my needs and the logging code in DTail 3 was just one big source code file with global variables and it wasn't sustainable to maintain anymore. So why not rewrite it for profit and fun?
      -
      -There's a are new log level structure now (The log level now can be specified with the "-logLevel" command line flag):
      -
      -
      -// Available log levels.
      -const (
      -	None    level = iota
      -	Fatal   level = iota
      -	Error   level = iota
      -	Warn    level = iota
      -	Info    level = iota
      -	Default level = iota
      -	Verbose level = iota
      -	Debug   level = iota
      -	Devel   level = iota
      -	Trace   level = iota
      -	All     level = iota
      -)
      -
      -
      -DTail also supports multiple log outputs (e.g. to file or to stdout). More are now easily pluggable with the new logging package. The output can also be "enriched" (default) or "plain" (read more about that further below).
      +Published at 2023-10-29T22:25:04+02:00

      -

      Configurable terminal color codes


      +Once in a while, I share photos on the inter-web with either family and friends or on my The Irregular Ninja photo site. One hobby of mine is photography (even though I don't have enough time for it - so I am primarily a point-and-shoot photographer).

      -A complaint I received from the users of DTail 3 were the terminal colors used for the output. Under some circumstances (terminal configuration) it made the output difficult to read so that users defaulted to "--noColor" (disabling colored output completely). I toke it by heart and also rewrote the color handling. It's now possible to configure the foreground and background colors and an attribute (e.g. dim, bold, ...).
      +I'm not particularly eager to use any photo social sharing platforms such as Flickr, 500px (I used them regularly in the past), etc., anymore. I value self-hosting, DIY and privacy (nobody should data mine my photos), and no third party should have any rights to my pictures.

      -The example "dtail.json" configuration file represents the default (now, more reasonable default) color codes used, and it is free to the user to customize them:
      +I value KISS (keep it simple and stupid) and simplicity. All that's required for a web photo album is some simple HTML and spice it up with CSS. No need for JavaScript, no need for a complex dynamic website.

      -{
      -  "Client": {
      -    "TermColorsEnable": true,
      -    "TermColors": {
      -      "Remote": {
      -        "DelimiterAttr": "Dim",
      -        "DelimiterBg": "Blue",
      -        "DelimiterFg": "Cyan",
      -        "RemoteAttr": "Dim",
      -        "RemoteBg": "Blue",
      -        "RemoteFg": "White",
      -        "CountAttr": "Dim",
      -        "CountBg": "Blue",
      -        "CountFg": "White",
      -        "HostnameAttr": "Bold",
      -        "HostnameBg": "Blue",
      -        "HostnameFg": "White",
      -        "IDAttr": "Dim",
      -        "IDBg": "Blue",
      -        "IDFg": "White",
      -        "StatsOkAttr": "None",
      -        "StatsOkBg": "Green",
      -        "StatsOkFg": "Black",
      -        "StatsWarnAttr": "None",
      -        "StatsWarnBg": "Red",
      -        "StatsWarnFg": "White",
      -        "TextAttr": "None",
      -        "TextBg": "Black",
      -        "TextFg": "White"
      -      },
      -      "Client": {
      -        "DelimiterAttr": "Dim",
      -        "DelimiterBg": "Yellow",
      -        "DelimiterFg": "Black",
      -        "ClientAttr": "Dim",
      -        "ClientBg": "Yellow",
      -        "ClientFg": "Black",
      -        "HostnameAttr": "Dim",
      -        "HostnameBg": "Yellow",
      -        "HostnameFg": "Black",
      -        "TextAttr": "None",
      -        "TextBg": "Black",
      -        "TextFg": "White"
      -      },
      -      "Server": {
      -        "DelimiterAttr": "AttrDim",
      -        "DelimiterBg": "BgCyan",
      -        "DelimiterFg": "FgBlack",
      -        "ServerAttr": "AttrDim",
      -        "ServerBg": "BgCyan",
      -        "ServerFg": "FgBlack",
      -        "HostnameAttr": "AttrBold",
      -        "HostnameBg": "BgCyan",
      -        "HostnameFg": "FgBlack",
      -        "TextAttr": "AttrNone",
      -        "TextBg": "BgBlack",
      -        "TextFg": "FgWhite"
      -      },
      -      "Common": {
      -        "SeverityErrorAttr": "AttrBold",
      -        "SeverityErrorBg": "BgRed",
      -        "SeverityErrorFg": "FgWhite",
      -        "SeverityFatalAttr": "AttrBold",
      -        "SeverityFatalBg": "BgMagenta",
      -        "SeverityFatalFg": "FgWhite",
      -        "SeverityWarnAttr": "AttrBold",
      -        "SeverityWarnBg": "BgBlack",
      -        "SeverityWarnFg": "FgWhite"
      -      },
      -      "MaprTable": {
      -        "DataAttr": "AttrNone",
      -        "DataBg": "BgBlue",
      -        "DataFg": "FgWhite",
      -        "DelimiterAttr": "AttrDim",
      -        "DelimiterBg": "BgBlue",
      -        "DelimiterFg": "FgWhite",
      -        "HeaderAttr": "AttrBold",
      -        "HeaderBg": "BgBlue",
      -        "HeaderFg": "FgWhite",
      -        "HeaderDelimiterAttr": "AttrDim",
      -        "HeaderDelimiterBg": "BgBlue",
      -        "HeaderDelimiterFg": "FgWhite",
      -        "HeaderSortKeyAttr": "AttrUnderline",
      -        "HeaderGroupKeyAttr": "AttrReverse",
      -        "RawQueryAttr": "AttrDim",
      -        "RawQueryBg": "BgBlack",
      -        "RawQueryFg": "FgCyan"
      -      }
      -    }
      -  },
      -  ...
      -}
      +         ___        .---------.._
      +  ______!fsc!_....-' .g8888888p. '-------....._
      +.'          //     .g8:       :8p..---....___ \'.
      +| foo.zone //  ()  d88:       :88b|==========! !|
      +|         //       888:       :888|==========| !|
      +|___      \\_______'T88888888888P''----------'//|   
      +|   \       """"""""""""""""""""""""""""""""""/ |   
      +|    !...._____      .="""=.   .[]    ____...!  |   
      +|   /               ! .g$p. !   .[]          :  |   
      +|  !               :  $$$$$  :  .[]          :  |   
      +|  !irregular.ninja ! 'T$P' !   .[]           '.|   
      +|   \__              "=._.="   .()        __    |   
      +|.--'  '----._______________________.----'  '--.|
      +'._____________________________________________.'   
       

      -You notice the different sections - these are different contexts:
      +

      Table of Contents




      -When you do so, make sure that you check your "dtail.json" against the JSON schema file. This is to ensure that you don't configure an invalid color accidentally (requires "jsonschema" to be installed on your computer). Furthermore, the schema file is also a good reference for all possible colors available:
      +

      Introducing photoalbum.sh



      -
      -jsonschema -i dtail.json schemas/dtail.schema.json
      -
      +photoalbum.sh is a minimal Bash (Bourne Again Shell) script for Unix-like operating systems (such as Linux) to generate static web photo albums. The resulting static photo album is pure HTML+CSS (without any JavaScript!). It is specially designed to be as simple as possible.

      -

      Serverless mode


      +

      Installation



      -All DTail commands can now operate on log files (and other text files) directly without any DTail server running. So there isn't a need anymore to install a DTail server when you are on the target server already anyway, like the following example shows:
      +Installation is straightforward. All required is a recent version of GNU Bash, GNU Make, Git and ImageMagick. On Fedora, the dependencies are installed with:

      -% dtail --files /var/log/foo.log
      +% sudo dnf install -y ImageMagick make git
       

      -or
      +Now, clone, make and install the script:

      -% dmap --files /var/log/foo.log --query 'from TABLE select .... outfile result.csv'
      +% git clone https://codeberg.org/snonux/photoalbum
      +Cloning into 'photoalbum'...
      +remote: Enumerating objects: 1624, done.
      +remote: Total 1624 (delta 0), reused 0 (delta 0), pack-reused 1624
      +Receiving objects: 100% (1624/1624), 193.36 KiB | 1.49 MiB/s, done.
      +Resolving deltas: 100% (1227/1227), done.
      +
      +% cd photoalbum
      +/home/paul/photoalbum
      +
      +% make
      +cut -d' ' -f2 changelog | head -n 1 | sed 's/(//;s/)//' > .version
      +test ! -d ./bin && mkdir ./bin || exit 0
      +sed "s/PHOTOALBUMVERSION/$(cat .version)/" src/photoalbum.sh > ./bin/photoalbum
      +chmod 0755 ./bin/photoalbum
      +
      +% sudo make install
      +test ! -d /usr/bin && mkdir -p /usr/bin || exit 0
      +cp ./bin/* /usr/bin
      +test ! -d /usr/share/photoalbum/templates && mkdir -p /usr/share/photoalbum/templates || exit 0
      +cp -R ./share/templates /usr/share/photoalbum/
      +test ! -d /etc/default && mkdir -p /etc/default || exit 0
      +cp ./src/photoalbum.default.conf /etc/default/photoalbum
       

      -The way it works in Go code is that a connection to a server is managed through an interface and in serverless mode DTail calls through that interface to the server code directly without any TCP/IP and SSH connection made in the background. This means, that the binaries are a bit larger (also ship with the code which normally would be executed by the server) but the increase of binary size is not much.
      -
      -

      Shorthand flags


      -
      -The "--files" from the previous example is now redundant. As a shorthand, It is now possible to do the following instead:
      +You should now have the photoalbum command in your $PATH. But wait to use it! First, it needs to be set up!

      -% dtail /var/log/foo.log
      +% photoalbum version
      +This is Photoalbum Version 0.5.1
       

      -Of course, this also works with all other DTail client commands (dgrep, dcat, ... etc).
      +

      Setting it up



      -

      Spartan (aka plain) mode


      -
      -There's a plain mode, which makes DTail only print out the "plain" text of the files operated on (without any DTail specific enriched output). E.g.:
      +Now, it's time to set up the Irregular Ninja static web photo album (or any other web photo album you may be setting up!)! Create a directory (here: irregular.ninja for the Irregular Ninja Photo site - or any oter sub-directory reflecting your album's name), and inside of that directory, create an incoming directory. The incoming directory. Copy all photos to be part of the album there.

      -% dcat --plain /etc/passwd > /etc/test
      -% diff /etc/test /etc/passwd  # Same content, no diff
      +% mkdir irregular.ninja
      +% cd irregular.ninja
      +% # cp -Rpv ~/Photos/your-photos ./incoming
       

      -This might be useful if you wanted to post-process the output.
      -
      -

      Standard input pipe


      -
      -In serverless mode, you might want to process your data in a pipeline. You can do that now too through an input pipe:
      -
      -
      -% dgrep --plain --regex 'somethingspecial' /var/log/foo.log |
      -    dmap --query 'from TABLE select .... outfile result.csv'
      -
      +In this example, I am skipping the cp ... part as I intend to use an alternative incoming directory, as you will see later in the configuration file.

      -Or, use any other "standard" tool:
      +The general usage of potoalbum is as follows:

      -% awk '.....' < /some/file | dtail ....
      +photoalbum clean|generate|version [rcfile] photoalbum
      +photoalbum makemake
       

      -

      New command dtailhealth


      +Whereas:

      -Prior to DTail 4, there was a flag for the "dtail" command to check the health of a remote DTail server (for use with monitoring system such as Nagios). That has been moved out to a separate binary to reduce complexity of the "dtail" command. The following checks whether DTail is operational on the current machine (you could also check a remote instance of DTail server, just adjust the server address).
      +
        +
      • clean: Cleans up the workspace
      • +
      • generate: Generates the static photo album
      • +
      • version: Prints out the version
      • +
      • makemake: Creates a Makefile and photoalbumrc in the current working directory.
      • +

      +So what we will do next is to run the following inside of the irregular.ninja/ directory; it will generate a Makefile and a configuration file photoalbumrc containing a few configurable options:

      -
      -% cat check_dtail.sh
      -#!/bin/sh
      +
      +
      % photoalbum makemake
      +You may now customize ./photoalbumrc and run make
      +
      +% cat Makefile
      +all:
      +	photoalbum generate photoalbumrc
      +clean:
      +	photoalbum clean photoalbumrc
       
      -exec /usr/local/bin/dtailhealth --server localhost:2222
      +% 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
       

      -

      Improved documentation


      -
      -Some features, such as custom log formats and the map-reduce query language, are now documented. Also, the examples have been updated to reflect the new features added. This also includes the new animated example Gifs (plus documentation how they were created).
      -
      -I must admit that not all features are documented yet:
      -
      -
        -
      • Server side scheduled map-reduce queries
      • -
      • Server side continuous map-reduce queries
      • -
      • Some more docs about terminal color customization
      • -
      • Some more docs about log levels
      • -

      -That will be added in one of the future releases.
      -
      -

      Integration testing suite


      +In the case for irregular.ninja, I changed the defaults to the following:

      -DTail comes already with some unit tests, but what's new is a full integration testing suite which covers all common use cases of all the commands (dtail, dcat, dgrep, dmap) with a server backend and also in serverless mode.
      + +
      --- 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'
      +

      -How are the tests implemented? All integration tests are simply unit tests in the "./integrationtests" folder. They must be explicitly activated with:
      +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.

      -
      -% export DTAIL_INTEGRATION_TEST_RUN_MODE=yes
      -
      +

      Generating the static photo album



      -Once done, first compile all commands, and then run the integration tests:
      +Let's generate it. Depending on the image sizes and count, the following step may take a while.

       % make
      +photoalbum generate photoalbumrc
      +Processing 1055079_cool-water-wallpapers-hd-hd-desktop-wal.jpg to /home/paul/irregular.ninja/dist/photos/1055079_cool-water-wallpapers-hd-hd-desktop-wal.jpg
      +Processing 11271242324.jpg to /home/paul/irregular.ninja/dist/photos/11271242324.jpg
      +Processing 11271306683.jpg to /home/paul/irregular.ninja/dist/photos/11271306683.jpg
      +Processing 13950707932.jpg to /home/paul/irregular.ninja/dist/photos/13950707932.jpg
      +Processing 14077406487.jpg to /home/paul/irregular.ninja/dist/photos/14077406487.jpg
      +Processing 14859380100.jpg to /home/paul/irregular.ninja/dist/photos/14859380100.jpg
      +Processing 14869239578.jpg to /home/paul/irregular.ninja/dist/photos/14869239578.jpg
      +Processing 14879132910.jpg to /home/paul/irregular.ninja/dist/photos/14879132910.jpg
      +.
      +.
      +.
      +Generating /home/paul/irregular.ninja/dist/html/7-4.html
      +Creating thumb /home/paul/irregular.ninja/dist/thumbs/20211130_091051.jpg
      +Creating blur /home/paul/irregular.ninja/dist/blurs/20211130_091051.jpg
      +Generating /home/paul/irregular.ninja/dist/html/page-7.html
      +Generating /home/paul/irregular.ninja/dist/html/7-5.html
      +Generating /home/paul/irregular.ninja/dist/html/7-5.html
      +Generating /home/paul/irregular.ninja/dist/html/7-5.html
      +Creating thumb /home/paul/irregular.ninja/dist/thumbs/DSCF0188.JPG
      +Creating blur /home/paul/irregular.ninja/dist/blurs/DSCF0188.JPG
      +Generating /home/paul/irregular.ninja/dist/html/page-7.html
      +Generating /home/paul/irregular.ninja/dist/html/7-6.html
      +Generating /home/paul/irregular.ninja/dist/html/7-6.html
      +Generating /home/paul/irregular.ninja/dist/html/7-6.html
      +Creating thumb /home/paul/irregular.ninja/dist/thumbs/P3500897-01.jpg
      +Creating blur /home/paul/irregular.ninja/dist/blurs/P3500897-01.jpg
       .
       .
       .
      -% go clean -testcache
      -% go test -race -v ./integrationtests
      +Generating /home/paul/irregular.ninja/dist/html/8-0.html
      +Generating /home/paul/irregular.ninja/dist/html/8-41.html
      +Generating /home/paul/irregular.ninja/dist/html/9-0.html
      +Generating /home/paul/irregular.ninja/dist/html/9-41.html
      +Generating /home/paul/irregular.ninja/dist/html/index.html
      +Generating /home/paul/irregular.ninja/dist/.//index.html
       

      -

      Improved code


      +The result will be in the distribution directory ./dist. This directory is publishable to the inter-web:
      +
      +
      +% ls ./dist
      +blurs  html  index.html  photos  thumbs
      +

      -Not that the code quality of DTail has been bad (I have been using Go vet and Go lint for previous releases and will keep using these), but this time I had new tools (such as SonarQube and BlackDuck) in my arsenal to:
      +I usually do that via rsync to my web server (I use OpenBSD with the standard httpd web server, btw.), which is as simple as:

      -
        -
      • Reduce the complexity of a couple of functions (splitting code up into several smaller functions)
      • -
      • Avoid repeating code (this version of DTail doesn't use Go generics yet, though).
      • -

      -Other than that, a lot of other code has been refactored as I saw fit.
      +
      +% rsync --delete -av ./dist/. admin@blowfish.buetow.org:/var/www/htdocs/irregular.ninja/
      +

      -

      Use of memory pools


      +Have a look at the end result here:

      -DTail makes excessive use of string builder and byte buffer objects. For performance reasons, those are now re-used from memory pools.
      +https://irregular.ninja

      -

      What's next


      +PS: There's also a server-side synchronisation script mirroring the same content to another server for high availability reasons (out of scope for this blog post).

      -DTail 5 won't be released any time soon I guess, but some 4.x.y releases will follow this year fore sure. I can think of:
      +

      Cleaning it up



      -
        -
      • New (but backwards compatible) features which don't require a new major version bump (some features have been requested at work internally).
      • -
      • Even more improved documentation.
      • -
      • Dependency updates.
      • -

      -I use usually DTail at work, but I have recently installed it on my personal OpenBSD machines too. I might write a small tutorial here (and I might also add the rc scripts as examples to one of the next DTail releases).
      +A simple make clean will clean up the ./dist directory and all other (if any) temp files created.

      -I am a bit busy at the moment with two other pet projects of mine (one internal work-project, and one personal one, the latter you will read about in the next couple of months). If you have ideas (or even a patch), then please don't hesitate to contact me (either via E-Mail or a request at GitHub).
      +

      HTML templates



      -Other related posts are:
      +Poke around in this source directory. You will find a bunch of Bash-HTML template files. You could tweak them to your liking.

      -2021-04-22 DTail - The distributed log tail program
      -2022-03-06 The release of DTail 4.0.0 (You are currently reading this)
      -2022-10-30 Installing DTail on OpenBSD
      -2023-09-25 DTail usage examples
      +

      Conclusion


      +
      +A decent looking (in my opinion, at least) in less than 500 (273 as of this writing, to be precise) lines of Bash code and with minimal dependencies; what more do you want? How many LOCs would this be in Raku with the same functionality (can it be sub-100?).

      -Thanks!
      +Also, I like the CSS effects which I recently added. In particular, for the Irregular Ninja site, I randomly shuffled the CSS effects you see. The background blur images are the same but rotated 180 degrees and blurred out.

      -Paul
      +photoalbum.sh source code on Codeberg.

      E-Mail your comments to paul@nospam.buetow.org :-)

      +Other Bash and KISS-related posts are:
      +
      +2024-04-01 KISS high-availability with OpenBSD
      +2023-12-10 Bash Golf Part 3
      +2023-10-29 KISS static web photo albums with photoalbum.sh (You are currently reading this)
      +2023-06-01 KISS server monitoring with Gogios
      +2022-01-01 Bash Golf Part 2
      +2021-11-29 Bash Golf Part 1
      +2021-09-12 Keep it simple and stupid
      +2021-06-05 Gemtexter - One Bash script to rule it all
      +2021-05-16 Personal Bash coding style guide
      +
      Back to the main site
      - Computer operating systems I use(d) - - https://foo.zone/gemfeed/2022-02-04-computer-operating-systems-i-use.html - 2022-02-04T09:58:22+00:00 + DTail usage examples + + https://foo.zone/gemfeed/2023-09-25-dtail-usage-examples.html + 2023-09-25T14:57:42+03:00 Paul Buetow aka snonux paul@dev.buetow.org - This is a list of Operating Systems I currently use. This list is in no particular order and also will be updated over time. The very first operating system I used was MS-DOS (mainly for games) and the very first Unix like operating system I used was SuSE Linux 5.3. My first smartphone OS was Symbian on a clunky Sony Ericsson device. + Hey there. As I am pretty busy this month personally (I am now on Paternity Leave) and as I still want to post once monthly, the blog post of this month will only be some DTail usage examples. They're from the DTail documentation, but not all readers of my blog may be aware of those!
      -

      Computer operating systems I use(d)


      -
      -Published at 2022-02-04T09:58:22+00:00; Updated at 2022-02-18
      -
      -
      -              /(        )`
      -              \ \___   / |
      -              /- _  `-/  '
      -             (/\/ \ \   /\
      -             / /   | `    \
      -             O O   ) /    |
      -             `-^--'`<     '
      -            (_.)  _  )   /
      -             `.___/`    /
      -               `-----' /
      -  <----.     __ / __   \
      -  <----|====O)))==) \) /====
      -  <----'    `--' `.__,' \
      -               |        |
      -                \       /
      -           ______( (_  / \______
      -  (FL)   ,'  ,-----'   |        \
      -         `--{__________)        \/   "Berkeley Unix Daemon"
      -
      -
      -This is a list of Operating Systems I currently use. This list is in no particular order and also will be updated over time. The very first operating system I used was MS-DOS (mainly for games) and the very first Unix like operating system I used was SuSE Linux 5.3. My first smartphone OS was Symbian on a clunky Sony Ericsson device.
      -
      -

      Fedora Linux


      -
      -Fedora Linux is the operating system I use on my primary (personal) laptop. It's a ThinkPad X1 Carbon Gen. 9. Lenovo which comes along with official Lenovo Linux support. I already noticed hardware firmware updates being installed directly through Fedora from Lenovo. Fedora is a real powerhouse, cutting-edge and reasonably stable at the same time. It's baked by Red Hat.
      -
      -I also use Fedora on my Microsoft Surface Go 2 convertible tablet. Fedora works quite OK (and much better than Windows) on this device. It's also the perfect travel companion.
      -
      -I use the GNOME Desktop on my Fedora boxes. I have memorized and customized a bunch of keyboard shortcuts. But the fact that I mostly work in the terminal (with tmux) makes the Desktop environment I use only secondary.
      -
      -

      EndeavourOS


      -
      -I installed EndeavourOS on my (older) ThinkPad X240 to try out an Arch based Linux distribution. I also could have installed plain Arch, but I don't see the point when there is EndeavourOS. EndeavourOS is as close as you can get to the plain Arch experience but with an easy installer. I am not saying that it's difficult to install plain Arch but it's, unless you are new to Linux and want to learn about the installation procedure, just waste of time in my humble opinion. Give Linux From Scratch a shot instead if you really want to learn about Linux.
      -
      -https://www.linuxfromscratch.org/
      -
      -On EndeavourOS, I use the Xfce desktop environment which feels very snappy and fast on the X240 (which I purchased back in 2014). Usually, I have my X240 standing right next to my work laptop and use it for playing music (mainly online radio streams), for personal note taking and occasional emailing and instant messaging.
      -
      -As this is a rolling Linux distribution there are a lot of software updates coming through every day. Sometimes, it only takes a minute until the next version of a package is available. Honestly, I find that a bit annoying to constantly catch up with all the updates. As for now I will live with it and/or automate it a bit more. It'll be OK if it breaks occasionally, as this is not my primary laptop anyway.
      -
      -Arch Linux and EndeavourOS are community distributions. This means, that there is no big corporation in the backyard lurking around. They won't give you the firmware updates for cutting edge hardware out of the box, though, but they are still a very good choice for hobbyist and also for older hardware where future firmware updates are less likely to happen.
      -
      -I am very happy with the package availability through the official repository and AUR.
      -
      -https://endeavouros.com/
      +

      DTail usage examples



      -

      FreeBSD


      -
      -I have run FreeBSD in many occasions. Right after SuSE Linux, FreeBSD (around 4.x) was the second open source system I used in my life on regular basis. I didn't even go to university yet then I started using it :-). Also, a former employer of mine even allowed me to install FreeBSD on my main workstation (which I actually did and used it for a couple of years).
      -
      -I remember it used to be a pain bootstrapping Java for FreeBSD due to the lack of pre-compiled binary packages. You had first to enable the Linux compatibility layer, then install Linux Java, and then compile FreeBSD Java with the bootstrapped Linux Java (yes, Java is mainly programmed in C++, but for some reason compiling Java for FreeBSD also required an installation of Java). Nowadays, there are ready OpenJDK binary packages you could install. So things have improved a lot since.
      -
      -FreeBSD always had a place somewhere in my life:
      +Published at 2023-09-25T14:57:42+03:00

      -
        -
      • On a Desktop PC (personal and work)
      • -
      • On a Laptop
      • -
      • On a webserver, FTP server, DNS server, mail server
      • -
      • On a server offering FreeBSD jails to customers for rent
      • -
      • As an experiment running Debian GNU/kFreeBSD inside of jails
      • -

      -Debian GNU/kFreeBSD is now dead (same is my experiment)...
      +Hey there. As I am pretty busy this month personally (I am now on Paternity Leave) and as I still want to post once monthly, the blog post of this month will only be some DTail usage examples. They're from the DTail documentation, but not all readers of my blog may be aware of those!

      -https://www.debian.org/ports/kfreebsd-gnu/
      +DTail is a distributed DevOps tool for tailing, grepping, catting logs and other text files on many remote machines at once which I programmed in Go.

      -...but I still have saved and old uname output :-):
      +https://dtail.dev

      -[root@saturn /usr/jail/serv14/etc] # jexec 21 bash
      -root@rhea:/ # uname -a
      -GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 27 13:10:09 CET
      -  2010 root@saturn.buetow.org:/usr/obj/usr/srcs/freebsd.src8/src/sys/SERV10 x86 64 amd64 Intel(R)
      -  Core(TM) i7 CPU 920 @ 2.67GHz GNU/kFreeBSD
      +                              ,_---~~~~~----._
      +                        _,,_,*^____      _____``*g*\"*,
      +  ____ _____     _ _   / __/ /'     ^.  /      \ ^@q   f
      + |  _ \_   _|_ _(_) |   @f |      ((@|  |@))    l  0 _/
      + | | | || |/ _` | | |  \`/   \~____ / __ \_____/    \
      + | |_| || | (_| | | |   |           _l__l_           I
      + |____/ |_|\__,_|_|_|   }          [______]           I
      +                        ]            | | |            |
      +                        ]             ~ ~             |
      +                        |   Let's tail those logs!   |
      +                         |                           |
       

      -Currently, I use FreeBSD on my personal NAS server. The server is a regular PC with a bunch of hard drives and a ZFS RAIDZ (with 4x2TB drives) + a couple of external backup drives.
      -
      -https://www.FreeBSD.org
      -
      -

      CentOS 7


      -
      -While CentOS 8 is already out of support, I still use CentOS 7 (which will receive security updates until 2024). CentOS 7 runs in a cloud VM and is the home to my personal NextCloud and Wallabag installations. You probably know already NextCloud. About Wallabag: It is a great free and open source alternative to Pocket (for reading articles from the web offline later). Yes, you can pay for a Wallabag subscription, but you can also host it for free on your own server.
      -
      -NextCloud
      -Wallabag
      -
      -The reason I use Linux and not *BSD at the moment for these services is Docker. With Docker, it's so easy-peasy to get these up and running. I will have to switch to another OS before CentOS 7 runs out of support, though. It might be CentOS Stream, Rocky Linux, or, more likely, I will use FreeBSD. On FreeBSD there isn't Docker, but what can be done is to create a self-contained Jail for each of the web-apps.
      -
      -I have been using FreeBSD Jails for LAMP stacks before I started using CentOS. The reason why I switched to CentOS (it was still CentOS 6 at that time) in the first place was, that I wanted to try out something new.
      -
      -https://www.centos.org
      -
      -

      OpenBSD


      -
      -I use two small OpenBSD "cloud" boxes for my "public facing internet front-ends". The services I run here are:
      +

      Table of Contents




      -OpenBSD is a complete operating system. I love it due to it's "simplicity" and "correctness" and the good documentation (I love the manual pages in particular). OpenBSD is also known for its innovations in security. I must admin, though, that most Unix like operating system would be secure enough for my personal needs and that I don't really need to use OpenBSD here. But nevertheless, I think it's the ideal operating system for what I am using it for.
      -
      -The only softwares which were not part of the base system and I had to install additionally were the Gemini server (vger) and Git, which both were available as pre-compiled OpenBSD binary packages. So, besides of these two packages, it is indeed a pretty complete operating system for my use case.
      -
      -https://www.openbsd.org
      +

      Commands



      -

      macOS (proprietary)


      -
      -I have to use a MacBook Pro with macOS for work. What else can I say but that this would have never been my personal choice. At least macOS is a UNIX under the hood and comes with a decent terminal and there are plenty of terminal apps available via Brew. Some of the inner workings of macOS were actually forked from the FreeBSD project.
      -
      -developer.apple.com: BSD in macOS/Darwin
      -
      -I find the macOS UI rather confusing.
      -
      -

      LineageOS (mobile)


      -
      -At some point I got fed up with big tech, like Google and Samsung (or Apple, but personally I don't use Apple), spying on me. So I purchased a Google phone (a midrange Pixel phone) and installed LineageOS, a free and open source distribution of Android, on it. I don't have anything from Google installed on it (not even the play store, I install my apps from F-Droid). It's my daily driver since mid 2021 now.
      -
      -So far the experience is not great but good. The main culprits are not having Google Maps, Google Gboard and the camera app. The latter lacks some features on LineageOS (e.g. No wide angle lens support). Also, I can't use my banking apps anymore. Sometimes apps crash for no apparent reason(s) but I get around it so far. I shouldn't spend so much time on my smartphone anyway! And the whole point of switching to LineageOS was to get away of big tech and therefore I should not complain :-). What I do like is that 95% the things I used to do on a proprietary mobile phone also can be done with LineageOS.
      -
      -Read also "The Midle Way" section of this blog post regarding smartphones.
      -
      -There's also the excellent Termux app in the F-Droid store, which transforms the phone into a small Linux handheld device. I am able to run all of my Linux/Unix terminal apps with it.
      -
      -https://lineageos.org/
      -https://termux.com/
      -
      -

      Samsung's Stock Android (mobile proprietary)


      -
      -Unfortunatley, I still have to keep my proprietary Android phone around. Sometimes, I really need to use some proprietary apps which are only available form the Google play store and also require the Google services installed on the phone. I don't carry this phone around all the time and I only use it intentionally for very specific use cases. I think this is the best compromise I can make.
      -
      -

      iOS (mobile proprietary)


      -
      -I have to use an iPhone for work. I like the hardware but I hate the OS (you can also call it spyOS), but it's the necessarries evil, unfortunately. Apple is even worse than Google here (despite claiming for themselves to produce the most secure phone(s)). I don't have it with me all the time or switched off when I don't need it. I also find iOS quite unintuitive to use.
      -
      -Being on-call for work means to to be reachable 24/7. This implies that the phone is carried around all the time (in an switched-on state). 1984 is now.
      -https://en.wikipedia.org/wiki/Nineteen_Eighty-Four
      -
      -

      Other OSes


      -
      -

      InfinyTime (smartwatch)


      -
      -I use it on my PineTime smartwatch. Other than checking the time and my step count, I really don't do anything else fancy with it (yet).
      -
      -https://www.pine64.org/pinetime/
      -https://infinitime.io/
      -
      -

      motionEyeOS


      -
      -I usually install an army of RaspberryPi 3's in my house before I travel for a prolonged amount of time. All Pi's are equipped with an camera and have motionEyeOS (Linux based video surveillance system) installed. There's a neat Android app in the F-Droid store which let's me keep an eye on everything. I make the Pi's accessible from the internet via reverse SSH tunnels through one of my frontend servers.
      -
      -https://github.com/ccrisan/motioneyeos
      -
      -

      Kobo OS (proprietary)


      -
      -I use a Kobo Forma as my e-reader device. I have started to switch off the Wifi and to only sideload DRM free ePubs on it. Even offline, it's a fully capable reader device. I wouldn't like the Kobo to call home to Rakuten. I would love to replace it one day with an open source e-reader alternative like the PineNote. There are also some interesting attempts installing postmarketOS Linux on Kobo devices. The latter boots already, but is far from being usable as a normal e-reader.
      -
      -The PineNote
      -Kobo Clara HD becomes an e-ink Linux tablet
      -
      -But as a fall-back, someone could still use the good old dead tree format!
      +DTail consists out of a server and several client binaries. In this post, I am showcasing their use!

      -

      Android TV (proprietary)


      +
        +
      • Use dtail to follow logs
      • +
      • Use dtail to aggregate logs while they are followed
      • +
      • Use dcat to display logs and other text files already written
      • +
      • Use dgrep to grep (search) logs and other text files already written
      • +
      • Use dmap to aggregate logs and other text files already written
      • +
      • dserver is the DTail server, where all the clients can connect to
      • +

      +

      Following logs



      -An Android TV box is used for watching movies and series on Netflix and Amazon Prime video (yes, I am human too and rely once in a while on big tech streaming services). The Android TV box is currently in the process of being replaced by OSMC, though. Most services seem to work fine with OSMC, but didn't get around tinkering with Netflix and Amazon there yet.
      +The following example demonstrates how to follow logs of several servers at once. The server list is provided as a flat text file. The example filters all records containing the string INFO. Any other Go compatible regular expression can also be used instead of INFO.

      -https://osmc.tv/
      + +
      % dtail --servers serverlist.txt --grep INFO --files "/var/log/dserver/*.log"
      +

      -

      Other OSes..


      +Hint: you can also provide a comma separated server list, e.g.: servers server1.example.org,server2.example.org:PORT,...

      -This section is just for the sake of having a complete list of all OSes I used for some significant amount of time. I might not use all of them any more...
      +Tail example

      -

      NetBSD


      +Hint: You can also use the shorthand version (omitting the --files)

      -I have been using NetBSD on an old Sun Sparcstation 10 as a student. I also have run NetBSD on a very old ThinkPad with 96MB!!! of RAM (even with X/evilWM). I also installed (but never really used) NetBSD on an HP Jornada 680. But that's all more than 10 years ago. I haven't looked at NetBSD for long time. I want to revive it on an "old" ThinkPad T450 of mine which I currently don't use.
      + +
      % dtail --servers serverlist.txt --grep INFO "/var/log/dserver/*.log"
      +

      -https://netbsd.org
      +

      Aggregating logs



      -

      Other OSes in use...


      +To run ad-hoc map-reduce aggregations on newly written log lines you must add a query. The following example follows all remote log lines and prints out every few seconds the result to standard output.

      -SailfishOS - Nice mobile OS, but unfortunately includes proprietary components
      -Red Hat Enterprise Linux - Only for some work stuff
      +Hint: To run a map-reduce query across log lines written in the past, please use the dmap command instead.

      -

      Other OSes not used any more...


      + +
      % dtail --servers serverlist.txt \
      +    --files '/var/log/dserver/*.log' \
      +    --query 'from STATS select sum($goroutines),sum($cgocalls),
      +             last($time),max(lifetimeConnections)'
      +

      -SuSE Linux 5.3 - The first Linux OS I used
      -SGI's IRIX - On a SGI Onyx 3200
      -MeeGo - On a Nokia N9
      -Microsoft Windows
      -Microsoft DOS - With and without Windows 3.x
      -Symbian - The first smartphone OS I used
      -WearOS - On a Google smartwatch
      -Debian GNU/Linux - Rock solid, but atm. I prefer Fedora/EndeavourOS
      -Ubuntu Linux (based on Debian)
      -Linux from scratch - The best way to learn Linux
      -SUSE Linux Enterprise - Only for some work stuff
      +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.

      -

      Other OSes I only had a glance at...


      +Tail map-reduce example

      -OpenSolaris - Continuation of the open source version of Solaris
      -Arch Linux ARM
      -eComStation - Continuation of IBM OS/2
      -MINIX
      -OpenVMS
      -IBM OS/2 Warp
      -FreeDOS - Open source alternative to DOS
      -Plan9
      -ReactOS - A Microsoft Windows open source clone
      -Debian GNU/Hurd - Debian on the GNU kernel
      -Debian GNU/kFreeBSD - Debian on the FreeBSD kernel
      -Gentoo Linux
      -Haiku - A BeOS open source clone
      -Sun Solaris (now owned by Oracle)
      -OpenDarwin ("now" PureDarwin) - Open source operating system based on the open parts of macOS
      +Hint: You can also use the shorthand version:

      -

      Other OSes which seem interesting...


      + +
      % dtail --servers serverlist.txt \
      +    --files '/var/log/dserver/*.log' \
      +    'from STATS select sum($goroutines),sum($cgocalls),
      +     last($time),max(lifetimeConnections)'
      +

      -Asteroids OS - Open source smartphone OS
      -DragonFly BSD - Fork of FreeBSD 4
      -Phosh (on postmarketOS) - A true Linux shell for the smartphone
      +Here is another example:

      -E-Mail your comments to paul@nospam.buetow.org :-)
      + +
      % 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)'
      +

      -Back to the main site
      -
      -
      -
      - - Welcome to the foo.zone - - https://foo.zone/gemfeed/2022-01-23-welcome-to-the-foo.zone.html - 2022-01-23T16:42:04+00:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - I don't count this as a real blog post, but more of an announcement (I aim to write one real post once monthly). From now on, 'foo.zone' is the new address of this site. All other addresses will still forward to it and eventually (based on the traffic still going through) will be deactivated. - -
      -

      Welcome to the foo.zone


      +Tail map-reduce example 2

      -Published at 2022-01-23T16:42:04+00:00
      +You can also continuously append the results to a CSV file by adding outfile append filename.csv to the query:

      -
      -  __                                  
      - / _| ___   ___   _______  _ __   ___ 
      -| |_ / _ \ / _ \ |_  / _ \| '_ \ / _ \
      -|  _| (_) | (_) | / / (_) | | | |  __/
      -|_|  \___/ \___(_)___\___/|_| |_|\___|
      -                                      
      +
      +
      % dtail --servers serverlist.txt \
      +    --files '/var/log/dserver/*.log' \
      +    --query 'from STATS select ... outfile append result.csv'
       

      -I don't count this as a real blog post, but more of an announcement (I aim to write one real post once monthly). From now on, "foo.zone" is the new address of this site. All other addresses will still forward to it and eventually (based on the traffic still going through) will be deactivated.
      +

      How to use dcat



      -As you can read on Wikipedia, "foo" is, alongside to "bar" and "baz", a metasyntactic variable (you know what I mean if you are a programmer or IT person):
      -
      -https://en.wikipedia.org/wiki/Metasyntactic_variable
      +The following example demonstrates how to cat files (display the full content of the files) on several servers at once.

      -

      What is the foo zone?


      +As you can see in this example, a DTail client also creates a local log file of all received data in ~/log. You can also use the noColor and -plain flags (this all also work with other DTail commands than dcat).

      -It's my personal internet site and blog. Everything you read on this site is my personal opinion and experience. It's not intended to be anything professional. If you want my professional background, then go to my LinkedIn profile.
      + +
      % dcat --servers serverlist.txt --files /etc/hostname
      +

      -Since I re-booted this blog last year, I struggled to find a good host name for it. I started off with "buetow.org", and later I switched halfway to "snonux.de". Buetow is my last name, and snonux relates to some of my internet nicknames and personal IT projects. I also have a "SnonuxBSD" ASCII-art banner in the motd of my FreeBSD based home-NAS.
      +Cat example

      -For a while, I was thinking about a better host name for this site, meeting the following criteria:
      +Hint: You can also use the shorthand version:

      -
        -
      • Isn't directly linked to my name or my internet nicknames.
      • -
      • Reflects the "nature" of this site.
      • -
      • Is still pretty generic.
      • -
      • Is "cool".
      • -
      • Is short and easy to remember.
      • -
      • Doesn't cost millions.
      • -

      -So I think that foo.zone is the perfect match. It's a bit geeky, but so is this site. The meta-syntactic variable relates to computer science and programming, so does this site. Other than that, staying in this sphere, it's a pretty generic name.
      + +
      % dcat --servers serverlist.txt /etc/hostname
      +

      -

      To be in the .zone and not in a .surf club


      +

      How to use dgrep



      -I was pretty happy finding out that foo.zone was still available for registration. I stumbled across it just yesterday while I was playing around with my new authoritative DNS servers. I was actually quite surprised as usually such short SLDs (second level domains), especially "foo", are all taken already.
      +The following example demonstrates how to grep files (display only the lines which match a given regular expression) of multiple servers at once. In this example, we look after some entries in /etc/passwd. This time, we don't provide the server list via an file but rather via a comma separated list directly on the command line. We also explore the -before, -after and -max flags (see animation).

      -As a funny bit, I almost chose "foo.surf" over "foo.zone" as in "surfing this site", but then decided against it as I would have to tell everyone that I am not into water sports so much. Well, on the other hand, I now may have to explain to non-programmers that I am not a fan of the rock band "Foo Fighters". But that will be acceptable, as I don't expect "normal" people visiting the foo zone as much anyway. If you reached as far, I have to congratulate you. You are not a normal person.
      + +
      % dgrep --servers server1.example.org:2223 \
      +    --files /etc/passwd \
      +    --regex nologin
      +

      -

      What about my old hosts


      +Generally, dgrep is also a very useful way to search historic application logs for certain content.

      -The host buetow.org will stay. However, not as the primary address for this site. I will keep using it for my personal internet infrastructure as well as for most of my E-Mail addresses. I used buetow.org for that over the past 10 years already anyway and that won't change any time soon. I don't know what I am going to do with snonux.de in the long run. A .de SLD (for Germany) is pretty cheap, so I might just keep it for now.
      +Grep example

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +Hint: -regex is an alias for -grep.

      -Back to the main site
      -
      -
      -
      - - Bash Golf Part 2 - - https://foo.zone/gemfeed/2022-01-01-bash-golf-part-2.html - 2022-01-01T23:36:15+00:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - This is the second blog post about my Bash Golf series. This series is random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content. - -
      -

      Bash Golf Part 2


      +

      How to use dmap



      -Published at 2022-01-01T23:36:15+00:00; Updated at 2022-01-05
      +To run a map-reduce aggregation over logs written in the past, the dmap command can be used. The following example aggregates all map-reduce fields dmap will print interim results every few seconds. You can also write the result to an CSV file by adding outfile result.csv to the query.

      -
      -    '\       '\                   .  .                |>18>>
      -      \        \              .         ' .           |
      -     O>>      O>>         .                 'o        |
      -      \       .\. ..   .                              |
      -      /\    .  /\    . .                              |
      -     / /   .  / /  .'    .                            |
      -jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      -                        Art by Joan Stark, mod. by Paul Buetow
      +
      +
      % 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)'
       

      -This is the second blog post about my Bash Golf series. This series is random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.
      +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.

      -2021-11-29 Bash Golf Part 1
      -2022-01-01 Bash Golf Part 2 (You are currently reading this)
      +DMap example

      -

      Redirection


      +

      How to use the DTail serverless mode



      -Let's have a closer look at Bash redirection. As you might already know that there are 3 standard file descriptors:
      +Until now, all examples so far required to have remote server(s) to connect to. That makes sense, as after all DTail is a *distributed* tool. However, there are circumstances where you don't really need to connect to a server remotely. For example, you already have a login shell open to the server an all what you want is to run some queries directly on local log files.

      -
        -
      • 0 aka stdin (standard input)
      • -
      • 1 aka stdout (standard output)
      • -
      • 2 aka stderr (standard error output)
      • -

      -These are most certainly the ones you are using on regular basis. "/proc/self/fd" lists all file descriptors which are open by the current process (in this case: the current Bash shell itself):
      +The serverless mode does not require any dserver up and running and therefore there is no networking/SSH involved.

      -
      -❯ ls -l /proc/self/fd/
      -total 0
      -lrwx------. 1 paul paul 64 Nov 23 09:46 0 -> /dev/pts/9
      -lrwx------. 1 paul paul 64 Nov 23 09:46 1 -> /dev/pts/9
      -lrwx------. 1 paul paul 64 Nov 23 09:46 2 -> /dev/pts/9
      -lr-x------. 1 paul paul 64 Nov 23 09:46 3 -> /proc/162912/fd
      -
      +All commands shown so far also work in a serverless mode. All what needs to be done is to omit a server list. The DTail client then starts in serverless mode.

      -The following examples demonstrate two different ways to accomplish the same thing. The difference is that the first command is directly printing out "Foo" to stdout and the second command is explicitly redirecting stdout to its own stdout file descriptor:
      +

      Serverless map-reduce query



      -
      -❯ echo Foo
      -Foo
      -❯ echo Foo > /proc/self/fd/0
      -Foo
      +The following dmap example is the same as the previously shown one, but the difference is that it operates on a local log file directly:
      +
      + +
      % 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)'
       

      -Other useful redirections are:
      +As a shorthand version the following command can be used:

      -
        -
      • Redirect stderr to stdin: "echo foo 2>&1"
      • -
      • Redirect stdin to stderr: "echo foo >&2"
      • -

      -It is, however, not possible to redirect multiple times within the same command. E.g. the following won't work. You would expect stdin to be redirected to stderr and then stderr to be redirected to /dev/null. But as the example shows, Foo is still printed out:
      + +
      % dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
      +        lifetimeConnections group by $hostname order by max($cgocalls)' \
      +        /var/log/dsever/dserver.log
      +

      -
      -❯ echo Foo 1>&2 2>/dev/null
      -Foo
      +You can also use a file input pipe as follows:
      +
      + +
      % cat /var/log/dserver/dserver.log | \
      +    dmap 'from STATS select $hostname,max($goroutines),max($cgocalls),$loadavg,
      +          lifetimeConnections group by $hostname order by max($cgocalls)'
       

      -Update: A reader sent me an email and pointed out that the order of the redirections is important.
      +

      Aggregating CSV files



      -As you can see, the following will not print out anything:
      +In essence, this works exactly like aggregating logs. All files operated on must be valid CSV files and the first line of the CSV must be the header. E.g.:

      -
      -❯ echo Foo 2>/dev/null 1>&2
      -❯
      +
      +
      % 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
       

      -A good description (also pointed out by the reader) can be found here:
      +DMap can also be used to query and aggregate CSV files from remote servers.

      -Order of redirection
      +

      Other serverless commands



      -Ok, back to the original blog post. You can also use grouping here (neither of these commands will print out anything to stdout):
      +The serverless mode works transparently with all other DTail commands. Here are some examples:

      -
      -❯ { echo Foo 1>&2; } 2>/dev/null
      -❯ ( echo Foo 1>&2; ) 2>/dev/null
      -❯ { { { echo Foo 1>&2; } 2>&1; } 1>&2; } 2>/dev/null
      -❯ ( ( ( echo Foo 1>&2; ) 2>&1; ) 1>&2; ) 2>/dev/null
      -❯
      +
      +
      % dtail /var/log/dserver/dserver.log
       

      -A handy way to list all open file descriptors is to use the "lsof" command (that's not a Bash built-in), whereas $$ is the process id (pid) of the current shell process:
      -
      -
      -❯ lsof -a -p $$ -d0,1,2
      -COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
      -bash    62676 paul    0u   CHR  136,9      0t0   12 /dev/pts/9
      -bash    62676 paul    1u   CHR  136,9      0t0   12 /dev/pts/9
      -bash    62676 paul    2u   CHR  136,9      0t0   12 /dev/pts/9
      +
      +
      % dtail --logLevel trace /var/log/dserver/dserver.log
       

      -Let's create our own descriptor "3" for redirection to a file named "foo":
      -
      -
      -❯ touch foo
      -❯ exec 3>foo # This opens fd 3 and binds it to file foo.
      -❯ ls -l /proc/self/fd/3
      -l-wx------. 1 paul paul 64 Nov 23 10:10 \
      -    /proc/self/fd/3 -> /home/paul/foo
      -❯ cat foo
      -❯ echo Bratwurst >&3
      -❯ cat foo
      -Bratwurst
      -❯ exec 3>&- # This closes fd 3.
      -❯ echo Steak >&3
      --bash: 3: Bad file descriptor
      -
      -
      -You can also override the default file descriptors, as the following example script demonstrates:
      + +
      % dcat /etc/passwd
      +

      -
      -❯ cat grandmaster.sh
      -#!/usr/bin/env bash
      -
      -# Write a file data-file containing two lines
      -echo Learn You a Haskell > data-file
      -echo for Great Good >> data-file
      -
      -# Link fd with fd 6 (saves default stdin)
      -exec 6<&0
      -
      -# Overwrite stdin with data-file
      -exec < data-file
      -
      -# Read the first two lines from it
      -declare LINE1 LINE2
      -read LINE1
      -read LINE2
      -
      -# Print them
      -echo First line: $LINE1
      -echo Second line: $LINE2
      -
      -# Restore default stdin and delete fd 6
      -exec 0<&6 6<&-
      +
      +
      % dcat --plain /etc/passwd > /etc/test
      +# Should show no differences.
      +diff /etc/test /etc/passwd 
       

      -Let's execute it:
      + +
      % dgrep --regex ERROR --files /var/log/dserver/dsever.log
      +

      -
      -❯ chmod 750 ./grandmaster.sh
      -❯ ./grandmaster.sh
      -First line: Learn You a Haskell
      -Second line: for Great Good
      +
      +
      % dgrep --before 10 --after 10 --max 10 --grep ERROR /var/log/dserver/dsever.log
       

      -

      HERE


      +Use --help for more available options. Or go to the DTail page for more information! Hope you find DTail useful!

      -I have mentioned HERE-documents and HERE-strings already in this post. Let's do some more examples. The following "cat" receives a multi line string from stdin. In this case, the input multi line string is a HERE-document. As you can see, it also interpolates variables (in this case the output of "date" running in a subshell).
      +E-Mail your comments to paul@nospam.buetow.org :-)

      -
      -❯ cat <<END
      -> Hello World
      -> It’s $(date)
      -> END
      -Hello World
      -It's Fri 26 Nov 08:46:52 GMT 2021
      -
      +Other related posts are:

      -You can also write it the following way, but that's less readable (it's good for an obfuscation contest):
      +2023-09-25 DTail usage examples (You are currently reading this)
      +2022-10-30 Installing DTail on OpenBSD
      +2022-03-06 The release of DTail 4.0.0
      +2021-04-22 DTail - The distributed log tail program

      -
      -❯ <<END cat
      -> Hello Universe
      -> It’s $(date)
      -> END
      -Hello Universe
      -It's Fri 26 Nov 08:47:32 GMT 2021
      -
      +I hope you find the tools presented in this post useful!

      -Besides of an HERE-document, there is also a so-called HERE-string. Besides of...
      +Paul

      -
      -❯ declare VAR=foo
      -❯ if echo "$VAR" | grep -q foo; then
      -> echo '$VAR ontains foo'
      -> fi
      -$VAR ontains foo
      -
      +Back to the main site
      +
      +
      +
      + + Site Reliability Engineering - Part 1: SRE and Organizational Culture + + https://foo.zone/gemfeed/2023-08-18-site-reliability-engineering-part-1.html + 2023-08-18T22:43:47+03:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + Being a Site Reliability Engineer (SRE) is like stepping into a lively, ever-evolving universe. The world of SRE mixes together different tech, a unique culture, and a whole lot of determination. It’s one of the toughest but most exciting jobs out there. There's zero chance of getting bored because there's always a fresh challenge to tackle and new technology to play around with. It's not just about the tech side of things either; it's heavily rooted in communication, collaboration, and teamwork. As someone currently working as an SRE, I’m here to break it all down for you in this blog series. Let's dive into what SRE is really all about! + +
      +

      Site Reliability Engineering - Part 1: SRE and Organizational Culture



      -...you can use a HERE-string like that:
      +Published at 2023-08-18T22:43:47+03:00

      -
      -❯ if grep -q foo <<< "$VAR"; then
      -> echo '$VAR contains foo'
      -> fi
      -$VAR contains foo
      -
      +Being a Site Reliability Engineer (SRE) is like stepping into a lively, ever-evolving universe. The world of SRE mixes together different tech, a unique culture, and a whole lot of determination. It’s one of the toughest but most exciting jobs out there. There's zero chance of getting bored because there's always a fresh challenge to tackle and new technology to play around with. It's not just about the tech side of things either; it's heavily rooted in communication, collaboration, and teamwork. As someone currently working as an SRE, I’m here to break it all down for you in this blog series. Let's dive into what SRE is really all about!

      -Or even shorter, you can do:
      +2023-08-18 Site Reliability Engineering - Part 1: SRE and Organizational Culture (You are currently reading this)
      +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance
      +2024-01-09 Site Reliability Engineering - Part 3: On-Call Culture
      +2024-09-07 Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers

      -❯ grep -q foo <<< "$VAR" && echo '$VAR contains foo'
      -$VAR contains foo
      +▓▓▓▓░░                                                                                  
      +                                                                                          
      +DC on fire:
      +                                                                                          
      +                ▓▓                                    ▓▓                ▓▓                
      +      ░░  ░░    ▓▓▓▓                  ██                  ░░            ▓▓▓▓        ▓▓    
      +    ▓▓░░░░  ░░  ▓▓▓▓                              ▓▓░░                  ▓▓▓▓              
      +    ░░░░      ▓▓▓▓▓▓        ▓▓      ▓▓            ▓▓                  ▓▓▓▓▓▓      ▓▓      
      +    ▓▓░░    ▓▓▒▒▒▒▓▓▓▓    ▓▓        ▓▓▓▓        ▓▓▓▓▓▓              ▓▓▒▒▒▒▓▓▓▓    ▓▓▓▓    
      +  ██▓▓      ▓▓▒▒░░▒▒▓▓  ▓▓██      ▓▓▓▓▓▓        ▓▓▒▒▓▓              ▓▓▒▒░░▒▒▓▓  ██▓▓▓▓    
      +  ▓▓▓▓██  ▓▓▒▒░░░░▒▒▓▓  ▓▓▓▓      ▓▓▒▒▒▒▓▓    ▓▓▒▒░░▒▒▓▓██▓▓      ▓▓▒▒░░░░▒▒▓▓  ▓▓▒▒▒▒▓▓  
      +  ▓▓▒▒▒▒▓▓▓▓▒▒░░▒▒▓▓▓▓▓▓▒▒▒▒▓▓  ▓▓▓▓░░▒▒▓▓    ▓▓▒▒░░▒▒▓▓▒▒▒▒▓▓    ▓▓▒▒░░▒▒▓▓▓▓▓▓▓▓░░▒▒▓▓  
      +  ▒▒░░▒▒▓▓▓▓▒▒░░▒▒▓▓▓▓▒▒░░▒▒▓▓  ▓▓▒▒░░▒▒▓▓    ▓▓░░░░▒▒▒▒░░░░▒▒██████▒▒░░▒▒██▓▓▓▓▒▒░░▒▒▓▓██
      +  ░░░░▒▒▓▓▒▒░░▒▒▓▓▓▓▓▓▒▒░░▒▒▓▓██▒▒░░░░▒▒▓▓  ▓▓▒▒░░▒▒▓▓▒▒▒▒░░▒▒▓▓▓▓▒▒░░▒▒▓▓▓▓▓▓▒▒░░░░▒▒▓▓▓▓
      +  ░░░░▒▒▓▓▒▒░░░░▓▓██▒▒░░░░▒▒▓▓██▒▒░░░░▒▒██▓▓▓▓▒▒░░▒▒▓▓▓▓▒▒░░░░▒▒▓▓▒▒░░░░██▓▓▓▓▒▒░░░░▒▒████
      +  ▒▒░░▒▒▓▓▓▓░░░░▒▒▓▓▒▒▒▒░░░░▒▒▓▓▓▓▒▒░░░░▒▒▓▓▓▓▒▒░░░░▒▒▓▓▒▒░░▒▒▓▓▓▓▓▓░░░░▒▒▓▓▓▓▓▓▒▒░░░░▒▒▓▓
      +  ▒▒░░▒▒▓▓▒▒▒▒░░▒▒██▒▒▒▒░░▒▒▒▒██▒▒▒▒░░░░░░▒▒▓▓▒▒░░░░▒▒▒▒░░░░▒▒████▒▒▒▒░░▒▒██▓▓▒▒▒▒░░░░░░▒▒
      +  ░░░░░░▒▒░░░░░░░░▒▒▒▒▒▒░░░░▒▒▒▒▒▒░░░░░░░░▒▒▒▒░░░░░░▒▒▒▒░░░░░░▒▒▒▒░░░░░░░░▒▒▒▒▒▒░░░░░░░░▒▒
      +  ░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░
       

      -You can also use a Bash regex to accomplish the same thing, but the points of the examples so far were to demonstrate HERE-{documents,strings} and not Bash regular expressions:
      +

      SRE and Organizational Culture: Navigating the Nexus



      -
      -❯ if [[ "$VAR" =~ foo ]]; then echo yay; fi
      -yay
      -
      +At the core of SRE is the principle of "prevention over cure." Unlike traditional IT setups that mostly react to problems, SRE focuses on spotting issues before they happen. This proactive approach involves using Service Level Indicators (SLIs) and Service Level Objectives (SLOs). These tools give teams specific metrics and targets to aim for, helping them keep systems reliable and users happy. It's all about creating a culture that prioritizes user experience and makes sure everything runs smoothly to meet their needs.

      -You can also use it with "read":
      +Another key concept in SRE is the "error budget." It’s a clever approach that recognizes no system is perfect and that failures will happen. Instead of punishing mistakes, SRE culture embraces them as chances to learn and improve. The idea is to give teams a "budget" for errors, creating a space where innovation can thrive and failures are simply seen as lessons learned.

      -
      -❯ read a <<< ja
      -❯ echo $a
      -ja
      -❯ read b <<< 'NEIN!!!'
      -❯ echo $b
      -NEIN!!!
      -❯ dumdidumstring='Learn you a Golang for Great Good'
      -❯ read -a words <<< "$dumdidumstring"
      -❯ echo ${words[0]}
      -Learn
      -❯ echo ${words[3]}
      -Golang
      -
      -
      -The following is good for an obfuscation contest too:
      +SRE isn't just about tech and metrics; it's also about people. It tackles the "hero culture" that often ends up burning out IT teams. Sure, having a hero swoop in to save the day can be great, but relying on that all the time just isn’t sustainable. Instead, SRE focuses on collective expertise and teamwork. It recognizes that heroes are at their best within a solid team, making the need for constant heroics unnecessary. This way of thinking promotes a balanced on-call experience and highlights trust, ownership, good communication, and collaboration as key to success. I've been there myself, falling into the hero trap, and I know firsthand that it's just not feasible to be the go-to person for every problem that comes up.

      -
      -❯ echo 'I like Perl too' > perllove.txt
      -❯ cat - perllove.txt <<< "$dumdidumstring"
      -Learn you a Golang for Great Good
      -I like Perl too
      -
      +Also, the SRE model puts a big emphasis on good documentation. It's not enough to just have docs; they need to be top-notch and go through the same quality checks as code. This really helps with onboarding new team members, training, and keeping everyone on the same page.

      -

      RANDOM


      +Adopting SRE can be a big challenge for some organizations. They might think the SRE approach goes against their goals, like preferring to roll out new features quickly rather than focusing on reliability, or seeing SRE practices as too much hassle. Building an SRE culture often means taking the time to explain things patiently and showing the benefits, like faster release cycles and a better user experience.

      -Random is a special built-in variable containing a different pseudo random number each time it's used.
      +Monitoring and observability are also big parts of SRE, highlighting the need for top-notch tools to query and analyze data. This aligns with the SRE focus on continuous learning and being adaptable. SREs naturally need to be curious, ready to dive into any strange issues, and always open to picking up new tools and practices.

      -
      -❯ echo $RANDOM
      -11811
      -❯ echo $RANDOM
      -14997
      -❯ echo $RANDOM
      -9104
      -
      +For SRE to really work in any organization, everyone needs to buy into its principles. It's about moving away from working in isolated silos and relying on SRE to just patch things up. Instead, it’s about making reliability a shared responsibility across the whole team.

      -That's very useful if you want to randomly delay the execution of your scripts when you run it on many servers concurrently, just to spread the server load (which might be caused by the script run) better.
      +In short, bringing SRE principles into the mix goes beyond just the technical stuff. It helps shift the whole organizational culture to value things like preventing issues before they happen, always learning, working together, and being open with communication. When SRE and corporate culture blend well, you end up with not just reliable systems but also a strong, resilient, and forward-thinking workplace.

      -Let's say you want to introduce a random delay of 1 minute. You can accomplish it with:
      +Organizations that have SLIs, SLOs, and error budgets in place are already pretty far along in their SRE journey. Getting there takes a lot of communication, convincing people, and patience.

      -
      -❯ cat ./calc_answer_to_ultimate_question_in_life.sh
      -#!/usr/bin/env bash
      -
      -declare -i MAX_DELAY=60
      -
      -random_delay () {
      -    local -i sleep_for=$((RANDOM % MAX_DELAY))
      -    echo "Delaying script execution for $sleep_for seconds..."
      -    sleep $sleep_for
      -    echo 'Continuing script execution...'
      -}
      -
      -main () {
      -    random_delay
      -    # From here, do the real work. Calculating the answer to
      -    # the ultimate question can take billions of years....
      -    : ....
      -}
      -
      -main
      -
      -❯
      -❯ ./calc_answer_to_ultimate_question_in_life.sh
      -Delaying script execution for 42 seconds...
      -Continuing script execution...
      -
      +Continue with the second part of this series:

      -

      set -x and set -e and pipefile


      +2023-11-19 Site Reliability Engineering - Part 2: Operational Balance

      -In my opinion, -x and -e and pipefile are the most useful Bash options. Let's have a look at them one after another.
      +E-Mail your comments to paul@nospam.buetow.org :-)

      -

      -x


      +Back to the main site
      +
      +
      +
      + + Gemtexter 2.1.0 - Let's Gemtext again³ + + https://foo.zone/gemfeed/2023-07-21-gemtexter-2.1.0-lets-gemtext-again-3.html + 2023-07-21T10:19:31+03:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + I proudly announce that I've released Gemtexter version `2.1.0`. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash. + +
      +

      Gemtexter 2.1.0 - Let's Gemtext again³



      --x prints commands and their arguments as they are executed. This helps to develop and debug your Bash code:
      +Published at 2023-07-21T10:19:31+03:00

      -
      -❯ set -x
      -❯ square () { local -i num=$1; echo $((num*num)); }
      -❯ num=11; echo "Square of $num is $(square $num)"
      -+ num=11
      -++ square 11
      -++ local -i num=11
      -++ echo 121
      -+ echo 'Square of 11 is 121'
      -Square of 11 is 121
      -
      +I proudly announce that I've released Gemtexter version 2.1.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash.

      -You can also set it when calling an external script without modifying the script itself:
      +https://codeberg.org/snonux/gemtexter

      -❯ bash -x ./half_broken_script_to_be_debugged.sh
      +-=[ typewriters ]=-  1/98
      +                                        .-------.
      +       .-------.                       _|~~ ~~  |_
      +      _|~~ ~~  |_       .-------.    =(_|_______|_)
      +    =(_|_______|_)=    _|~~ ~~  |_     |:::::::::|
      +      |:::::::::|    =(_|_______|_)    |:::::::[]|
      +      |:::::::[]|      |:::::::::|     |o=======.|
      +      |o=======.|      |:::::::[]|     `"""""""""`
      + jgs  `"""""""""`      |o=======.|
      +  mod. by Paul Buetow  `"""""""""`
       

      -Let's do that on one of the example scripts we covered earlier:
      +

      Table of Contents



      -
      -❯ bash -x ./grandmaster.sh
      -+ bash -x ./grandmaster.sh
      -+ echo Learn You a Haskell
      -+ echo for Great Good
      -+ exec
      -+ exec
      -+ declare LINE1 LINE2
      -+ read LINE1
      -+ read LINE2
      -+ echo First line: Learn You a Haskell
      -First line: Learn You a Haskell
      -+ echo Second line: for Great Good
      -Second line: for Great Good
      -+ exec
      -❯
      -
      +
      +

      Why Bash?


      +
      +This project is too complex for a Bash script. Writing it in Bash was to try out how maintainable a "larger" Bash script could be. It's still pretty maintainable and helps me try new Bash tricks here and then!

      -

      -e


      +Let's list what's new!

      -This is a very important option you want to use when you are paranoid. This means, you should always "set -e" in your scripts when you need to make absolutely sure that your script runs successfully (with that I mean that no command should exit with an unexpected status code).
      +

      Switch to GPL3 license



      -Ok, let's dig deeper:
      +Many (almost all) of the tools and commands (GNU Bash, GMU Sed, GNU Date, GNU Grep, GNU Source Highlight) used by Gemtexter are licensed under the GPL anyway. So why not use the same? This was an easy switch, as I was the only code contributor so far!

      -
      -❯ help set | grep -- -e
      -      -e  Exit immediately if a command exits with a non-zero status.
      -
      +

      Source code highlighting support



      -As you can see in the following example, the Bash terminates after the execution of "grep" as "foo" is not matching "bar". Therefore, grep exits with 1 (unsuccessfully) and the shell aborts. And therefore, "bar" will not be printed out anymore:
      +The HTML output now supports source code highlighting, which is pretty neat if your site is about programming. The requirement is to have the source-highlight command, which is GNU Source Highlight, to be installed. Once done, you can annotate a bare block with the language to be highlighted. E.g.:

      -❯ bash -c 'set -e; echo hello; grep -q bar <<< foo; echo bar'
      -hello
      -❯ echo $?
      -1
      + ```bash
      + if [ -n "$foo" ]; then
      +   echo "$foo"
      + fi
      + ```
       

      -Whereas the outcome changes when the regex matches:
      +The result will look like this (you can see the code highlighting only in the Web version, not in the Geminispace version of this site):

      -
      -❯ bash -c 'set -e; echo hello; grep -q bar <<< barman; echo bar'
      -hello
      -bar
      -❯ echo $?
      -0
      +
      +
      if [ -n "$foo" ]; then
      +  echo "$foo"
      +fi
       

      -So does it mean that grep will always make the shell terminate whenever its exit code isn't 0? This will render "set -e" quite unusable. Frankly, there are other commands where an exit status other than 0 should not terminate the whole script abruptly. Usually, what you want is to branch your code based on the outcome (exit code) of a command:
      +Please run source-highlight --lang-list for a list of all supported languages.

      -
      -❯ bash -c 'set -e
      ->    grep -q bar <<< foo
      ->    if [ $? -eq 0 ]; then
      ->        echo "matching"
      ->    else
      ->        echo "not matching"
      ->    fi'
      -❯ echo $?
      -1
      -
      +

      HTML exact variant



      -...but the example above won't reach any of the branches and won't print out anything, as the script terminates right after grep.
      +Gemtexter is there to convert your Gemini Capsule into other formats, such as HTML and Markdown. An HTML exact variant can now be enabled in the gemtexter.conf by adding the line declare -rx HTML_VARIANT=exact. The HTML/CSS output changed to reflect a more exact Gemtext appearance and to respect the same spacing as you would see in the Geminispace.

      -The proper solution is to use grep as an expression in a conditional (e.g. in an if-else statement):
      +

      Use of Hack webfont by default



      -
      -❯ bash -c 'set -e
      ->    if grep -q bar <<< foo; then
      ->        echo "matching"
      ->    else
      ->        echo "not matching"
      ->    fi'
      -not matching
      -❯ echo $?
      -0
      -❯ bash -c 'set -e
      ->    if grep -q bar <<< barman; then
      ->        echo "matching"
      ->    else
      ->        echo "not matching"
      ->    fi'
      -matching
      -❯ echo $?
      -0
      -
      -
      -You can also temporally undo "set -e" if there is no other way:
      +The Hack web font is a typeface designed explicitly for source code. It's a derivative of the Bitstream Vera and DejaVu Mono lineage, but it features many improvements and refinements that make it better suited to reading and writing code.

      -
      -❯ cat ./e.sh
      -#!/usr/bin/env bash
      -
      -set -e
      -
      -foo () {
      -    local arg="$1"; shift
      -
      -    if [ -z "$arg" ]; then
      -        arg='You!'
      -    fi
      -    echo "Hello $arg"
      -}
      -
      -bar () {
      -    # Temporally disable e
      -    set +e
      -    local arg="$1"; shift
      -    # Enable e again.
      -    set -e
      -
      -    if [ -z "$arg" ]; then
      -        arg='You!'
      -    fi
      -    echo "Hello $arg"
      -}
      -
      -# Will succeed
      -bar World
      -foo Universe
      -bar
      -
      -# Will terminate the script
      -foo
      -
      -❯ ./e.sh
      -Hello World
      -Hello Universe
      -Hello You!
      -
      +The font has distinctive glyphs for every character, which helps to reduce confusion between similar-looking characters. For example, the characters "0" (zero), "O" (capital o), and "o" (lowercase o), or "1" (one), "l" (lowercase L), and "I" (capital i) all have distinct looks in Hack, making it easier to read and understand code at a glance.

      -Why does calling "foo" with no arguments make the script terminate? Because as no argument was given, the "shift" won't have anything to do as the argument list $@ is empty, and therefore "shift" fails with a non-zero status.
      +Hack is open-source and freely available for use and modification under the MIT License.

      -Why would you want to use "shift" after function-local variable assignments? Have a look at my personal Bash coding style guide for an explanation :-):
      +

      HTML Mastodon verification support



      -./2021-05-16-personal-bash-coding-style-guide.html
      +The following link explains how URL verification works in Mastodon:

      -

      pipefail


      +https://joinmastodon.org/verification

      -The pipefail option makes it so that not only the exit code of the last command of the pipe counts regards its exit code but any command of the pipe:
      +So we have to hyperlink to the Mastodon profile to be verified and also to include a rel='me' into the tag. In order to do that add this to the gemtexter.conf (replace the URI to your Mastodon profile accordingly):

      -
      -❯ help set | grep pipefail -A 2
      -    pipefail     the return value of a pipeline is the status of
      -                 the last command to exit with a non-zero status,
      -                 or zero if no command exited with a non-zero status
      +
      +
      declare -xr MASTODON_URI='https://fosstodon.org/@snonux'
       

      -The following greps for paul in passwd and converts all lowercase letters to uppercase letters. The exit code of the pipe is 0, as the last command of the pipe (converting from lowercase to uppercase) succeeded:
      +and add the following into your index.gmi:

      -❯ grep paul /etc/passwd | tr '[a-z]' '[A-Z]'
      -PAUL:X:1000:1000:PAUL BUETOW:/HOME/PAUL:/BIN/BASH
      -❯ echo $?
      -0
      +=> https://fosstodon.org/@snonux Me at Mastodon
       

      -Let's look at another example, where "TheRock" doesn't exist in the passwd file. However, the pipes exit status is still 0 (success). This is so because the last command ("tr" in this case) still succeeded. It is just that it didn't get any input on stdin to process:
      +The resulting line in the HTML output will be something as follows:

      -
      -❯ grep TheRock /etc/passwd
      -❯ echo $?
      -1
      -❯ grep TheRock /etc/passwd | tr '[a-z]' '[A-Z]'
      -❯ echo $?
      -0
      +
      +
      <a href='https://fosstodon.org/@snonux' rel='me'>Me at Mastodon</a>
       

      -To change this behaviour, pipefile can be used. Now, the pipes exit status is 1 (fail), because the pipe contains at least one command (in this case grep) which exited with status 1:
      +

      More


      +
      +Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.

      -
      -❯ set -o pipefail
      -❯ grep TheRock /etc/passwd | tr '[a-z]' '[A-Z]'
      -❯ echo $?
      -1
      -
      +E-Mail your comments to paul@nospam.buetow.org :-)

      Other related posts are:

      -2021-05-16 Personal Bash coding style guide
      +2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴
      +2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³ (You are currently reading this)
      +2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
      +2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
      2021-06-05 Gemtexter - One Bash script to rule it all
      -2021-11-29 Bash Golf Part 1
      -2022-01-01 Bash Golf Part 2 (You are currently reading this)
      -
      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2021-04-24 Welcome to the Geminispace

      Back to the main site
      - How to stay sane as a DevOps person - - https://foo.zone/gemfeed/2021-12-26-how-to-stay-sane-as-a-devops-person.html - 2021-12-26T12:02:02+00:00 + 'Software Developmers Career Guide and Soft Skills' book notes + + https://foo.zone/gemfeed/2023-07-17-career-guide-and-soft-skills-book-notes.html + 2023-07-17T04:56:20+03:00 Paul Buetow aka snonux paul@dev.buetow.org - Log4shell (CVE-2021-44228) made it clear, once again, that working in information technology is not an easy job (especially when you are a DevOps person). I thought it would be interesting to summarize a few techniques to help you to relax. + These notes are of two books by 'John Sommez' I found helpful. I also added some of my own keypoints to it. These notes are mainly for my own use, but you might find them helpful, too.
      -

      How to stay sane as a DevOps person


      +

      "Software Developmers Career Guide and Soft Skills" book notes



      -Published at 2021-12-26T12:02:02+00:00; Updated at 2022-01-12
      +Published at 2023-07-17T04:56:20+03:00
      +
      +These notes are of two books by "John Sommez" I found helpful. I also added some of my own keypoints to it. These notes are mainly for my own use, but you might find them helpful, too.

      -                                     )
      -                             )      ((     (
      -                           (        ))     )
      -                    )       )      //     (
      -               _   (        __    (     ~->>
      -        ,-----' |__,_~~___<'__`)-~__--__-~->> <
      -        | //  : | -__   ~__ o)____)),__ - '> >-  >
      -        | //  : |- \_ \ -\_\ -\ \ \ ~\_  \ ->> - ,  >>
      -        | //  : |_~_\ -\__\ \~'\ \ \, \__ . -<-  >>
      -        `-----._| `  -__`-- - ~~ -- ` --~> >
      -         _/___\_    //)_`//  | ||]
      -   _____[_______]_[~~-_ (.L_/  ||
      -  [____________________]' `\_,/'/
      -    ||| /          |||  ,___,'./
      -    ||| \          |||,'______|
      -    ||| /          /|| I==||
      -    ||| \       __/_||  __||__
      ------||-/------`-._/||-o--o---o---
      -  ~~~~~'
      +         ,..........   ..........,
      +     ,..,'          '.'          ',..,
      +    ,' ,'            :            ', ',
      +   ,' ,'             :             ', ',
      +  ,' ,'              :              ', ',
      + ,' ,'............., : ,.............', ',
      +,'  '............   '.'   ............'  ',
      + '''''''''''''''''';''';''''''''''''''''''
      +                    '''
       

      -Log4shell (CVE-2021-44228) made it clear, once again, that working in information technology is not an easy job (especially when you are a DevOps person). I thought it would be interesting to summarize a few techniques to help you to relax.
      -
      -(PS: When I mean DevOps, I also mean Site Reliability Engineers and Sysadmins. I believe SRE, DevOps Engineer and Sysadmin are just synonym titles for the same job).
      -
      -https://en.wikipedia.org/wiki/Log4Shell
      -
      -

      Set clear expectations


      -
      -It's important to set clear expectations. It can be difficult to guess what others expect or don't expect from you. If you know exactly what you are supposed to do, you can work towards a specific goal and don't worry about all the other noise so much.
      -
      -However, if you are in a more senior position, it is expected from you to plan your tasks by yourself to a large degree and also be flexible, so you can react quickly to new situations (e.g. resolving incidents). Also, to a large degree, you have to prioritise your work by yourself. This can overthrow all of your plans. In extreme cases, it can help to share your plans with your team so that everyone is on the same page. Afterwards, be the execution machine. People are happy when they see that stuff gets done. Communicate clearly all critical work you do. This will capture all the technical debt there might be. It does not help in the long run if things are fixed in the background without any visibility.
      -
      -Due to politeness, many people are not setting clear expectations. I personally may sound sometimes "too German" when setting expectations, but so far nobody complained, and I have even received positive feedback about it.
      -
      -

      Always respond to requests but set expectations and boundaries


      -
      -There are many temptations to get side-tracked by other projects and/or issues. It is important to set boundaries here. But always answer to all requests as nothing is more frustrating than asking a person and never getting any answer back. This is especially the case when everyone is working form home where people are using tools such as Slack and E-Mail for most of their communications.
      -
      -

      Dealing with requests


      -
      -If the request is urgent, and you have the capacity to help, probably you should help. If it's not urgent, maybe ask to pospone the request (e.g. ask to create a ticket, so that someone from your team can work on it later).
      -
      -If the request is urgent, but you don't have the knowledge or the capacity to help, try to defer to a colleague who might be able to help. You could also provide some quick tips and hints, so that the requester can resolve the issue by himself. Make it transparent why you might not have the time right now, as this can help the person to review his own priorities or to escalate.
      -
      -

      Escalation is only a tool


      -
      -Never make or take an escalation personally. The only forms of escalation should be due to technical issues or lack of resources. An escalation then becomes like a math equation and does not need human resources involved. So de-facto, an escalation is nothing negative, but just a process people can follow to form decision-making. In a good company escalations tend to be an exception, though. Staff knows how to deal with the things by themselves without bothering management too much.
      -
      -

      Think positively


      -
      -If times are very stressful, think that it could always be worse:
      +

      Table of Contents




      -

      Go slower even if you could go faster


      -
      -When working in a team, you may feel that you could get done things faster when you just did everything by yourself. This can be a bit frustrating at times, as you might need to work late hours and also might need to explain things over and over again to others. Also, you could be the one who needs to get things explained over and over again as you are not so familiar with the topic (yet). You will appreciate it if the other person is slowing down for you a bit.
      +

      Improve



      -

      You work in a team


      +

      Always learn new things



      -Security is a team sport. So slow down and make sure that everyone is on track with the goals. You can go full-speed with your very own subtasks, though. Not everyone knows how to use all the tools so well like a full-time DevOps person. As a DevOps person, you are not a security expert, though. Security experts are different people in your company, but DevOps will be the main tribe deploying mitigations (following the security recommendations) and management will be the main tribe coordinating all the efforts.
      -
      -So even if you think that you can do everything faster by your own, can you really? You probably don't know what you don't know about IT security. The more you know about it, the more you know about what you don't know.
      -
      -

      Don't rush


      -
      -Slowing down also helps to prevent errors. Don't rush your tasks, even if they are urgent. Try to be quick, but don't rush them. Maybe you are writing a script to mitigate a production issue. You could others peer review that script, for example. Their primary programming language may not be the same (e.g. Golang vs Perl), but they would understand the logic. Or ask another DevOps person from your company with good scripting skills review your mitigation, but he then may lack the domain knowledge of the software you are patching. So in either case, the review will take a bit longer as the reviewer might not be an expert in everything.
      +When you learn something new, e.g. a programming language, first gather an overview, learn from multiple sources, play around and learn by doing and not consuming and form your own questions. Don't read too much upfront. A large amount of time is spent in learning technical skills which were never use. You want to have a practical set of skills you are actually using. You need to know 20 percent to get out 80 percent of the results.

      -So relax, don't always expect immediate results. Set clear and reasonable timelines for the management about the mitigations. You are not a superhero who has to do everything by yourself. Sometimes, you will miss a deadline. But that will have good reasons. Don't rush to complete just to meet a deadline.
      +
        +
      • Learn a technology with a goal, e.g. implement a tool. Practice practise practice.
      • +
      • "I know X can do Y, I don't know exactly how, but I can look it up."
      • +
      • Read what experts are writing, for example follow blogs. Stay up to date and spent half an hour per day trading blogs and books.
      • +
      • Pick an open source application, read the code and try to understand it to get a feel of the syntax of the programming language.
      • +
      • Understand, that the standard library makes you a much better programmer.
      • +
      • Self learning is the top skill a programmer can have and is also useful in other aspects in your life.
      • +
      • Keep learning skills every day. Code every day. Don't be overconfident for job security. Read blogs, read books.
      • +
      • If you want to learn, then do it by exploring. Also teach what you learned (for example write a blog post or hold a presentation).
      • +

      +Fake it until you make it. But be honest about your abilities or lack of. There is however only time between now and until you make it. Refer to your abilities to learn.

      -Read also "Defensive DevOps" about deploying mitigation scripts.
      +Boot camps: The advantage of a boot camp is to pragmatically learn things fast. We almost always overestimate what we can do in a day. Especially during boot camps. Connect to others during the boot camps

      -

      You are not a superhero


      +

      Set goals



      -Always keep that in mind. You can't solve all problems by your own. Maybe you could, but that would be a lot of additional stress (and this will reflect to your personal life). Also, Superman and Wonder Woman receive much higher salaries than you will ever do ;-).
      +Your own goals are important but the manager also looks at how the team performs and how someone can help the team perform better. Check whether you are on track with your goals every 2 weeks in order to avoid surprises for the annual review. Make concrete goals for next review. Track and document your progress. Invest in your education. Make your goals known. If you want something, then ask for it. Nobody but you knows what you want.

      -I have been a superhero multiple times mitigating critical incidents, and I was proud about it in those moments. But actually, I am not proud looking at those retrospectively as for everything there should be other people around who should be able to resolve an incident. No company should rely on a single person, there must always be a substitute. You are not a superhero and as harsh as it sounds, everyone is replaceable. Every superhero can be replaced with another superhero. The only thing it takes to become a superhero is time to get to know the infrastructure and tools very well, paired with work dedication.
      +

      Ratings



      -This doesn't mean, that you shouldn't try your best. But you don't need to try to be the superhero. Maybe someone else will be the superhero, but that's OK as long as it's not always the same person every time. Everyone can have a good day after all. If I could choose between being a superhero or having a good night sleep, I would probably prefer the sleep.
      +That's a trap: If you have to rate yourself, that's a trap. That never works in an unbiased way. Rate yourself always the best way but rate your weakest part as high as possible minus one point. Rate yourself as good as you can otherwise. Nobody is putting for fun a gun on his own head.

      -

      Give away some of your superpowers


      +
        +
      • Don't do peer rating, it can fire back on you. What if the colleague becomes your new boss?
      • +
      • Cooperate rankings are unfortunately HR guidelines and politics and only mirror a little your actual performance.
      • +

      +

      Promotions



      -If you are a superhero, try to give away some of your superpowers, so that you can relax in the evening knowing that others (e.g. the current on-call engineers) know how to tackle things. Every member of the team needs to do DevOps (even the team managers, in my humble opinion). Some may be less experienced than others or have other expertises, but to counteract this you could document the recurring tasks so that they are easy to follow (which then later could be either automated away or, even better, fully fixed).
      +The most valuable employees are the ones who make themselves obsolete and automate all away. Keep a safety net of 3 to 6 months of finances. Safe at least 10 percent of your earnings. Also, if you make money it does not mean that you have to spent more money. Is a new car better than a used car which both can bring you from A to B? Liability vs assets.

      -On the other side, if you are a DevOps person, try to sneak into other people's shoes too. For example, you might not be an expert in Java programming, but a lot of the infrastructure is programmed in Java. This is where usually the Software Developers and Engineers shine. But if you know how to read, debug and even extend Java code too (by learning from the Software Developer superheroes), then your will only benefit from it.
      +
        +
      • Raise or promotion, what's better? Promotion is better as money will follow anyway then.
      • +
      • Take projects no-one wants and make them shine. A promotion will follow.
      • +
      • A promotion is not going to come to you because you deserve it. You have to hunt and ask for it.
      • +
      • Track all kudos (e.g. ask for emails from your colleagues).
      • +
      • Big corporations HRs don't expect a figjit. That's why it's so important to keep track of your accomplishments and kudos'.
      • +
      • If you want a raise be specific how much and know to back your demands. Don't make a thread and no ultimatums.
      • +
      • Best way for a promotion is to switch jobs. You can even switch back with a better salary.
      • +

      +

      Finish things



      -So you are not a superhero. Or, if you are a superhero, then all colleagues should be superheroes too.
      +Hard work is necessary for accomplish results. However, work smarter not harder. Furthermore, working smart is not a substitute for working hard. Work both, hard and smart.

      -

      Don't jump on all problems immediately


      +
        +
      • Learn to finish things without motivation. Things will pay off when you stick to stuff and eventually motivation can also come back.
      • +
      • You will fail if you don't plan realistically. Set also a schedule and follow to it as of life depends on it.
      • +
      • Advances come only of you give more than asked. Consistency, commitment and knowing what you need to do is more key than hard work.
      • +
      • Any action is better than no action. If you get stuck you have gained nothing.
      • +
      • You need to know the unknowns. Identify as many unknown not known things as possible.
      • +

      +Hard vs fun: Both engage the brain (video games vs work). Some work is hard and other is easy. Hard work is boring. The harsh truth is you have to put in hard and boring work in order to accomplish and be successful. Work won't be always boring though, as joy will follow with mastery.

      -In a perfect world, every member of a team comes along with the same strengths and skills. But in reality, everyone is different.
      +Defeat is finally give up. Failure is the road to success, embrace it. Failure does not define you but how you respond to it. Events don't make your unhappy, but how you react to events do.

      -In order to distribute the troubleshooting skills across the team, you should not jump on every problem immediately. Leave some space for others to resolve the issue. This is where the best learning happens. Nobody will learn from you when you solve all problems. People might learn something after you explained what you did, but the takeaways will be minimal compared to when people try to resolve issues by themselves. Always be available for questions which will help your colleagues to steer into the right direction and if you think it helps, give them some tips resolving the issue, even if they didn't ask for it. Sometimes, engineers are too proud to ask.
      +

      Expand the empire



      -The whole paragraph changes when there is an issue you don't know how to resolve. Jump on it, so you can learn from it. But also ask for advice if you are unsure about it.
      +The larger your empire is, the larger your circle of influence is. The larger the circle of influence is, the more opportunities you have.

      -If the issue is a very critical one, then you might better off trying to resolve it as fast as possible with your full powers in order to avoid any major damage to the company. This, of course, only works if you know how to resolve it quickly. So, don't leave others with not much experience yet looking at it. If possible, work with the team to resolve the issue. Unfortunately, solving it with the team is not always the fastest way. So in this particular circumstance, the company may be better off being saved by a single superhero. Make sure that the problem will not occur again or, at least, that others can fix it the next time without Superman flying by.
      +
        +
      • Do the dirty work if you want to expand the empire. That's there the opportunities are.
      • +
      • SCRUM often fails due to the lack to commitment. The backlog just becomes a wish to get completed.
      • +
      • Apply work on your quality standards. Don't cross the line of compromise. Always improve your skills. Never be happy being good enough.
      • +

      +Become visible, keep track that you accomplishments. E.g. write a weekly summary. Do presentations, be seen. Learn new things and share your learnings. Be the problem solver and not the blamer.

      -

      Force breaks; and shutdown now


      +

      Be pragmatic and also manage your time



      -Be strict about your time off. Nowadays, tech workers check their messages also out of office hours and are reachable 24/7. This really should only be the case when you are on-call, to be honest (or if you work for a startup). All other out-of-office time is owned by you and not your employer. You have signed an 40 hour/week and not 7 days/week contract. Of course, there will be always some sort of flexibility and exceptions. You might need to work over the weekend to get a migration done or a problem solved. But to balance it out, you should have other days off as substitutes.
      +Make use of time boxing via the Pomodoro technique: Set a target of rounds and track the rounds. That give you exact focused work time. That's really the trick. For example set a goal of 6 daily pomodores.

      -It's important to shut down your brain from work during your breaks (be strict with your breaks, leave your desk for lunch or for a walk early afternoon and if you aren't on-call also don't take your work-phone with you). You will be happier and also much more energized and productive in the afternoon. Also, when you are reachable 24/7, your colleagues will start thinking that you don't have anything more important to do than work.
      +
        +
      • Every time you do something question why does it make sense be pragmatic and don't follow because it is best practice.
      • +
      • You can also apply the time boxing technique (Cal Newport) for focused deep work.
      • +

      +You should feel good of the work done even if you don't finished the task. You will feel good about pomodoro wise even you don't finish the task on hand yet. Helps you to enjoy time off more. Working longer may not sell anything.

      -

      Block time every day for personal advance


      +

      The quota system



      -It does not matter how many tasks are in your backlog or how many issues are to be tackled. *Always* find time for personal advance. The most issues aren't critical anyway and can wait a bit. At the end of the day, you will have a nice feeling that you have accomplished something meaningful. This can be an interesting project or learning a new technology you are interested in. Of course, there must be consensus with your manager (unless you do that kind of thing in your personal time of course).
      +Defined quota of things done. E.g. N runs per week or M Blog posts per month or O pomodoros per week. This helps with consistency. Truly commit to these quotas. Failure is not an option. Start with small commitments. Don't commit to something you can't fulfill otherwise you set yourself up for failure.

      -If you are too busy at work and just can't block time, then maybe it's time to think about alternatives. But before you do that, probably there is something else you can do. Perhaps you just think you can't block time, but you would be positively surprised to hear from your manager that he will fully support you. Of course, he won't agree to you working full-time on your pet projects. But a certain portion of your time should be allocated for personal advance. After all, your employer also want's you to stay happy so that you don't look for alternatives. It's of everyone's interest that you like your job and stay motivated. The more you are motivated, the more productive you are. The more productive you are, the more valuable you are for the company.
      +
        +
      • Why does the quota System work? Slow and consistent pace is the key. It also overcomes willpower weaknesses as goals are preset.
      • +
      • Internal motivation is more important over external motivation. Check out Daniels book drive.
      • +
      • Multitasking: Batching is effective. E.g. emails twice daily at pre-set times..
      • +

      +

      Don't waste time



      -

      More


      +The biggest time waster is TV watching. The TV is programming you. It's insane that Americans watch so much TV as they work full time. Schedule one show at a time and watch it when you want to watch it. Most movies are crap anyways. The good movies will come to you as people will talk about them.

      -Another blog post worth reading:
      +
        +
      • Social media is time waster as well. Schedule your Social Media times. For example be on Facebook only for max one hour on Saturdays.
      • +
      • Meetings can waste time as well. Simply don't go to them. Try to cancel meeting if it can be dealt with via email.
      • +
      • Enjoying things is not a waste of time. E.g. you could still play a game once in a while. It is important not to cut away all you enjoy from your life.
      • +

      +

      Habits



      -https://unixsheikh.com/articles/how-to-stay-sane-in-todays-world-of-tech.html
      +Try to have as many good habits as possible. Start with easy habits, and make them a little bit more challenging over time. Set ankers and rewards. Over time the routines will become habits naturally.

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +Habit stacking is effective, which is combining multiple habits at the same time. For example you can workout on a circular trainer while while watching a learning video on O'Reilly Safari Online while getting closer to your weekly step goal.

      -Back to the main site
      -
      -
      -
      - - Bash Golf Part 1 - - https://foo.zone/gemfeed/2021-11-29-bash-golf-part-1.html - 2021-11-29T14:06:14+00:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - This is the first blog post about my Bash Golf series. This series is about random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content. - -
      -

      Bash Golf Part 1


      +
        +
      • We don't have control over our habits but our own routines.
      • +
      • Routines help to form the habits, though.
      • +

      +

      Work-life balance



      -Published at 2021-11-29T14:06:14+00:00; Updated at 2022-01-05
      +Avoid overwork hours. That's not as beneficial as you might think and comes only with very small rewards. Invest rather in yourself and not in your employer.

      -
      -     '\                   .  .                        |>18>>
      -       \              .         ' .                   |
      -      O>>         .                 'o                |
      -       \       .                                      |
      -       /\    .                                        |
      -      / /  .'                                         |
      -jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      -                                            Art by Joan Stark
      -
      +
        +
      • Work-life balance is a myth. Make it so that you enjoy work and your personal life and not just personal life.
      • +
      • Maintain fewer but good relationships. As a reward, better and integrated your life will be.
      • +
      • Life in the present Moment. Make the best of every moment of your life.
      • +
      • Enjoy every aspect of your life. If you want to take away one thing from this book that is it.
      • +

      +Use your most productive hours to work on you. Make that your priority. Take care of yourself a priority (E.g. do workouts or learn a new language). You can always workout 2 or 1 hour per day, but will you pay the price?

      -This is the first blog post about my Bash Golf series. This series is about random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.
      +

      Mental health



      -2021-11-29 Bash Golf Part 1 (You are currently reading this)
      -2022-01-01 Bash Golf Part 2
      +
        +
      • Friendships and positive thinking help to have and maintain better health, longer Life, better productivity and increased happiness.
      • +
      • Positive thinking can be trained and be a habit. Read the book "The Power of Positive Thinking".
      • +
      • Stoicism helps. Meditation helps. Playing for fun helps too.
      • +

      +Become the person you want to become (your self image). Program your brain unconsciously. Don't become the person other people want you to be. Embrace yourself, you are you.

      -

      TCP/IP networking


      +In most cases burnout is just an illusion. If you don't have motivation push through the wall. People usually don't pass the wall as they feel they are burned out. After pushing through the wall you will have the most fun, for example you will be able playing the guitar greatly.

      -You probably know the Netcat tool, which is a swiss army knife for TCP/IP networking on the command line. But did you know that the Bash natively supports TCP/IP networking?
      +

      Physical health



      -Have a look here how that works:
      +Utilise a standing desk and treadmill (you could walk and type at the same time). Increase the incline in order to burn more calories. Even on the standing desk you burn more calories than sitting. When you use pomodoro then you can use the small breaks for push-ups (maybe won't do as good when you are in a fasted state).

      -
      -❯ cat < /dev/tcp/time.nist.gov/13
      -
      -59536 21-11-18 08:09:16 00 0 0 153.6 UTC(NIST) *
      -
      +
        +
      • You can only do one thing, lose fat or gain muscles. Not both at the same time.
      • +
      • Train your strength by heavy lifting, but only with a very few repetitions (e.g. 5 max for each exercise, everything over this is body building).
      • +
      • If you want to increase the muscle mass use medium weights but lift them more often. If you want to increase your endurance lift light weights but with even more reps.
      • +
      • Avoid highly processed foods
      • +

      +Intermittent fasting is an effective method to maintain weight and health. But it does not mean that you can only eat junk food in the feeding windows. Also, diet and nutrition is the most important for health and fitness. They make it also easier to stay focused and positive.

      -The Bash treats /dev/tcp/HOST/PORT in a special way so that it is actually establishing a TCP connection to HOST:PORT. The example above redirects the TCP output of the time-server to cat and cat is printing it on standard output (stdout).
      +

      No drama



      -A more sophisticated example is firing up an HTTP request. Let's create a new read-write (rw) file descriptor (fd) 5, redirect the HTTP request string to it, and then read the response back:
      +Avoid drama at work. Where are humans there is drama. You can decide where to spent your energy in. But don't avoid conflict. Conflict is healthy in any kind of relationship. Be tactful and state your opinion. The goal is to find the best solution to the problem.

      -
      -❯ exec 5<>/dev/tcp/google.de/80
      -❯ echo -e "GET / HTTP/1.1\nhost: google.de\n\n" >&5
      -❯ cat <&5 | head
      -HTTP/1.1 301 Moved Permanently
      -Location: http://www.google.de/
      -Content-Type: text/html; charset=UTF-8
      -Date: Thu, 18 Nov 2021 08:27:18 GMT
      -Expires: Sat, 18 Dec 2021 08:27:18 GMT
      -Cache-Control: public, max-age=2592000
      -Server: gws
      -Content-Length: 218
      -X-XSS-Protection: 0
      -X-Frame-Options: SAMEORIGIN
      -
      +Don't worry about other people what they do and don't do. You only worry about you. Shut up and get your own things done. But you could help to inspire a not working colleague.

      -You would assume that this also works with the ZSH, but it doesn't. This is one of the few things which don't work with the ZSH but in the Bash. There might be plugins you could use for ZSH to do something similar, though.
      +
        +
      • During an argument, take the opponent's position and see how your opinion changes.
      • +
      • If you they to convince someone else it's an argument. Of you try to find the best solution it is a good resolution.
      • +
      • If someone is hurting the team let the manager know but phrase it nicely.
      • +
      • How to get rid of a never ending talking person? Set up focus hours officially where you don't want to be interrupted. Present as if it is your defect that you get interrupted easily.
      • +
      • TOXIC PEOPLE: AVOID THEM. RUN.
      • +
      • Boss likes if you get shit done without getting asked all the time about things and also without drama.
      • +

      +You have to learn how to work in a team. Be honest but tactful. It's not too be the loudest but about selling your ideas. Don't argue otherwise you won't sell anything. Be persuasive by finding the common ground. Or lead the colleagues to your idea and don't sell it upfront. Communicate clearly.

      -

      Process substitution


      +

      Personal brand



      -The idea here is, that you can read the output (stdout) of a command from a file descriptor:
      +
        +
      • Invest your value outside the company. Build your personal brand. Show how valuable you are, also to other companies. Become an asset.
      • +
      • Invest in your education. Make your goals known. If you want something ask for it (see also the sections about goals in this document).
      • +

      +

      Market yourself



      -
      -❯ uptime # Without process substitution
      - 10:58:03 up 4 days, 22:08,  1 user,  load average: 0.16, 0.34, 0.41
      -
      -❯ cat <(uptime) # With process substitution
      - 10:58:16 up 4 days, 22:08,  1 user,  load average: 0.14, 0.33, 0.41
      -
      -❯ stat <(uptime)
      -  File: /dev/fd/63 -> pipe:[468130]
      -  Size: 64              Blocks: 0          IO Block: 1024   symbolic link
      -Device: 16h/22d Inode: 468137      Links: 1
      -Access: (0500/lr-x------)  Uid: ( 1001/    paul)   Gid: ( 1001/    paul)
      -Context: unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
      -Access: 2021-11-20 10:59:31.482411961 +0000
      -Modify: 2021-11-20 10:59:31.482411961 +0000
      -Change: 2021-11-20 10:59:31.482411961 +0000
      - Birth: -
      -
      +
        +
      • The best way to market yourself is to make you usable.
      • +
      • Create a brand. Decide your focus. Throw your name out as often as possible.
      • +

      +Have a blog. Schedule your posts. Consistency beats every other factor. E.g. post once a month a new post. Find your voice, you don't have to sound academic. Keep writing, if you keep it long enough the rewards will be coming. Your own blog can take 5 years to take off. Most people give up too soon.

      -This example doesn't make any sense practically speaking, but it clearly demonstrates how process substitution works. The standard output pipe of "uptime" is redirected to an anonymous file descriptor. That fd then is opened by the "cat" command as a regular file.
      +
        +
      • Consistency of your blog is key. Also write quality content. Don't try to be a man of success but try to be a man of value.
      • +
      • Have an elevator pitch: "buetow.org - Having fun with computers!"
      • +
      • Have social media accounts, especially the ones which are more tech related.
      • +

      +

      Networking



      -A useful use case is displaying the differences of two sorted files:
      +Ask people so they talk about themselves. They are not really interested in you. Use meetup.com to find groups you are interested and build up the network over time. Don't drink on social networking events even when others do. Talking to other people at events only has upsides. Just saying "hi" and introducing yourself is enough. What worse can happen? If the person rejects you so what, life goes on. Ask open questions and no "yes" and "no" questions. E.g.: "What is your story, why are you here?".

      -
      -❯ echo a > /tmp/file-a.txt
      -❯ echo b >> /tmp/file-a.txt
      -❯ echo c >> /tmp/file-a.txt
      -❯ echo b > /tmp/file-b.txt
      -❯ echo a >> /tmp/file-b.txt
      -❯ echo c >> /tmp/file-b.txt
      -❯ echo X >> /tmp/file-b.txt
      -❯ diff -u <(sort /tmp/file-a.txt) <(sort /tmp/file-b.txt)
      ---- /dev/fd/63  2021-11-20 11:05:03.667713554 +0000
      -+++ /dev/fd/62  2021-11-20 11:05:03.667713554 +0000
      -@@ -1,3 +1,4 @@
      - a
      - b
      - c
      -+X
      -❯ echo X >> /tmp/file-a.txt # Now, both files have the same content again.
      -❯ diff -u <(sort /tmp/file-a.txt) <(sort /tmp/file-b.txt)
      -❯
      -
      -
      -Another example is displaying the differences of two directories:
      +

      Public speaking



      -
      -❯ diff -u <(ls ./dir1/ | sort) <(ls ./dir2/ | sort)
      -
      +Before your talk go on stage 10 minutes in advance. Introduce yourself to the front row people. During the talk they will smile at you and encourage you during your talk.

      -More (Bash golfing) examples:
      +
        +
      • Try at least 5 times before giving up public speaking. You can also start small, e.g. present a topic at work you are learning.
      • +
      • Practise your talk and timing. You can also record your practicing.
      • +

      +Just do it. Just go to conferences. Even if you are not speaking. Sell your boss what you would learn and "this and that" and you would present the learnings to the team afterwards.

      -
      -❯ wc -l <(ls /tmp/) /etc/passwd <(env)
      -     24 /dev/fd/63
      -     49 /etc/passwd
      -     24 /dev/fd/62
      -     97 total
      -❯
      -
      -❯ while read foo; do
      ->    echo $foo
      -> done < <(echo foo bar baz)
      -foo bar baz
      -❯
      -
      +

      New job



      -So far, we only used process substitution for stdout redirection. But it also works for stdin. The following two commands result into the same outcome, but the second one is writing the tar data stream to an anonymous file descriptor which is substituted by the "bzip2" command reading the data stream from stdin and compressing it to its own stdout, which then gets redirected to a file:
      +

      For the interview



      -
      -❯ tar cjf file.tar.bz2 foo
      -❯ tar cjf >(bzip2 -c > file.tar.bz2) foo
      -
      +
        +
      • Build up a network before the interview. E.g., follow and comment blogs. Or go to meet-ups and conferences. Join user groups.
      • +
      • Ask to touch base before the real interview and ask questions about the company. Do "pre-interviews".
      • +
      • Have a blog, a CV can only be 2 pages and an interview only can last only 2 hours. A blog helps you also to be a better communicator.
      • +

      +If you are specialized then there is a better chance to get a fitting job. No one will hire a general lawyer if there are specialized lawyers available. Even if you are specialized, you will have a wide range of skills (T-shape knowledge).

      -Just think a while and see whether you understand fully what is happening here.
      +

      Find the right type of company



      -

      Grouping


      +Not all companies are equal. They have individual cultures and guidelines.

      -Command grouping can be quite useful for combining the output of multiple commands:
      +
        +
      • Startup: dynamic and larger impact. Many hats on.
      • +
      • Medium size companies: most stable ones. Not cutting edge technologies. No crazy working hours.
      • +
      • Large company: very established with a lot of structure however constant layoffs and restructurings. Less impact you can have. Complex politics.
      • +
      • Working for yourself: This is harder than you think, probably much harder.
      • +

      +Work in a tech. company if you want to work on/with cutting edge technologies.

      -
      -❯ { ls /tmp; cat /etc/passwd; env; } | wc -l
      -97
      -❯ ( ls /tmp; cat /etc/passwd; env; ) | wc -l
      -97
      -
      +

      Apply for the new job



      -But wait, what is the difference between curly braces and normal braces? I assumed that the normal braces create a subprocess whereas the curly ones don't, but I was wrong:
      +Get a professional resume writer. Get referrals of writers and get samples from there. Get sufficient with algorithm and data structures interview questions. Cracking the coding interview book and blog

      -
      -❯ echo $$
      -62676
      -❯ { echo $$; }
      -62676
      -❯ ( echo $$; )
      -62676
      -
      +
        +
      • Apply for each job with a specialised CV each. Each CV fits the job better.
      • +
      • Best get a job via a personal referral or inbound marketing. The latter is somehow rare.
      • +
      • Inbound marketing is for example someone responds to your blog and offers you a job.
      • +
      • Interview the interviewer. Be persistent.
      • +
      • Create creative looking resumes, see simple programmer website. Action-result style for a resume.
      • +

      +Invest in your dress code as appearance masters. It does make sense to invest in your style. You could even hire a professional stylist (not my personal way though).

      -One difference is, that the curly braces require you to end the last statement with a semicolon, whereas with the normal braces you can omit the last semicolon:
      +

      Negotiation



      -
      -❯ ( env; ls ) | wc -l
      -27
      -❯ { env; ls } | wc -l
      ->
      -> ^C
      -
      +
        +
      • Whoever names the number first loses. You don't know what someone else is expecting unless told. Low ball number may be an issue but you have to know the market.
      • +
      • Salary is not about what you need but what you are worth. Try to find out what you are worth.
      • +
      • Big tech companies have a pay scale. You can ask for this.
      • +
      • Don't tell your current salary. Only do one counter offer and say "If you do X then I commit today". Be tactful and not rude. Nobody wants to be taken advantage of. Also, don't be arrogant.
      • +
      • If the company wants to know your range, respond: "I would rather learn more about the job and compensation. You have a range in mind, correct?" Be brave and just pause here.
      • +
      • Otherwise, if the company refuses then say "if you tell me what the range is and although I am not yet sure yet what are my exact salary requirements are I can see if the range is of what I am looking for. If they absolute refuse give a high ball range you would expect and make it conditional to the overall compensation package. E.g. 70k to 100k depending on the compensation package. THE LOW END SHOULD BE YOUR REAL LOW END. Play a little bit of hardball here and be brave. Practise it.
      • +
      • Put 10 percent on top of the salary range into a counter offer.
      • +
      • Everything is negotiable, not only the salary.
      • +
      • Job markup rate: Check it regarding the recruitment rate negotiation.
      • +
      • Don't make a rushed decision based on deadlines. Make a fairly high counter offer shortly before deadline.
      • +
      • You should also cope with rejections while selling yourself. There is no such thing as job security.
      • +

      +
        +
      • Never spilt the difference is the best book for learning negotiation techniques..
      • +

      +

      Leaving the old job



      -In case you know more (subtle) differences, please write me an E-Mail and let me know.
      +When leaving a job make a clean and non personal as possible. Never complain and never explain. Don't worry about abandonment of the team. Everybody is replacement and you make a business decision. Don't threaten to quit as you are replaceable.

      -Update: A reader sent me an E-Mail and pointed me to the Bash manual page, which explains the difference between () and {} (I should have checked that by myself):
      +

      Other things



      -
      -(list) list is executed in a subshell environment (see COMMAND EXECUTION ENVIRONMENT
      -       below).   Variable  assignments  and builtin commands that affect the shell's
      -       environment do not remain in effect after the command completes.  The  return
      -       status is the exit status of list.
      -
      -{ list; }
      -       list  is simply executed in the current shell environment.  list must be ter‐
      -       minated with a newline or semicolon.  This is known as a group command.   The
      -       return  status  is the exit status of list.  Note that unlike the metacharac‐
      -       ters ( and ), { and } are reserved words and must occur where a reserved word
      -       is  permitted  to  be recognized.  Since they do not cause a word break, they
      -       must be separated from list by whitespace or another shell metacharacter.
      -
      +
        +
      • As a leader lead by example and don't lead from the Eiffel tower.
      • +
      • As a leader you are responsible for the team. If the team fails then it's your fault only.
      • +

      +

      Testing



      -So I was right that () is executed in a subprocess. But why does $$ not show a different PID? Also here (as pointed out by the reader) is the answer in the manual page:
      +Unit testing Vs regression testing: Unit tests test the smallest possible unit and get rewritten if the unit gets changed. It's like programming against a specification n. Regression tests test whether the software still works after the change. Now you know more than most software engineers.

      -
      -$      Expands to the process ID of the shell.  In a () subshell, it expands to  the
      -       process ID of the current shell, not the subshell.
      -
      +

      Books to read



      -If we want print the subprocess PID, we can use the BASHPID variable:
      +
        +
      • Clean Code
      • +
      • Code Complete
      • +
      • Cracking the Interview - Lessons and Solutions.
      • +
      • Daniels Book "Drive" (about internal and external motivation)
      • +
      • God's degree (inventor of Dilbert)
      • +
      • Head first Design Patterns
      • +
      • How to win Friends and influence People
      • +
      • Never Split the Difference [X]
      • +
      • Structure and programming functional programs
      • +
      • The obstacle is the way [X]
      • +
      • The passionate programmer
      • +
      • The Power of Positive Thinking (Highly religious - I personally don't like it)
      • +
      • The Pragmatic Programmer [X]
      • +
      • The war of Art (to combat procrastination)
      • +
      • Willpower Instinct
      • +

      +E-Mail your comments to paul@nospam.buetow.org :-)

      -
      -❯ echo $BASHPID; { echo $BASHPID; }; ( echo $BASHPID; )
      -1028465
      -1028465
      -1028739
      -
      +Other book notes of mine are:

      -

      Expansions


      +2024-10-24 "Staff Engineer" book notes
      +2024-07-07 "The Stoic Challenge" book notes
      +2024-05-01 "Slow Productivity" book notes
      +2023-11-11 "Mind Management" book notes
      +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes (You are currently reading this)
      +2023-05-06 "The Obstacle is the Way" book notes
      +2023-04-01 "Never split the difference" book notes
      +2023-03-16 "The Pragmatic Programmer" book notes

      -Let's start with simple examples:
      +Back to the main site
      +
      +
      +
      + + KISS server monitoring with Gogios + + https://foo.zone/gemfeed/2023-06-01-kiss-server-monitoring-with-gogios.html + 2023-06-01T21:10:17+03:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + Gogios is a minimalistic and easy-to-use monitoring tool I programmed in Google Go designed specifically for small-scale self-hosted servers and virtual machines. The primary purpose of Gogios is to monitor my personal server infrastructure for `foo.zone`, my MTAs, my authoritative DNS servers, my NextCloud, Wallabag and Anki sync server installations, etc. + +
      +

      KISS server monitoring with Gogios



      -
      -❯ echo {0..5}
      -0 1 2 3 4 5
      -❯ for i in {0..5}; do echo $i; done
      -0
      -1
      -2
      -3
      -4
      -5
      -
      +Published at 2023-06-01T21:10:17+03:00

      -You can also add leading 0 or expand to any number range:
      +Gogios is a minimalistic and easy-to-use monitoring tool I programmed in Google Go designed specifically for small-scale self-hosted servers and virtual machines. The primary purpose of Gogios is to monitor my personal server infrastructure for foo.zone, my MTAs, my authoritative DNS servers, my NextCloud, Wallabag and Anki sync server installations, etc.

      -
      -❯ echo {00..05}
      -00 01 02 03 04 05
      -❯ echo {000..005}
      -000 001 002 003 004 005
      -❯ echo {201..205}
      -201 202 203 204 205
      -
      +With compatibility with the Nagios Check API, Gogios offers a simple yet effective solution to monitor a limited number of resources. In theory, Gogios scales to a couple of thousand checks, though. You can clone it from Codeberg here:

      -It also works with letters:
      +https://codeberg.org/snonux/gogios

      -
      -❯ echo {a..e}
      -a b c d e
      -
      +Gogios logo

      -Now it gets interesting. The following takes a list of words and expands it so that all words are quoted:
      +

      Table of Contents



      +
      -❯ echo \"{These,words,are,quoted}\"
      -"These" "words" "are" "quoted"
      +    _____________________________    ____________________________
      +   /                             \  /                            \
      +  |    _______________________    ||    ______________________    |
      +  |   /                       \   ||   /                      \   |
      +  |   | # Alerts with status c|   ||   | # Unhandled alerts:  |   |
      +  |   | hanged:               |   ||   |                      |   |
      +  |   |                       |   ||   | CRITICAL: Check Pizza|   |
      +  |   | OK->CRITICAL: Check Pi|   ||   | : Late delivery      |   |
      +  |   | zza: Late delivery    |   ||   |                      |   |
      +  |   |                       |   ||   | WARNING: Check Thirst|   |
      +  |   |                       |   ||   | : OutofKombuchaExcept|   |
      +  |   \_______________________/   ||   \______________________/   |
      +  |  /|\ GOGIOS MONITOR 1    _    ||  /|\ GOGIOS MONITOR 2   _    |
      +   \_____________________________/  \____________________________/
      +     !_________________________!      !________________________!
      +
      +------------------------------------------------
      +ASCII art was modified by Paul Buetow
      +The original can be found at
      +https://asciiart.website/index.php?art=objects/computers
       

      -Let's also expand to the cross product of two given lists:
      +

      Motivation



      -
      -❯ echo {one,two}\:{A,B,C}
      -one:A one:B one:C two:A two:B two:C
      -❯ echo \"{one,two}\:{A,B,C}\"
      -"one:A" "one:B" "one:C" "two:A" "two:B" "two:C"
      -
      +With experience in monitoring solutions like Nagios, Icinga, Prometheus and OpsGenie, these tools often came with many features that I didn't necessarily need for personal use. Contact groups, host groups, check clustering, and the requirement of operating a DBMS and a WebUI added complexity and bloat to my monitoring setup.

      -Just because we can:
      +My primary goal was to have a single email address for notifications and a simple mechanism to periodically execute standard Nagios check scripts and notify me of any state changes. I wanted the most minimalistic monitoring solution possible but wasn't satisfied with the available options.

      -
      -❯ echo Linux-{one,two,three}\:{A,B,C}-FreeBSD
      -Linux-one:A-FreeBSD Linux-one:B-FreeBSD Linux-one:C-FreeBSD Linux-two:A-FreeBSD Linux-two:B-FreeBSD Linux-two:C-FreeBSD Linux-three:A-FreeBSD Linux-three:B-FreeBSD Linux-three:C-FreeBSD
      -
      +This led me to create Gogios, a lightweight monitoring tool tailored to my specific needs. I chose the Go programming language for this project as it comes, in my opinion, with the best balance of ease to use and performance.
      +
      +

      Features



      -

      - aka stdin and stdout placeholder


      +
        +
      • Compatible with Nagios Check scripts: Gogios leverages the widely-used Nagios Check API, allowing to use existing Nagios plugins.
      • +
      • Lightweight and Minimalistic: Gogios is designed to be simple and fairly easy to set up.
      • +
      • Configurable Check Timeout and Concurrency: Gogios allows you to set a timeout for checks and configure the number of concurrent checks, offering flexibility in monitoring your resources.
      • +
      • Configurable check dependency: A check can depend on another check, which enables scenarios like not executing an HTTP check when the server isn't pingable.
      • +
      • Retries: Check retry and retry intervals are configurable per check.
      • +
      • Email Notifications: Gogios can send email notifications regarding the status of monitored services, ensuring you stay informed about potential issues.
      • +
      • CRON-based Execution: Gogios can be quickly scheduled to run periodically via CRON, allowing you to automate monitoring without needing a complex setup.
      • +

      +

      Example alert



      -Some commands and Bash builtins use "-" as a placeholder for stdin and stdout:
      +This is an example alert report received via E-Mail. Whereas, [C:2 W:0 U:0 OK:51] means that we've got two alerts in status critical, 0 warnings, 0 unknowns and 51 OKs.

      -❯ echo Hello world
      -Hello world
      -❯ echo Hello world | cat -
      -Hello world
      -❯ cat - <<ONECHEESEBURGERPLEASE
      -Hello world
      -ONECHEESEBURGERPLEASE
      -Hello world
      -❯ cat - <<< 'Hello world'
      -Hello world
      +Subject: GOGIOS Report [C:2 W:0 U:0 OK:51]
      +
      +This is the recent Gogios report!
      +
      +# Alerts with status changed:
      +
      +OK->CRITICAL: Check ICMP4 vulcan.buetow.org: Check command timed out
      +OK->CRITICAL: Check ICMP6 vulcan.buetow.org: Check command timed out
      +
      +# Unhandled alerts:
      +
      +CRITICAL: Check ICMP4 vulcan.buetow.org: Check command timed out
      +CRITICAL: Check ICMP6 vulcan.buetow.org: Check command timed out
      +
      +Have a nice day!
       

      -Let's walk through all three examples from the above snippet:
      +

      Installation



      -
        -
      • The first example is obvious (the Bash builtin "echo" prints its arguments to stdout).
      • -
      • The second pipes "Hello world" via stdout to stdin of the "cat" command. As cat's argument is "-" it reads its data from stdin and not from a regular file named "-". So "-" has a special meaning for cat.
      • -
      • The third and fourth examples are interesting as we don't use a pipe as of "|" but a so-called HERE-document and a HERE-string. But the end results are the same.
      • -

      -The "tar" command understands "-" too. The following example tars up some local directory and sends the data to stdout (this is what "-f -" commands it to do). stdout then is piped via an SSH session to a remote tar process (running on buetow.org) and reads the data from stdin and extracts all the data coming from stdin (as we told tar with "-f -") on the remote machine:
      +

      Compiling and installing Gogios



      -
      -❯ tar -czf - /some/dir | ssh hercules@buetow.org tar -xzvf - 
      -
      +This document is primarily written for OpenBSD, but applying the corresponding steps to any Unix-like (e.g. Linux-based) operating system should be easy. On systems other than OpenBSD, you may always have to replace does with the sudo command and replace the /usr/local/bin path with /usr/bin.

      -This is yet another example of using "-", but this time using the "file" command:
      +To compile and install Gogios on OpenBSD, follow these steps:

      -
      -$ head -n 1 grandmaster.sh
      -#!/usr/bin/env bash
      -$ file - < <(head -n 1 grandmaster.sh)
      -/dev/stdin: a /usr/bin/env bash script, ASCII text executable
      +
      +
      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
       

      -Some more golfing:
      +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:

      -
      -$ cat -
      -hello
      -hello
      -^C
      -$ file -
      -#!/usr/bin/perl
      -/dev/stdin: Perl script text executable
      +
      +
      export GOOS=openbsd
      +export GOARCH=amd64
      +go build -o gogios cmd/gogios/main.go
       

      -

      Alternative argument passing


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

      -This is a quite unusual way of passing arguments to a Bash script:
      +https://www.rexify.org

      -
      -❯ cat foo.sh
      -#/usr/bin/env bash
      -declare -r USER=${USER:?Missing the username}
      -declare -r PASS=${PASS:?Missing the secret password for $USER}
      -echo $USER:$PASS
      -
      +

      Setting up user, group and directories



      -So what we are doing here is to pass the arguments via environment variables to the script. The script will abort with an error when there's an undefined argument.
      +It is best to create a dedicated system user and group for Gogios to ensure proper isolation and security. Here are the steps to create the _gogios user and group under OpenBSD:

      -
      -❯ chmod +x foo.sh
      -❯ ./foo.sh
      -./foo.sh: line 3: USER: Missing the username
      -❯ USER=paul ./foo.sh
      -./foo.sh: line 4: PASS: Missing the secret password for paul
      -❯ echo $?
      -1
      -❯ USER=paul PASS=secret ./foo.sh
      -paul:secret
      +
      +
      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
       

      -You have probably noticed this *strange* syntax:
      +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.

      -
      -❯ VARIABLE1=value1 VARIABLE2=value2 ./script.sh
      -
      +

      Installing monitoring plugins



      -That's just another way to pass environment variables to a script. You can write it as well as like this:
      +Gogios relies on external Nagios or Icinga monitoring plugin scripts. On OpenBSD, you can install the monitoring-plugins package with Gogios. The monitoring-plugins package is a collection of monitoring plugins, similar to Nagios plugins, that can be used to monitor various services and resources:

      -
      -❯ export VARIABLE1=value1
      -❯ export VARIABLE2=value2
      -❯ ./script.sh
      +
      +
      doas pkg_add monitoring-plugins
      +doas pkg_add nrpe # If you want to execute checks remotely via NRPE.
       

      -But the downside of it is that the variables will also be defined in your current shell environment and not just in the scripts sub-process.
      -
      -

      : aka the null command


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

      -First, let's use the "help" Bash built-in to see what it says about the null command:
      +

      Configuration



      -
      -❯ help :
      -:: :
      -    Null command.
      -
      -    No effect; the command does nothing.
      -
      -    Exit Status:
      -    Always succeeds.
      -
      +

      MTA



      -PS: IMHO, people should use the Bash help more often. It is a very useful Bash reference. Too many fallbacks to a Google search and then land on Stack Overflow. Sadly, there's no help built-in for the ZSH shell though (so even when I am using the ZSH I make use of the Bash help as most of the built-ins are compatible).
      +Gogios requires a local Mail Transfer Agent (MTA) such as Postfix or OpenBSD SMTPD running on the same server where the CRON job (see about the CRON job further below) is executed. The local MTA handles email delivery, allowing Gogios to send email notifications to monitor status changes. Before using Gogios, ensure that you have a properly configured MTA installed and running on your server to facilitate the sending of emails. Once the MTA is set up and functioning correctly, Gogios can leverage it to send email notifications.

      -OK, back to the null command. What happens when you try to run it? As you can see, absolutely nothing. And its exit status is 0 (success):
      +You can use the mail command to send an email via the command line on OpenBSD. Here's an example of how to send a test email to ensure that your email server is working correctly:

      -❯ :
      -❯ echo $?
      -0
      +echo 'This is a test email from OpenBSD.' | mail -s 'Test Email' your-email@example.com
       

      -Why would that be useful? You can use it as a placeholder in an endless while-loop:
      +Check the recipient's inbox to confirm the delivery of the test email. If the email is delivered successfully, it indicates that your email server is configured correctly and functioning. Please check your MTA logs in case of issues.

      -
      -❯ while : ; do date; sleep 1; done
      -Sun 21 Nov 12:08:31 GMT 2021
      -Sun 21 Nov 12:08:32 GMT 2021
      -Sun 21 Nov 12:08:33 GMT 2021
      -^C
      -❯
      -
      +

      Configuring Gogios



      -You can also use it as a placeholder for a function body not yet fully implemented, as an empty function ill result in a syntax error:
      +To configure Gogios, create a JSON configuration file (e.g., /etc/gogios.json). Here's an example configuration:

      -
      -❯ foo () {  }
      --bash: syntax error near unexpected token `}'
      -❯ foo () { :; }
      -❯ foo
      -❯
      +
      +
      {
      +  "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"]
      +    }
      +  }
      +}
       

      -Or use it as a placeholder for not yet implemented conditional branches:
      +
        +
      • EmailTo: Specifies the recipient of the email notifications.
      • +
      • EmailFrom: Indicates the sender's email address for email notifications.
      • +
      • CheckTimeoutS: Sets the timeout for checks in seconds.
      • +
      • CheckConcurrency: Determines the number of concurrent checks that can run simultaneously.
      • +
      • StateDir: Specifies the directory where Gogios stores its persistent state in a state.json file.
      • +
      • Checks: Defines a list of checks to be performed, each with a unique name, plugin path, and arguments.
      • +

      +Adjust the configuration file according to your needs, specifying the checks you want Gogios to perform.

      -
      -❯ if foo; then :; else echo bar; fi
      -
      +If you want to execute checks only when another check succeeded (status OK), use DependsOn. In the example above, the HTTP checks won't run when the hosts aren't pingable. They will show up as UNKNOWN in the report.

      -Or (not recommended) as a fancy way to comment your Bash code:
      +Retries and RetryInterval are optional check configuration parameters. In case of failure, Gogios will retry Retries times each RetryInterval seconds.

      -
      -❯ : I am a comment and have no other effect
      -❯ : I am a comment and result in a syntax error ()
      --bash: syntax error near unexpected token `('
      -❯ : "I am a comment and don't result in a syntax error ()"
      -❯
      -
      +For remote checks, use the check_nrpe plugin. You also need to have the NRPE server set up correctly on the target host (out of scope for this document).

      -As you can see in the previous example, the Bash still tries to interpret some syntax of all text following after ":". This can be exploited (also not recommended) like this:
      +The state.json file mentioned above keeps track of the monitoring state and check results between Gogios runs, enabling Gogios only to send email notifications when there are changes in the check status.

      -
      -❯ declare i=0
      -❯ $[ i = i + 1 ]
      -bash: 1: command not found...
      -❯ : $[ i = i + 1 ]
      -❯ : $[ i = i + 1 ]
      -❯ : $[ i = i + 1 ]
      -❯ echo $i
      -4
      -
      +

      Running Gogios



      -For these kinds of expressions it's always better to use "let" though. And you should also use $((...expression...)) instead of the old (deprecated) way $[ ...expression... ] like this example demonstrates:
      +Now it is time to give it a first run. On OpenBSD, do:

      -
      -❯ declare j=0
      -❯ let j=$((j + 1))
      -❯ let j=$((j + 1))
      -❯ let j=$((j + 1))
      -❯ let j=$((j + 1))
      -❯ echo $j
      -4
      +
      +
      doas -u _gogios /usr/local/bin/gogios -cfg /etc/gogios.json
       

      -

      (No) floating point support


      +To run Gogios via CRON on OpenBSD as the gogios user and check all services once per minute, follow these steps:

      -I have to give a plus-point to the ZSH here. As the ZSH supports floating point calculation, whereas the Bash doesn't:
      +Type doas crontab -e -u _gogios and press Enter to open the crontab file for the _gogios user for editing and add the following lines to the crontab file:

      -❯ bash -c 'echo $(( 1/10 ))'
      -0
      -❯ zsh -c 'echo $(( 1/10 ))'
      -0
      -❯ bash -c 'echo $(( 1/10.0 ))'
      -bash: line 1: 1/10.0 : syntax error: invalid arithmetic operator (error token is ".0 ")
      -❯ zsh -c 'echo $(( 1/10.0 ))'
      -0.10000000000000001
      -❯
      +*/5 8-22 * * * /usr/local/bin/gogios -cfg /etc/gogios.json
      +0 7 * * * /usr/local/bin/gogios -renotify -cfg /etc/gogios.json
       

      -It would be nice to have native floating point support for the Bash too, but you don't want to use the shell for complicated calculations anyway. So it's fine that Bash doesn't have that, I guess.
      +Gogios is now configured to run every five minutes from 8 am to 10 pm via CRON as the _gogios user. It will execute the checks and send monitoring status whenever a check status changes via email according to your configuration. Also, Gogios will run once at 7 am every morning and re-notify all unhandled alerts as a reminder.

      -In the Bash you will have to fall back to an external command like "bc" (the arbitrary precision calculator language):
      +

      High-availability



      -
      -❯ bc <<< 'scale=2; 1/10'
      -.10
      -
      +To create a high-availability Gogios setup, you can install Gogios on two servers that will monitor each other using the NRPE (Nagios Remote Plugin Executor) plugin. By running Gogios in alternate CRON intervals on both servers, you can ensure that even if one server goes down, the other will continue monitoring your infrastructure and sending notifications.

      -See you later for the next post of this series.
      +
        +
      • Install Gogios on both servers following the compilation and installation instructions provided earlier.
      • +
      • Install the NRPE server (out of scope for this document) and plugin on both servers. This plugin allows you to execute Nagios check scripts on remote hosts.
      • +
      • Configure Gogios on both servers to monitor each other using the NRPE plugin. Add a check to the Gogios configuration file (/etc/gogios.json) on both servers that uses the NRPE plugin to execute a check script on the other server. For example, if you have Server A and Server B, the configuration on Server A should include a check for Server B, and vice versa.
      • +
      • Set up alternate CRON intervals on both servers. Configure the CRON job on Server A to run Gogios at minutes 0, 10, 20, ..., and on Server B to run at minutes 5, 15, 25, ... This will ensure that if one server goes down, the other server will continue monitoring and sending notifications.
      • +
      • Gogios doesn't support clustering. So it means when both servers are up, unhandled alerts will be notified via E-Mail twice; from each server once. That's the trade-off for simplicity.
      • +

      +There are plans to make it possible to execute certain checks only on certain nodes (e.g. on elected leader or master nodes). This is still in progress (check out my Gorum Git project).

      -Other related posts are:
      +

      Conclusion:



      -2021-05-16 Personal Bash coding style guide
      -2021-06-05 Gemtexter - One Bash script to rule it all
      -2021-11-29 Bash Golf Part 1 (You are currently reading this)
      -2022-01-01 Bash Golf Part 2
      +Gogios is a lightweight and straightforward monitoring tool that is perfect for small-scale environments. With its compatibility with the Nagios Check API, email notifications, and CRON-based scheduling, Gogios offers an easy-to-use solution for those looking to monitor a limited number of resources. I personally use it to execute around 500 checks on my personal server infrastructure. I am very happy with this solution.

      E-Mail your comments to paul@nospam.buetow.org :-)

      +Other KISS-related posts are:
      +
      +2024-04-01 KISS high-availability with OpenBSD
      +2023-10-29 KISS static web photo albums with photoalbum.sh
      +2023-06-01 KISS server monitoring with Gogios (You are currently reading this)
      +2021-09-12 Keep it simple and stupid
      +
      Back to the main site
      - Defensive DevOps - - https://foo.zone/gemfeed/2021-10-22-defensive-devops.html - 2021-10-22T10:02:46+03:00 + 'The Obstacle is the Way' book notes + + https://foo.zone/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html + 2023-05-06T17:23:16+03:00 Paul Buetow aka snonux paul@dev.buetow.org - I have seen many different setups and infrastructures during my carreer. My roles always included front-line ad-hoc fire fighting production issues. This often involves identifying and fixing these under time pressure, without the comfort of 2-week-long SCRUM sprints and without an exhaustive QA process. I also wrote a lot of code (Bash, Ruby, Perl, Go, and a little Java), and I followed the typical software development process, but that did not always apply to critical production issues. + These are my personal takeaways after reading 'The Obstacle Is the Way' by Ryan Holiday. This is mainly for my own use, but you might find it helpful too.
      -

      Defensive DevOps


      +

      "The Obstacle is the Way" book notes


      +
      +Published at 2023-05-06T17:23:16+03:00

      -Published at 2021-10-22T10:02:46+03:00
      +These are my personal takeaways after reading "The Obstacle Is the Way" by Ryan Holiday. This is mainly for my own use, but you might find it helpful too.

      -                                                            c=====e
      -                                                               H
      -      ____________                                         _,,_H__
      -     (__((__((___()                                       //|     |
      -    (__((__((___()()_____________________________________// |ACME |
      -   (__((__((___()()()------------------------------------'  |_____|
      -                           ASCII Art by Clyde Watson
      +         ,..........   ..........,
      +     ,..,'          '.'          ',..,
      +    ,' ,'            :            ', ',
      +   ,' ,'             :             ', ',
      +  ,' ,'              :              ', ',
      + ,' ,'............., : ,.............', ',
      +,'  '............   '.'   ............'  ',
      + '''''''''''''''''';''';''''''''''''''''''
      +                    '''
       

      -I have seen many different setups and infrastructures during my carreer. My roles always included front-line ad-hoc fire fighting production issues. This often involves identifying and fixing these under time pressure, without the comfort of 2-week-long SCRUM sprints and without an exhaustive QA process. I also wrote a lot of code (Bash, Ruby, Perl, Go, and a little Java), and I followed the typical software development process, but that did not always apply to critical production issues.
      -
      -Unfortunately, no system is 100% reliable, and you can never be prepared for a subset of the possible problem-space. IT infrastructures can be complex. Not even mentioning Kubernetes yet, a Microservice-based infrastructure can complicate things even further. You can take care of 99% of all potential problems by following all DevOps best practices. Those best practices are not the subject of this blog post; this post is about the sub 1% of the issues arising from nowhere you can't be prepared for.
      -
      -Is there a software bug in a production, even though the software passed QA (after all, it is challenging to reproduce production behaviour in an artificial testing environment) and the software didn't show any issues running in production until a special case came up just now after it got deployed to production a week ago? Are there multiple hardware failure happening which causes loss of service redundancy or data inaccessibility? Is the automation of external customers connected to our infrastructure putting unexpectedly extra pressure on your grid, driving higher latencies and putting the SLAs at risk? You bet the solution is: Sysadmins, SREs and DevOps Engineers to the rescue.
      -
      -You agree that fixing production issues this way is not proactive but rather reactive. I prefer to call it defensive, though, as you "defend" your system against a production issue. But, at the same time, you have to take a cautious (defensive) approach to fix it, as you don't want to make things worse.
      -
      -Over time, I have compiled a list of fire-fighting automation strategies, which I would like to share here.
      -
      -

      Meet Defensive DevOps


      -
      -Defensive DevOps is a term I invented by myself. I define it this way:
      +

      Table of Contents




      -That sounds a bit crazy, but this is, unfortunately, in rare occasions the reality. As the question is not whether production issues will happen, the question is WHEN they will happen. Every large provider, such as Google, Netflix, and so on, suffered significant outages before, and I firmly believe that their engineers know what they are doing. But you can prepare for the unexpected only to a certain degree.
      +"The obstacle is the way" is a powerful statement that encapsulates the wisdom of turning challenges into opportunities for growth and success. We will explore using obstacles as fuel, transforming weaknesses into strengths, and adopting a mindset that allows us to be creative and persistent in the face of adversity.

      -

      Don't fully automate from the beginning


      +

      Reframe your perspective


      +
      +The obstacle in your path can become your path to success. Instead of being paralyzed by challenges, see them as opportunities to learn and grow. Remember, the things that hurt us often instruct us.
      +
      +We spend a lot of time trying to get things perfect and look at the rules, but what matters is that it works; it doesn't need to be after the book. Focus on results rather than on beautiful methods. In Jujitsu, it does matter that you bring your opponent down, but not how. There are many ways from point A to point B; it doesn't need to be a straight line. So many try to find the best solution but need to catch up on what is in Infront of them. Think progress and not perfection.

      -Do you have to solve problem X? The best solution would be to fully automate it away, correct? No, the best way is to fix problem X manually first. Does the problem appear on one server or on thousand servers? The scale does not matter here. The point is that you should fix the problem at least once manually, so you understand the problem and how to solve it before implementing automation around it.
      +Don't always try to use the front door; a backdoor could open. It's nonsense. Don't fight the judo master with judo. Non-action can be action, exposing the weaknesses of others.

      -You should also have a short meeting with your team. Every person may has a different perspective and can give valuable input for determining the best strategy. But, again, keep the session short and efficient. Focus on the facts. After all, you are the domain expert and you probably know what you are doing.
      +

      Embrace rationality



      -Once you understand the problem, fix it on a different server again. This time maybe write a small program or script. Semi-automate the process, but don't fully automate it yet. Start the semi-automated solution manually on a couple of more servers and observe the result. You want to gain more confidence that this really solved the problem. This can take a couple of hours manually running it over and over again. During that process, you will improve your script iteratively.
      +It is a superpower to see things rationally when others are fearful. Focus on the reality of the situation without letting emotions, such as anger, cloud your judgment. This ability will enable you to make better decisions in adversity. Ability to see things what they really are. E.g. wine is old fermented grapes, or other people behaving like animals during a fight. Show the middle finger if someone persists on the stupid rules occasionally.

      -

      Develop code directly on production systems


      +

      Control your response



      -You have to develop code directly on a production system. This sounds a bit controversial, but you want to get a working solution ASAP, and there is a very high chance that you can't reproduce problem X in a development or QA environment. Or at least it will consume significant effort and time to reproduce the problem, and by the time your code is ready, it's already too late. So the most practical solution is to directly develop your solution against a production system with the problem at hand.
      +You can choose how you respond to obstacles. Focus on what you can control, and don't let yourself feel harmed by external circumstances. Remember, you decide how things affect you; nobody else does. Choose to feel good in response to any situation. Embrace the challenges and obstacles that come your way, as they are opportunities for growth and learning.

      -You might not have your full-featured IDE available on a production system, but a text editor, such as Vim (or Neovim), is sufficient for writing scripts. Some editors allow you to edit files remotely. With Vim you can accomplish it with "vim scp://SERVER///path/to/file.sh". Every time you save the file, it will be automatically uploaded via SCP to the server. From there, you can execute it directly. This comes with the additional benefits of still having access to all the Vim plugins installed locally, which you might not have installed on any production machines. This approach also removes any network delays you might experience when running your editor directly on a remote machine.
      +

      Practice emotional and physical resilience



      -Unfortunately, it will be a bit more complicated when you rely on code reviews (e.g. in a FIPS environment). Pair-programming could be the solution here.
      +Martial artists know the importance of developing physical and emotional strength. Cultivate the art of not panicking; it will help you avoid making mistakes during high-pressure situations.

      -

      Don't make it worse


      +Focus on what you can control. Don't choose to feel harmed, and then you won't be harmed. I decide things that affect me; nobody else does. E.g., in prison, your mind stays your own. Don't ignore fear but explain it away, have a different view.

      -You want to triple-check that your script is not damaging your system even further. You might introduce a bug to the code, so there should always be a way to roll back any permanent change it causes. You have to program it in a defensive style:
      +

      Persistence and patience



      -
        -
      • Make sure that all that your script does is logged to a file. Best, when it's a Bash script, use "set -x". This makes the script print all commands as they are executed. Always write the output to a file. This helps to verify that your script is working as intended. The log output should always include timestamps for each significant operation performed.
      • -
      • Make sure that no command executed by your script is failing. You should use "set -e" in your script, which makes the whole script terminate immediately if a command in it exits with a non-zero status. This will save you from apparent errors, e.g. trying to move files to a non-existent directory or trying to operate on a non-existent file.
      • -
      • Your script should never delete any files. If solving problem X involves deleting files, don't delete them but rename or move them to a separate directory so that these can be recovered just in case.
      • -
      • When you rename/move files around, always add a timestamp to a directory or the end of the file name (e.g. with "mv FILE FILE.$(date +%s"). This ensures that a backup never gets overwritten by another backup during a subsequential run of your script. Alternatively, before renaming a file, check whether the destination file already exists or not.
      • -
      • When solving problem X involves manipulating files in place, be ultra-cautious. Best try to avoid in-place file manipulation. But if you really have to, you should, if disk space permits, always create a backup of the file first. Depending on the particular case, you might add a timestamp to the backup or only keep the very first initial backup of a file.
      • -
      • You should implement a "--dry" switch in your script. When you run the script in dry mode, it won't manipulate anything on the system, but it would only print out what it would do. Always run your script in dry mode before running it for real.
      • -

      -Furthermore, when you write Bash script, always run the tool ShellSheck (https://shellshock.io/) on it. This helps to catch many potential issues before applying it in production.
      +Practice persistence and patience in your pursuits. Focus on the process rather than the prize and take one step at a time. Remember, the journey is about finishing tasks, projects, or workouts to the best of your ability. Never be in a hurry and never be desperate. There is no reason to be rushed; there are all in the long haul. Follow the process and not the price. Take it one step at a time. The process is about finishing (workout, task, project, etc.).

      -

      Test your code


      +

      Embrace failure



      -You probably won't have time for writing unit tests. But what you can do is to pedantically test your code manually. But you have to do the testing on a production machine. So how can you test your code in production without causing more damage?
      +Failure is a natural part of life and can make us stronger. Treat defeat as a stepping stone to success and education. What is defeat? The first step to education. Failure makes you stronger. If we do our best, we can be proud of it, regardless of the result. Do your job, but do it right. Only an asshole thinks he is too good at the things he does. Also, asking for forgiveness is easier than asking for permission.

      -Your script should be idempotent. This means you can run it infinite times in a row, and you will always get the same result. For example, in the first run of the script, a file A get's renamed to A.backup. The second time you run the script, it attempts to do the same, but it recognises that A has already been renamed to A.backup and then it is skipping that step. This is very helpful for manually testing, as it means that you can re-run the script every time you extended it. You should dry-run the script at least once before running it for real. You can apply the same principle for almost all features you add to the code.
      +

      Be adaptable



      -You may also want to inject manual negative testing into your script. For example, you want to run a particular function F in your script but only if a certain pre-condition is met, and you want to ensure that the code branching works as expected. The pre-condition check could be pretty complex (e.g. N log messages containing a specific warning string are found in the applications logs, but only on the cluster leader server). You can flip the switch directly in the code manually (e.g. run F only, when the pre-condition isn't met) and then perform a dry run of the script and study the output. Once done, flip the switch back to its correct configuration. For double insurance, test the same on a different server type (e.g. on a follower and not on a leader system).
      +There are many ways to achieve your goals; sometimes, unconventional methods are necessary. Feel free to break the rules or go off the beaten path if it will lead to better results. Transform weaknesses into strengths. We have a choice of how to respond to things. It's not about being positive but to be creative. Aim high, but stuff will happen; E.g., surprises will always happen.

      -By following these principles, you test every line of code while you are developing on it.
      +

      Embrace non-action



      -

      Automation


      +We constantly push to the next thing. Sometimes the best course of action is standing still or even going backwards. Obstacles might resolve by themselves. Or going sideways. Sometimes, the best action is to stand still, go sideways, or even go backwards. Obstacles may resolve themselves or present new opportunities if you're patient and observant. People always want your input before you have all the facts. They want you to play after their rules. The question is, do you let them? The English call it the cool head. Being in control of Stress; requires practice. Appear, the absence of fear (Greek). When all others do it one way, it does not mean it is the correct or best practice.

      -At one point, you will be tired of manually running your script and also confident enough to automate it. You could deploy it with a configuration management system such as puppet Puppet and schedule a periodic execution via cron, a systemd timer or even a separate background daemon process. You have to be extremely careful here. The more you automate, the more damage you can cause. You don't want to automate it on all servers involved at once, but you want to slowly ramp up the automation.
      +

      Leverage crisis



      -First, automate it only on one single server and monitor the result closely. At first, only automate running the script in dry mode. Also, don't forget that you still should log everything that the script is doing. Once everything looks fine, you can automate the script on the canary server for real. It shouldn't be a disaster if something goes wrong as usually systems are designed in a HA fashion, where the same data is still at least on another server available. In the worst-case scenario, you could recover data from there or from the local backup files your script created.
      +In times of crisis, seize the chance to do things never done before. Great people use negative situations to their advantage and become the most effective in challenging circumstances.

      -Now, you can add a handful more canary servers to the automation. You should keep close attention to what the automation is doing. You could use a tool like DTail for distributed log file following. At this point, you could also think of deploying a monitoring check (e.g. Icinga) to see whether your script is not terminating abnormally or logging warnings or errors.
      +The art of not panicking; otherwise, you will make mistakes. When overs are shocked, you know which way to take due to your thinking of the problem at Hand. A crisis gives you a chance to do things which never done before. Ordinary people shy from negative situations; great people use these for their benefit and are the most effective. The obstacle is not just turned upside down but used as a catapult.

      -DTail - The distributed log tail program
      +Be prepared for nothing to work. Problems are an opportunity to do your best, not to do miracles. Always manage your expectations. It will suck, but it will be ok. Be prepared to begin from the beginning. Be cheerful and eagerly work on the next obstacle. Each time you become better. Life is not a sprint but a marathon. After each obstacle lies another obstacle, there won't be anything without obstacles. Passing one means you are ready for the next.

      -From there, you could automate the solution on more and more servers. Best, ramp up the automation to a handful of systems, and later to a whole line of servers (e.g. all secondary servers of a given cluster). And afterwards, automate it on all servers.
      +

      Build your inner citadel



      -Remember, whenever something goes wrong, you will have plenty of logs and backup files available. The disaster recovery would involve extending your script to take care of that too or writing a new script for rolling back the backups.
      +Develop your inner strength during good times so you can rely on it in bad times. Always prepare for adversity and face it with calmness and resilience. Be humble enough that things which happen will happen. Build your inner citadel. In good times strengthen it. In bad times rely on it.

      -

      Out of office hours


      +We should always prepare for things to get tough. Your house burns down: no worries, we eliminated much rubbish. Imagine what can go wrong before things go wrong. We are prepared for adversity; it's other people who aren't. Phil Jackson's hip problem example. To receive unexpected benefits, you must first accept the unexpected obstacles. Meditate on death. It's a universal obstacle. Use it as a reminder to do your best.

      -If possible, don't deploy any automation shortly before out of office hours, such as in the evening, before holidays or weekends. The only exception would be that you, or someone else, will be available to monitor the automation out of office hours. If it is a critical issue, someone, for example, the on-call person, could take over. Or ask your boss to work now but to take off another day to compensate.
      +

      Love everything that happens



      -You should add an easy off-switch to your automation so that everyone from your team knows how to pause it if something goes wrong in order to adjust the automation accordingly. Of course, you should still follow all the principles mentioned in this blog post when making any changes.
      +Turn an obstacle the other way around for your benefit. Use it at fuel. It's simple but challenging. Most are paralyzed instead. The obstacle in the path becomes the path. Obstacles are neither good nor bad. The things which hurt, instruct.

      -

      Retrospective


      +Should I hate people who hate me? That's their problem and not mine. Be always calm and relaxed during the fight. The story of the battle is the story of the smile. Cheerfulness in all situations, especially the bad ones. Love for everything that happens; if it happens, it was meant to happen. We can choose how we react to things, so why not choose to feel good? I love everything that happens. You must never lower yourself to the person you don't like.

      -For every major incident, you need to follow up with an incident retrospective. A blame-free, detailed description of exactly what went wrong to cause the incident, along with a list of steps to take to prevent a similar incident from occurring again in the future.
      +

      Conclusion



      -This usually means creating one or more tickets, which will be dealt with soon. Once the permanent fix is deployed, you can remove your ad-hoc automation and monitoring around it and focus on your regular work again.
      +Life is a marathon, not a sprint. Each obstacle we overcome prepares us for the next one. Remember, the obstacle is not just a barrier to be turned upside down; it can also be used as a catapult to propel us forward. By embracing challenges and using them as opportunities for growth, we become stronger, more adaptable, and, ultimately, more successful.

      E-Mail your comments to paul@nospam.buetow.org :-)

      +Other book notes of mine are:
      +
      +2024-10-24 "Staff Engineer" book notes
      +2024-07-07 "The Stoic Challenge" book notes
      +2024-05-01 "Slow Productivity" book notes
      +2023-11-11 "Mind Management" book notes
      +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      +2023-05-06 "The Obstacle is the Way" book notes (You are currently reading this)
      +2023-04-01 "Never split the difference" book notes
      +2023-03-16 "The Pragmatic Programmer" book notes
      +
      Back to the main site
      - Keep it simple and stupid - - https://foo.zone/gemfeed/2021-09-12-keep-it-simple-and-stupid.html - 2021-09-12T09:39:20+03:00 + Unveiling `guprecords.raku`: Global Uptime Records with Raku + + https://foo.zone/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html + 2023-04-30T13:10:26+03:00 Paul Buetow aka snonux paul@dev.buetow.org - A robust computer system must be kept simple and stupid (KISS). The fancier the system is, the more can break. Unfortunately, most systems tend to become complex and challenging to maintain in today's world. In the early days, so I was told, engineers understood every part of the system, but nowadays, we see more of the 'lasagna' stack. One layer or framework is built on top of another layer, and in the end, nobody has got a clue what's going on. + For fun, I am tracking the uptime of various personal machines (servers, laptops, workstations...). I have been doing this for over ten years now, so I have a lot of statistics collected.
      -

      Keep it simple and stupid


      +

      Unveiling guprecords.raku: Global Uptime Records with Raku



      -Published at 2021-09-12T09:39:20+03:00; Updated at 2023-03-23
      +Published at 2023-04-30T13:10:26+03:00

      -  _______________                        |*\_/*|_______
      -  |  ___________  |     .-.     .-.      ||_/-\_|______  |
      -  | |           | |    .****. .****.     | |           | |
      -  | |   0   0   | |    .*****.*****.     | |   0   0   | |
      -  | |     -     | |     .*********.      | |     -     | |
      -  | |   \___/   | |      .*******.       | |   \___/   | |
      -  | |___     ___| |       .*****.        | |___________| |
      -  |_____|\_/|_____|        .***.         |_______________|
      -    _|__|/ \|_|_.............*.............._|________|_
      -   / ********** \                          / ********** \
      - /  ************  \                      /  ************  \
      ---------------------                    --------------------
      ++-----+-----------------+-----------------------------+
      +| Pos |            Host |                    Lifespan |
      ++-----+-----------------+-----------------------------+
      +|  1. |        dionysus |  8 years, 6 months, 17 days |
      +|  2. |          uranus |  7 years, 2 months, 16 days |
      +|  3. |   alphacentauri |  6 years, 9 months, 13 days |
      +|  4. |         *vulcan |   4 years, 5 months, 6 days |
      +|  5. |             sun |  3 years, 10 months, 2 days |
      +|  6. |           uugrn |   3 years, 5 months, 5 days |
      +|  7. |       deltavega |  3 years, 1 months, 21 days |
      +|  8. |           pluto | 2 years, 10 months, 30 days |
      +|  9. |         tauceti |  2 years, 3 months, 22 days |
      +| 10. |        callisto |  2 years, 3 months, 13 days |
      ++-----+-----------------+-----------------------------+
       

      -A robust computer system must be kept simple and stupid (KISS). The fancier the system is, the more can break. Unfortunately, most systems tend to become complex and challenging to maintain in today's world. In the early days, so I was told, engineers understood every part of the system, but nowadays, we see more of the "lasagna" stack. One layer or framework is built on top of another layer, and in the end, nobody has got a clue what's going on.
      -
      -

      Need faster hardware


      +

      Table of Contents



      -This not just makes the system much more complex, difficult to maintain and challenging to troubleshoot, but also slow. So more experts are needed to support it. Also, newer and faster hardware is required to make it run smoothly. Often, it's so much easier to buy speedier hardware than rewrite a whole system from scratch from the bottom-up. The latter would require much more resources in the short run, but in the long run, it should pay off. Unfortunately, many project owners scare away from it as they only want to get their project done and then move on.
      -
      -

      Too complex to be replaced


      -
      -

      On COBOL


      -
      -Have a look at COBOL, a prevalent programming language of the past. No one is learning COBOL in college or university anymore, but many legacy systems still require COBOL experts. Why is this? It's just too scary to write everything from scratch. There's too much COBOL code out there that can't be replaced from today to tomorrow.
      -
      -https://nymag.com/intelligencer/2020/04/what-is-cobol-what-does-it-have-to-do-with-the-coronavirus.html
      -
      -

      On Kubernetes


      -
      -Now have a look at Kubernetes (k8s), the current trendy infrastructure thing to use nowadays. Of course, there are many benefits of using k8s (auto-scaling, reproducible deployments, dynamic resource allocation and resource sharing, saving of hardware costs, good commercial for potential employees as it is the current hot sauce of infrastructure). But all of this also comes with costs: You need experts operating the k8s cluster (or you need to pay extra for a managed cluster in the cloud), increased complexity of the system (k8s comes with a steep learning curve). The latter not only applies to the engineers managing the k8s cluster - it also applies to the software engineers, who now have to develop 'cloud native' applications and, therefore, have to change how they developed software how they used to. They all need to be re-educated on what cloud-native means, and they also need to understand the key concepts of k8s for writing optimal software for it.
      -
      -

      The younger generation of IT professionals


      -
      -Maybe the younger generation knows all of this already after graduation, but then they are missing other critical parts of the system for sure. I have seen engineers who knew about containers and how to configure resource restrictions for a Docker container managed via k8s but have never heard the terms Linux control groups and Linux namespaces. So obviously, there is some knowledge gap of the underlying architecture. This can be a big problem when you have to troubleshoot such a system during a production incident and k8s adds a lot of abstraction to the mix which doesn't make it easier.
      -
      -Coming back to COBOL, k8s is on its way to becoming something similar. One day, k8s might not be the hottest tech stuff everyone wants to use. But there will be still many legacy k8s clusters around but not enough experts available to manage those:
      -
      -https://www.techrepublic.com/article/why-kubernetes-is-our-modern-day-cobol-says-a-tech-expert/
      -
      -Another article which stroke me is:
      +
      +

      Introduction



      -Today's Students Don't Understand the Basics of Computer Operations
      +For fun, I am tracking the uptime of various personal machines (servers, laptops, workstations...). I have been doing this for over ten years now, so I have a lot of statistics collected.

      -And here is something to smile about:
      +As a result of this, I am introducing guprecords.raku, a handy Raku script that helps me combine uptime statistics from multiple servers into one comprehensive report. In this blog post, I'll explore what Guprecords is and some examples of its application. I will also add some notes on Raku.

      -https://christine.website/blog/theres-a-node-2021-10-02
      +Guprecords, or global uptime records, is a Raku script designed to generate a consolidated uptime report from multiple hosts:

      -

      The bloated web


      +https://codeberg.org/snonux/guprecords
      +The Raku Programming Language

      -Another example is the modern web. Have you ever wondered why the internet becomes slower and slower nowadays? The modern web is so much like lasagna that I decided to use Gemini to be the primary protocol of my website. The HTML version of this website is just a fallback as many visitors don't know what Gemini is and don't have any compatible software installed for surfing the Geminispace:
      +A previous version of Guprecords was actually written in Perl, the older and more established language from which Raku was developed. One of the primary motivations for rewriting Guprecords in Raku was to learn the language and explore its features. Raku is a more modern and powerful language compared to Perl, and working on a real-world project like Guprecords provided a practical and engaging way to learn the language.

      -2021-04-24-welcome-to-the-geminispace.html
      +Over the last years, I have been reading the following books and resources about Raku:

      -The Gemtext protocol is KISS. There's no way to do other formattings than headings, links, paragraphs, lists, quotes, and bare text blocks (e.g., ASCII art or code snippets). There's no way to create bloated Gemini sites, and due to its limited capabilities, there's also no way to commercialise it (e.g. there's no good way to track the site visitors as things like cookies don't exist). By design, the Gemini protocol can't be extended, so there is no chance to abuse it even in the future. Gemini sites will stay KISS forever, and there won't be any fancy HTML/JavaScript frameworks like we see on the modern web.
      +
        +
      • Raku Guide (at raku.guide)
      • +
      • Think Perl 6
      • +
      • Raku Fundamentals
      • +
      • Raku Recipes
      • +

      +And I have been following the Raku newsletter, and sometimes I have been lurking around in the IRC channels, too. Watching Raku coding challenges on YouTube was pretty fun, too. However, nothing beats actually using Raku to learn the language. After reading all of these resources, I may have a good idea about the features and paradigms, but I am by far not an expert.

      -

      Fancy log-management solutions


      +

      How Guprecords works



      -Yet another example I want to bring up is DTail, the distributed log tail program I wrote. There are many great and fancy log-management solutions available to choose from, and they all seem complex to set up and maintain. The ELK stack, for example, requires you to operate an ElasticSearch cluster (or multiple, if you are geo-redundant), Logstash (different configurations and instances, depending on your infrastructure) and a Kibana web-frontend (which also needs to be highly available). I have operated ElasticSearch clusters on multiple occasions, and I must say that it is not an easy task to optimise it for the particular workload you might encounter. I also have seen many ES clusters operated by other people, and I have seen these clusters failing a lot (so it's not just me). The reduced complexity of DTail also makes it more robust against outages. You won't troubleshoot your distributed application very well if the log management infrastructure isn't working either.
      +Guprecords works in three stages:

      -2021-04-22-dtail-the-distributed-log-tail-program.html
      +
        +
      • 1. Generating uptime statistics using uptimed: First, I need to install and run uptimed on each host to generate uptime statistics. This tool is available for most common Linux and *BSD distributions and macOS via Homebrew.
      • +
      • 2. Collecting uptime records to a central location: The next step involves collecting the raw uptime statistics files generated by uptimed on each host. It's a good idea to store all record files in a central git repository. The records file contains information about the total uptime since boot, boot time, and the operating system and kernel version. Guprecords itself does not do the collection part, but have a look at the README.md in the git repository for some guidance.
      • +
      • 3. Generating global uptime stats: Finally, run the guprecords.raku script with the appropriate flags to create a global uptime report. For example, I can use the following command:
      • +

      + +
      $ raku guprecords.raku --stats=dir=$HOME/git/uprecords/stats --all
      +

      -I don't say that the ELK stack doesn't work, but it requires experts and additional hardware resources to support it. But instead, if you keep your infrastructure simple (e.g. only use DTail), it will maintain pretty much by itself.
      +This command will generate a comprehensive uptime report from the collected statistics, making it easy to review and enjoy the data.

      -

      More KISS


      +Guprecords supports the following features:

      -

      The Adslowbe PDF Reader


      +
        +
      • Supports multiple categories: Host, Kernel, KernelMajor, and KernelName
      • +
      • Supports multiple metrics: Boots, Uptime, Score, Downtime, and Lifespan
      • +
      • Output formats available: Plaintext, Markdown, and Gemtext
      • +
      • Provides top entries based on the specified limit
      • +

      +

      Example



      -Another perfect example is the Adobe PDF reader. How can it be that the inventor of the PDF format creates such a terrible user experience with its official reader? The reader is awful bloated, and slow. There are much better alternatives around (especially for Linux and other UNIX like operating systems, look at Zathura for example). I believe the reason Adobe's reader is like this is featuritis, and 90% of the users don't use 90% of all available features. Less is more; keep it simple and stupid.
      +You have already seen an example at the very top of this post, where the hosts were grouped by their total lifespans (uptime+downtime). Here's an example of what the global uptime report (grouped by total host uptimes) might look like:

      -

      The power of plain text files


      +
      +Top 20 Uptime's by Host
      +
      ++-----+-----------------+-----------------------------+
      +| Pos |            Host |                      Uptime |
      ++-----+-----------------+-----------------------------+
      +|  1. |         *vulcan |   4 years, 5 months, 6 days |
      +|  2. |          uranus | 3 years, 11 months, 21 days |
      +|  3. |             sun |  3 years, 9 months, 26 days |
      +|  4. |           uugrn |   3 years, 5 months, 5 days |
      +|  5. |       deltavega |  3 years, 1 months, 21 days |
      +|  6. |           pluto | 2 years, 10 months, 29 days |
      +|  7. |         tauceti |  2 years, 3 months, 19 days |
      +|  8. |       tauceti-f |  1 years, 9 months, 18 days |
      +|  9. | *ultramega15289 |  1 years, 8 months, 17 days |
      +| 10. |          *earth |  1 years, 5 months, 22 days |
      +| 11. |       *blowfish |  1 years, 4 months, 20 days |
      +| 12. |   ultramega8477 |  1 years, 3 months, 25 days |
      +| 13. |           host0 |   1 years, 3 months, 9 days |
      +| 14. |       tauceti-e |  1 years, 2 months, 20 days |
      +| 15. |        makemake |   1 years, 1 months, 6 days |
      +| 16. |        callisto | 0 years, 10 months, 31 days |
      +| 17. |   alphacentauri | 0 years, 10 months, 28 days |
      +| 18. |          london |  0 years, 9 months, 16 days |
      +| 19. |         twofish |  0 years, 8 months, 31 days |
      +| 20. |     *fishfinger |  0 years, 8 months, 17 days |
      ++-----+-----------------+-----------------------------+
      +

      -Speaking of file formats, never underestimate the power of plain text files. Plain text files don't require any special software to be opened, and they outlive the software which created them in the first place. You will still be able to read a plain text file on a modern computer system ten (or twenty) years from now, but you probably won't be able to read such an old version of an Adobe Photoshop image file if the software required for reading that format isn't supported anymore and doesn't run anymore on modern computers.
      +This table ranks the top 20 hosts based on their total uptime, with the host having the highest uptime at the top. The hosts marked with * are still active, means stats were collected within the last couple of months.

      -

      KISS for programmers


      +My up to date stats can be seen here:

      -Not to mention, keeping things simple and stupid also reduces the potential malicious attack surface. It's not just about the software and services you use and operate. It's also about the software you write. Here is a nice article about the KISS principle in software development:
      +My machine uptime stats

      -https://thevaluable.dev/kiss-principle-explained/
      +Just recently, I decommissioned vulcan (the number one stop from above), which used to be my CentOS 7 (initially CentOS 6) VM hosting my personal NextCloud and Wallabag (which I modernised just recently with a brand new shiny Rocky Linux 9 VM). This was the last uptimed output before shutting it down (it always makes me feel sentimental decommissioning one of my machines :'-():

      -

      When KISS is not KISS anymore


      +
      +     #               Uptime | System                                     Boot up
      +----------------------------+---------------------------------------------------
      +     1   545 days, 17:58:15 | Linux 3.10.0-1160.15.2.e  Sun Jul 25 19:32:25 2021
      +     2   279 days, 10:12:14 | Linux 3.10.0-957.21.3.el  Sun Jun 30 12:43:41 2019
      +     3   161 days, 06:08:43 | Linux 3.10.0-1160.15.2.e  Sun Feb 14 11:05:38 2021
      +     4   107 days, 01:26:35 | Linux 3.10.0-957.1.3.el7  Thu Dec 20 09:29:13 2018
      +     5    96 days, 21:13:49 | Linux 3.10.0-1127.13.1.e  Sat Jul 25 17:56:22 2020
      +->   6    89 days, 23:05:32 | Linux 3.10.0-1160.81.1.e  Sun Jan 22 12:39:36 2023
      +     7    63 days, 18:30:45 | Linux 3.10.0-957.10.1.el  Sat Apr 27 18:12:43 2019
      +     8    63 days, 06:53:33 | Linux 3.10.0-1127.8.2.el  Sat May 23 10:41:08 2020
      +     9    48 days, 11:44:49 | Linux 3.10.0-1062.18.1.e  Sat Apr  4 22:56:07 2020
      +    10    42 days, 08:00:13 | Linux 3.10.0-1127.19.1.e  Sat Nov  7 11:47:33 2020
      +    11    36 days, 22:57:19 | Linux 3.10.0-1160.6.1.el  Sat Dec 19 19:47:57 2020
      +    12    21 days, 06:16:28 | Linux 3.10.0-957.10.1.el  Sat Apr  6 11:56:01 2019
      +    13    12 days, 20:11:53 | Linux 3.10.0-1160.11.1.e  Mon Jan 25 18:45:27 2021
      +    14     7 days, 21:29:18 | Linux 3.10.0-1127.13.1.e  Fri Oct 30 14:18:04 2020
      +    15     6 days, 20:07:18 | Linux 3.10.0-1160.15.2.e  Sun Feb  7 14:57:35 2021
      +    16     1 day , 21:46:41 | Linux 3.10.0-957.1.3.el7  Tue Dec 18 11:42:19 2018
      +    17     0 days, 01:25:57 | Linux 3.10.0-957.1.3.el7  Tue Dec 18 10:16:08 2018
      +    18     0 days, 00:42:34 | Linux 3.10.0-1160.15.2.e  Sun Jul 25 18:49:38 2021
      +    19     0 days, 00:08:32 | Linux 3.10.0-1160.81.1.e  Sun Jan 22 12:30:52 2023
      +----------------------------+---------------------------------------------------
      +1up in     6 days, 22:08:18 | at                        Sat Apr 29 10:53:25 2023
      +no1 in   455 days, 18:52:44 | at                        Sun Jul 21 07:37:51 2024
      +    up  1586 days, 00:20:28 | since                     Tue Dec 18 10:16:08 2018
      +  down     0 days, 01:08:32 | since                     Tue Dec 18 10:16:08 2018
      +   %up               99.997 | since                     Tue Dec 18 10:16:08 2018
      +

      -There is, however, a trap. The more you spend time with things, the more these things feel natural to you and you become an expert. The more you become an expert, the more you introduce more abstractions and other clever ways of doing things. For you, things seem to be KISS still, but another person may not be an expert and might not understand what you do. One of the fundamental challenges is to keep things really KISS. You might add abstraction upon abstraction to a system and don't even notice it until it is too late.
      +

      Conclusion



      -

      Other relevant readings


      +Guprecords is a small, yet powerful tool for analyzing uptime statistics. While developing Guprecords, I have come to truly appreciate and love Raku's expressiveness. The language is designed to be both powerful and flexible, allowing developers to express their intentions and logic more clearly and concisely.

      -Is the madness ever going to end?
      -Write plain text files
      +Raku's expressive syntax, support for multiple programming paradigms, and unique features, such as grammars and lazy evaluation, make it a joy to work with.

      -Enough ranted for now!
      +Working on Guprecords in Raku has been an enjoyable experience, and I've found that Raku's expressiveness has significantly contributed to the overall quality and effectiveness of the script. The language's ability to elegantly express complex logic and data manipulation tasks makes it an excellent choice for developing tools like these, where expressiveness and productiveness are of the utmost importance.

      -Other KISS-related posts are:
      +So far, I have only scratched the surface of what Raku can do. I hope to find more time to become a regular Rakoon (a Raku Programmer). I have many Ideas for other small tools like Guprecords, but the challenge is finding the time. I'd love to explore Raku Grammars and also I would love to explore writing concurrent code in Raku (I also love Go (Golang), btw!). Ideas for future Raku personal projects include:

      -2021-09-12 Keep it simple and stupid (You are currently reading this)
      -2023-06-01 KISS server monitoring with Gogios
      -2023-10-29 KISS static web photo albums with photoalbum.sh
      +
        +
      • A log file analyzer, for generating anonymized foo.zone visitor stats for both, the Web and Gemini.
      • +
      • A social media sharing scheduler a la buffer.com. I am using Buffer at the moment to share posts on Mastadon, Twitter, Telegram and LinkedIn, but it is proprietary and also it's not really reliable.
      • +
      • Rewrite the static photo album generator of irregular.ninja in Raku (from Bash).
      • +

      +E-Mail your comments to hi@foo.zone :-)

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +Other related posts are:

      -Controversially, a lack of features is a feature. Enjoy your peace an quiet. - Michael W Lucas
      +2023-05-01 Unveiling guprecords.raku: Global Uptime Records with Raku (You are currently reading this)
      +2022-06-15 Sweating the small stuff - Tiny projects of mine
      +2022-05-27 Perl is still a great choice
      +2011-05-07 Perl Daemon (Service Framework)
      +2008-06-26 Perl Poetry

      Back to the main site
      - On being Pedantic about Open-Source - - https://foo.zone/gemfeed/2021-08-01-on-being-pedantic-about-open-source.html - 2021-08-01T10:37:58+03:00 + 'Never split the difference' book notes + + https://foo.zone/gemfeed/2023-04-01-never-split-the-difference-book-notes.html + 2023-04-01T20:00:17+03:00 Paul Buetow aka snonux paul@dev.buetow.org - I believe that it is essential to always have free and open-source alternatives to any kind of closed-source proprietary software available to choose from. But there are a couple of points you need to take into consideration. + These are my personal takeaways after reading 'Never split the difference' by Chris Voss. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.
      -

      On being Pedantic about Open-Source


      +

      "Never split the difference" book notes


      +
      +Published at 2023-04-01T20:00:17+03:00

      -Published at 2021-08-01T10:37:58+03:00; Updated at 2023-01-23
      +These are my personal takeaways after reading "Never split the difference" by Chris Voss. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.

      -                                           __
      -                               _____....--' .'
      -                     ___...---'._ o      -`(
      -           ___...---'            \   .--.  `\
      - ___...---'                      |   \   \ `|
      -|                                |o o |  |  |
      -|                                 \___'.-`.  '.
      -|                                      |   `---'
      -'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^' LGB - Art by lgbearrd
      +         ,..........   ..........,
      +     ,..,'          '.'          ',..,
      +    ,' ,'            :            ', ',
      +   ,' ,'             :             ', ',
      +  ,' ,'              :              ', ',
      + ,' ,'............., : ,.............', ',
      +,'  '............   '.'   ............'  ',
      + '''''''''''''''''';''';''''''''''''''''''
      +                    '''
       

      -I believe that it is essential to always have free and open-source alternatives to any kind of closed-source proprietary software available to choose from. But there are a couple of points you need to take into consideration.
      -
      -

      The costs of open-source


      -
      -One benefit of using open-source software is that it doesn't cost anything, right? That's correct in many cases. However, in some cases you still need to spend a significant amount of time configuring the software to work for you. It will be more expensive to use open-source software than proprietary commercial one if you aren't careful.
      -
      -Not to say that I haven't seen the same effect with commercial software where people had to, after buying it, put a bunch of effort to make it work due to the lack of quality or due to high complexity. But that's either bad luck or bad decision-making. Most commercial providers I have worked with try to make it work for you, so you also will buy other products and services from them later on and don't lose you as a happy customer.
      -
      -

      Commercial providers


      -
      -Producers of commercial software want to earn money after all. This is to grow their businesses and also to be able to pay their employees, who also need to care for their families. Employees build up their careers, build houses, and are proud of their accomplishments in the company.
      -
      -So per se, commercial software is not a bad thing. Right? At least, commercial closed-source software is not a bad thing in its heart. Unfortunately, some companies have to keep their software closed-source to not lose their competitive edge over other competitors.
      -
      -

      Earning on open-source


      +

      Table of Contents



      -There are also companies that earn on open-source software. All the code they write is free for download and use, but you, as a customer, could pay for service and support if you are not an expert and can't manage it by yourself.
      -
      -I like this approach, as you can balance the effort and costs the way it suits you best, and in doubt, you can audit the source code. Are you already an expert? Perfect, you don't need to buy additional support for the software. Everything can be set up by yourself, given that you have the time and priority.
      -
      -Also, once an open-source project reached a certain size, it is unlikely to be abandoned one day. As long as at least one person is willing to be the open-source maintainer, the project won't die. Whereas commercial providers can decide from today to tomorrow to retire software or go bankrupt (unless you purchase Microsoft Word, I don't believe it will die anytime soon).
      -
      -

      Open-source organizations and individual contributors


      -
      -Besides corporations, millions of individual open-source contributors write free and open-source software not for money but for pleasure. Often, they are organized in non-profit organizations, working together to reach a common goal (it is worth mentioning that there are also many professionals, payed by large corporations, working full-time for non-profit open-source projects in order to push the features and reach the goals of the corporations). Sometimes, people don't agree on the project goal, so it gets forked, which can be a good thing. The more diversity, the better, as this is where competition and innovation happens. Also, the end user will end up with more choices.
      -
      -These open-source projects are of a very high quality standard and are rock-solid, if not better, alternatives to proprietary counterparts. If the project isn't backed by a large corporation already, you should donate to these open-source organizations and/or individual contributors. I have donated to some projects I use personally. Do you learn a foreign language and use Anki flashcards? It's entirely free and open-source, and they happily accept donations ensuring future maintenance and development.
      -
      -

      Lesser known projects and the charm of clunkiness


      +
      +

      Tactical listening, spreading empathy



      -Looking at the smaller, lesser-known open-source projects (not talking about established open-source projects like FreeBSD and Linux): You can't, however, expect the software to be perfect and bug-free. After all, most of the code is written for pleasure and fun in the developers' free time. Besides the developer himself, you might be the only user of the project. The software may be a bit clunky to use, and probably bugs are lurking around, and it might only work for a very specific use case.
      +Be a mirror, copy each other to be comfy with each other to build up trust. Mirroring is mainly body language. A mirror is to repeat the words the other just said. Simple but effective.

      -Clunkiness can be charmful, though. And it can also encourage you to contribute code to make it better. There is a lot of such code in personal GitHub and GitLab repositories. The quality of such small open-source projects varies drastically. Many hobbyist programmers see programming as an art and put tons of effort into their projects. Others upload broken crap, which is dangerous to use. So have a look at the code before you use it!
      +
        +
      • A mirror needs space and silence between the words. At least 4 seconds.
      • +
      • A mirror might be awkward to be used at first, especially with a question coupled to it.
      • +
      • We fear what's different and are drawn to what is similar.
      • +

      +Mirror training is like Jedi training. Simple but effective. A mirror needs space. Be silent after "you want this?"

      -

      The security aspect


      +

      Mindset of discovery



      -One of the main conceptions about open-source software is that it is more secure than closed-source software because everybody can read and fix the code. Is that actually true? You can only be sure when you audit the code by yourself. If you are like me, you won't have time to audit all the open-source software you use. It's impossible to audit more than 100 million lines of Linux kernel code. Static code analysis tools come in handy here, but they still require humans to look at the results.
      +Try to have multiple realities in your mind and use facts to distinguish between real and false.

      -Security bugs in open-source projects are exposed to the public and fixed quickly, while we don't know exactly what happens to security bugs in closed-source ones. Still, hackers and security specialists can find them through reverse engineering and penetration testing. Overall, thinking of security, In my opinion it is still better to prefer open-source software because the more significant the project, the higher the probability that security bugs are found and fixed as more parties are looking into it. Furthermore, provided you have the necessary resources, you could still deduct an audit by yourself. The latter especially happens when companies with its own security and penetration testing departments are evaluating the use of open-source. This is something not every company can afford though.
      +
        +
      • Focus on what the counterpart has to say and what he needs and wants. Understanding him makes him vulnerable.
      • +
      • Empathy understanding the other person from his perspective, but it does not mean agreeing with him.
      • +
      • Detect and label the emotions of others for your powers.
      • +
      • To be understood seems to solve all problems magically.
      • +

      +Try: to put a label on someone's emotion and then be silent. Wait for the other to reveal himself. "You seem unhappy about this?"

      -

      Always watch out for open-source alternatives


      +

      More tips



      -Do you need Microsoft Word? Why don't you just use the Vim text editor or GNU Emacs to write your letters? If that's too nerdy, you can still use open-source alternatives such as AbiWord or LibreOffice. Larger organizations have the tendency to standardize the software their employees have to use. Unfortunately, as Microsoft Word is the de-facto standard text processing program, most companies prefer Word over LibreOffice. Same with Microsoft Excel vs LibreOffice Calc or other spreadsheet alternatives like Gnumeric. I don't know why that is; please....
      +
        +
      • Put on a poker face and don't show emotions.
      • +
      • Slow things down. Don't be a problem solver.
      • +
      • Smile while you are talking, even on the phone. Be easy and encouraging.
      • +
      • Being right is not the key to successful negotiation; being mindful is.
      • +
      • Be in the safe zone of empathy and acknowledge bad news.
      • +

      +

      "No" starts the conversation



      -E-Mail your comments to paul@nospam.buetow.org :-)
      +When the opponent starts with a "no", he feels in control and comfortable. That's why he has to start with "no".

      -I only use free and open-source operating systems on my personal Laptops, Desktop PCs and servers (FreeBSD and Linux based ones). Most of the programs and apps I use on them are free and open-source as well, and I am comfortable with it for over twenty years. Exceptions are the BIOSes and some firmwares of my devices. I also use Skype as most of my friends and family are using it. They are, unfortunately, proprietary software still. But I will be looking into Matrix as a Skype alternative when I have time. There are also open BIOS alternatives, but they usually don't work on my devices.
      +
        +
      • "Yes" and "maybe" might be worthless, but "no" starts the conversation.
      • +
      • If someone is saying "no" to you, he will be open to what you have to say next.
      • +
      • "No" is not stopping the negotiation but will open up opportunities you were not thinking about before.
      • +
      • Start with "no". Great negotiators seek "no" because that's when the great discussions begin.
      • +
      • A "no" can be scary if you are not used to it. If your biggest fear is "no", then you can't negotiate.
      • +

      +Get a "That's right" when negotiating. Don't get a "you're right". You can summarise the opponent to get a "that's right".

      -

      What about mobile?


      +

      Win-win



      -Update 2023-01-21: Check out my newer post about GrapheneOS, which solves some of my dilemmas
      +Win-win is a naive approach when encountering the win-lose counterpart, but always cooperate. Don't compromise, and don't split the difference. We don't compromise because it's right; we do it because it is easy. You must embrace the hard stuff; that's where the great deals are.

      -Why GrapheneOS Rox
      +

      On Deadlines



      -I struggle to go 100% open-source on my Smartphone. I use a Samsung phone with the stock Android as provided by Samsung. I love the device as it is large enough to use as a portable reading and note-taking device, and it can also take decent pictures. As a cloud backup solution, I have my own NextCloud server (open-source). Android is mainly open-source software, but many closed parts are still included. I replaced most of the standard apps with free and open-source variants from the F-Droid store though.
      +
        +
      • All deadlines are imaginary.
      • +
      • Most of the time, deadlines unsettle us without a good reason.
      • +
      • They push a deal to a conclusion.
      • +
      • They rush the counterpart to cause pressure and anxiety.
      • +

      +

      Analyse the opponent



      -I could get a LineageOS based phone to get rid of the proprietary Android parts (I tried that out a couple of times in the past). But then a couple of convenient apps, such as Google Maps or Banking or Skype or the E-Ticket apps of various Airlines, various review apps when searching for restaurants, Audible (I think Audible offers an excellent service), etc., won't work anymore. The proprietary Google Maps is still the best maps app, even though there are open alternatives available. It's not that I couldn't live without these apps, but they make life a lot more convenient.
      +
        +
      • Understand the motivation of people behind the table as well.
      • +
      • Ask how affected they will be.
      • +
      • Determine your and the opposite negotiation style. Accommodation, analyst, assertive.
      • +
      • Treat them how they need to be treated.
      • +

      +The person on the other side is never the issue; the problem is the issue. Keep this in mind to avoid emotional issues with the person and focus on the problem, not the person. The bond is essential; never create an enemy.

      -

      Know the alternatives


      +

      Use different ways of saying "no."



      -Thinking about alternative solutions is always a good idea. My advice is never to be entirely dependant on any proprietary software. Before you decide to use proprietary software, try to find alternatives in the open-source world. You might need to invest some time playing around with the options available. Maybe they are good enough for you, or maybe not.
      +I had paid my rent always in time. I had positive experiences with the building and would be sad for the landlord to lose a good tenant. I am looking for a win-win agreement between us. Pulling out the research, other neighbours offer much lower prices even if your building is a better location and services. How can I effort 200 more....

      -If you still want to use proprietary software, use it with caution. Have a look at the recent change at Google Photos: For a long time, "high quality" photos could be uploaded there quota-less for free. However, Google recently changed the model so that people exceeding a quota have to start paying for the extra space consumed. I am not against Google's decision, but it shows you that a provider can always change its direction. So you can't entirely rely on these. I repeat myself: Don't fully rely on anything proprietary, but you might still use proprietary software or services for your own convenience.
      +...then put an extreme anker.

      -

      You can't control it all


      +You always have to embrace thoughtful confrontation for good negotiation and life. Don't avoid honest, clear conflict. It will give you the best deals. Compromises are mostly bad deals for both sides. Most people don't negotiate a win-win but a win-lose. Know the best and worst outcomes and what is acceptable for you.

      -The biggest problem I have with going 100% open-source is actually time. You can't control all the software you use or might be using in the future. You have only a finite amount of time available in your life. So you have to decide what's more important: Investigate and use an open-source alternative of every program and app you have installed, or rather spend quality time with your family and have a nice walk in the park or go to a sports class or cook a nice meal? You can't control it all in today's world of tech, not as a user and even not as a tech worker. There's a great blog post worth reading:
      +

      Calibrated question



      -https://unixsheikh.com/articles/how-to-stay-sane-in-todays-world-of-tech.html
      +Calibrated questions. Give the opponent a sense of power. Ask open-how questions to get the opponent to solve your problem and move him in your direction. Calibrated questions are the best tools. Summarise everything, and then ask, "how I am supposed to do that?". Asking for help this way with a calibrated question is a powerful tool for joint problem solving

      -

      The middle way


      +Being calm and respectful is essential. Without control of your emotions, it won't work. The counterpart will have no idea how constrained they are with your question. Avoid questions which get a yes or short answers. Use "why?".

      -Regarding my personal Smartphone dilemma: I guess the middle way is to use two phones:
      +Counterparts are more involved if these are their solutions. The counterpart must answer with "that's right", not "you are right". He has to own the problem. If not, then add more why questions.

        -
      • Have a secondary, proprietary Android phone with Google Play store (or an Apple iPhone if this is more your thing) and all its benefits for occasional use. Use the proprietary phone only with intention. Such a phone implies some risks regarding your privacy. If you aren't careful, app providers will collect your personal data for building a digital profile of you, which gets used for online advertisement and other things. This doesn't only applies to the Smartphone, this also applies to some proprietary software (including cloud services such as Google Photos) you use on your home computer or websites you visit (I am looking at you, Facebook, Twitter and friends). Try to disable all tracking features on such a phone. It's not a guarantee that nobody will be collecting data from you anymore, but you should take at least the chance. Cal Newport once mentioned that you should not use privacy concerning apps as much anyway and instead spend more time on things which matter.
      • -
      • Have a primary phone, entirely based on free and open-source software. There will be probably no app collecting your personal data. Try to use the primary phone for all of your everyday activities and fall back to the proprietary phone only for particular use cases. Once there is decent hardware (with a decent camera) running Linux (such as Mobian, for example) available, I will consider a purchase. The only 3rd party which then will still be able to track you will be your network provider. You could start your own phone network, but that seems overkill. There is already the Pinephone and the Librem 5 running a real Linux (Android is Linux based, but it doesn't count as a real Linux for me). Still, I want to wait a bit longer for better hardware to be available (I want to have a good camera always with me).
      • -
      • You could also add a tertiary phone to the mix, which you only use for work and nothing else. That one will be very likely a proprietary phone too. You only have to keep this one around when you are working or when you are on-call.
      • +
      • Tone and body language need to align with what people are saying.
      • +
      • Deal with it via a labelled question.
      • +
      • Liers tend to talk with "them" and "their" and not with "I".
      • +
      • Also, liars tend to talk in complex sentences.

      -I have been playing with other smartphone OS alternatives, especially with MeeGo (which has died already) and SailfishOS, too. Security and privacy seem to be significantly improved compared to an Android. As a matter of fact, I bought a cheap and used Sony Xperia XA2 last year and installed SailfishOS on it. It's a nice toy, but it's still not the holy open-source grail as there are also proprietary parts in SailfishOS. Platforms such as Mobian, Ubuntu Touch and Plasma Mobile are more compelling to me. People must explore alternatives to Android and Apple here, as otherwise, you won't own any gadgets anymore:
      -
      -https://news.slashdot.org/story/21/07/10/0120236/by-2030-you-wont-own-any-gadgets
      -
      -Anyhow, any gadgets, including your phone, should be a tool you use. Don't let the phone use you!
      -
      -

      The downside of being a nobody


      +Prepare 3 to 5 calibrated questions for your counterpart. Be curious what is really motivating the other side. You can get out the "Black Swan".

      -Be aware that it might be to your disadvantage if you manage to go completely under cover without anyone collecting data from you. Suppose you are a nobody on the web (no social media profiles, no tracking history, etc.). In that case, you aren't behaving like the mass, and therefore you are suspicious. So it might be even a good thing to leave your marks here and there once in a while. You aren't hiding anything anyway, correct? Just be mindful what you are sharing about yourself. I share personal things very rarely on Facebook for example. And I only share a small subset of my personal life on my personal homepage and this blog and on all of my social media accounts. Nobody is interested in what I have for breakfast anyway I guess. Write me an E-Mail if you are interested in what I am having for breakfast.
      +

      The black swan



      -

      Mobile open-source OSes are still evolving


      +What we don't know can break our deal. Uncovering it can bring us unexpected success. You get what you ask for in this world, but you must learn to ask correctly. Reveal the black swan by asking questions.

      -You might have noticed that I wrote a lot about Smartphones in this article. The reason is that free and open-source software for Smartphones is still evolving. In contrast, for Laptops and Desktop PCs, it's already there. There is no reason to use proprietary operating systems such as Windows or macOS on your computers unless your employer forces you to use one of these. Why would they force you? It has to do with standardization again. The IT department only can manage so many platforms. It wouldn't be manageable by IT if every employee would install their own Linux distribution or one of the *BSDs. That might work for small startups but not for larger companies, especially not for a security-focused companies.
      +

      More



      -I would love a standardized Linux at work, though. Dell and Lenovo also officially support Linux on their notebooks. The culprit may be knowledgeable IT staff maintaining and giving support to the Desktop Linux users. Not all colleagues are Linux geeks like you and me. I am using macOS for work, but I am not an Apple expert. Occasionally I have to contact IT support regarding some issues I have. I don't use the macOS GUI a lot; I mainly live in the terminal so I can run the same tools I also use on Linux.
      +Establish a range at top places like corp. I get... (e.g. remote London on a project basis). Set a high salary range and not a number. Also, check on LinkedIn premium for the salaries.

      -

      Conclusion


      +
        +
      • Give an unexpected gift, e.g. show them my pet project and publicity for engineering.
      • +
      • Use an odd number, which makes you seem to have thought a lot about the sum and calculated it.
      • +
      • Define success and metrics for your next raise.
      • +
      • What does it take to be successful here? Ask the question, and they will tell you and guide you.
      • +
      • Set an extreme anker. Make the counterpart the illusion of losing something.
      • +
      • Hope-based deals. Hope is not a strategy.
      • +
      • Tactical empathy, listening as a martial art. It is emotional intelligence on steroids.
      • +
      • Being right isn't the key to a successful negotiation, but having the correct mindset is.
      • +
      • Don't shop the groceries when you are hungry.
      • +

      +Slow.... it.... down....

      -Should you be pedantic about open-source software? It depends. It depends on your fundamental values and how much time you are ready to invest. Open-source software is not just free as in money, but also free as in freedom. You will gain back complete control of your personal data. Unfortunately, installing ready proprietary apps from the Play Store is much more convenient than building up a trustworthy open-source-based infrastructure by yourself. As a guideline, use proprietary software and services with caution. Be mindful about your choices and where you leave your digital fingerprints. In doubt, think less is more. Do you really need this new shiny app? What benefit does it provide to you? Probably you don't really need that shiny new app.
      +E-Mail your comments to paul@nospam.buetow.org :-)

      -You have better chances when you know how to manage your own server and install and manage alternatives to the big cloud providers by yourself. I have the advantage that I have work experience as a Linux Systems Administrator here. I mentioned NextCloud already. I use NextCloud for online photo and file storage, contact and calendar sync and as an RSS news feed server. You could do the same with your own E-Mail server, you can also host your own website and blog. I also mentioned Matrix as a Skype alternative (which could also be an alternative to WhatsApp, Skype, Telegram, Viber, ...). I don't know a lot about Matrix yet, but it seems to be a very neat alternative. I am ready to invest time in it as one of my future personal pet projects. Not only because I think it's better, but also because for fun and as a hobby. But this doesn't mean that I invest *all* of my personal free time in it.
      +Other book notes of mine are:

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2024-10-24 "Staff Engineer" book notes
      +2024-07-07 "The Stoic Challenge" book notes
      +2024-05-01 "Slow Productivity" book notes
      +2023-11-11 "Mind Management" book notes
      +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      +2023-05-06 "The Obstacle is the Way" book notes
      +2023-04-01 "Never split the difference" book notes (You are currently reading this)
      +2023-03-16 "The Pragmatic Programmer" book notes

      Back to the main site
      - The Well-Grounded Rubyist - - https://foo.zone/gemfeed/2021-07-04-the-well-grounded-rubyist.html - 2021-07-04T10:51:23+01:00 + Gemtexter 2.0.0 - Let's Gemtext again² + + https://foo.zone/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html + 2023-03-25T17:50:32+02:00 Paul Buetow aka snonux paul@dev.buetow.org - When I was a Linux System Administrator, I have been programming in Perl for years. I still maintain some personal Perl programming projects (e.g. Xerl, guprecords, Loadbars). After switching jobs a couple of years ago (becoming a Site Reliability Engineer), I found Ruby (and some Python) widely used there. As I wanted to do something new, I decided to give Ruby a go. + I proudly announce that I've released Gemtexter version `2.0.0`. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.
      -

      The Well-Grounded Rubyist


      -
      -Published at 2021-07-04T10:51:23+01:00
      +

      Gemtexter 2.0.0 - Let's Gemtext again²



      -When I was a Linux System Administrator, I have been programming in Perl for years. I still maintain some personal Perl programming projects (e.g. Xerl, guprecords, Loadbars). After switching jobs a couple of years ago (becoming a Site Reliability Engineer), I found Ruby (and some Python) widely used there. As I wanted to do something new, I decided to give Ruby a go.
      -
      -You should learn or try out one new programming language once yearly anyway. If you end up not using the new language, that's not a problem. You will learn new techniques with each new programming language and this also helps you to improve your overall programming skills even for other languages. Also, having some background in a similar programming language makes it reasonably easy to get started. Besides that, learning a new programming language is kick-a** fun!
      -
      -
      +Published at 2023-03-25T17:50:32+02:00

      -Superficially, Perl seems to have many similarities to Ruby (but, of course, it is entirely different to Perl when you look closer), which pushed me towards Ruby instead of Python. I have tried Python a couple of times before, and I managed to write good code, but I never felt satisfied with the language. I didn't love the syntax, especially the indentations used; they always confused me. I don't dislike Python, but I don't prefer to program in it if I have a choice, especially when there are more propelling alternatives available. Personally, it's so much more fun to program in Ruby than in Python.
      +I proudly announce that I've released Gemtexter version 2.0.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.

      -
      +https://codeberg.org/snonux/gemtexter

      -Yukihiro Matsumoto, the inventor of Ruby, said: "I wanted a scripting language that was more powerful than Perl and more object-oriented than Python" - So I can see where some of the similarities come from. I personally don't believe that Ruby is more powerful than Perl, though, especially when you take CPAN and/or Perl 6 (now known as Raku) into the equation. Well, it all depends on what you mean with "more powerful". But I want to stay pragmatic and use what's already used at my workplace.
      +This is a new major release, so it contains a breaking change (see "Meta cache made obsolete").

      -

      My Ruby problem domain


      +Let's list what's new!

      -I wrote a lot of Ruby code over the last couple of years. There were many small to medium-sized tools and other projects such as Nagios monitoring checks, even an internal monitoring & reporting site based on Sinatra. All Ruby scripts I wrote do their work well; I didn't encounter any significant problems using Ruby for any of these tasks. Of course, there's nothing that couldn't be written in Perl (or Python), though, after all, these languages are all Turing-complete and all these languages also come with a huge set of 3rd party libraries :-).
      +
      +-=[ typewriters ]=-  1/98
      +
      +       .-------.
      +      _|~~ ~~  |_       .-------.
      +    =(_|_______|_)=    _|~~ ~~  |_
      +      |:::::::::|    =(_|_______|_)
      +      |:::::::[]|      |:::::::::|
      +      |o=======.|      |:::::::[]|
      + jgs  `"""""""""`      |o=======.|
      +  mod. by Paul Buetow  `"""""""""`
      +

      -I don't use Ruby for all programming projects, though.
      +

      Table of Contents




      -Also have a look at my personal Bash coding style.
      -Read here about DTail - the distributed log tail program.
      -This is a magazine article about I/O Riot I wrote.
      -
      -For all other in-between tasks I mainly use the Ruby programming language (unless I decide to give something new a shot once in a while).
      +

      Minimal template engine



      -

      Being stuck in Ruby-mediocrity


      +Gemtexter now supports templating, enabling dynamically generated content to .gmi files before converting anything to any output format like HTML and Markdown.

      -As a Site Reliability Engineer there were many tasks and problems to be solved as efficiently and quickly as possible and, of course, without bugs. So I learned Ruby relatively fast by doing and the occasional web search for "how to do thing X". I always was eager to get the problem at hand solved and as long as the code solved the problem I usually was happy.
      +A template file name must have the suffix gmi.tpl. A template must be put into the same directory as the Gemtext .gmi file to be generated. Gemtexter will generate a Gemtext file index.gmi from a given template index.gmi.tpl. A <<< and >>> encloses a multiline template. All lines starting with << will be evaluated as a single line of Bash code and the output will be written into the resulting Gemtext file.

      -Until now, I never read a whole book or took a course on Ruby. As a result, I found myself writing Ruby in a Perl-ish procedural style (with Perl, you can do object-oriented programming too, but Perl wasn't designed from the ground up to be an object-oriented language). I didn't take advantage of all the specialities Ruby has to offer as I invested most of my time in the problems at hand and not in the Ruby idiomatic way of doing things.
      +For example, the template index.gmi.tpl:

      -An unexpected benefit was that most of my Ruby code (probably not all, there are always dark corners in some old code bases lurking around) was easy to follow and extend or fix, even by people who usually don't speak Ruby, as there wasn't too much magic involved in my code - However, I could have done better still. Looking at other Ruby projects, I noticed over time that there is so much more to the language I wanted to explore. For example new techniques and the Ruby best practise, and much more about how things work under the hood, I wanted to learn about.
      +
      +# Hello world
      +
      +<< echo "> This site was generated at $(date --iso-8601=seconds) by \`Gemtexter\`"
      +
      +Welcome to this capsule!
      +
      +<<<
      +  for i in {1..10}; do
      +    echo Multiline template line $i
      +  done
      +>>>
      +

      -

      O'Reilly Safari Books Online


      +... results into the following index.gmi after running ./gemtexter --generate (or ./gemtexter --template, which instructs to do only template processing and nothing else):

      -I do have an O'Reilly Safari Online subscription (thank you, employer). To my liking, I found the "The Well-Grounded Rubyist" book there (the text version and also the video version of it). I watched the video version for a couple of weeks, chunking the content into small pieces so it was able to fit into my schedule, increasing the playback speed for the topics I knew already well enough and slowed it down to actual pace when there was something new to learn and occasionally jumped back to the text book to review what I just learned. To my satisfaction, I was already familiar with over half of the language. But there was still the big chunk, especially how the magic happens under the hood in Ruby, which I missed out on, but I am happy now to be aware of it now.
      +
      +# Hello world
      +
      +> This site was generated at 2023-03-15T19:07:59+02:00 by `Gemtexter`
      +
      +Welcome to this capsule!
      +
      +Multiline template line 1
      +Multiline template line 2
      +Multiline template line 3
      +Multiline template line 4
      +Multiline template line 5
      +Multiline template line 6
      +Multiline template line 7
      +Multiline template line 8
      +Multiline template line 9
      +Multiline template line 10
      +

      -I also loved the occasional dry humour in the book: "An enumerator is like a brain in a science fiction movie, sitting on a table with no connection to a body but still able to think". :-)
      +Another thing you can do is insert an index with links to similar blog posts. E.g.:

      -Will I rewrite and refactor all of my existing Ruby programs? Probably not, as they all do their work as intended. Some of these scripts will be eventually replaced or retired. But depending on the situation, I might refactor a module, class or a method or two once in a while. I already knew how to program in an object-oriented style from other languages (e.g. Java, C++, Perl Moose and plain) before I started Ruby, so my existing Ruby code is not as bad as you might assume after reading this article :-). In contrast to Java/C++, Ruby is a dynamic language, and the idiomatic ways of doing things differs from statically typed languages.
      +
      +See more entries about DTail and Golang:
      +
      +<< template::inline::rindex dtail golang
      +
      +Blablabla...
      +

      -

      Key takeaways


      +... scans all other post entries with dtail and golang in the file name and generates a link list like this:

      -These are my key takeaways. These only point out some specific things I have learned, and represent, by far, not everything I've learned from the book.
      +
      +See more entries about DTail and Golang:
      +
      +=> ./2022-10-30-installing-dtail-on-openbsd.html 2022-10-30 Installing DTail on OpenBSD
      +=> ./2022-04-22-programming-golang.html 2022-04-22 The Golang Programming language
      +=> ./2022-03-06-the-release-of-dtail-4.0.0.html 2022-03-06 The release of DTail 4.0.0
      +=> ./2021-04-22-dtail-the-distributed-log-tail-program.html 2021-04-22 DTail - The distributed log tail program (You are currently reading this)
      +
      +Blablabla...
      +

      -

      "Everything" is an object


      +

      Added hooks



      -In Ruby, everything is an object. However, Ruby is not Smalltalk. It depends on what you mean by "everything". Fixnums are objects. Classes also are, as instances of class Class. Methods, operators and blocks aren't but can be wrapped by objects via a "Proc". A simple assignment is not and can't. Statements like "while" also aren't and can't. Comments obviously also fall in the latter group. Ruby is more object-oriented than everything else I have ever seen, except for Smalltalk.
      +You can configure PRE_GENERATE_HOOK and POST_PUBLISH_HOOK to point to scripts to be executed before running --generate, or after running --publish. E.g. you could populate some of the content by an external script before letting Gemtexter do its thing or you could automatically deploy the site after running --publish.

      -In Ruby, like in Java/C++, classes are classes, objects are instances of classes, and there are class inheritances. There is single inheritance in Ruby, but with the power of mixing in modules, you can extend your classes in a better way than multiple class inheritances (like in C++) would allow. It's also different to Java interfaces, as interfaces in Java only come with the method prototypes and not with the actual method implementations like Ruby modules.
      +The sample config file gemtexter.conf includes this as an example now; these scripts will only be executed when they actually exist:

      -

      "Normal" objects and singleton objects


      + +
      declare -xr PRE_GENERATE_HOOK=./pre_generate_hook.sh
      +declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh
      +

      -In Ruby, you can also have singleton objects. A singleton object can be an instance of a class but be modified after its creation (e.g. a method added to only this particular instance after its instantiation). Or, another variant of a singleton object is a class (yes, classes are also objects in Ruby). All of that is way better described in the book, so have a read by yourself if you are confused now; just remember: Rubys object system is very dynamic and flexible. At runtime, you can add and modify classes, objects of classes, singleton objects and modules. You don't need to restart the Ruby interpreter; you can change the code during runtime dynamically through Ruby code.
      +

      Use of safer Bash options



      -

      Domain specific languages


      +Gemtexter now does set -euf -o pipefile, which helps to eliminate bugs and to catch scripting errors sooner. Previous versions only set -e.

      -Due to Ruby's flexibility through object individualization (e.g. adding methods at runtime, or changing the core behaviour of classes, catching unknown method calls and dynamically dispatch and/or generate the missing methods via the "method_missing" method), Ruby is a very good language to write your own small domain specific language (DSL) on top of Ruby syntax. I only noticed that after reading this book. Maybe, this is one of the reasons why even the configuration management system Puppet once tried to use a Ruby DSL instead of the Puppet DSL for its manifests. I am not sure why the project got abandoned though, probably it has to do with performance. Do be honest, Ruby is not the fastest language, but it is fast enough for most use cases. And, especially from Ruby 3, performance is one of the main things being worked on currently. If I want performance, I can always use another programming language.
      +

      Meta cache made obsolete



      -

      Ruby is "self-ish"


      +Here is the breaking change to older versions of Gemtexter. The $BASE_CONTENT_DIR/meta directory was made obsolete. meta was used to store various information about all the blog post entries to make generating an Atom feed in Bash easier. Especially the publishing dates of each post were stored there. Instead, the publishing date is now encoded in the .gmi file. And if it is missing, Gemtexter will set it to the current date and time at first run.

      -Ruby will fall back to the default "self" object if you don't specify an object method receiver. To give you an example, some more explanation is needed: There is the "Kernel" module mixed into almost every Ruby object. For example, "puts" is just a method of module "Kernel". When you write "puts :foo", Ruby sends the message "puts" to the current object "self". The class of object "self" is "Object". Class Object has module "Kernel" mixed in, and "Kernel" defines the method "puts".
      +An example blog post without any publishing date looks like this:

      -
      ->> self
      -=> main
      ->> self.class
      -=> Object
      ->> self.class.included_modules
      -=> [PP::ObjectMixin, Kernel]
      ->> Kernel.class
      -=> Module
      ->> Kernel.methods.grep(/puts/)
      -=> [:puts]
      ->> puts 'Hello Ruby'
      -Hello Ruby
      -=> nil
      ->> self.puts 'Hello World'
      -Hello World
      -=> nil
      +
      +
      % cat gemfeed/2023-02-26-title-here.gmi
      +# Title here
      +
      +The remaining content of the Gemtext file...
       

      -Ruby offers a lot of syntactic sugar and seemingly magic, but it all comes back to objects and messages to objects under the hood. As all is hidden in objects, you can unwrap and even change the magic and see what's happening under the hood. Then, suddenly everything makes so much sense.
      -
      -

      Functional programming


      +Gemtexter will add a line starting with > Published at ... now. Any subsequent Atom feed generation will then use that date.

      -Ruby embraces an object-oriented programming style. But there is good news for fans of the functional programming paradigm: From immutable data (frozen objects), pure functions, lambdas and higher-order functions, lazy evaluation, tail-recursion optimization, method chaining, currying and partial function application, all of that is there. I am delighted about that, as I am a big fan of functional programming (having played with Haskell and Standard ML before).
      + +
      % cat gemfeed/2023-02-26-title-here.gmi
      +# Title here
      +
      +> Published at 2023-02-26T21:43:51+01:00
      +
      +The remaining content of the Gemtext file...
      +

      -Remember, however, that Ruby is not a pure functional programming language. You, the Rubyist, need to explicitly decide when to apply a functional style, as, by heart, Ruby is designed to be an object-oriented language. The language will not enforce side effect avoidance, and you will have to enable tail-recursion optimization (as of Ruby 2.5) explicitly, and variables/objects aren't immutable by default either. But that all does not hinder you from using these features.
      +

      XMLLint support



      -I liked this book so much so that I even bought myself a (used) paper copy of it. To my delight, there was also a free eBook version in ePub format included, which I now have on my Kobo Forma eBook reader. :-)
      +Optionally, when the xmllint binary is installed, Gemtexter will perform a simple XML lint check against the Atom feed generated. This is a double-check of whether the Atom feed is a valid XML.

      -

      Perl


      +

      More



      -Will I abandon my beloved Perl? Probably not. There are also some Perl scripts I use at work. But unfortunately I only have a limited amount of time and I have to use it wisely. I might look into Raku (formerly known as Perl 6) next year and use it for a personal pet project, who knows. :-). I also highly recommend reading the two Perl books "Modern Perl" and "Higher-Order Perl".
      +Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.

      E-Mail your comments to paul@nospam.buetow.org :-)

      +Other related posts are:
      +
      +2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴
      +2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
      +2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again² (You are currently reading this)
      +2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
      +2021-06-05 Gemtexter - One Bash script to rule it all
      +2021-04-24 Welcome to the Geminispace
      +
      Back to the main site
      - Gemtexter - One Bash script to rule it all - - https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html - 2021-06-05T19:03:32+01:00 + 'The Pragmatic Programmer' book notes + + https://foo.zone/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html + 2023-03-16T00:55:20+02:00 Paul Buetow aka snonux paul@dev.buetow.org - You might have read my previous blog posts about entering the Geminispace, where I pointed out the benefits of having and maintaining an internet presence there. This whole site (the blog and all other pages) is composed in the Gemtext markup language. + These are my personal takeaways after reading 'The Pragmatic Programmer' by David Thomas and Andrew Hunt. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.
      -

      Gemtexter - One Bash script to rule it all


      -
      -Published at 2021-06-05T19:03:32+01:00
      -
      -
      -                                                               o .,<>., o
      -                                                               |\/\/\/\/|
      -                                                               '========'
      -                                                               (_ SSSSSSs
      -                                                               )a'`SSSSSs
      -                                                              /_   SSSSSS
      -                                                              .=## SSSSS
      -                                                              .####  SSSSs
      -                                                              ###::::SSSSS
      -                                                             .;:::""""SSS
      -                                                            .:;:'  . .  \\
      -                                                           .::/  '     .'|
      -                                                          .::( .         |
      -                                                          :::)           \
      -                                                          /\(            /
      -                                                         /)            ( |
      -                                                       .'  \  .       ./ /
      -                                                    _-'    |\  .        |
      -                                  _..--..   .  /"---\      | ` |      . |
      -          -=====================,' _     \=(*#(7.#####()   |  `/_..   , (
      -                      _.-''``';'-''-) ,.  \ '  '+/// |   .'/   \  ``-.) \
      -                    ,'  _.-  ((    `-'  `._\    `` \_/_.'  )    /`-._  ) |
      -                  ,'\ ,'  _.'.`:-.    \.-'                 /   <_L   )"  |
      -                _/   `._,' ,')`;  `-'`'                    |     L  /    /
      -               / `.   ,' ,|_/ / \                          (    <_-'     \
      -               \ / `./  '  / /,' \                        /|`         `. |
      -               )\   /`._   ,'`._.-\                       |)            \'
      -              /  `.'    )-'.-,' )__)                      |\            `|
      -             : /`. `.._(--.`':`':/ \                      ) \             \
      -             |::::\     ,'/::;-))  /                      ( )`.            |
      -             ||:::::  . .::':  :`-(                       |/    .          |
      -             ||::::|  . :|  |==[]=:                       .        -       \
      -             |||:::|  : ||  :  |  |                      /\           `     |
      - ___ ___     '|;:::|  | |'   \=[]=|                     /  \                \
      -|   /_  ||``|||:::::  | ;    | |  |                     \_.'\_               `-.
      -:   \_``[]--[]|::::'\_;'     )-'..`._                 .-'\``:: ` .              \
      - \___.>`''-.||:.__,'     SSt |_______`>              <_____:::.         . . \  _/
      -                                                           `+a:f:......jrei'''
      -
      -
      -You might have read my previous blog posts about entering the Geminispace, where I pointed out the benefits of having and maintaining an internet presence there. This whole site (the blog and all other pages) is composed in the Gemtext markup language.
      -
      -This comes with the benefit that I can write content in my favourite text editor (Vim).
      -
      -

      Motivation


      -
      -Another benefit of using Gemini is that the Gemtext markup language is easy to parse. As my site is dual-hosted (Gemini+HTTP), I could, in theory, just write a shell script to deal with the conversion from Gemtext to HTML; there is no need for a full-featured programming language here. I have done a lot of Bash in the past, but I am also often revisiting old tools and techniques for refreshing and keeping the knowledge up to date here.
      -
      -Motivational comic strip
      -
      -I have exactly done that - I wrote a Bash script, named Gemtexter, for that:
      +

      "The Pragmatic Programmer" book notes



      -https://codeberg.org/snonux/gemtexter
      +Published at 2023-03-16T00:55:20+02:00

      -In short, Gemtexter is a static site generator and blogging engine that uses Gemtext as its input format.
      +These are my personal takeaways after reading "The Pragmatic Programmer" by David Thomas and Andrew Hunt. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.

      -

      Output formats


      +
      +         ,..........   ..........,
      +     ,..,'          '.'          ',..,
      +    ,' ,'            :            ', ',
      +   ,' ,'             :             ', ',
      +  ,' ,'              :              ', ',
      + ,' ,'............., : ,.............', ',
      +,'  '............   '.'   ............'  ',
      + '''''''''''''''''';''';''''''''''''''''''
      +                    '''
      +

      -Gemtexter takes the Gemtext Markup files as the input and generates the following outputs from it (you find examples for each of these output formats on the Gemtexter GitHub page):
      +Think about your work while doing it - every day on every project. Have a feeling of continuous improvement.

        -
      • HTML files for my website
      • -
      • Markdown files for a GitHub page
      • -
      • A Gemtext Atom feed for my blog posts
      • -
      • A Gemfeed for my blog posts (a particular feed format commonly used in Geminispace. The Gemfeed can be used as an alternative to the Atom feed).
      • -
      • An HTML Atom feed of my blog posts
      • +
      • Be a realist.
      • +
      • Smell challenges.
      • +
      • Care about your craft.
      • +
      • Code can always be flawed, but it can meet the requirements.
      • +
      • You should be proud of your code, though.

      -I could have done all of that with a more robust language than Bash (such as Perl, Ruby, Go...), but I didn't. The purpose of this exercise was to challenge what I can do with a "simple" Bash script and learn new things.
      -
      -

      Taking it as far as I should, but no farther


      -
      -The Bash is suitable very well for small scripts and ad-hoc automation on the command line. But it is for sure not a robust programming language. Writing this blog post, Gemtexter is nearing 1000 lines of code, which is actually a pretty large Bash script.
      -
      -

      Modularization


      -
      -I modularized the code so that each core functionality has its own file in ./lib. All the modules are included from the main Gemtexter script. For example, there is one module for HTML generation, one for Markdown generation, and so on.
      -
      - -
      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.
      -
      -

      Bash best practises and ShellCheck


      -
      -While working on Gemtexter, I also had a look at the Google Shell Style Guide and wrote a blog post on that:
      -
      -Personal bash coding style guide
      -
      -I followed all these best practices, and in my opinion, the result is a pretty maintainable Bash script (given that you are fluent with all the sed and grep commands I used).
      -
      -ShellCheck, a shell script analysis tool written in Haskell, is run on Gemtexter ensuring that all code is acceptable. I am pretty impressed with what ShellCheck found.
      -
      -It, for example, detected "some_command | while read var; do ...; done" loops and hinted that these create a new subprocess for the while part. The result is that all variable modifications taking place in the while-subprocess won't reflect the primary Bash process. ShellSheck then recommended rewriting the loop so that no subprocess is spawned as "while read -r var; do ...; done < <(some_command)". ShellCheck also pointed out to add a "-r" to "read"; otherwise, there could be an issue with backspaces in the loop data.
      -
      -Furthermore, ShellCheck recommended many more improvements. Declaration of unused variables and missing variable and string quotations were the most common ones. ShellSheck immensely helped to improve the robustness of the script.
      -
      -https://shellcheck.net
      -
      -

      Unit testing


      -
      -There is a basic unit test module in ./lib/assert.source.sh, which is used for unit testing. I found this to be very beneficial for cross-platform development. For example, I noticed that some unit tests failed on macOS while everything still worked fine on my Fedora Linux laptop.
      -
      -After digging a bit, I noticed that I had to install the GNU versions of the sed and grep commands on macOS and a newer version of the Bash to make all unit tests pass and Gemtexter work.
      +No one writes perfect code, including you. However:

      -It has been proven quite helpful to have unit tests in place for the HTML part already when working on the Markdown generator part. To test the Markdown part, I copied the HTML unit tests and changed the expected outcome in the assertions. This way, I could implement the Markdown generator in a test-driven way (writing the test first and afterwards the implementation).
      +
        +
      • Paranoia is good thinking.
      • +
      • Practice defensive programming and crash early.
      • +
      • Crashing is often the best thing you can do.
      • +
      • Changes should be reversible.
      • +

      +Erlang: Defensive programming is a waste of time. Let it crash. "This can never happen" - don't practise that kind of self-deception when programming.

      -

      HTML unit test example


      +Leave assertions in the code, even in production. Only leave out the assertions causing the performance issues.

      - -
      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 />'
      -
      +Take small steps, always. Get feedback, too, for each of the steps the code does. Avoid fortune telling. If you have to involve in it, then the step is too large.

      -

      Markdown unit test example


      +Decouple the code (e.g. OOP or functional programming). Prefer interfaces for types and mixins for a class extension over class inheritance.

      - -
      gemtext='=> http://example.org Description of the link'
      -assert::equals "$(generate::make_link md "$gemtext")" \
      -    '[Description of the link](http://example.org)  '
      -
      +
        +
      • Refactor now and not later.
      • +
      • Later, it will be even more painful.
      • +

      +Don't think outside the box. Find the box. The box is more extensive than you think. Think about the hard problem at hand. Do you have to do it a certain way, or do you have to do it at all?

      -

      Handcrafted HTML styles


      +Do what works and not what's fashionable. E.g. does SCRUM make sense? The goal is to deliver deliverables and not to "become" agile.

      -I had a look at some ready off the shelf CSS styles, but they all seemed too bloated. There is a whole industry selling CSS styles on the interweb. I preferred an effortless and minimalist style for the HTML site. So I handcrafted the Cascading Style Sheets manually with love and included them in the HTML header template.
      +

      Continuous learning



      -For now, I have to re-generate all HTML files whenever the CSS changes. That should not be an issue now, but I might move the CSS into a separate file one day.
      +Add new tools to your repertoire every day and keep the momentum up. Learning new things is your most crucial aspect. Invest regularly in your knowledge portfolio. The learning process extends your thinking. It does not matter if you will never use it.

      -It's worth mentioning that all generated HTML files and Atom feeds pass the W3C validation tests.
      -
      -

      Configurability


      +
        +
      • Learn a new programming language every year.
      • +
      • Read a technical book every month.
      • +
      • Take courses.
      • +

      +Think critically about everything you learn. Use paper for your notes. There is something special about it.

      -In case someone else than me wants to use Gemtexter for his own site, it is pretty much configurable. It is possible to specify your own configuration file and your own HTML templates. Have a look at the GitHub page for examples.
      +

      Stay connected



      -

      Future features


      +It's your life, and you own it. Bruce Lee once said:

      -I could think of the following features added to a future version of Gemtexter:
      +"I am not on the world to life after your expectations, neither are you to life after mine."

        -
      • Templating of Gemtext files so that the .html files are generated from .gmi.tpl files. The template engine could do such things as an automatic table of contents and sitemap generation. It could also include the output of inlined shell code, e.g. a fortune quote.
      • -
      • Add support for more output formats, such as Groff, PDF, plain text, Gopher, etc.
      • -
      • External CSS file for HTML.
      • -
      • Improve speed by introducing parallelism and/or concurrency and/or better caching.
      • +
      • Go to meet-ups and actively engage.
      • +
      • Stay current.
      • +
      • Dealing with computers is hard. Dealing with people is harder.

      -

      Conclusion


      +It's your life. Share it, celebrate it, be proud and have fun.

      -It was quite a lot of fun writing Gemtexter. It's a relatively small project, but given that I worked on that in my spare time once in a while, it kept me busy for several weeks.
      +

      The story of stone soup



      -I finally revamped my personal internet site and started to blog again. I wanted the result to be exactly how it is now: A slightly retro-inspired internet site built for fun with unconventional tools.
      +How to motivate others to contribute something (e.g. ideas to a startup):

      -Other related posts are:
      +A kindly, old stranger was walking through the land when he came upon a village. As he entered, the villagers moved towards their homes, locking doors and windows. The stranger smiled and asked, why are you all so frightened. I am a simple traveler, looking for a soft place to stay for the night and a warm place for a meal. "There's not a bite to eat in the whole province," he was told. "We are weak and our children are starving. Better keep moving on." "Oh, I have everything I need," he said. "In fact, I was thinking of making some stone soup to share with all of you." He pulled an iron cauldron from his cloak, filled it with water, and began to build a fire under it. Then, with great ceremony, he drew an ordinary-looking stone from a silken bag and dropped it into the water. By now, hearing the rumor of food, most of the villagers had come out of their homes or watched from their windows. As the stranger sniffed the "broth" and licked his lips in anticipation, hunger began to overcome their fear. "Ahh," the stranger said to himself rather loudly, "I do like a tasty stone soup. Of course, stone soup with cabbage -- that's hard to beat." Soon a villager approached hesitantly, holding a small cabbage he'd retrieved from its hiding place, and added it to the pot. "Wonderful!!" cried the stranger. "You know, I once had stone soup with cabbage and a bit of salt beef as well, and it was fit for a king." The village butcher managed to find some salt beef . . . And so it went, through potatoes, onions, carrots, mushrooms, and so on, until there was indeed a delicious meal for everyone in the village to share. The village elder offered the stranger a great deal of money for the magic stone, but he refused to sell it and traveled on the next day. As he left, the stranger came upon a group of village children standing near the road. He gave the silken bag containing the stone to the youngest child, whispering to a group, "It was not the stone, but the villagers that had performed the magic."

      -2021-04-24 Welcome to the Geminispace
      -2021-05-16 Personal Bash coding style guide
      -2021-06-05 Gemtexter - One Bash script to rule it all (You are currently reading this)
      -2021-11-29 Bash Golf Part 1
      -2022-01-01 Bash Golf Part 2
      -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
      -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
      -2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
      +By working together, everyone contributes what they can, achieving a greater good together.

      E-Mail your comments to paul@nospam.buetow.org :-)

      +Other book notes of mine are:
      +
      +2024-10-24 "Staff Engineer" book notes
      +2024-07-07 "The Stoic Challenge" book notes
      +2024-05-01 "Slow Productivity" book notes
      +2023-11-11 "Mind Management" book notes
      +2023-07-17 "Software Developmers Career Guide and Soft Skills" book notes
      +2023-05-06 "The Obstacle is the Way" book notes
      +2023-04-01 "Never split the difference" book notes
      +2023-03-16 "The Pragmatic Programmer" book notes (You are currently reading this)
      +
      Back to the main site
      - Personal Bash coding style guide - - https://foo.zone/gemfeed/2021-05-16-personal-bash-coding-style-guide.html - 2021-05-16T14:51:57+01:00 + How to shut down after work + + https://foo.zone/gemfeed/2023-02-26-how-to-shut-down-after-work.html + 2023-02-26T23:48:01+02:00 Paul Buetow aka snonux paul@dev.buetow.org - Lately, I have been polishing and writing a lot of Bash code. Not that I never wrote a lot of Bash, but now as I also looked through the Google Shell Style Guide, I thought it is time also to write my thoughts on that. I agree with that guide in most, but not in all points. + Do you need help fully discharging from work in the evenings or for the weekend? Shutting down from work won't just improve your work-life balance; it will also significantly improve the quality of your personal life and work. After a restful weekend, you will be much more energized and productive the next working day. So it should not just be in your own, but also your employers' interest that you fully relax and shut down after work.
      -

      Personal Bash coding style guide


      -
      -Published at 2021-05-16T14:51:57+01:00
      +

      How to shut down after work



      -
      -   .---------------------------.
      -  /,--..---..---..---..---..--. `.
      - //___||___||___||___||___||___\_|
      - [j__ ######################## [_|
      -    \============================|
      - .==|  |"""||"""||"""||"""| |"""||
      -/======"---""---""---""---"=|  =||
      -|____    []*          ____  | ==||
      -//  \\               //  \\ |===||  hjw
      -"\__/"---------------"\__/"-+---+'
      -
      -
      -Lately, I have been polishing and writing a lot of Bash code. Not that I never wrote a lot of Bash, but now as I also looked through the Google Shell Style Guide, I thought it is time also to write my thoughts on that. I agree with that guide in most, but not in all points.
      -
      -Google Shell Style Guide
      -
      -

      My modifications


      -
      -These are my modifications to the Google Guide.
      -
      -

      Shebang


      +Published at 2023-02-26T23:48:01+02:00

      -Google recommends using always...
      +Do you need help fully discharging from work in the evenings or for the weekend? Shutting down from work won't just improve your work-life balance; it will also significantly improve the quality of your personal life and work. After a restful weekend, you will be much more energized and productive the next working day. So it should not just be in your own, but also your employers' interest that you fully relax and shut down after work.

      -#!/bin/bash 
      +    |\   "Music should be heard not only with the ears, but also the soul."
      +|---|--\-----------------------|-----------------------------------------|  
      +|   |   |\                     |                   |@     |\             |
      +|---|---|--\-------------------|-------------/|----|------|--\----|------|     
      +|  @|   |   |\          |O     |        3  /  |    |@     |       |      | 
      +|---|--@|---|--\--------|------|---------/----|----|------|-------|------|      
      +|  @|      @|    \      |O     |       / |    |    |@    @|      @|.     | 
      +|-----------|-----|-----|------|-----/---|---@|----|--------------|------|     
      +|          @|     |     |O     |    |    |         |             @|.     | 
      +|-----------|----@|-----|------|----|---@|------------------------|------|  
      +           @|           |           |        Larry Komro         @|.     
      +                                  -@-        [kom...@uwec.edu]
       

      -... 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:
      +

      Table of Contents



      -
      -#!/usr/bin/env bash
      -
      +
      +

      Have a shutdown routine



      -

      Two space soft-tabs indentation


      +Have a routine. Try to finish work around the same time every day. Write any outstanding tasks down for the next day, so you are sure you will remember them. Writing them down brings wonders as you can remove them from your mind for the remainder of the day (or the upcoming weekend) as you know you will surely pick them up the next working day. Tidying up your workplace could also count toward your daily shutdown routine.

      -I know there have been many tab- and soft-tab wars on this planet. Google recommends using two space soft-tabs for Bash scripts.
      +A commute home from the office also greatly helps, as it disconnects your work from your personal life. Don't work on your commute home, though! If you don't commute but work from home, then it helps to walk around the block or in a nearby park to disconnect from work.

      -I don't care if I use two or four space indentations. I agree, however, that we should not use tabs. I tend to use four-space soft-tabs as that's how I currently configured Vim for any programming language. What matters most, though, is consistency within the same script/project.
      +

      Don't work when you officially don't work



      -Google also recommends limiting the line length to 80 characters. For some people, that seems to be an old habit from the '80s, where all computer terminals couldn't display longer lines. But I think that the 80 character mark is still a good practice, at least for shell scripts. For example, I am often writing code on a Microsoft Go Tablet PC (running Linux, of course), and it comes in convenient if the lines are not too long due to the relatively small display on the device.
      +Unless you are self-employed, you have likely signed an N-hour per week contract with your employer, and your regular working times are from X o'clock in the morning to Y o'clock in the evening (with M minutes lunch break in the middle). And there might be some flexibility in your working times, too. But that kind of flexibility (e.g. extending the lunch break so that there is time to pick up a family member from the airport) will be agreed upon, and you will counteract it, for example, by starting working earlier the next day or working late, that one exception. But overall, your weekly working time will stay N hours.

      -I hit the 80 character line length quicker with the four spaces than with two spaces, but that makes me refactor the Bash code more aggressively, which is a good thing.
      +Another exception would be when you are on an on-call schedule and are expected to watch your work notifications out-of-office times. But that is usually only a few days per month and, therefore, not the norm. And it should also be compensated accordingly.

      -

      Breaking long pipes


      +There might be some maintenance work you must carry out, which can only be done over the weekend, but it should be explicitly agreed upon and compensated for. Also, there might be a scenario that a production incident comes up shortly before the end of the work day, requiring you (and your colleagues) to stay a bit longer. But this should be an exceptional case.

      -Google recommends breaking up long pipes like this:
      +Other than that, there is no reason why you should work out-of-office hours. I know many people who suffer "the fear of missing out", so slack messages and E-Mails are checked until late in the evening, during weekends or holidays. I have been improving here personally a lot over the last couple of months, but still, I fall into this trap occasionally.

      -
      -# All fits on one line
      -command1 | command2
      -
      -# Long commands
      -command1 \
      -  | command2 \
      -  | command3 \
      -  | command4
      -
      +Also, when you respond to slack messages and E-Mails, your colleagues can think that you have nothing better to do. They also will take it for granted and keep slacking and messaging you out of regular office times.

      -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:
      +Checking for your messages constantly outside of regular office times makes it impossible to shut down and relax from work altogether.

      -
      -# Long commands
      -command1 |
      -    command2 |
      -    command3 |
      -    command4
      -
      +

      Distract your mind



      -

      Quoting your variables


      +Often, your mind goes back to work-related stuff even after work. That's normal as you concentrated highly on your work throughout the day. The brain unconsciously continues to work and will automatically present you with random work-related thoughts. You can counteract this by focusing on non-work stuff, which may include:

      -Google recommends always quote your variables. Generally, it would be best if you did that only for variables where you are unsure about the content/values of the variables (e.g., content is from an external input source and may contain whitespace or other special characters). In my opinion, the code will become quite noisy when you always quote your variables like this:
      +
        +
      • Exercise. A half an hour workout or yoga session, followed by some stretching, helps to calm your mind after work.
      • +
      • Play (with your family, pets, friends, or video game)
      • +
      • Mindfully listen to music. When have you ever "really" listened to music? I mean, not just as a background stimulation but really paid attention to the melody, rhythm, voice and lyrics? That requires focused attention and distracts you from other thoughts.
      • +
      • Think of or work on that fun passion project. I currently, for example, like to learn and code a bit in Rakulang.
      • +
      • Read. Nothing beats reading a good Science Fiction Novel (or whatever you prefer) before falling asleep.
      • +

      +Some of these can be habit-stacked: Exercise could be combined with watching videos about your passion project (e.g. watching lectures about that new programming language you are currently learning for fun). With walking, for example, you could combine listening to an Audiobook or music, or you could also think about your passion project during that walk.

      -
      -greet () {
      -    local -r greeting="${1}"
      -    local -r name="${2}"
      -    echo "${greeting} ${name}!"
      -}
      -
      +

      Get a pet



      -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:
      +Even if you have children, it helps wonders to get a pet. My cat, for example, will remind me a few times daily to take a few minute's breaks to pet, play or give food. So my cat not only helps me after work but throughout the day.

      -
      -say_hello_to_paul () {
      -    local -r greeting=Hello
      -    local -r name=Paul
      -    echo "$greeting $name!"
      -}
      -
      +My neighbour also works from home, and he has dogs, which he regularly has to take out to the park.

      -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:
      +

      Journal your day



      -
      -declare FOO=bar
      -# Curly braces around FOO are necessary
      -echo "foo${FOO}baz"
      -
      +If you are upset about something, making it impossible to shut down from work, write down everything (e.g., with a pen in a paper journal). Writing things down helps you to "get rid" of the negative. Especially after conflicts with colleagues or company decisions, you don't agree on. This kind of self-therapy is excellent. Brainstorm all your emotions and (even if opinionated) opinions so you have everything on paper. Once done, you don't think about it so much anymore, as you know you can access that information if required. But stopping ruminating about it will be much easier now. You will likely never access that information again, though. But at least writing the thoughts down saved your day.

      -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.
      +Write down three things which went well for the day. This helps you to appreciate the day.

      -

      Prefer built-in commands over external commands


      +

      Don't stress about what your employer expects from you



      -Google recommends using the built-in commands over available external commands where possible:
      +Think about what's fun and motivates you. Maybe the next promotion to Principal or a Manager role isn't for you. Many fall into the trap of stressing themselves out to satisfy the employer so that the next upgrade will happen and think about it constantly, even after work. But it is more important that you enjoy your craftsmanship. Work on what you expect from yourself. Ideally, your goals should be aligned with your employer. I am not saying you should abandon everything what your manager is asking you to do, but it is, after all, your life. And you have to decide where and on what you want to work. But don't sell yourself short. Keep track of your accomplishments.

      -
      -# Prefer this:
      -addition=$(( X + Y ))
      -substitution="${string/#foo/bar}"
      -
      -# Instead of this:
      -addition="$(expr "${X}" + "${Y}")"
      -substitution="$(echo "${string}" | sed -e 's/^foo/bar/')"
      -
      +

      Call it a day



      -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).
      +Every day you gave your best was good; the day's outcome doesn't matter. What matters is that you know you gave your best and are closer to your goals than the previous day. This gives you a sense of progress and accomplishment.

      -I prefer to do light text processing with the Bash built-ins and more complicated text processing with external programs such as sed, grep, awk, cut, and tr. However, there is also medium-light text processing where I would want to use external programs. That is so because I remember using them better than the Bash built-ins. The Bash can get relatively obscure here (even Perl will be more readable then - Side note: I love Perl).
      +There are some days at work you feel drained afterwards and think you didn't progress towards your goals at all. It's more challenging to shut down from work after such a day. A quick hack is to work on a quick win before the end of the day, giving you a sense of accomplishment after all. Another way is to make progress on your fun passion project after work. It must not be work-related, but a sense of accomplishment will still be there.
      +
      +E-Mail your comments to paul@nospam.buetow.org :-)

      -Also, you would like to use an external command for floating-point calculation (e.g., bc) instead of using the Bash built-ins (worth noticing that ZSH supports built-in floating-points).
      +Back to the main site
      +
      +
      +
      + + Why GrapheneOS rox + + https://foo.zone/gemfeed/2023-01-23-why-grapheneos-rox.html + 2023-01-23T15:31:52+02:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + In 2021 I wrote 'On Being Pedantic about Open-Source', and there was a section 'What about mobile?' where I expressed the dilemma about the necessity of using proprietary mobile operating systems. With GrapheneOS, I found my perfect solution for personal mobile phone use. + +
      +

      Why GrapheneOS rox



      -I even didn't get started with what you can do with awk (especially GNU Awk), a fully-fledged programming language. Tiny Awk snippets tend to be used quite often in Shell scripts without honouring the real power of Awk. But if you did everything in Perl or Awk or another scripting language, then it wouldn't be a Bash script anymore, wouldn't it? ;-)
      +Published at 2023-01-23T15:31:52+02:00

      -

      My additions


      +In 2021 I wrote "On Being Pedantic about Open-Source", and there was a section "What about mobile?" where I expressed the dilemma about the necessity of using proprietary mobile operating systems. With GrapheneOS, I found my perfect solution for personal mobile phone use.

      -

      Use of 'yes' and 'no'


      +On Being Pedantic about Open-Source

      -Bash does not support a boolean type. I tend just to use the strings 'yes' and 'no' here. I used 0 for false and 1 for true for some time, but I think that the yes/no strings are easier to read. Yes, the Bash script would need to perform string comparisons on every check, but if performance is crucial to you, you wouldn't want to use a Bash script anyway, correct?
      +What is GrapheneOS?

      -
      -declare -r SUGAR_FREE=yes
      -declare -r I_NEED_THE_BUZZ=no
      -
      -buy_soda () {
      -    local -r sugar_free=$1
      -
      -    if [[ $sugar_free == yes ]]; then
      -        echo 'Diet Dr. Pepper'
      -    else
      -        echo 'Pepsi Coke'
      -    fi
      -}
      -
      -buy_soda $I_NEED_THE_BUZZ
      -
      +GrapheneOS is a privacy and security-focused mobile OS with Android app compatibility developed as a non-profit open-source project. It's focused on the research and development of privacy and security technologies, including substantial improvements to sandboxing, exploits mitigations and the permission model.

      -

      Non-evil alternative to variable assignments via eval


      +GrapheneOS is an independent Android distribution based on the Android Open Source Project (AOSP) but hardened in multiple ways. Other independent Android distributions, like LineageOS, are also based on AOSP, but GrapheneOS takes it further so that it can be my daily driver on my phone.

      -Google is in the opinion that eval should be avoided. I think so too. They list these examples in their guide:
      +https://GrapheneOS.org
      +https://LineageOS.org

      -# 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)"
      -
      +Art by Joan Stark
      +               _.===========================._
      +            .'`  .-  - __- - - -- --__--- -.  `'.
      +        __ / ,'`     _|--|_________|--|_     `'. \
      +      /'--| ;    _.'\ |  '         '  | /'._    ; |
      +     //   | |_.-' .-'.'      ___      '.'-. '-._| |
      +    (\)   \"` _.-` /     .-'`_ `'-.     \ `-._ `"/
      +    (\)    `-'    |    .' .-'" "'-. '.    |    `-`
      +   (\)            |   / .'(3)(2)(1)'. \   |
      +   (\)            |  / / (4) .-.     \ \  |
      +   (\)            |  | |(5) (   )'==,J |  |
      +  (\)             |  \ \ (6) '-' (0) / /  |
      + (\)              |   \ '.(7)(8)(9).' /   |
      + (\)           ___|    '. '-.._..-' .'    |
      + (\)          /.--|      '-._____.-'      |
      +  (\)        (\)  |\_  _  __   _   __  __/|
      + (\)        (\)   |                       |
      +(\)_._._.__(\)    |                       |
      + (\\\\jgs\\\)      '.___________________.'
      +  '-'-'-'--'
       

      -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:
      +

      Table of Contents



      -
      -% cat vars.source.sh
      -declare foo=bar
      -declare bar=baz
      -declare bay=foo
      -
      -% bash -c 'source vars.source.sh; echo $foo $bar $baz'
      -bar baz foo
      -
      +
      +

      User Profiles



      -And suppose I want to assign variables dynamically. In that case, I could just run an external script and source its output (This is how you could do metaprogramming in Bash without the use of eval - write code which produces code for immediate execution):
      +GrapheneOS allows configuring up to 32 user profiles (including a guest profile) on a single phone. A profile is a completely different environment within the phone, and it is possible to switch between them instantly. Sessions of a profile can continue running in the background or be fully terminated. Each profile can have completely different settings and different applications installed.

      -
      -% cat vars.sh
      -#!/usr/bin/env bash
      -cat <<END
      -declare date="$(date)"
      -declare user=$USER
      -END
      -
      -% bash -c 'source <(./vars.sh); echo "Hello $user, it is $date"'
      -Hello paul, it is Sat 15 May 19:21:12 BST 2021
      -
      +I use my default profile with primarily open-source applications installed, which I trust. I use another profile for banking (PayPal, various proprietary bank apps, Amazon store app, etc.) and another profile for various Google services (which I try to avoid, but I have to use once in a while). Furthermore, I have configured a profile for Social Media use (that one isn't in my default profile, as otherwise I am tempted to scroll social media all the time, which I try to avoid and only want to do intentionally when switching to the corresponding profile!).

      -The downside is that ShellCheck won't be able to follow the dynamic sourcing anymore.
      +The neat thing about the profiles is that some can run a sandboxed version of Google Play (see later in this post), while others don't. So some profiles can entirely operate without any Google Play, and only some profiles (to which I rarely switch) have Google Play enabled.

      -

      Prefer pipes over arrays for list processing


      +You notice how much longer (multiple days) your phone can be on a single charge when Google Play Services isn't running in the background. This tells a lot about the background activities and indicates that using Google Play shouldn't be the norm.

      -When I do list processing in Bash, I prefer to use pipes. You can chain them through Bash functions as well, which is pretty neat. Usually, my list processing scripts are of a structure like this:
      +

      Proxying some of the Google offerings



      -
      -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 
      -}
      -
      -# 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
      -}
      -
      -main () {
      -    filter_lines |
      -        process_lines |
      -        postprocess_lines |
      -        generate_report
      -}
      -
      -main
      -
      +There's also the case that I am using an app from the Google Play store (as the app isn't available from F-Droid), which doesn't require Google Play Services to run in the background. Here's where I use the Aurora Android store. The Aurora store can be installed through F-Droid. Aurora acts as an anonymous proxy from your phone to the Google Play Store and lets you install apps from there. No Google credentials are required for that!

      -The stdout is always passed as a pipe to the next following stage. The stderr is used for info logging.
      +https://f-droid.org

      -

      Assign-then-shift


      +There's a similar solution for watching videos on YouTube. You can use the NewPipe app (also from F-Droid), which acts as an anonymous proxy for watching videos from YouTube. So there isn't any need to install the official YouTube app, and there isn't any need to login to your Google account. What's so bad about the official app? You don't know which data it is sending about you to Google, so it is a privacy concern.

      -I often refactor existing Bash code. That leads me to add and removing function arguments quite often. It's pretty repetitive work changing the $1, $2.... function argument numbers every time you change the order or add/remove possible arguments.
      +

      Google Play Sandboxing



      -The solution is to use of the "assign-then-shift"-method, which goes like this: "local -r var1=$1; shift; local -r var2=$1; shift". The idea is that you only use "$1" to assign function arguments to named (better readable) local function variables. You will never have to bother about "$2" or above. That is very useful when you constantly refactor your code and remove or add function arguments. It's something that I picked up from a colleague (a pure Bash wizard) some time ago:
      +Before switching to GrapheneOS, I had been using LineageOS on one of my phones for a couple of years. Still, I always had to have a secondary personal phone with all of these proprietary apps which (partially) only work with Google Play on the phone (e.g. Banking, Navigation, various travel apps from various Airlines, etc.) somewhere around as I didn't install Google Play on my LineageOS phone due to privacy concerns and only installed apps from the F-Droid store on it. When travelling, I always had to carry around a second phone with Google Play on it, as without it; life would become inconvenient pretty soon.

      -
      -some_function () {
      -    local -r param_foo="$1"; shift
      -    local -r param_baz="$1"; shift
      -    local -r param_bay="$1"; shift
      -    ...
      -}
      -
      +With GrapheneOS, it is different. Here, I do not just have a separate user profile, "Google", for various Google apps where Google Play runs, but Google Play also runs in a sandbox!!!

      -Want to add a param_baz? Just do this:
      +GrapheneOS has a compatibility layer providing the option to install and use the official releases of Google Play in the standard app sandbox. Google Play receives no special access or privileges on GrapheneOS instead of bypassing the app sandbox and receiving a massive amount of highly privileged access. Instead, the compatibility layer teaches it how to work within the full app sandbox. It also isn't used as a backend for the OS services as it would be elsewhere since GrapheneOS doesn't use Google Play even when it's installed.

      -
      -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
      -    ...
      -}
      -
      +When I need to access Google Play, I can switch to the "Google" profile. Even there, Google is sandboxed to the absolute minimum permissions required to be operational, which gives additional privacy protection.

      -Want to remove param_foo? Nothing easier than that:
      +The sad truth is that Google Maps is still the best navigation app. When driving unknown routes, I can switch to my Google profile to use Google Maps. I don't need to do that when going streets I know about, but it is crucial (for me) to have Google Maps around when driving to a new destination.

      -
      -some_function () {
      -    local -r param_bar="$1"; shift
      -    local -r param_baz="$1"; shift
      -    local -r param_bay="$1"; shift
      -    ...
      -}
      -
      +Also, Google Translate and Google Lens are still the best translation apps I know. I just recently relocated to another country, where I am still learning the language, so Google Lens has been proven very helpful on various occasions by ad-hoc translating text into English or German for me.

      -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.
      +The same applies to banking. Many banking apps require Google Play to be available (It might be even more secure to only use banking apps from the Google Play store due to official support and security updates). I rarely need to access my mobile banking app, but once in a while, I need to. As you have guessed by now, I can switch to my banking profile (with Google Play enabled), do what I need to do, and then terminate the session and go back to my default profile, and then my life can go on :-).

      -

      Paranoid mode


      +It is great to have the flexibility to use any proprietary Android app when needed. That only applies to around 1% of my phone usage time, but you often don't always know when you need "that one app now". So it's perfect that it's covered with the phone you always have with you.

      -I call this the paranoid mode. The Bash will stop executing when a command exits with a status not equal to 0:
      +

      The camera and the cloud



      -
      -set -e
      -grep -q foo <<< bar
      -echo Jo
      -
      +I really want my phone to shoot good looking pictures, so that I can later upload them to the Irregular Ninja:

      -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:
      +https://irregular.ninja

      -
      -#!/usr/bin/env bash
      -
      -set -e
      -
      -some_function () {
      -    .. some critical code
      -    ...
      -
      -    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
      -    ...
      -}
      -
      +The stock camera app of the OASP could be better. Photos usually look washed out, and the app lacks features. With GrapheneOS, there are two options:

      -

      Learned


      +
        +
      • Use the official Google camera app with sandboxed Google Play Services running. You will get the full Google experience here.
      • +
      • Or, just use the default GrapheneOS camera app.
      • +

      +The GrapheneOS camera app is much better than the stock OASP camera app. I have been comparing the photo quality of my Pixel phone under LineageOS and GrapheneOS, and the differences are pronounced. I didn't compare the quality with the official Google camera app, but I have seen some comparison videos and the differences seem like they aren't groundbreaking.

      -There are also a couple of things I've learned from Google's guide.
      +For automatic backups of my photos, I am relying on a self-hosted instance of NextCloud (with a client app available via F-Droid). So there isn't any need to rely on any Google apps and services (Google Play Photos or Google Camera app) anymore, and that's great!

      -

      Unintended lexicographical comparison.


      +https://nextcloud.com

      -The following looks like a valid Bash code:
      +I also use NextCloud to synchronize my notes (NextCloud Notes), my RSS news feeds (NextCloud News) and contacts (DAVx5). All apps required are available in the F-Droid store.

      -
      -if [[ "${my_var}" > 3 ]]; then
      -    # True for 4, false for 22.
      -    do_something
      -fi
      -
      +

      Fine granular permissions



      -... but it is probably an unintended lexicographical comparison. A correct way would be:
      +Another great thing about GrapheneOS is that, besides putting your apps into different profiles, you can also restrict network access and configure storage scopes per app individually.

      -
      -if (( my_var > 3 )); then
      -    do_something
      -fi
      -
      +For example, let's say you are installing that one proprietary app from the Google Play Store through the Aurora store, and then you want to ensure that the app doesn't send data "home" through the internet. Nothing is easier to do than that. Just remove network access permissions from that only app.

      -or
      +The app also wants to store and read some data from your phone (e.g. it could be a proprietary app for enhancing photos, and therefore storage access to a photo folder would be required). In GrapheneOS, you can configure a storage scope for that particular app, e.g. only read and write from one folder but still forbid access to all other folders on your phone.

      -
      -if [[ "${my_var}" -gt 3 ]]; then
      -    do_something
      -fi
      -
      +

      Termux



      -

      PIPESTATUS


      +Termux can be installed on any Android phone through F-Droid, so it doesn't need to be a GrapheneOS phone. But I have to mention Termux here as it significantly adds value to my phone experience.

      -I have never used the PIPESTATUS variable before. I knew that it's there, but I never bothered to understand how it works until now thoroughly.
      +Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.

      -The PIPESTATUS variable in Bash allows checking of the return code from all parts of a pipe. If it's only necessary to check the success or failure of the whole pipe, then the following is acceptable:
      +https://termux.dev

      -
      -tar -cf - ./* | ( cd "${dir}" && tar -xf - )
      -if (( PIPESTATUS[0] != 0 || PIPESTATUS[1] != 0 )); then
      -    echo "Unable to tar files to ${dir}" >&2
      -fi
      -
      +In short, Termux is an entire Linux environment running on your Android phone. Just pair your phone with a Bluetooth keyboard, and you will have the whole Linux experience. I am only using terminal Linux applications with Termux, though. What makes it especially great is that I could write on a new blog post (in Neovim through Termux on my phone) or do some coding whilst travelling (e.g. during a flight), or look up my passwords or some other personal documents (through my terminal-based password manager). All changes I commit to Git can be synced to the server with a simple git push once online (e.g. after the plane landed) again.

      -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).
      +There are Pixel phones with a screen size of 6", and that's decent enough for occasional use like that, and everything (the phone, the BT keyboard, maybe an external battery pack) all fit nicely in a small travel pocket.

      -
      -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
      -
      +

      So, why not use a pure Linux phone?



      -

      Use common sense and BE CONSISTENT.


      +Strictly speaking, an Android phone is a Linux phone, but it's heavily modified and customized. For me, a "pure" Linux phone is a more streamlined Linux kernel running in a distribution like Ubuntu Touch or Mobian.

      -The following two paragraphs are thoroughly quoted from the Google guidelines. But they hit the hammer on the head:
      +A pure Linux phone, e.g. with Ubuntu Touch installed, e.g. on a PinePhone, Fairphone, the Librem 5 or the Volla phone, is very appealing to me. And they would also provide an even better Linux experience than Termux does. Some support running LineageOS within an Anbox, enabling you to run various proprietary Android apps occasionally within Linux.

      -If you are editing code, take a few minutes to look at the code around you and determine its style. If they use spaces around their if clauses, you should, too. If their comments have little boxes of stars around them, make your comments have little boxes of stars around them too.
      +Ubuntu Touch
      +More Linux distributions for mobile devices

      -The point of having style guidelines is to have a common vocabulary of coding so people can concentrate on what you are saying rather than on how you are saying it. We present global style rules here, so people know the vocabulary. But local style is also important. If the code you add to a file looks drastically different from the existing code around it, the discontinuity throws readers out of their rhythm when they go to read it. Try to avoid this.
      +But here, Google Play would not be sandboxed; you could not configure individual network permissions and storage scopes like in GrapheneOS. Pure Linux-compatible phones usually come with a crappy camera, and the battery life is generally pretty bad (only a few hours). Also, no big tech company pushes the development of Linux phones. Everything relies on hobbyists, whereas multiple big tech companies put a lot of effort into the Android project, and a lot of code also goes into the Android Open-Source project.

      +Currently, pure Linux phones are only a nice toy to tinker with but are still not ready (will they ever?) to be the daily driver. SailfishOS may be an exception; I played around with it in the past. It is pretty usable, but it's not an option for me as it is partial a proprietary operating system.

      -

      Advanced Bash learning pro tip


      +SailfishOS

      -I also highly recommend having a read through the "Advanced Bash-Scripting Guide" (not from Google). I use it as the universal Bash reference and learn something new every time I look at it.
      +

      Small GrapheneOS downsides



      -Advanced Bash-Scripting Guide
      +Sometimes, switching a profile to use a different app is annoying, and you can't copy and paste from the system clipboard from one profile to another. But that's a small price I am willing to pay!

      -Other related posts are:
      +Another thing is that GrapheneOS can only run on Google Pixel phones, whereas LineageOS can be installed on a much larger variety of hardware. But on the other hand, GrapheneOS works very well on Pixel phones. The GrapheneOS team can concentrate their development efforts on a smaller set of hardware which then improves the software's quality (best example: The camera app).

      -2021-05-16 Personal Bash coding style guide (You are currently reading this)
      -2021-06-05 Gemtexter - One Bash script to rule it all
      -2021-11-29 Bash Golf Part 1
      -2022-01-01 Bash Golf Part 2
      +And, of course, GrapheneOS is an open-source project. This is a good thing; however, on the other side, nobody can guarantee that the OS will not break or will not damage your phone. You have to trust the GrapheneOS project and donate to the project so they can keep up with the great work. But I rather trust the GrapheneOS team than big tech.

      E-Mail your comments to paul@nospam.buetow.org :-)

      @@ -8046,104 +8093,138 @@ fi - Welcome to the Geminispace - - https://foo.zone/gemfeed/2021-04-24-welcome-to-the-geminispace.html - 2021-04-24T19:28:41+01:00 + (Re)learning Java - My takeaways + + https://foo.zone/gemfeed/2022-12-24-ultrarelearning-java-my-takeaways.html + 2022-12-24T23:18:40+02:00 Paul Buetow aka snonux paul@dev.buetow.org - ASCII Art by Andy Hood! + As a regular participant in the annual Pet Project competition at work, I always try to find a project where I can learn something new. In this post, I would like to share my takeaways after revisiting Java. You can read about my motivations in my 'Creative universe' post:
      -

      Welcome to the Geminispace


      +

      (Re)learning Java - My takeaways



      -Published at 2021-04-24T19:28:41+01:00; Updated at 2021-06-18
      +Published at 2022-12-24T23:18:40+02:00

      -ASCII Art by Andy Hood!
      +As a regular participant in the annual Pet Project competition at work, I always try to find a project where I can learn something new. In this post, I would like to share my takeaways after revisiting Java. You can read about my motivations in my "Creative universe" post:

      -Have you reached this article already via Gemini? It requires a Gemini client; web browsers such as Firefox, Chrome, Safari, etc., don't support the Gemini protocol. The Gemini address of this site (or the address of this capsule as people say in Geminispace) is:
      +Creative universe

      -https://foo.zone
      +I have been programming in Java back in the days as a university student, and even my Diploma Thesis I implemented in Java (it would require some overhaul so that it is fully compatible with a recent version of Java, though - It still compiles and runs, but with a lot of warnings, though!):

      -However, if you still use HTTP, you are just surfing the fallback HTML version of this capsule. In that case, I suggest reading on what this is all about :-).
      +VS-Sim: Distributed systems simulator

      -
      -    /\
      -   /  \
      -  |    |
      -  |NASA|
      -  |    |
      -  |    |
      -  |    |
      - '      `
      - |Gemini|
      - |      |
      - |______|
      -  '-`'-`   .
      -  / . \'\ . .'
      - ''( .'\.' ' .;'
      -'.;.;' ;'.;' ..;;' AsH
      -
      -
      +However, after that, I became a Linux Sysadmin and mainly continued programming in Perl, Puppet, bash, and a little Python. For personal use, I also programmed a bit in Haskell and C. After my Sysadmin role, I moved to London and became a Site Reliability Engineer (SRE), where I mainly programmed in Ruby, bash, Puppet and Golang and a little bit of C.
      +
      +At my workplace, as an SRE, I don't do Java a lot. I have been reading Java code to understand the software better so I can apply and suggest workarounds or fixes to existing issues and bugs. However, most of our stack is in Java, and our Software Engineers use Java as their primary programming language.
      +
      +
      +
      +

      Table of Contents


      +
      +
      +

      Stuck at Java 1.4


      +
      +Over time, I had been missing out on many new features that were added to the language since Java 1.4, so I decided to implement my next Pet Project in Java and learn every further aspect of the language as my main goal. Of course, I still liked the idea of winning a Pet Project Prize, but my main objective was to level up my Java skills.
      +
      +

      (Re)learning & upskilling to Java 18


      +
      +

      Effective Java


      +
      +This book was recommended by my brother and also by at least another colleague at work to be one of the best, if not the best, book about Java programming. I read the whole book from the beginning to the end and immersed myself in it. I fully agree; this is a great book. Every Java developer or Java software engineer should read it!
      +
      +

      -

      Motivation


      +I recommend reading the 90-part effective Java Series on dev.to. It's a perfect companion to the book as it explains all the chapters again but from a slightly different perspective and helps you to really understand the content.
      +
      +Kyle Carter's 90-part Effective Java Series

      -

      My urge to revamp my personal website


      +

      Java Pub House



      -For some time, I had to urge to revamp my personal website. Not to update the technology and its design but to update all the content (+ keep it current) and start a small tech blog again. So unconsciously, I began to search for an excellent platform to do all of that in a KISS (keep it simple & stupid) way.
      +During my lunch breaks, I usually have a walk around the block or in a nearby park. I used that time to listen to the Java Pub House podcast. I listened to *every* episode and learned tons of new stuff. I can highly recommend this podcast. Especially GraalVM, a high-performance JDK distribution written for Java and other JVM languages, captured my attention. GraalVM can compile Java code into native binaries, improving performance and easing the distribution of Java programs. Because of the latter, I should release a VS-Sim GraalVM edition one day through a Linux AppImage ;-).

      -

      My still great Laptop running hot


      +https://www.javapubhouse.com
      +https://www.graalvm.org

      -Earlier this year (2021), I noticed that my almost seven-year-old but still great Laptop started to become hot and slowed down while surfing the web. Also, the Laptop's fan became quite noisy. This was all due to the additional bloat such as JavaScript, excessive use of CSS, tracking cookies+pixels, ads, and so on there was on the website.
      +

      Java Concurrency course



      -All I wanted was to read an interesting article, but after a big advertising pop-up banner appeared and made everything worse, I gave up and closed the browser tab.
      +I also watched a course on O'Reilly Safari Books online about Java Concurrency. That gave an excellent refresher on how the Java thread pools work and what were the concurrency primitives available in the standard library.

      -

      Discovering the Gemini internet protocol


      +

      Read a lot of Java code



      -Around the same time, I discovered a relatively new, more lightweight protocol named Gemini, which does not support all these CPU-intensive features like HTML, JavaScript, and CSS. Also, tracking and ads are unsupported by the Gemini protocol.
      +First, the source code is often the best documentation (if programmed nicely), and second, it helps to get the hang of the language and standard practices. I started to read more and more Java code at work. I did that whenever I had to understand how something, in particular, worked (e.g. while troubleshooting and debugging an issue).

      -The "downside" is that due to the limited capabilities of the Gemini protocol, all sites look very old and spartan. But that is not a downside; that is, in fact, a design choice people made. It is up to the client software how your capsule looks. For example, you could use a graphical client, such as Lagrange, with nice font renderings and colours to improve the appearance. Or you could use a very minimalistic command line black-and-white Gemini client. It's your (the user's) choice.
      +

      Observed Java code reviews



      -Screenshot Amfora Gemini terminal client surfing this site
      -Screenshot graphical Lagrange Gemini client surfing this site
      +Another great way to get the hang of Java again was to sneak into the code reviews of the Software Engineer colleagues. They are the expert on the matter and are a great source to copy knowledge. It's OK to stay passive and only follow the reviews. Sometimes, it's OK to step up and take ownership of the review. The developers will also always be happy to answer any naive questions which come up.

      -Why is there a need for a new protocol? As the modern web is a superset of Gemini, can't we use simple HTML 1.0 instead? That's a good and valid question. It is not a technical problem but a human problem. We tend to abuse the features once they are available. You can ensure that things stay efficient and straightforward as long as you are using the Gemini protocol. On the other hand, you can't force every website on the modern web to only create plain and straightforward-looking HTML pages.
      +

      Took ownership of a roadmap-Java project



      -

      My own Gemini capsule


      +Besides my Pet Project, I also took ownership of a regular roadmap Java project at work, making an internal Java service capable of running in Kubernetes. This was a bunch of minor changes and adding a bunch of classes and unit tests dealing with the statelessness and a persistent job queue in Redis. The job also involved reading and understanding a lot of already existing Java code. It wasn't part of my job description, but it was fun, and I learned a lot. The service runs smoothly in production now. Of course, all of my code got reviewed by my Software Engineering colleagues.

      -As it is effortless to set up and maintain your own Gemini capsule (Gemini server + content composed via the Gemtext markup language), I decided to create my own. What I like about Gemini is that I can use my favourite text editor and get typing. I don't need to worry about the style and design of the presence, and I also don't have to test anything in ten different web browsers. I can only focus on the content! As a matter of fact, I am using the Vim editor + its spellchecker + auto word completion functionality to write this.
      +

      The good



      -This site was generated with Gemtexter. You can read more about it here:
      +From the new language features and syntaxes, there are many personal takeaways, and I can't possibly list them all, but here are some of my personal highlights:

      -Gemtexter - One Bash script to rule it all
      +
        +
      • Static factory methods and public constructors both have their uses, and it pays to understand their relative merits. Often static factories are preferable (cleaner and easier to read), so avoid the reflex to provide public constructors without first considering static factories.
      • +
      • Java streams were utterly new to me. I love how they can help to produce more compact code. But it's challenging to set the line of when enough is enough. Overusing streams can have the opposite effect: Code becomes more complex and challenging to understand. And it is so easy to parallelize the computation of streams by "just" marking the stream as .parallel() (more on that later in this post).
      • +
      • Overall, object-oriented languages tend to include more and more functional paradigms. The functional interfaces, which Java provides now, are fantastic. Their full powers shine in combination with the use of streams. An entire book can be written about Java functional interfaces, so I leave it to you to do any further digging.
      • +
      • Local type inference help to reduce even more boilerplate code. E.g. instead of Hash<String,Hash<String,String>> foo = new Hash<String,Hash<String,String>>(); it's possible to just write var foo = new Hash<String,Hash<String,String>>();
      • +
      • Class inheritance isn't the preferred way anymore to structure reusable code. Now, it's composition over inheritance. E.g. use dependency injection (inject one object to another object through its constructor) or prefer interfaces (which now also support default implementations of methods) over class inheritance. This makes sense to me as I do that already when I program in Ruby.
      • +
      • I learned the try-with-resources pattern. Very useful in ensuring closing resources again correctly. No need anymore for complicated and nested finally-blocks, which used to be almost impossible to get right previously in case of an error condition (e.g. I/O error somewhere deeply nested in an input or output stream).
      • +
      • Optimize only when required. It's considered to be cleaner to prefer immutable variables (declaring them as final). I knew that already, but for Java, it always seemed to be a waste of resources (creating entirely new objects whenever states change), but apparently, it's okay. Java also does many internal tricks for performance optimization here, e.g. interning strings.
      • +
      • I learned about the concept of static member classes and the difference between non-static member classes (also sometimes known as inner classes). Non-static member classes have full access to all members of their outer class (think of closure). In contrast, static member classes act like completely separate classes without such access but provide the benefit of a nested name that can help group functionality in the code.
      • +
      • I learned about the existence of thread-local variables. These are only available to the current thread and aren't shared with other threads.
      • +
      • I learned about the concept of Java modules, which help to structure larger code bases better. The traditional Java packages are different.
      • +
      • I learned to love the new Optional type. I already knew the concept from Haskell, where Maybe would be the corresponding type. Optional helps to avoid null-pointers but comes with some (minimal) performance penalty. So, in the end, you end up with both Optional types and null-pointers in your code (depending on the requirements). But I like to prefer Optional over null-pointer when "no result" is a valid return value from a method.
      • +
      • The enum type is way more powerful than I thought. Initially, I felt an enum could only be used to define a list of constants and then to compare an instance to another instance of the same. An enum is still there to define a list of constants, but it's also almost like a class (you can implement constructors, and methods, inherit from other enums). There are quite a lot of possible use cases.
      • +
      • A small but almost the most helpful thing I learned is always to use the @Override annotation when overriding a method from a parent class. If done, Java helps to detect any typos or type errors when overriding methods. That's useful and spares a lot of time debugging where a method was mistakenly overloaded but not overridden.
      • +
      • Lambdas are much cleaner, shorter and easier to read than anonymous classes. Many Java libraries require passing instances of (anonymous) classes (e.g. in Swing) to other objects. Lambdas are so lovely because they are primarily compatible with the passing of anonymous classes, so they are a 1:1 replacement in many instances. Lambdas also play very nicely together with the Java functional interfaces, as each Lambda got a type, and the type can be an already existing functional interface (or, if you got a particular case, you could define your custom functional interface for your own set of Lambdas, of course).
      • +
      • I love the concept of Java records. You can think of a record as an immutable object holding some data (as members). They are ideal for pipe and stream processing. They are much easier to define (with much less boilerplate) and come with write protection out of the box.
      • +

      +

      The bad and the ugly



      -

      Gemini advantages summarised


      +There are also many ugly corners in Java. Many are doomed to stay there forever due to historical decisions and ensuring backward compatibility with older versions of the Java language and the Java standard library.

        -
      • Supports an alternative to the modern bloated web
      • -
      • Easy to operate and easy to write content
      • -
      • No need to worry about various web browser compatibilities
      • -
      • It's the client's responsibility how the content is designed+presented
      • -
      • Lightweight (although not as lightweight as the Gopher protocol)
      • -
      • Supports privacy (no cookies, no request header fingerprinting, TLS encryption)
      • -
      • Fun to play with (it's a bit geeky, yes, but a lot of fun!)
      • +
      • Finalizers and cleaners seem obsolete, fragile and still, you can use them.
      • +
      • In many cases, extreme caution needs to be taken to minimize the accessibility of class members. You might think that Java provides the best "out-of-the-box" solution for proper encapsulation, but the language has many loopholes.
      • +
      • In the early days, Java didn't support generics yet. So what you would use is to cast everything to Object. Java now fully supports generics (for a while already), but you can still cast everything to Object and back to whatever type you want. That can lead to nasty runtime errors. Also, there's a particular case to convert between an Array of Object to an Array of String or from an Array of String to a List of String. Java can't convert between these types automatically, and extreme caution needs to be taken when enforcing so (e.g. through explicit type casts). In many of these cases, Java would print out warnings that need to be manually suppressed via annotations. Programming that way, converting data between old and new best practices, is clunky.
      • +
      • If you don't know what you do, Java streams can be all wrong. Side effects in functions used in streams can be nasty to debug. Also, don't just blindly add a .parallel() to your stream. You need to understand what the stream does and how it exactly works; otherwise, parallelizing a stream can impact the performance drastically (in a negative way). There need to be language constructs preventing you from doing the wrong things. That's so much easier to do it right in a purely functional programming language like Haskell.
      • +
      • Java is a pretty old language (already), so there are many obstacles to consider. There are too many exceptions and different outcomes of how Java code can behave. In most cases, when you write an API, every method you program needs to be documented so the user won't encounter any surprises using your code. Writing and reading a lot of documentation seems to be quite the overhead when the method name is already descriptive.
      • +
      • Java serialization is broken. It works, and the language still supports it, but you better not use Java's native way of object serialization and deserialization. Unbelievable how much can get wrong here, especially regarding security (injecting arbitrary code).
      • +
      • Being a bit spoiled by Golang's Goroutines, I was shocked about the limitations of the Java threads. They are resource hungry, and you can't just spin up millions of them as you would with Goroutines. I knew this limitation of threads already (as it's not a problem of the language but of how threads work in the OS), but still, I was pretty shocked when I got reminded of them again. Of course, there's a workaround: Use asynchronous sockets so that you don't waste a whole thread on a single I/O operation (in my case, waiting for a network response). Golang's runtime does that automatically for you: An OS thread will be re-used for other tasks until the network socket unblocks. Every modern programming language should support lightweight threads or Coroutines like Go's Goroutines.

      -

      Dive into deep Gemini space



      -Check out one of the following links for more information about Gemini. For example, you will find a FAQ that explains why the protocol is named Gemini. Many Gemini capsules are dual-hosted via Gemini and HTTP(S) so that people new to Gemini can sneak peek at the content with a regular web browser. Some people go as far as tri-hosting all their content via HTTP(S), Gemini and Gopher.
      +

      Conclusion



      -https://gemini.circumlunar.space
      -https://gemini.circumlunar.space
      +While (re)learning Java, I felt like a student again and was quite enthusiastic about it initially. I invested around half a year, immersing myself intensively in Java (again). The last time I did that was many years ago as a university student. I even won a Silver Prize at work, implementing a project this year (2022 as of writing this). I feel confident now with understanding, debugging and patching Java code at work, which boosted my debugging and troubleshooting skills.

      -Other related posts are:
      +I don't hate Java, but I don't love programming in it, either. I will, I guess, always see Java as the necessary to get stuff done (reading code to understand how the service works, adding a tiny feature to make my life easier, adding a quick bug fix to overcome an obstacle...).

      -2021-04-24 Welcome to the Geminispace (You are currently reading this)
      -2021-06-05 Gemtexter - One Bash script to rule it all
      -2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
      -2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
      -2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³
      +Although Java has significantly improved since 1.4, its code still tends to be more boilerplate. Not mainly because due to lines of code (Golang code tends to be quite repetitive, primarily when no generics are used), but due to the levels of abstractions it uses. Class hierarchies can be ten classes or deeper, and it is challenging to understand what the code is doing. Good test coverage and much documentation can mitigate the problem partially. Big enterprises use Java, and that also reflects to the language. There are too many libraries and too many abstractions that are bundled with too many legacy abstractions and interfaces and too many exceptions in the library APIs. There's even an external library named Lombok, which aims to reduce Java boilerplate code. Why is there a need for an external library? It should be all part of Java itself.
      +
      +https://projectlombok.org/
      +
      +Java needs a clean cut. The clean cut shall be incompatible with previous versions of Java and only promote modern best practices without all the legacy burden carried around. The same can be said for other languages, e.g. Perl, but in Perl, they already attack the problem with the use of flags which change the behaviour of the language to more modern standards. Or do it like Python, where they had a hard (incompatible) cut from version 2 to version 3. It will be painful, for sure. But that would be the only way I would enjoy using that language as one of my primary languages to code new stuff regularly. Currently, my Java will stay limited to very few projects and the more minor things already mentioned in this post.
      +
      +Am I a Java expert now? No, by far not. But I am better now than before :-).

      E-Mail your comments to paul@nospam.buetow.org :-)

      @@ -8152,131 +8233,143 @@ fi - DTail - The distributed log tail program - - https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program.html - 2021-04-22T19:28:41+01:00 + I tried (Doom) Emacs, but I switched back to (Neo)Vim + + https://foo.zone/gemfeed/2022-11-24-i-tried-emacs-but-i-switched-back-to-neovim.html + 2022-11-24T11:17:15+02:00 Paul Buetow aka snonux paul@dev.buetow.org - This article first appeared at the Mimecast Engineering Blog but I made it available here in my personal internet site too. + As a long-lasting user of Vim (and NeoVim), I always wondered what GNU Emacs is really about, so I decided to try it. I didn't try vanilla GNU Emacs, but Doom Emacs. I chose Doom Emacs as it is a neat distribution of Emacs with Evil mode enabled by default. Evil mode allows Vi(m) key bindings (so to speak, it's emulating Vim within Emacs), and I am pretty sure I won't be ready to give up all the muscle memory I have built over more than a decade.
      -

      DTail - The distributed log tail program


      +

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



      -Published at 2021-04-22T19:28:41+01:00; Updated at 2021-04-26
      +Published at 2022-11-24T11:17:15+02:00; Updated at 2022-11-26

      -DTail logo image
      +As a long-lasting user of Vim (and NeoVim), I always wondered what GNU Emacs is really about, so I decided to try it. I didn't try vanilla GNU Emacs, but Doom Emacs. I chose Doom Emacs as it is a neat distribution of Emacs with Evil mode enabled by default. Evil mode allows Vi(m) key bindings (so to speak, it's emulating Vim within Emacs), and I am pretty sure I won't be ready to give up all the muscle memory I have built over more than a decade.

      -This article first appeared at the Mimecast Engineering Blog but I made it available here in my personal internet site too.
      +GNU Emacs
      +Doom Emacs

      -Original Mimecast Engineering Blog post at Medium
      +I used Doom Emacs for around two months. Still, ultimately I decided to switch back to NeoVim as my primary editor and IDE and Vim (usually pre-installed on Linux-based systems) and Nvi (usually pre-installed on *BSD systems) as my "always available editor" for quick edits. (It is worth mentioning that I don't have a high opinion on whether Vim or NeoVim is the better editor, I prefer NeoVim as it comes with better defaults out of the box, but there is no real blocker to use Vim instead).

      -Running a large cloud-based service requires monitoring the state of huge numbers of machines, a task for which many standard UNIX tools were not really designed. In this post, I will describe a simple program, DTail, that Mimecast has built and released as Open-Source, which enables us to monitor log files of many servers at once without the costly overhead of a full-blown log management system.
      +Vim
      +NeoVim

      -At Mimecast, we run over 10 thousand server boxes. Most of them host multiple microservices and each of them produces log files. Even with the use of time series databases and monitoring systems, raw application logs are still an important source of information when it comes to analysing, debugging, and troubleshooting services.
      +So why did I switch back to the Vi-family?

      -Every engineer familiar with UNIX or a UNIX-like platform (e.g., Linux) is well aware of tail, a command-line program for displaying a text file content on the terminal which is also especially useful for following application or system log files with tail -f logfile.
      +
      +             _/  \    _(\(o
      +             /     \  /  _  ^^^o
      +            /   !   \/  ! '!!!v'
      +           !  !  \ _' ( \____
      +           ! . \ _!\   \===^\)
      +Art by      \ \_!  / __!
      + Gunnar Z.   \!   /    \    <--- Emacs is a giant dragon
      +       (\_      _/   _\ )
      +        \ ^^--^^ __-^ /(__ 
      +         ^^----^^    "^--v'
      +

      -Think of DTail as a distributed version of the tail program which is very useful when you have a distributed application running on many servers. DTail is an Open-Source, cross-platform, fairly easy to use, support and maintain log file analysis & statistics gathering tool designed for Engineers and Systems Administrators. It is programmed in Google Go.
      +

      Table of Contents



      -

      A Mimecast Pet Project


      +
      +

      Emacs is a giant dragon



      -DTail got its inspiration from public domain tools available already in this area but it is a blue sky from-scratch development which was first presented at Mimecast’s annual internal Pet Project competition (awarded with a Bronze prize). It has gained popularity since and is one of the most widely deployed DevOps tools at Mimecast (reaching nearly 10k server installations) and many engineers use it on a regular basis. The Open-Source version of DTail is available at:
      +Emacs feels like a giant dragon as it is much more than an editor or an integrated development environment. Emacs is a whole platform on its own. There's an E-Mail client, an IRC client, or even games you can run within Emacs. And you can also change Emacs within Emacs using its own Lisp dialect, Emacs Lisp (Emacs is programmed in Emacs Lisp). Therefore, Emacs is also its own programming language. You can change every aspect of Emacs within Emacs itself. People jokingly state Emacs is an operating system and that you should directly use it as the init 1 process (if you don't know what the init 1 process is: Under UNIX and similar operating systems, it's the very first userland processed launched. That's usually systemd on Linux-based systems, launchd on macOS, or any other init script or init system used by the OS)!

      -https://dtail.dev
      +In many aspects, Emacs is like shooting at everything with a bazooka! However, I prefer it simple. I only wanted Emacs to be a good editor (which it is, too), but there's too much other stuff in Emacs that I don't need to care about! Vim and NeoVim do one thing excellent: Being great text editors and, when loaded with plugins, decent IDEs, too.

      -Try it out — We would love any feedback. But first, read on…
      +

      Magit love



      -

      Differentiating from log management systems


      +I almost fell in love with Magit, an integrated Git client for Emacs. But I think the best way to interact with Git is to use the git command line directly. I don't worry about typing out all the commands, as the most commonly used commands are in my shell history. Other useful Git programs I use frequently are bit and tig. Also, get a mechanical keyboard that makes hammering whole commands into the terminal even more enjoyable.

      -Why not just use a full-blown log management system? There are various Open-Source and commercial log management solutions available on the market you could choose from (e.g. the ELK stack). Most of them store the logs in a centralized location and are fairly complex to set up and operate. Possibly they are also pretty expensive to operate if you have to buy dedicated hardware (or pay fees to your cloud provider) and have to hire support staff for it.
      +Magit
      +Tig

      -DTail does not aim to replace any of the log management tools already available but is rather an additional tool crafted especially for ad-hoc debugging and troubleshooting purposes. DTail is cheap to operate as it does not require any dedicated hardware for log storage as it operates directly on the source of the logs. It means that there is a DTail server installed on all server boxes producing logs. This decentralized comes with the direct advantages that there is no introduced delay because the logs are not shipped to a central log storage device. The reduced complexity also makes it more robust against outages. You won’t be able to troubleshoot your distributed application very well if the log management infrastructure isn’t working either.
      +Magit is pretty neat for basic Git operations, but I found myself searching the internet for the correct sub-commands to do the things I wanted to do in Git. Mainly, the way how branches are managed is confusing. Often, I fell back to the command line to fix up the mess I produced with Magit (e.g. accidentally pushing to the wrong remote branch, so I found myself fixing things manually on the terminal with the git command with forced pushes....). Magit is hotkey driven, and common commands are quickly explorable through built-in hotkey menus. Still, I found it challenging to navigate to more advanced Git sub-commands that way which was much easier accomplished by using the git command directly.

      -DTail sample session animated gif
      +

      Graphical UI



      -As a downside, you won’t be able to access any logs with DTail when the server is down. Furthermore, a server can store logs only up to a certain capacity as disks will fill up. For the purpose of ad-hoc debugging, these are not typically issues. Usually, it’s the application you want to debug and not the server. And disk space is rarely an issue for bare metal and VM-based systems these days, with sufficient space for several weeks’ worth of log storage being available. DTail also supports reading compressed logs. The currently supported compression algorithms are gzip and zstd.
      +If there is one thing I envy about Emacs is that it's a graphical program, whereas the Vi-family of editors are purely terminal-based. I see the benefits of being a graphical program as this enables the use of multiple fonts simultaneously to embed pictures and graphs (that would be neat as a Markdown preview, for example). There's also GVim (Vim with GTK UI), but that's more of an afterthought.

      -

      Combining simplicity, security and efficiency


      +There are now graphical front-end clients for NeoVim, but I still need to dig into them. Let me know your experience if you have one. Luckily, I don't rely on something graphical in my text editor, but it would improve how the editor looks and feels. UTF8 can already do a lot in the terminal, and terminal emulators also allow you to use TrueType fonts. Still, you will always be limited to one TTF font for the whole terminal, and it isn't possible to have, for example, a different font for headings, paragraphs, etc... you get the idea. TTF+UTF8 can't beat authentic graphics.

      -DTail also has a client component that connects to multiple servers concurrently for log files (or any other text files).
      +

      Scripting it



      -The DTail client interacts with a DTail server on port TCP/2222 via SSH protocol and does not interact in any way with the system’s SSH server (e.g., OpenSSH Server) which might be running at port TCP/22 already. As a matter of fact, you don’t need a regular SSH server running for DTail at all. There is no support for interactive login shells at TCP/2222 either, as by design that port can only be used for text data streaming. The SSH protocol is used for the public/private key infrastructure and transport encryption only and DTail implements its own protocol on top of SSH for the features provided. There is no need to set up or buy any additional TLS certificates. The port 2222 can be easily reconfigured if you preferred to use a different one.
      +It is possible to customize every aspect of Emacs through Emacs Lisp. I have done some Elk Scheme programming in the past (a dialect of Lisp), but that was a long time ago, and I am not willing to dive here again to customize my environment. I would instead take the pragmatic approach and script what I need in VimScript (a terrible language, but it gets the job done!). I watched Damian Conway's VimScript course on O'Reilly Safari Books Online, which I greatly recommend. Yes, VimScript feels clunky, funky and weird and is far less elegant than Lisp, but it gets its job done - in most cases! (That reminds me that the Vim team has announced a new major version of VimScript with improvements and language changes made - I haven't gotten to it yet - but I assume that VimScript will always stay VimScript).

      -The DTail server, which is a single static binary, will not fork an external process. This means that all features are implemented in native Go code (exception: Linux ACL support is implemented in C, but it must be enabled explicitly on compile time) and therefore helping to make it robust, secure, efficient, and easy to deploy. A single client, running on a standard Laptop, can connect to thousands of servers concurrently while still maintaining a small resource footprint.
      +Emacs Lisp
      +Elk Scheme
      +VimScript
      +Scripting Vim by Damian Conway

      -Recent log files are very likely still in the file system caches on the servers. Therefore, there tends to be a minimal I/O overhead involved.
      +NeoVim is also programmable with Lua, which seems to be a step up and Vim comes with a Perl plugin API (which was removed from NeoVim, but that is a different story - why would someone remove the most potent mature text manipulation programming language from one of the most powerful text editors?).

      -

      The DTail family of commands


      +NeoVim Lua API

      -Following the UNIX philosophy, DTail includes multiple command-line commands each of them for a different purpose:
      +One example is my workflow of how I compose my blog articles (e.g. this one you are currently reading): I am writing everything in NeoVim, but I also want to have every paragraph checked against Grammarly (as English is not my first language). So I write a whole paragraph, then I select the entire paragraph via visual selection with SHIFT+v, and then I press ,y to yank the paragraph to the systems clipboard, then I paste the paragraph to Grammarly's browser window with CTRL+v, let Grammarly suggest the improvements, and then I copy the result back with CTRL+c to the system clipboard and in NeoVim I type ,i to insert the result back overriding the old paragraph (which is still selected in visual mode) with the new content. That all sounds a bit complicated, but it's surprisingly natural and efficient.

      -
        -
      • dserver: The DTail server, the only binary required to be installed on the servers involved.
      • -
      • dtail: The distributed log tail client for following log files.
      • -
      • dcat: The distributed cat client for concatenating and displaying text files.
      • -
      • dgrep: The distributed grep client for searching text files for a regular expression pattern.
      • -
      • dmap: The distributed map-reduce client for aggregating stats from log files.
      • -

      -DGrep sample session animated gif
      +To come back to the example, for the clipboard integration, I use this small VimScript snippet, and I didn't have to dig into any Lisp or Perl for this:

      -

      Usage example


      + +
      " Clipboard
      +vnoremap ,y !pbcopy<CR>ugv
      +vnoremap ,i !pbpaste<CR>
      +nmap ,i !wpbpaste<CR>
      +

      -The use of these commands is almost self-explanatory for a person already used to the standard command line in Unix systems. One of the main goals is to make DTail easy to use. A tool that is too complicated to use under high-pressure scenarios (e.g., during an incident) can be quite detrimental.
      +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.

      -The basic idea is to start one of the clients from the command line and provide a list of servers to connect to with –servers. You also must provide a path of remote (log) files via –files. If you want to process multiple files per server, you could either provide a comma-separated list of file paths or make use of file system globbing (or a combination of both).
      +

      The famous Emacs Org mode



      -The following example would connect to all DTail servers listed in the serverlist.txt, follow all files with the ending .log and filter for lines containing the string error. You can specify any Go compatible regular expression. In this example we add the case-insensitive flag to the regex:
      +Org-mode is an Emacs mode for keeping notes, authoring documents, computational notebooks, literate programming, maintaining to-do lists, planning projects, and more — in a fast and effective plain-text system. There's even a dedicated website for it:

      -
      -dtail –servers serverlist.txt –files ‘/var/log/*.log’ –regex ‘(?i:error)’
      -
      +https://orgmode.org/

      -You usually want to specify a regular expression as a client argument. This will mean that responses are pre-filtered for all matching lines on the server-side and thus sending back only the relevant lines to the client. If your logs are growing very rapidly and the regex is not specific enough there might be the chance that your client is not fast enough to keep up processing all of the responses. This could be due to a network bottleneck or just as simple as a slow terminal emulator displaying the log lines on the client-side.
      +In short, Org-mode is an "interactive markup language" that helps you organize everything mentioned above. I rarely touched the surface during my two-month experiment with Emacs, and I am impressed by it, so I see the benefits of having that. But it's not for me.

      -A green 100 in the client output before each log line received from the server always indicates that there were no such problems and 100% of all log lines could be displayed on your terminal (have a look at the animated Gifs in this post). If the percentage falls below 100 it means that some of the channels used by the servers to send data to the client are congested and lines were dropped. In this case, the color will change from green to red. The user then could decide to run the same query but with a more specific regex.
      +I use "Dead Tree Mode" to organize my work and notes. Dead tree? Yeah, I use an actual pen and a real paper journal (Leuchtturm or a Moleskine and a set of coloured 0.5 Muji Pens are excellent choices). That's far more immersive and flexible than a computer program can ever be. Yes, some automation and interaction with the computer (like calendar scheduling etc.) are missing. Still, an actual paper journal forces you to stay simple and focus on the actual work rather than tinkering with your computer program. (But I could not resist, and I wrote a VimScript which parses a table of contents page in Markdown format of my scanned paper journals, and NeoVim allows me to select a topic so that the corresponding PDF scan on the right journal page gets opened in an external PDF viewer (the PDF viewer is zathura, it uses Vi-keybindings, of course) :-). (See the appendix of this blog post for that script).

      -You could also provide a comma-separated list of servers as opposed to a text file. There are many more options you could use. The ones listed here are just the very basic ones. There are more instructions and usage examples on the GitHub page. Also, you can study even more of the available options via the –help switch (some real treasures might be hidden there).
      +Zathura

      -

      Fitting it in


      +On the road, I also write some of my notes in Markdown format to NextCloud Notes, which is editable from my phone and via NeoVim on my computers. Markdown is much less powerful than Org-mode, but I prefer it the simple way. There's a neat terminal application, ranger, which I use to browse my NextCloud Notes when they are synced to a local folder on my machine. ranger is a file manager inspired by Vim and therefore makes use of Vim keybindings and it feels just natural to me.

      -DTail integrates nicely into the user management of existing infrastructure. It follows normal system permissions and does not open new “holes” on the server which helps to keep security departments happy. The user would not have more or less file read permissions than he would have via a regular SSH login shell. There is a full SSH key, traditional UNIX permissions, and Linux ACL support. There is also a very low resource footprint involved. On average for tailing and searching log files less than 100MB RAM and less than a quarter of a CPU core per participating server are required. Complex map-reduce queries on big data sets will require more resources accordingly.
      +Ranger - A Vim inspired file manager
      +Did I mention that I also use my zsh (my default shell) and my tmux (terminal multiplexer) in Vi-mode?

      -

      Advanced features


      +Z shell
      +tmux terminal multiplexer

      -The features listed here are out of the scope of this blog post but are worthwhile to mention:
      +

      Seeking simplicity



      -
        -
      • Distributed map-reduce queries on stats provided in log files with dmap. dmap comes with its own SQL-like aggregation query language.
      • -
      • Stats streaming with continuous map-reduce queries. The difference to normal queries is that the stats are aggregated over a specified interval only on the newly written log lines. Thus, giving a de-facto live stat view for each interval.
      • -
      • Server-side scheduled queries on log files. The queries are configured in the DTail server configuration file and scheduled at certain time intervals. Results are written to CSV files. This is useful for generating daily stats from the log files without the need for an interactive client.
      • -
      • Server-side stats streaming with continuous map-reduce queries. This for example can be used to periodically generate stats from the logs at a configured interval, e.g., log error counts by the minute. These then can be sent to a time-series database (e.g., Graphite) and then plotted in a Grafana dashboard.
      • -
      • Support for custom extensions. E.g., for different server discovery methods (so you don’t have to rely on plain server lists) and log file formats (so that map-reduce queries can parse more stats from the logs).
      • -

      -

      For the future


      +I am not ready to dive deep into the whole world of Emacs. I prefer small and simple tools as opposed to complex tools. Emacs comes with many features out of the box, whereas in Vim/NeoVim, you would need to install many plugins to replicate some of the behaviour. Yes, I need to invest time managing all the Vim/NeoVim plugins I use, but I feel more in control compared to Doom Emacs, where a framework around vanilla Emacs manages all the plugins. I could use vanilla Emacs and manage all my plugins the vanilla way, but for me, it's not worth the effort to learn and dive into that as all that I want to do I can already do with Vim/NeoVim.

      -There are various features we want to see in the future.
      +I am not saying that Vim/NeoVim are simple programs, but they are much simpler than Emacs with much smaller footprints; furthermore, they appear to be more straightforward as I am used to them. I only need Vim/NeoVim to be an editor, an IDE (through some plugins), and nothing more.

      -
        -
      • A spartan mode, not printing out any extra information but the raw remote log files would be a nice feature to have. This will make it easier to post-process the data produced by the DTail client with common UNIX tools. (To some degree this is possible already, just disable the ANSI terminal color output of the client with -noColors and pipe the output to another program).
      • -
      • Tempting would be implementing the dgoawk command, a distributed version of the AWK programming language purely implemented in Go, for advanced text data stream processing capabilities. There are 3rd party libraries available implementing AWK in pure Go which could be used.
      • -
      • A more complex change would be the support of federated queries. You can connect to thousands of servers from a single client running on a laptop. But does it scale to 100k of servers? Some of the servers could be used as middleware for connecting to even more servers.
      • -
      • Another aspect is to extend the documentation. Especially the advanced features such as map-reduce query language and how to configure the server-side queries currently do require more documentation. For now, you can read the code, sample config files or just ask the author for that! But this will be certainly addressed in the future.
      • -

      -

      Open Source


      +

      Conclusion



      -Mimecast highly encourages you to have a look at DTail and submit an issue for any features you would like to see. Have you found a bug? Maybe you just have a question or comment? If you want to go a step further: We would also love to see pull requests for any features or improvements. Either way, if in doubt just contact us via the DTail GitHub page.
      +I understand the Emacs users now. Emacs is an incredibly powerful platform for almost everything, not just text editing. With Emacs, you can do nearly everything (Writing, editing, programming, calendar scheduling and note taking, Jira integration, playing games, listening to music, reading/writing emails, browsing the web, using as a calculator, generating HTML pages, configuring interactive menus, jumping around between every feature and every file within one single session, chat on IRC, surf the Gopherspace, ... the options are endless....). If you want to have one piece of software which rules it all and you are happy to invest a large part of your time in your platform: Pick Emacs, and over time Emacs will become "your" Emacs, customized to your own needs and change the way it works, which makes the Emacs users stick even more to it.

      -https://dtail.dev
      +Vim/NeoVim also comes with a very high degree of customization options, but to a lesser extreme than Emacs (but still, a much higher degree than most other editors out there). If you want the best text editor in the world, which can also be tweaked to be a decent IDE, you are only looking for: Pick Vim or NeoVim! You would also need to invest a lot of time in learning, tweaking and customizing Vim/NeoVim, but that's a little more straightforward, and the result is much more lightweight once you get used to the "Vi way of doing things" you never would want to change back. I haven't tried the Emacs vanilla keystrokes, but they are terrible (that's probably one of the reasons why Doom Emacs uses Vim keybindings by default).

      -Other related posts are:
      +Update: One reader recommended to have a look at NvChad. NvChad is a NeoVim config written in Lua aiming to provide a base configuration with very beautiful UI and blazing fast startuptime (around 0.02 secs ~ 0.07 secs). They tweak UI plugins such as telescope, nvim-tree, bufferline etc well to provide an aesthetic UI experience. That sounds interesting!

      -2021-04-22 DTail - The distributed log tail program (You are currently reading this)
      -2022-03-06 The release of DTail 4.0.0
      -2022-10-30 Installing DTail on OpenBSD
      -2023-09-25 DTail usage examples
      +https://github.com/NvChad/NvChad

      E-Mail your comments to paul@nospam.buetow.org :-)

      @@ -8285,337 +8378,513 @@ dtail –servers serverlist.txt –files ‘/var/log/*.log’ –regex ‘(?i:er - Realistic load testing with I/O Riot for Linux - - https://foo.zone/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux.html - 2018-06-01T14:50:29+01:00 + Installing DTail on OpenBSD + + https://foo.zone/gemfeed/2022-10-30-installing-dtail-on-openbsd.html + 2022-10-30T11:03:19+02:00 Paul Buetow aka snonux paul@dev.buetow.org - This text first was published in the german IT-Administrator computer Magazine. 3 years have passed since and I decided to publish it on my blog too. + This will be a quick blog post, as I am busy with my personal life now. I have relocated to a different country and am still busy arranging things. So bear with me :-)
      -

      Realistic load testing with I/O Riot for Linux


      +

      Installing DTail on OpenBSD


      +
      +Published at 2022-10-30T11:03:19+02:00
      +
      +This will be a quick blog post, as I am busy with my personal life now. I have relocated to a different country and am still busy arranging things. So bear with me :-)
      +
      + In this post, I want to give a quick overview (or how-to) about installing DTail on OpenBSD, as the official documentation only covers Red Hat and Fedora Linux! And this blog post will also be used as my reference!
      +
      +https://dtail.dev
      +
      +I am using Rexify for my OpenBSD automation. Check out the following article covering my Rex setup in a little bit more detail:
      +
      +Let's Encrypt with OpenBSD and Rex

      -Published at 2018-06-01T14:50:29+01:00; Updated at 2021-05-08
      +I will also mention some relevant Rexfile snippets in this post!

      -       .---.
      -      /     \
      -      \.@-@./
      -      /`\_/`\
      -     //  _  \\
      -    | \     )|_
      -   /`\_`>  <_/ \
      -jgs\__/'---'\__/
      +       ,_---~~~~~----._
      + _,,_,*^____      _____``*g*\"*,
      +/ __/ /'     ^.  /      \ ^@q   f
      + @f   |       |  |       |  0 _/
      +\`/   \~__((@/ __ \__((@/    \
      + |           _l__l_           I    <--- The Go Gopher
      + }          [______]           I
      + ]            | | |            |
      + ]             ~ ~             |
      + |                            |
      +  |                           |
      +  |                           |       A       ;
      +~~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~,--,-/ \---,-/|~~,~~~~~~~~~~~~~~~~~~~~~~~~~~~
      +                           _|\,'. /|      /|   `/|-.
      +                       \`.'    /|      ,            `;.
      +                      ,'\   A     A         A   A _ /| `.;
      +                    ,/  _              A       _  / _   /|  ;
      +                   /\  / \   ,  ,           A  /    /     `/|
      +                  /_| | _ \         ,     ,             ,/  \
      +                 // | |/ `.\  ,-      ,       ,   ,/ ,/      \/
      +                 / @| |@  / /'   \  \      ,              >  /|    ,--.
      +                |\_/   \_/ /      |  |           ,  ,/        \  ./' __:..
      +                |  __ __  |       |  | .--.  ,         >  >   |-'   /     `
      +              ,/| /  '  \ |       |  |     \      ,           |    /
      +             /  |<--.__,->|       |  | .    `.        >  >    /   (
      +            /_,' \\  ^  /  \     /  /   `.    >--            /^\   |
      +                  \\___/    \   /  /      \__'     \   \   \/   \  |
      +                   `.   |/          ,  ,                  /`\    \  )
      +                     \  '  |/    ,       V    \          /        `-\
      + OpenBSD Puffy --->   `|/  '  V      V           \    \.'            \_
      +                       '`-.       V       V        \./'\
      +                           `|/-.      \ /   \ /,---`\         kat
      +                            /   `._____V_____V'
      +                                       '     '
       

      -

      Foreword


      +

      Table of Contents


      +
      +
      +

      Compile it


      +
      +First of all, DTail needs to be downloaded and compiled. For that, git, go, and gmake are required:
      +
      +
      +$ doas pkg_add git go gmake
      +

      -This text first was published in the german IT-Administrator computer Magazine. 3 years have passed since and I decided to publish it on my blog too.
      +I am happy that the Go Programming Language is readily available in the OpenBSD packaging system. Once the dependencies got installed, clone DTail and compile it:

      -https://www.admin-magazin.de/Das-Heft/2018/06/Realistische-Lasttests-mit-I-O-Riot
      +
      +$ mkdir git
      +$ cd git
      +$ git clone https://github.com/mimecast/dtail
      +$ cd dtail
      +$ gmake 
      +

      -I havn't worked on I/O Riot for some time now, but all what is written here is still valid. I am still using I/O Riot to debug I/O issues and pattern once in a while, so by all means the tool is not obsolete yet. The tool even helped to resolve a major production incident at work caused by disk I/O.
      +You can verify the version by running the following command:

      -I am eagerly looking forward to revamp I/O Riot so that it uses the new BPF Linux capabilities instead of plain old Systemtap (or alternatively: Newer versions of Systemtap can also use BPF as the backend I have learned). Also, when I wrote I/O Riot initially, I didn't have any experience with the Go programming language yet and therefore I wrote it in C. Once it gets revamped I might consider using Go instead of C as it would spare me from many segmentation faults and headaches during development ;-). I might also just stick to C for plain performance reasons and just refactor the code dealing with concurrency.
      +
      +$ ./dtail --version
      + DTail  4.1.0  Protocol 4.1  Have a lot of fun!
      +$ file dtail
      + dtail: ELF 64-bit LSB executable, x86-64, version 1
      +

      -Pleace notice that some of the screenshots show the command "ioreplay" instead of "ioriot". That's because the name has changed after taking those.
      +Now, there isn't any need anymore to keep git, go and gmake, so they can be deinstalled now:

      -

      The article


      +
      +$ doas pkg_delete git go gmake
      +

      -With I/O Riot IT administrators can load test and optimize the I/O subsystem of Linux-based operating systems. The tool makes it possible to record I/O patterns and replay them at a later time as often as desired. This means bottlenecks can be reproduced and eradicated.
      +One day I shall create an official OpenBSD port for DTail.

      -When storing huge amounts of data, such as more than 200 billion archived emails at Mimecast, it's not only the available storage capacity that matters, but also the data throughput and latency. At the same time, operating costs must be kept as low as possible. The more systems involved, the more important it is to optimize the hardware, the operating system and the applications running on it.
      +

      Install it



      -

      Background: Existing Techniques


      +Installing the binaries is now just a matter of copying them to /usr/local/bin as follows:

      -Conventional I/O benchmarking: Administrators usually use open source benchmarking tools like IOZone and bonnie++. Available database systems such as Redis and MySQL come with their own benchmarking tools. The common problem with these tools is that they work with prescribed artificial I/O patterns. Although this can test both sequential and randomized data access, the patterns do not correspond to what can be found on production systems.
      +
      +$ for bin in dserver dcat dgrep dmap dtail dtailhealth; do
      +  doas cp -p $bin /usr/local/bin/$bin
      +  doas chown root:wheel /usr/local/bin/$bin
      +done
      +

      -Testing by load test environment: Another option is to use a separate load test environment in which, as far as possible, a production environment with all its dependencies is simulated. However, an environment consisting of many microservices is very complex. Microservices are usually managed by different teams, which means extra coordination effort for each load test. Another challenge is to generate the load as authentically as possible so that the patterns correspond to a productive environment. Such a load test environment can only handle as many requests as its weakest link can handle. For example, load generators send many read and write requests to a frontend microservice, whereby the frontend forwards the requests to a backend microservice responsible for storing the data. If the frontend service does not process the requests efficiently enough, the backend service is not well utilized in the first place. As a rule, all microservices are clustered across many servers, which makes everything even more complicated. Under all these conditions it is very difficult to test I/O of separate backend systems. Moreover, for many small and medium-sized companies, a separate load test environment would not be feasible for cost reasons.
      +Also, we will be creating the _dserver service user:

      -Testing in the production environment: For these reasons, benchmarks are often carried out in the production environment. In order to derive value from this such tests are especially performed during peak hours when systems are under high load. However, testing on production systems is associated with risks and can lead to failure or loss of data without adequate protection.
      +
      +$ doas adduser -class nologin -group _dserver -batch _dserver
      +$ doas usermod -d /var/run/dserver/ _dserver
      +

      -

      Benchmarking the Email Cloud at Mimecast


      +The OpenBSD init script is created from scratch (not part of the official DTail project). Run the following to install the bespoke script:

      -For email archiving, Mimecast uses an internally developed microservice, which is operated directly on Linux-based storage systems. A storage cluster is divided into several replication volumes. Data is always replicated three times across two secure data centers. Customer data is automatically allocated to one or more volumes, depending on throughput, so that all volumes are automatically assigned the same load. Customer data is archived on conventional, but inexpensive hard disks with several terabytes of storage capacity each. I/O benchmarking proved difficult for all the reasons mentioned above. Furthermore, there are no ready-made tools for this purpose in the case of self-developed software. The service operates on many block devices simultaneously, which can make the RAID controller a bottleneck. None of the freely available benchmarking tools can test several block devices at the same time without extra effort. In addition, emails typically consist of many small files. Randomized access to many small files is particularly inefficient. In addition to many software adaptations, the hardware and operating system must also be optimized.
      +
      +$ cat <<'END' | doas tee /etc/rc.d/dserver
      +#!/bin/ksh
      +
      +daemon="/usr/local/bin/dserver"
      +daemon_flags="-cfg /etc/dserver/dtail.json"
      +daemon_user="_dserver"
      +
      +. /etc/rc.d/rc.subr
      +
      +rc_reload=NO
      +
      +rc_pre() {
      +    install -d -o _dserver /var/log/dserver
      +    install -d -o _dserver /var/run/dserver/cache
      +}
      +
      +rc_cmd $1 &
      +END
      +$ doas chmod 755 /etc/rc.d/dserver
      +

      -Mimecast encourages employees to be innovative and pursue their own ideas in the form of an internal competition, Pet Project. The goal of the pet project I/O Riot was to simplify OS and hardware level I/O benchmarking. The first prototype of I/O Riot was awarded an internal roadmap prize in the spring of 2017. A few months later, I/O Riot was used to reduce write latency in the storage clusters by about 50%. The improvement was first verified by I/O replay on a test system and then successively applied to all storage systems. I/O Riot was also used to resolve a production incident caused by disk I/O load.
      +

      Rexification



      -

      Using I/O Riot


      +This is the task for setting it up via Rex. Note the . . . ., that's a placeholder which we will fill up more and more during this blog post:

      -First, all I/O events are logged to a file on a production system with I/O Riot. It is then copied to a test system where all events are replayed in the same way. The crucial point here is that you can reproduce I/O patterns as they are found on a production system as often as you like on a test system. This results in the possibility of optimizing the set screws on the system after each run.
      +
      +desc 'Setup DTail';
      +task 'dtail', group => 'frontends',
      +   sub {
      +      my $restart = FALSE;
      +
      +      file '/etc/rc.d/dserver':
      +        content => template('./etc/rc.d/dserver.tpl'),
      +        owner => 'root',
      +        group => 'wheel',
      +        mode => '755',
      +        on_change => sub { $restart = TRUE };
      +
      +        .
      +        .
      +        .
      +        .
      +
      +      service 'dserver' => 'restart' if $restart;
      +      service 'dserver', ensure => 'started';
      +   };
      +

      -

      Installation


      +

      Configure it



      -I/O Riot was tested under CentOS 7.2 x86_64. For compiling, the GNU C compiler and Systemtap including kernel debug information are required. Other Linux distributions are theoretically compatible but untested. First of all, you should update the systems involved as follows:
      +Now, DTail is fully installed but still needs to be configured. Grab the default config file from GitHub ...

      -% sudo yum update
      +$ doas mkdir /etc/dserver
      +$ curl https://raw.githubusercontent.com/mimecast/dtail/master/examples/dtail.json.examples |
      +    doas tee /etc/dserver/dtail.json
       

      -If the kernel is updated, please restart the system. The installation would be done without a restart but this would complicate the installation. The installed kernel version should always correspond to the currently running kernel. You can then install I/O Riot as follows:
      +... and then edit it and adjust LogDir in the Common section to /var/log/dserver. The result will look like this:

      -% sudo yum install gcc git systemtap yum-utils kernel-devel-$(uname -r)
      -% sudo debuginfo-install kernel-$(uname -r)
      -% git clone https://github.com/mimecast/ioriot
      -% cd ioriot
      -% make
      -% sudo make install
      -% export PATH=$PATH:/opt/ioriot/bin
      +  "Common": {
      +    "LogDir": "/var/log/dserver",
      +    "Logger": "Fout",
      +    "LogRotation": "Daily",
      +    "CacheDir": "cache",
      +    "SSHPort": 2222,
      +    "LogLevel": "Info"
      +  }
       

      -Note: It is not best practice to install any compilers on production systems. For further information please have a look at the enclosed README.md.
      -
      -

      Recording of I/O events


      +

      Rexification



      -All I/O events are kernel related. If a process wants to perform an I/O operation, such as opening a file, it must inform the kernel of this by a system call (short syscall). I/O Riot relies on the Systemtap tool to record I/O syscalls. Systemtap, available for all popular Linux distributions, helps you to take a look at the running kernel in productive environments, which makes it predestined to monitor all I/O-relevant Linux syscalls and log them to a file. Other tools, such as strace, are not an alternative because they slow down the system too much.
      -
      -During recording, ioriot acts as a wrapper and executes all relevant Systemtap commands for you. Use the following command to log all events to io.capture:
      +That's as simple as adding the following to the Rex task:

      -% sudo ioriot -c io.capture
      +file '/etc/dserver',
      +  ensure => 'directory';
      +
      +file '/etc/dserver/dtail.json',
      +  content => template('./etc/dserver/dtail.json.tpl'),
      +  owner => 'root',
      +  group => 'wheel',
      +  mode => '755',
      +  on_change => sub { $restart = TRUE };
       

      -Screenshot I/O recording
      -
      -A Ctrl-C (SIGINT) stops recording prematurely. Otherwise, ioriot terminates itself automatically after 1 hour. Depending on the system load, the output file can grow to several gigabytes. Only metadata is logged, not the read and written data itself. When replaying later, only random data is used. Under certain circumstances, Systemtap may omit some system calls and issue warnings. This is to ensure that Systemtap does not consume too many resources.
      +

      Update the key cache for it



      -

      Test preparation


      +DTail relies on SSH for secure authentication and communication. However, the system user _dserver has no permission to read the SSH public keys from the user's home directories, so the DTail server also checks for available public keys in an alternative path /var/run/dserver/cache.

      -Then copy io.capture to a test system. The log also contains all accesses to the pseudo file systems devfs, sysfs and procfs. This makes little sense, which is why you must first generate a cleaned and playable version io.replay from io.capture as follows:
      +The following script, populating the DTail server key cache, can be run periodically via CRON:

      -% sudo ioriot -c io.capture -r io.replay -u $USER -n TESTNAME
      +$ cat <<'END' | doas tee /usr/local/bin/dserver-update-key-cache.sh
      +#!/bin/ksh
      +
      +CACHEDIR=/var/run/dserver/cache
      +DSERVER_USER=_dserver
      +DSERVER_GROUP=_dserver
      +
      +echo 'Updating SSH key cache'
      +
      +ls /home/ | while read remoteuser; do
      +    keysfile=/home/$remoteuser/.ssh/authorized_keys
      +
      +    if [ -f $keysfile ]; then
      +        cachefile=$CACHEDIR/$remoteuser.authorized_keys
      +        echo "Caching $keysfile -> $cachefile"
      +
      +        cp $keysfile $cachefile
      +        chown $DSERVER_USER:$DSERVER_GROUP $cachefile
      +        chmod 600 $cachefile
      +    fi
      +done
      +
      +# Cleanup obsolete public SSH keys
      +find $CACHEDIR -name \*.authorized_keys -type f |
      +while read cachefile; do
      +    remoteuser=$(basename $cachefile | cut -d. -f1)
      +    keysfile=/home/$remoteuser/.ssh/authorized_keys
      +
      +    if [ ! -f $keysfile ]; then
      +        echo 'Deleting obsolete cache file $cachefile'
      +        rm $cachefile
      +    fi
      +done
      +
      +echo 'All set...'
      +END
      +$ doas chmod 500 /usr/local/bin/dserver-update-key-cache.sh
       

      -The parameter -n allows you to assign a freely selectable test name. An arbitrary system user under which the test is to be played is specified via paramater -u.
      -
      -

      Test Initialization


      -
      -The test will most likely want to access existing files. These are files the test wants to read but does not create by itself. The existence of these must be ensured before the test. You can do this as follows:
      +Note that the script above is a slight variation of the official DTail script. The official DTail one is a bash script, but on OpenBSD, there's ksh. I run it once daily by adding it to the daily.local:

      -% sudo ioriot -i io.replay
      +$ echo /usr/local/bin/dserver-update-key-cache.sh | doas tee -a /etc/daily.local
      +/usr/local/bin/dserver-update-key-cache.sh
       

      -To avoid any damage to the running system, ioreplay only works in special directories. The tool creates a separate subdirectory for each file system mount point (e.g. /, /usr/local, /store/00,...) (here: /.ioriot/TESTNAME, /usr/local/.ioriot/TESTNAME, /store/00/.ioriot/TESTNAME,...). By default, the working directory of ioriot is /usr/local/ioriot/TESTNAME.
      +

      Rexification



      -Screenshot test preparation
      -
      -You must re-initialize the environment before each run. Data from previous tests will be moved to a trash directory automatically, which can be finally deleted with "sudo ioriot -P".
      -
      -

      Replay


      +That's done by adding ...

      -After initialization, you can replay the log with -r. You can use -R to initiate both test initialization and replay in a single command and -S can be used to specify a file in which statistics are written after the test run.
      +
      +file '/usr/local/bin/dserver-update-key-cache.sh',
      +  content => template('./scripts/dserver-update-key-cache.sh.tpl'),
      +  owner => 'root',
      +  group => 'wheel',
      +  mode => '500';
      +
      +append_if_no_such_line '/etc/daily.local', '/usr/local/bin/dserver-update-key-cache.sh';
      +

      -You can also influence the playback speed: "-s 0" is interpreted as "Playback as fast as possible" and is the default setting. With "-s 1" all operations are performed at original speed. "-s 2" would double the playback speed and "-s 0.5" would halve it.
      +... to the Rex task!

      -Screenshot replaying I/O
      +

      Start it



      -As an initial test, for example, you could compare the two Linux I/O schedulers CFQ and Deadline and check which scheduler the test runs the fastest. They run the test separately for each scheduler. The following shell loop iterates through all attached block devices of the system and changes their I/O scheduler to the one specified in variable $new_scheduler (in this case either cfq or deadline). Subsequently, all I/O events from the io.replay protocol are played back. At the end, an output file with statistics is generated:
      +Now, it's time to enable and start the DTail server:

      -% new_scheduler=cfq
      -% for scheduler in /sys/block/*/queue/scheduler; do
      -    echo $new_scheduler | sudo tee $scheduler
      -done
      -% sudo ioriot -R io.replay -S cfq.txt
      -% new_scheduler=deadline
      -% for scheduler in /sys/block/*/queue/scheduler; do
      -   echo $new_scheduler | sudo tee $scheduler
      -done
      -% sudo ioriot -R io.replay -S deadline.txt
      +$ sudo rcctl enable dserver
      +$ sudo rcctl start dserver
      +$ tail -f /var/log/dserver/*.log
      +INFO|1022-090634|Starting scheduled job runner after 2s
      +INFO|1022-090634|Starting continuous job runner after 2s
      +INFO|1022-090644|24204|stats.go:53|2|11|7|||MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=0
      +INFO|1022-090654|24204|stats.go:53|2|11|7|||MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=0
      +INFO|1022-090719|Starting server|DTail 4.1.0 Protocol 4.1 Have a lot of fun!
      +INFO|1022-090719|Generating private server RSA host key
      +INFO|1022-090719|Starting server
      +INFO|1022-090719|Binding server|0.0.0.0:2222
      +INFO|1022-090719|Starting scheduled job runner after 2s
      +INFO|1022-090719|Starting continuous job runner after 2s
      +INFO|1022-090729|86050|stats.go:53|2|11|7|||MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=0
      +INFO|1022-090739|86050|stats.go:53|2|11|7|||MAPREDUCE:STATS|currentConnections=0|lifetimeConnect
      +.
      +.
      +.
      +Ctr+C
       

      -According to the results, the test could run 940 seconds faster with Deadline Scheduler:
      +As we don't want to wait until tomorrow, let's populate the key cache manually:

      -% cat cfq.txt
      -Num workers: 4
      -hreads per worker: 128
      -otal threads: 512
      -Highest loadavg: 259.29
      -Performed ioops: 218624596
      -Average ioops/s: 101544.17
      -Time ahead: 1452s
      -Total time: 2153.00s
      -% cat deadline.txt
      -Num workers: 4
      -Threads per worker: 128
      -Total threads: 512
      -Highest loadavg: 342.45
      -Performed ioops: 218624596
      -Average ioops/s: 180234.62
      -Time ahead: 2392s
      -Total time: 1213.00s
      +$ doas /usr/local/bin/dserver-update-key-cache.sh
      +Updating SSH key cache
      +Caching /home/_dserver/.ssh/authorized_keys -> /var/cache/dserver/_dserver.authorized_keys
      +Caching /home/admin/.ssh/authorized_keys -> /var/cache/dserver/admin.authorized_keys
      +Caching /home/failunderd/.ssh/authorized_keys -> /var/cache/dserver/failunderd.authorized_keys
      +Caching /home/git/.ssh/authorized_keys -> /var/cache/dserver/git.authorized_keys
      +Caching /home/paul/.ssh/authorized_keys -> /var/cache/dserver/paul.authorized_keys
      +Caching /home/rex/.ssh/authorized_keys -> /var/cache/dserver/rex.authorized_keys
      +All set...
       

      -In any case, you should also set up a time series database, such as Graphite, where the I/O throughput can be plotted. Figures 4 and 5 show the read and write access times of both tests. The break-in makes it clear when the CFQ test ended and the deadline test was started. The reading latency of both tests is similar. Write latency is dramatically improved using the Deadline Scheduler.
      -
      -Graphite visualization of the mean read access times in ms with CFQ and Deadline Scheduler.
      +

      Use it



      -Graphite visualization of the average write access times in ms with CFQ and Deadline Scheduler.
      -
      -You should also take a look at the iostat tool. The iostat screenshot shows the output of iostat -x 10 during a test run. As you can see, a block device is fully loaded with 99% utilization, while all other block devices still have sufficient buffer. This could be an indication of poor data distribution in the storage system and is worth pursuing. It is not uncommon for I/O Riot to reveal software problems.
      +The DTail server is now ready to serve connections. You can use any DTail commands, such as dtail, dgrep, dmap, dcat, dtailhealth, to do so. Checkout out all the usage examples on the official DTail page.

      -Output of iostat. The block device sdy seems to be almost fully utilized by 99%.
      +I have installed DTail server this way on my personal OpenBSD frontends blowfish, and fishfinger, and the following command connects as user rex to both machines and greps the file /etc/fstab for the string local:

      -

      I/O Riot is Open Source


      +
      +❯ ./dgrep -user rex -servers blowfish.buetow.org,fishfinger.buetow.org --regex local /etc/fstab
      +CLIENT|earth|WARN|Encountered unknown host|{blowfish.buetow.org:2222 0xc0000a00f0 0xc0000a61e0 [blowfish.buetow.org]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9ZnF/LAk14SgqCzk38yENVTNfqibcluMTuKx1u53cKSp2xwHWzy0Ni5smFPpJDIQQljQEJl14ZdXvhhjp1kKHxJ79ubqRtIXBlC0PhlnP8Kd+mVLLHYpH9VO4rnaSfHE1kBjWkI7U6lLc6ks4flgAgGTS5Bb7pLAjwdWg794GWcnRh6kSUEQd3SftANqQLgCunDcP2Vc4KR9R78zBmEzXH/OPzl/ANgNA6wWO2OoKKy2VrjwVAab6FW15h3Lr6rYIw3KztpG+UMmEj5ReexIjXi/jUptdnUFWspvAmzIl6kwzzF8ExVyT9D75JRuHvmxXKKjyJRxqb8UnSh2JD4JN [23.88.35.144]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9ZnF/LAk14SgqCzk38yENVTNfqibcluMTuKx1u53cKSp2xwHWzy0Ni5smFPpJDIQQljQEJl14ZdXvhhjp1kKHxJ79ubqRtIXBlC0PhlnP8Kd+mVLLHYpH9VO4rnaSfHE1kBjWkI7U6lLc6ks4flgAgGTS5Bb7pLAjwdWg794GWcnRh6kSUEQd3SftANqQLgCunDcP2Vc4KR9R78zBmEzXH/OPzl/ANgNA6wWO2OoKKy2VrjwVAab6FW15h3Lr6rYIw3KztpG+UMmEj5ReexIjXi/jUptdnUFWspvAmzIl6kwzzF8ExVyT9D75JRuHvmxXKKjyJRxqb8UnSh2JD4JN 0xc0000a2180}
      +CLIENT|earth|WARN|Encountered unknown host|{fishfinger.buetow.org:2222 0xc0000a0150 0xc000460110 [fishfinger.buetow.org]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNiikdL7+tWSN0rCaw1tOd9aQgeUFgb830V9ejkyJ5h93PKLCWZSMMCtiabc1aUeUZR//rZjcPHFLuLq/YC+Y3naYtGd6j8qVrcfG8jy3gCbs4tV9SZ9qd5E24mtYqYdGlee6JN6kEWhJxFkEwPfNlG+YAr3KC8lvEAE2JdWvaZavqsqMvHZtAX3b25WCBf2HGkyLZ+d9cnimRUOt+/+353BQFCEct/2mhMVlkr4I23CY6Tsufx0vtxx25nbFdZias6wmhxaE9p3LiWXygPWGU5iZ4RSQSImQz4zyOc9rnJeP1rwGk0OWDJhdKNXuf0kIPdzMfwxv2otgY32/DJj6L [46.23.94.99]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNiikdL7+tWSN0rCaw1tOd9aQgeUFgb830V9ejkyJ5h93PKLCWZSMMCtiabc1aUeUZR//rZjcPHFLuLq/YC+Y3naYtGd6j8qVrcfG8jy3gCbs4tV9SZ9qd5E24mtYqYdGlee6JN6kEWhJxFkEwPfNlG+YAr3KC8lvEAE2JdWvaZavqsqMvHZtAX3b25WCBf2HGkyLZ+d9cnimRUOt+/+353BQFCEct/2mhMVlkr4I23CY6Tsufx0vtxx25nbFdZias6wmhxaE9p3LiWXygPWGU5iZ4RSQSImQz4zyOc9rnJeP1rwGk0OWDJhdKNXuf0kIPdzMfwxv2otgY32/DJj6L 0xc0000a2240}
      +Encountered 2 unknown hosts: 'blowfish.buetow.org:2222,fishfinger.buetow.org:2222'
      +Do you want to trust these hosts?? (y=yes,a=all,n=no,d=details): a
      +CLIENT|earth|INFO|STATS:STATS|cgocalls=11|cpu=8|connected=2|servers=2|connected%=100|new=2|throttle=0|goroutines=19
      +CLIENT|earth|INFO|Added hosts to known hosts file|/home/paul/.ssh/known_hosts
      +REMOTE|blowfish|100|7|fstab|31bfd9d9a6788844.h /usr/local ffs rw,wxallowed,nodev 1 2
      +REMOTE|fishfinger|100|7|fstab|093f510ec5c0f512.h /usr/local ffs rw,wxallowed,nodev 1 2
      +

      -The tool has already proven to be very useful and will continue to be actively developed as time and priority permits. Mimecast intends to be an ongoing contributor to Open Source. You can find I/O Riot at:
      +Running it the second time, and given that you trusted the keys the first time, it won't prompt you for the host keys anymore:

      -https://github.com/mimecast/ioriot
      +
      +❯ ./dgrep -user rex -servers blowfish.buetow.org,fishfinger.buetow.org --regex local /etc/fstab
      +REMOTE|blowfish|100|7|fstab|31bfd9d9a6788844.h /usr/local ffs rw,wxallowed,nodev 1 2
      +REMOTE|fishfinger|100|7|fstab|093f510ec5c0f512.h /usr/local ffs rw,wxallowed,nodev 1 2
      +

      -

      Systemtap


      +

      Conclusions



      -Systemtap is a tool for the instrumentation of the Linux kernel. The tool provides an AWK-like programming language. Programs written in it are compiled from Systemtap to C- and then into a dynamically loadable kernel module. Loaded into the kernel, the program has access to Linux internals. A Systemtap program written for I/O Riot monitors when, with which parameters, at which time, and from which process I/O syscalls take place and their return values.
      +It's a bit of manual work, but it's ok on this small scale! I shall invest time in creating an official OpenBSD port, though. That would render most of the manual steps obsolete, as outlined in this post!

      -For example, the open syscall opens a file and returns the responsible file descriptor. The read and write syscalls can operate on a file descriptor and return the number of read or written bytes. The close syscall closes a given file descriptor. I/O Riot comes with a ready-made Systemtap program, which you have already compiled into a kernel module and installed to /opt/ioriot. In addition to open, read and close, it logs many other I/O-relevant calls.
      +Check out the following for more information:

      -https://sourceware.org/systemtap/
      +https://dtail.dev
      +https://github.com/mimecast/dtail
      +https://www.rexify.org

      -

      More refereces


      +E-Mail your comments to paul@nospam.buetow.org :-)

      -IOZone
      -Bonnie++
      -Graphite
      -Memory mapped I/O
      +Other related posts are:

      -E-Mail your comments to paul@nospam.buetow.org :-)
      +2023-09-25 DTail usage examples
      +2022-10-30 Installing DTail on OpenBSD (You are currently reading this)
      +2022-03-06 The release of DTail 4.0.0
      +2021-04-22 DTail - The distributed log tail program

      Back to the main site
      - Object oriented programming with ANSI C - - https://foo.zone/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html - 2016-11-20T22:10:57+00:00 + After a bad night's sleep + + https://foo.zone/gemfeed/2022-09-30-after-a-bad-nights-sleep.html + 2022-09-30T09:53:23+03:00 Paul Buetow aka snonux paul@dev.buetow.org - You can do a little of object-oriented programming in the C Programming Language. However, that is, in my humble opinion, limited. It's easier to use a different programming language than C for OOP. But still it's an interesting exercise to try using C for this. + Everyone has it once in a while: A bad night's sleep. Here I attempt to list valuable tips on how to deal with it.
      -

      Object oriented programming with ANSI C


      +

      After a bad night's sleep


      +
      +Published at 2022-09-30T09:53:23+03:00; Updated at 2022-10-12

      -Published at 2016-11-20T22:10:57+00:00; Updated at 2022-01-29
      +Everyone has it once in a while: A bad night's sleep. Here I attempt to list valuable tips on how to deal with it.

      -  ___   ___  ____        ____ 
      - / _ \ / _ \|  _ \      / ___|
      -| | | | | | | |_) |____| |    
      -| |_| | |_| |  __/_____| |___ 
      - \___/ \___/|_|         \____|
      -                              
      +               z
      +                z
      +                 Z
      +       .--.  Z Z
      +      / _(c\   .-.     __
      +     | / /  '-;   \'-'`  `\______
      +     \_\/'/ __/ )  /  )   |      \--,
      +     | \`""`__-/ .'--/   /--------\  \
      +      \\`  ///-\/   /   /---;-.    '-'
      +jgs                (________\  \
      +                             '-'
       

      -You can do a little of object-oriented programming in the C Programming Language. However, that is, in my humble opinion, limited. It's easier to use a different programming language than C for OOP. But still it's an interesting exercise to try using C for this.
      +

      Table of Contents



      -

      Function pointers


      +
      +

      Don't take the day off.



      -Let's have a look at the following sample program. All you have to do is to add a function pointer such as "calculate" to the definition of struct "something_s". Later, during the struct initialization, assign a function address to that function pointer:
      +Don't take a day off after not sleeping enough the previous night. That would be wasting the holiday allowance. It wouldn't be possible to enjoy my free time anyway, so why not just work? There's still a way for an IT Engineer to be productive (sometimes even more) with half or less of the concentration power available!

      - -
      #include <stdio.h>
      -
      -typedef struct {
      -    double (*calculate)(const double, const double);
      -    char *name;
      -} something_s;
      -
      -double multiplication(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"
      -    };
      -
      -    something_s div = (something_s) {
      -        .calculate = division,
      -        .name = "Division"
      -    };
      -
      -    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));
      -}
      -
      +

      Start work early



      -As you can see, you can call the function (pointed by the function pointer) with the same syntax as in C++ or Java:
      +Probably I am already awake early and am unable to fall asleep again. My strategy here is to "attack" the day: Start work early and finish early. The early bird will also encounter fewer distractions from colleagues.

      - -
      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));
      -
      +

      Sweat the small stuff



      -However, that's just syntactic sugar for:
      +There's never a shortage of small items to hook off my list. Most of these items don't require my full concentration power, and I will be happy to get them off my list so that the next day, after a good night's sleep, I can immerse myself again in focused, deep work with all concentration powers at hand.

      - -
      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));
      -
      +Examples of "small work items" are:
      +
      +
        +
      • Tidying up the workspace.
      • +
      • Installing pending computer software updates.
      • +
      • Going through the work backlog: Create new tickets, close obsolete ones, and roughly pre-plan upcoming work.
      • +
      • Finishing off the easy tickets from the current sprint.
      • +
      • Going through any tedious paperwork.
      • +
      • Catch up with the journal and mark off all trivial action items.
      • +

      +

      Enter the flow state



      -Output:
      +I find it easy to enter the "flow state" after a bad night's sleep. All I need to do is to put on some ambient music (preferably instrumental chill house) and start to work on a not-too-difficult ticket.

      - -
      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
      -
      +Usually, the "flow state" is associated with deep-focused work, but deep-focused work isn't easily possible under sleep deprivation. It's still possible to be in the flow by working on more manageable tasks and leaving the difficult ones for the next day.

      -Not complicated at all, but nice to know and helps to make the code easier to read!
      +

      Reschedule meetings



      -

      That's not OOP, though


      +I find engaging in discussions and demanding meetings challenging after a lousy night's sleep. I still attend the sessions I am invited to as "only" a participant, but I prefer to reschedule all meetings I am the primary driver of.

      -However, that's not really how it works in object-oriented languages such as Java and C++. The method call in this example is not a method call as "mult" and "div" in this example are not "message receivers". I mean that the functions can not access the state of the "mult" and "div" struct objects. In C, you would need to do something like this instead if you wanted to access the state of "mult" from within the calculate function, you would have to pass it as an argument:
      +This, unfortunately, also includes interviews. Interviews require full concentration power. So for interviews, I would find a colleague to step in for me or ask to reschedule the interview altogether. Everything else wouldn't make it justice and would waste everyone's time!

      - -
      mult.calculate(mult,a,b));
      -
      +

      Invent


      +
      +The mind works differently under sleep deprivation: It's easier to invent new stuff as it's easier to have a look at things from different perspectives. Until an hour ago, I didn't know yet what I would be blogging about for this month, and then I just started writing this, and it took me only half an hour to write the first draft of this blog post!
      +
      +

      Fast


      +
      +I don't eat breakfast, and I don't eat lunch on these days. I only have dinner. Not eating means my mind doesn't get foggy, and I keep up the work momentum. This is called intermittent fasting, which not only generally helps to keep the weight under control and boosts the concentration power. Furthermore, intermittent fasting is healthy. You should include it in your routine, even after a good night's sleep.
      +
      +

      Stretch


      +
      +I won't have enough energy for strenuous physical exercise on those days, but a 30 to a 60-minute stretching session can make the day. Stretching will even hurt less under sleep deprivation! The stretching could also be substituted with a light Yoga session.

      -

      Real object oriented programming with C


      +

      Walk



      -If you want to take it further, hit "Object-Oriented Programming with ANSI-C" into your favourite internet search engine or follow the link below. It goes as far as writing a C preprocessor in AWK, which takes some object-oriented pseudo-C and transforms it to plain C so that the C compiler can compile it to machine code. This is similar to how the C++ language had its origins.
      +Walking is healthy, and the time can be used to listen to interesting podcasts. The available concentration power might not be enough for more sophisticated audio literature. I will have enough energy for one or two daily walks (~10k steps for the day in total). Sometimes, I listen to music during walks. I also try to catch the bright sunlight.
      +
      +

      Red Bull


      +
      +I don't think that Red Bull is a healthy drink. But once in a while, a can in the early afternoon brings wonders, and productivity will skyrocket. Other than Red Bull, drink a lot of water throughout the day. Don't forget to drink the sugar-free version; otherwise, your intermittent fast will be broken.
      +
      +

      Power nap


      +
      +I don't know how to "enforce" a nap, but sometimes I manage to power nap, and it helps wonders. A 30-minute nap sometimes brings me back to normal. If you don't tend to fast as you are too hungry, it helps to try to nap approximately 30 minutes after eating something.
      +
      +

      Don't take anything personally.



      -https://www.cs.rit.edu/~ats/books/ooc.pdf
      +It's much more challenging to keep the mind "under control" in this state. Every annoyance can potentially upset, which could reflect on the work colleagues. It is wise to attempt to go with a positive attitude into the day, always smile and be polite to the family and colleagues at work. Don't let anything drop out to the people next; they don't deserve it as they didn't do anything wrong! Also, remember, it can't be controlled at all. It's time to let go of the annoyances for the day.
      +
      +

      Meditate


      +
      +To keep the good vibe, it helps to meditate for 10 minutes. Meditation must nothing be fancy. It can be just lying on the sofa and observing your thoughts as they come and go. Don't judge your thoughts, as that could put you in a negative mood. It's not necessary to sit in an uncomfortable Yoga pose, and it is not required to chant "Ohhmmmmm".

      -

      OOP design patterns in the Linux Kernel


      +

      Write things down



      -Big C software projects, like Linux, also follow some OOP techniques:
      +Sometimes something requiring more concentration power demands time. This is where it helps to write a note in a journal and return to it another day. This doesn't mean slacking off but managing the rarely available concentration power for the day. I might repeat myself: Today, sweat all the small stuff. Tomorrow, do the deep-focused work on that crucial project again.
      +
      +It's easier to forget things on those days, so everything should be written down so that it can be worked off later. Things written down will not be overlooked!

      -https://lwn.net/Articles/444910/
      +

      Social media



      -C is a very old programming language with it's quirks. This might be one of the reasons why Linux will also let Rust code in.
      +I wouldn't say I like checking social media, as it can consume a lot of time and can become addictive. But once in a while, I want to catch up with my "networks". After a bad night's sleep, it's the perfect time to check your social media. Once done, you don't have to do it anymore for the next couple of days!

      E-Mail your comments to paul@nospam.buetow.org :-)

      diff --git a/gemfeed/bash-golf-part-3/bash-fork-bomb.jpg b/gemfeed/bash-golf-part-3/bash-fork-bomb.jpg new file mode 100644 index 00000000..6967c03a Binary files /dev/null and b/gemfeed/bash-golf-part-3/bash-fork-bomb.jpg differ diff --git a/gemfeed/dtail-the-distributed-log-tail-program/dgrep.gif b/gemfeed/dtail-the-distributed-log-tail-program/dgrep.gif new file mode 100644 index 00000000..e2f2ac64 Binary files /dev/null and b/gemfeed/dtail-the-distributed-log-tail-program/dgrep.gif differ diff --git a/gemfeed/dtail-the-distributed-log-tail-program/dtail.gif b/gemfeed/dtail-the-distributed-log-tail-program/dtail.gif new file mode 100644 index 00000000..8f6b56bf Binary files /dev/null and b/gemfeed/dtail-the-distributed-log-tail-program/dtail.gif differ diff --git a/gemfeed/dtail-the-distributed-log-tail-program/title.png b/gemfeed/dtail-the-distributed-log-tail-program/title.png new file mode 100644 index 00000000..4e343c4f Binary files /dev/null and b/gemfeed/dtail-the-distributed-log-tail-program/title.png differ diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-1/diagram.png b/gemfeed/f3s-kubernetes-with-freebsd-part-1/diagram.png new file mode 100644 index 00000000..fa6b655a Binary files /dev/null and b/gemfeed/f3s-kubernetes-with-freebsd-part-1/diagram.png differ diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-1/f3slogo.png b/gemfeed/f3s-kubernetes-with-freebsd-part-1/f3slogo.png new file mode 100644 index 00000000..cc45b40e Binary files /dev/null and b/gemfeed/f3s-kubernetes-with-freebsd-part-1/f3slogo.png differ diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-2/3beelinks.jpg b/gemfeed/f3s-kubernetes-with-freebsd-part-2/3beelinks.jpg new file mode 100644 index 00000000..7da37da7 Binary files /dev/null and b/gemfeed/f3s-kubernetes-with-freebsd-part-2/3beelinks.jpg differ diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-2/f3s-collage1.jpg b/gemfeed/f3s-kubernetes-with-freebsd-part-2/f3s-collage1.jpg new file mode 100644 index 00000000..294eb37d Binary files /dev/null and b/gemfeed/f3s-kubernetes-with-freebsd-part-2/f3s-collage1.jpg differ diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-2/f3s-collage2.jpg b/gemfeed/f3s-kubernetes-with-freebsd-part-2/f3s-collage2.jpg new file mode 100644 index 00000000..77c4c0bc Binary files /dev/null and b/gemfeed/f3s-kubernetes-with-freebsd-part-2/f3s-collage2.jpg differ diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-2/switch.jpg b/gemfeed/f3s-kubernetes-with-freebsd-part-2/switch.jpg new file mode 100644 index 00000000..8fe0edeb Binary files /dev/null and b/gemfeed/f3s-kubernetes-with-freebsd-part-2/switch.jpg differ diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-2/watt.jpg b/gemfeed/f3s-kubernetes-with-freebsd-part-2/watt.jpg new file mode 100644 index 00000000..e79fe68c Binary files /dev/null and b/gemfeed/f3s-kubernetes-with-freebsd-part-2/watt.jpg differ diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpg b/gemfeed/f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpg new file mode 100644 index 00000000..15b1ca78 Binary files /dev/null and b/gemfeed/f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpg differ diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpg b/gemfeed/f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpg new file mode 100644 index 00000000..5752f2fc Binary files /dev/null and b/gemfeed/f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpg differ diff --git a/gemfeed/from-.org-to-.cloud/old-man-yells-at-cloud.jpg b/gemfeed/from-.org-to-.cloud/old-man-yells-at-cloud.jpg new file mode 100644 index 00000000..da1170f8 Binary files /dev/null and b/gemfeed/from-.org-to-.cloud/old-man-yells-at-cloud.jpg differ diff --git a/gemfeed/gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg b/gemfeed/gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg new file mode 100644 index 00000000..844bc9fc Binary files /dev/null and b/gemfeed/gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg differ diff --git a/gemfeed/index.html b/gemfeed/index.html index f5c3bcbd..e997f0c7 100644 --- a/gemfeed/index.html +++ b/gemfeed/index.html @@ -8,22 +8,46 @@ -

      Gemfeed of foo.zone


      +

      +Home | Markdown | Gemini +

      +

      Gemfeed of foo.zone



      -

      To be in the .zone!


      +

      To be in the .zone!



      +2025-02-08 - Random Weird Things - Part Ⅱ
      +2025-02-01 - f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
      +2025-01-15 - Working with an SRE Interview
      +2025-01-01 - Posts from October to December 2024
      +2024-12-15 - Random Helix Themes
      +2024-12-03 - f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
      +2024-11-17 - f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
      +2024-10-24 - 'Staff Engineer' book notes
      +2024-10-02 - Gemtexter 3.0.0 - Let's Gemtext again⁴
      +2024-09-07 - Site Reliability Engineering - Part 4: Onboarding for On-Call Engineers
      +2024-09-07 - Projects I financially support
      +2024-08-05 - Typing 127.1 words per minute (>100wpm average)
      +2024-07-07 - 'The Stoic Challenge' book notes
      +2024-07-05 - Random Weird Things - Part Ⅰ
      +2024-06-23 - Terminal multiplexing with tmux
      +2024-05-03 - Projects I currently don't have time for
      +2024-05-01 - 'Slow Productivity' book notes
      +2024-04-01 - KISS high-availability with OpenBSD
      +2024-03-03 - A fine Fyne Android app for quickly logging ideas programmed in Go
      +2024-02-04 - From babylon5.buetow.org to *.buetow.cloud
      +2024-01-13 - One reason why I love OpenBSD
      +2024-01-09 - Site Reliability Engineering - Part 3: On-Call Culture
      +2023-12-10 - Bash Golf Part 3
      +2023-11-19 - Site Reliability Engineering - Part 2: Operational Balance
      2023-11-11 - 'Mind Management' book notes
      2023-10-29 - KISS static web photo albums with photoalbum.sh
      2023-09-25 - DTail usage examples
      -2023-08-20 - Site Reliability Engineering - Part 3: On-Call Culture and the Human Aspect
      -2023-08-19 - Site Reliability Engineering - Part 2: Operational Balance in SRE
      2023-08-18 - Site Reliability Engineering - Part 1: SRE and Organizational Culture
      2023-07-21 - Gemtexter 2.1.0 - Let's Gemtext again³
      2023-07-17 - 'Software Developmers Career Guide and Soft Skills' book notes
      2023-06-01 - KISS server monitoring with Gogios
      2023-05-06 - 'The Obstacle is the Way' book notes
      2023-05-01 - Unveiling guprecords.raku: Global Uptime Records with Raku
      -2023-04-09 - Algorithms and Data Structures in Go - Part 1
      2023-04-01 - 'Never split the difference' book notes
      2023-03-25 - Gemtexter 2.0.0 - Let's Gemtext again²
      2023-03-16 - 'The Pragmatic Programmer' book notes
      @@ -64,12 +88,13 @@ 2010-05-09 - The Fype Programming Language
      2010-05-07 - Lazy Evaluation with Standard ML
      2010-04-09 - Standard ML and Haskell
      +2009-02-13 - SGI Onyx 3200
      2008-12-29 - Using my Nokia N95 for fixing my MTA
      2008-06-26 - Perl Poetry
      diff --git a/gemfeed/kiss-server-monitoring-with-gogios/gogios-small.png b/gemfeed/kiss-server-monitoring-with-gogios/gogios-small.png new file mode 100644 index 00000000..aebe695c Binary files /dev/null and b/gemfeed/kiss-server-monitoring-with-gogios/gogios-small.png differ diff --git a/gemfeed/perl-is-still-a-great-choice/googletrendsperl.jpg b/gemfeed/perl-is-still-a-great-choice/googletrendsperl.jpg new file mode 100644 index 00000000..397c9f29 Binary files /dev/null and b/gemfeed/perl-is-still-a-great-choice/googletrendsperl.jpg differ diff --git a/gemfeed/perl-is-still-a-great-choice/regular_expressions.png b/gemfeed/perl-is-still-a-great-choice/regular_expressions.png new file mode 100644 index 00000000..acbc2437 Binary files /dev/null and b/gemfeed/perl-is-still-a-great-choice/regular_expressions.png differ diff --git a/gemfeed/random-weird-things-ii/css-conway.png b/gemfeed/random-weird-things-ii/css-conway.png new file mode 100644 index 00000000..c29d1d8b Binary files /dev/null and b/gemfeed/random-weird-things-ii/css-conway.png differ diff --git a/gemfeed/random-weird-things-ii/go-font-code.png b/gemfeed/random-weird-things-ii/go-font-code.png new file mode 100644 index 00000000..630cccfe Binary files /dev/null and b/gemfeed/random-weird-things-ii/go-font-code.png differ diff --git a/gemfeed/random-weird-things-ii/sqlite-gem.png b/gemfeed/random-weird-things-ii/sqlite-gem.png new file mode 100644 index 00000000..f3c3ceb6 Binary files /dev/null and b/gemfeed/random-weird-things-ii/sqlite-gem.png differ diff --git a/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure1-ioriot-io-recording.png b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure1-ioriot-io-recording.png new file mode 100644 index 00000000..43ac852f Binary files /dev/null and b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure1-ioriot-io-recording.png differ diff --git a/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure2-ioriot-test-preparation.png b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure2-ioriot-test-preparation.png new file mode 100644 index 00000000..709d7490 Binary files /dev/null and b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure2-ioriot-test-preparation.png differ diff --git a/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure3-ioriot-replay.png b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure3-ioriot-replay.png new file mode 100644 index 00000000..3bd66b6f Binary files /dev/null and b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure3-ioriot-replay.png differ diff --git a/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure4-ioriot-read-latency.png b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure4-ioriot-read-latency.png new file mode 100644 index 00000000..160b2305 Binary files /dev/null and b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure4-ioriot-read-latency.png differ diff --git a/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure5-ioriot-write-latency.png b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure5-ioriot-write-latency.png new file mode 100644 index 00000000..e30efdbb Binary files /dev/null and b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure5-ioriot-write-latency.png differ diff --git a/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure6-iostat.png b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure6-iostat.png new file mode 100644 index 00000000..0d3fc0d8 Binary files /dev/null and b/gemfeed/realistic-load-testing-with-ioriot-for-linux/figure6-iostat.png differ diff --git a/gemfeed/run-debian-on-your-phone-with-debroid/Deboroid.png b/gemfeed/run-debian-on-your-phone-with-debroid/Deboroid.png new file mode 100644 index 00000000..f76cf226 Binary files /dev/null and b/gemfeed/run-debian-on-your-phone-with-debroid/Deboroid.png differ diff --git a/gemfeed/sgi-onyx-3200/collage.webp b/gemfeed/sgi-onyx-3200/collage.webp new file mode 100644 index 00000000..e33ea1c8 Binary files /dev/null and b/gemfeed/sgi-onyx-3200/collage.webp differ diff --git a/gemfeed/sgi-onyx-3200/collage2.webp b/gemfeed/sgi-onyx-3200/collage2.webp new file mode 100644 index 00000000..21ccbc44 Binary files /dev/null and b/gemfeed/sgi-onyx-3200/collage2.webp differ diff --git a/gemfeed/sgi-onyx-3200/desk.webp b/gemfeed/sgi-onyx-3200/desk.webp new file mode 100644 index 00000000..d82681e5 Binary files /dev/null and b/gemfeed/sgi-onyx-3200/desk.webp differ diff --git a/gemfeed/sweating-the-small-stuff/jsmstrade.png b/gemfeed/sweating-the-small-stuff/jsmstrade.png new file mode 100644 index 00000000..ce5276f8 Binary files /dev/null and b/gemfeed/sweating-the-small-stuff/jsmstrade.png differ diff --git a/gemfeed/sweating-the-small-stuff/ninja.jpg b/gemfeed/sweating-the-small-stuff/ninja.jpg new file mode 100644 index 00000000..8a036323 Binary files /dev/null and b/gemfeed/sweating-the-small-stuff/ninja.jpg differ diff --git a/gemfeed/terminal-multiplexing-with-tmux/tmux-session-fzf.png b/gemfeed/terminal-multiplexing-with-tmux/tmux-session-fzf.png new file mode 100644 index 00000000..7a2e9440 Binary files /dev/null and b/gemfeed/terminal-multiplexing-with-tmux/tmux-session-fzf.png differ diff --git a/gemfeed/terminal-multiplexing-with-tmux/tmux-tree-view.png b/gemfeed/terminal-multiplexing-with-tmux/tmux-tree-view.png new file mode 100644 index 00000000..672859c5 Binary files /dev/null and b/gemfeed/terminal-multiplexing-with-tmux/tmux-tree-view.png differ diff --git a/gemfeed/the-well-grounded-rubyist/book-backside.jpg b/gemfeed/the-well-grounded-rubyist/book-backside.jpg new file mode 100644 index 00000000..2190e679 Binary files /dev/null and b/gemfeed/the-well-grounded-rubyist/book-backside.jpg differ diff --git a/gemfeed/the-well-grounded-rubyist/book-cover.jpg b/gemfeed/the-well-grounded-rubyist/book-cover.jpg new file mode 100644 index 00000000..b5a00063 Binary files /dev/null and b/gemfeed/the-well-grounded-rubyist/book-cover.jpg differ diff --git a/gemfeed/typing-127.1-words-per-minute/all-time-stats.png b/gemfeed/typing-127.1-words-per-minute/all-time-stats.png new file mode 100644 index 00000000..4d8a5a8f Binary files /dev/null and b/gemfeed/typing-127.1-words-per-minute/all-time-stats.png differ diff --git a/gemfeed/typing-127.1-words-per-minute/glove80.jpg b/gemfeed/typing-127.1-words-per-minute/glove80.jpg new file mode 100644 index 00000000..80b9c4fb Binary files /dev/null and b/gemfeed/typing-127.1-words-per-minute/glove80.jpg differ diff --git a/gemfeed/typing-127.1-words-per-minute/kinesis1.jpg b/gemfeed/typing-127.1-words-per-minute/kinesis1.jpg new file mode 100644 index 00000000..1edffb84 Binary files /dev/null and b/gemfeed/typing-127.1-words-per-minute/kinesis1.jpg differ diff --git a/gemfeed/typing-127.1-words-per-minute/kinesis2.jpg b/gemfeed/typing-127.1-words-per-minute/kinesis2.jpg new file mode 100644 index 00000000..d6ae665d Binary files /dev/null and b/gemfeed/typing-127.1-words-per-minute/kinesis2.jpg differ diff --git a/gemfeed/typing-127.1-words-per-minute/typing-speed-over-lessons.png b/gemfeed/typing-127.1-words-per-minute/typing-speed-over-lessons.png new file mode 100644 index 00000000..f9f85417 Binary files /dev/null and b/gemfeed/typing-127.1-words-per-minute/typing-speed-over-lessons.png differ diff --git a/gemfeed/ultrarelearning-java-my-takeaways/effective-java.jpg b/gemfeed/ultrarelearning-java-my-takeaways/effective-java.jpg new file mode 100644 index 00000000..213c6e03 Binary files /dev/null and b/gemfeed/ultrarelearning-java-my-takeaways/effective-java.jpg differ diff --git a/gemfeed/ultrarelearning-java-my-takeaways/learnjava.jpg b/gemfeed/ultrarelearning-java-my-takeaways/learnjava.jpg new file mode 100644 index 00000000..4c3b9e7b Binary files /dev/null and b/gemfeed/ultrarelearning-java-my-takeaways/learnjava.jpg differ diff --git a/gemfeed/using-my-nokia-n95-for-fixing-my-mta/nokia-n95.jpg b/gemfeed/using-my-nokia-n95-for-fixing-my-mta/nokia-n95.jpg new file mode 100644 index 00000000..6a11be8b Binary files /dev/null and b/gemfeed/using-my-nokia-n95-for-fixing-my-mta/nokia-n95.jpg differ diff --git a/gemfeed/welcome-to-the-geminispace/amfora-screenshot.png b/gemfeed/welcome-to-the-geminispace/amfora-screenshot.png new file mode 100644 index 00000000..093aec79 Binary files /dev/null and b/gemfeed/welcome-to-the-geminispace/amfora-screenshot.png differ diff --git a/gemfeed/welcome-to-the-geminispace/lagrange-screenshot.png b/gemfeed/welcome-to-the-geminispace/lagrange-screenshot.png new file mode 100644 index 00000000..478d2fdd Binary files /dev/null and b/gemfeed/welcome-to-the-geminispace/lagrange-screenshot.png differ -- cgit v1.2.3