From 351048311cb180e2691604d6c9ba980fcfcd2eeb Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 9 Apr 2023 13:36:34 +0300 Subject: Update content for gemtext --- gemfeed/2008-06-26-perl-poetry.gmi | 6 +- gemfeed/2008-06-26-perl-poetry.gmi.tpl | 6 +- .../2010-05-09-the-fype-programming-language.gmi | 4 +- .../2011-05-07-perl-daemon-service-framework.gmi | 12 +- ...011-05-07-perl-daemon-service-framework.gmi.tpl | 12 +- gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.gmi | 6 +- ...12-05-run-debian-on-your-phone-with-debroid.gmi | 12 +- ...05-gemtexter-one-bash-script-to-rule-it-all.gmi | 7 +- ...emtexter-one-bash-script-to-rule-it-all.gmi.tpl | 7 +- gemfeed/2021-09-12-keep-it-simple-and-stupid.gmi | 2 +- ...22-08-27-gemtexter-1.1.0-lets-gemtext-again.gmi | 4 +- ...8-27-gemtexter-1.1.0-lets-gemtext-again.gmi.tpl | 4 +- ...-03-25-gemtexter-2.0.0-lets-gemtext-again-2.gmi | 6 +- ...25-gemtexter-2.0.0-lets-gemtext-again-2.gmi.tpl | 6 +- gemfeed/atom.xml | 1560 ++++++++++++-------- 15 files changed, 965 insertions(+), 689 deletions(-) (limited to 'gemfeed') diff --git a/gemfeed/2008-06-26-perl-poetry.gmi b/gemfeed/2008-06-26-perl-poetry.gmi index ae0d3327..3930c5c7 100644 --- a/gemfeed/2008-06-26-perl-poetry.gmi +++ b/gemfeed/2008-06-26-perl-poetry.gmi @@ -33,7 +33,7 @@ Wikipedia: "Perl poetry is the practice of writing poems that can be compiled as ## math.pl -``` +```perl #!/usr/bin/perl # (C) 2006 by Paul C. Buetow @@ -77,7 +77,7 @@ __END__ ## christmas.pl -``` +```perl #!/usr/bin/perl # (C) 2006 by Paul C. Buetow @@ -123,7 +123,7 @@ This is perl, v5.8.8 built for i386-freebsd-64int ## shopping.pl -``` +```perl #!/usr/bin/perl # (C) 2007 by Paul C. Buetow diff --git a/gemfeed/2008-06-26-perl-poetry.gmi.tpl b/gemfeed/2008-06-26-perl-poetry.gmi.tpl index b0fc2747..6383099e 100644 --- a/gemfeed/2008-06-26-perl-poetry.gmi.tpl +++ b/gemfeed/2008-06-26-perl-poetry.gmi.tpl @@ -33,7 +33,7 @@ Wikipedia: "Perl poetry is the practice of writing poems that can be compiled as ## math.pl -``` +```perl #!/usr/bin/perl # (C) 2006 by Paul C. Buetow @@ -77,7 +77,7 @@ __END__ ## christmas.pl -``` +```perl #!/usr/bin/perl # (C) 2006 by Paul C. Buetow @@ -123,7 +123,7 @@ This is perl, v5.8.8 built for i386-freebsd-64int ## shopping.pl -``` +```perl #!/usr/bin/perl # (C) 2007 by Paul C. Buetow diff --git a/gemfeed/2010-05-09-the-fype-programming-language.gmi b/gemfeed/2010-05-09-the-fype-programming-language.gmi index 0cdb7270..3cddb4c2 100644 --- a/gemfeed/2010-05-09-the-fype-programming-language.gmi +++ b/gemfeed/2010-05-09-the-fype-programming-language.gmi @@ -23,7 +23,7 @@ The Fype interpreter is written in an object-oriented style of C. Each "main com To give you an idea of how it works here as an example is a snippet from the main Fype "class header": -``` +```c typedef struct { Tupel *p_tupel_argv; // Contains command line options List *p_list_token; // Initial list of token @@ -34,7 +34,7 @@ typedef struct { And here is a snippet from the primary Fype "class implementation": -``` +```c Fype* fype_new() { Fype *p_fype = malloc(sizeof(Fype)); diff --git a/gemfeed/2011-05-07-perl-daemon-service-framework.gmi b/gemfeed/2011-05-07-perl-daemon-service-framework.gmi index c531d246..496df530 100644 --- a/gemfeed/2011-05-07-perl-daemon-service-framework.gmi +++ b/gemfeed/2011-05-07-perl-daemon-service-framework.gmi @@ -26,7 +26,7 @@ PerlDaemon supports: ## Quick Guide -``` +```sh # Starting ./bin/perldaemon start (or shortcut ./control start) @@ -43,7 +43,7 @@ To stop a daemon from running in foreground mode, "Ctrl+C" must be hit. To see m 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": -``` +```sh pb@titania:~/svn/utils/perldaemon/trunk$ ./control keys # Path to the logfile daemon.logfile=./log/perldaemon.log @@ -74,7 +74,7 @@ daemon.wd=./ So let's start the daemon with a loop interval of 10 seconds: -``` +```sh $ ./control keys | grep daemon.loopinterval daemon.loopinterval=1 $ ./control keys daemon.loopinterval=10 | grep daemon.loopinterval @@ -90,7 +90,7 @@ Stopping daemon now... If you want to change that property forever, either edit perldaemon.conf or do this: -``` +```sh $ ./control keys daemon.loopinterval=10 > new.conf; mv new.conf conf/perldaemon.conf ``` @@ -104,7 +104,7 @@ PerlDaemon uses `Time::HiRes` to make sure that all the events run incorrect int This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-). -``` +```perl package PerlDaemonModules::ExampleModule; use strict; @@ -140,7 +140,7 @@ sub do ($) { Want to give it some better use? It's just as easy as: -``` +```sh cd ./lib/PerlDaemonModules/ cp ExampleModule.pm YourModule.pm vi YourModule.pm diff --git a/gemfeed/2011-05-07-perl-daemon-service-framework.gmi.tpl b/gemfeed/2011-05-07-perl-daemon-service-framework.gmi.tpl index 5834890e..6069488a 100644 --- a/gemfeed/2011-05-07-perl-daemon-service-framework.gmi.tpl +++ b/gemfeed/2011-05-07-perl-daemon-service-framework.gmi.tpl @@ -26,7 +26,7 @@ PerlDaemon supports: ## Quick Guide -``` +```sh # Starting ./bin/perldaemon start (or shortcut ./control start) @@ -43,7 +43,7 @@ To stop a daemon from running in foreground mode, "Ctrl+C" must be hit. To see m 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": -``` +```sh pb@titania:~/svn/utils/perldaemon/trunk$ ./control keys # Path to the logfile daemon.logfile=./log/perldaemon.log @@ -74,7 +74,7 @@ daemon.wd=./ So let's start the daemon with a loop interval of 10 seconds: -``` +```sh $ ./control keys | grep daemon.loopinterval daemon.loopinterval=1 $ ./control keys daemon.loopinterval=10 | grep daemon.loopinterval @@ -90,7 +90,7 @@ Stopping daemon now... If you want to change that property forever, either edit perldaemon.conf or do this: -``` +```sh $ ./control keys daemon.loopinterval=10 > new.conf; mv new.conf conf/perldaemon.conf ``` @@ -104,7 +104,7 @@ PerlDaemon uses `Time::HiRes` to make sure that all the events run incorrect int This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-). -``` +```perl package PerlDaemonModules::ExampleModule; use strict; @@ -140,7 +140,7 @@ sub do ($) { Want to give it some better use? It's just as easy as: -``` +```sh cd ./lib/PerlDaemonModules/ cp ExampleModule.pm YourModule.pm vi YourModule.pm diff --git a/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.gmi b/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.gmi index ceb6c8f2..ba7f93b3 100644 --- a/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.gmi +++ b/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.gmi @@ -10,7 +10,7 @@ In computing, a polyglot is a computer program or script written in a valid form 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: -``` +```perl #include #define $arg function_argument @@ -60,7 +60,7 @@ You can find the full source code at GitHub: ### Let's run it with C and C++ -``` +```sh % gcc fibonacci.pl.raku.c -o fibonacci % ./fibonacci Hello, welcome to the Fibonacci Numbers! @@ -100,7 +100,7 @@ fib(10) = 55 ### Let's run it with Perl and Raku -``` +```sh % perl fibonacci.pl.raku.c Hello, welcome to the Fibonacci Numbers! This program is all, valid C and C++ and Perl and Raku code! diff --git a/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid.gmi b/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid.gmi index 08ff03dc..50c7486d 100644 --- a/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid.gmi +++ b/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid.gmi @@ -29,7 +29,7 @@ All scripts mentioned here can be found on GitHub at: 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. -```code +```sh sudo dnf install debootstrap # 5g dd if=/dev/zero of=jessie.img bs=$[ 1024 * 1024 ] \ @@ -54,7 +54,7 @@ sudo umount jessie Now setup the Debian image on an external SD card on the Phone via Android Debugger as follows: -``` +```sh adb root && adb wait-for-device && adb shell mkdir -p /storage/sdcard1/Linux/jessie exit @@ -97,7 +97,7 @@ mount | grep jessie This is to be performed on the Android phone itself (inside a Debian chroot): -``` +```sh chroot $(pwd)/jessie /bin/bash -l export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin /debootstrap/debootstrap --second-stage @@ -109,7 +109,7 @@ exit # Leave adb shell 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. -``` +```sh # Install script jessie.sh adb push storage/sdcard1/Linux/jessie.sh /storage/sdcard/Linux/jessie.sh adb shell @@ -146,7 +146,7 @@ exit # Exit chroot This enters Debroid on your phone and starts the example service uptimed: -``` +```sh sh jessie.sh enter # Setup example serice uptimed @@ -166,7 +166,7 @@ exit # Exit adb shell If you want to start Debroid automatically whenever your phone starts, then do the following: -``` +```sh adb push data/local/userinit.sh /data/local/userinit.sh adb shell chmod +x /data/local/userinit.sh diff --git a/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi b/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi index bdd62b75..4a38fb3a 100644 --- a/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi +++ b/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi @@ -79,7 +79,7 @@ The Bash is suitable very well for small scripts and ad-hoc automation on the co 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. -``` +```sh paul in uranus in gemtexter on 🌱 main ❯ wc -l gemtexter lib/* 117 gemtexter @@ -122,16 +122,15 @@ It has been proven quite helpful to have unit tests in place for the HTML part a ### HTML unit test example -``` +```bash gemtext='=> http://example.org Description of the link' assert::equals "$(generate::make_link html "$gemtext")" \ 'Description of the link
' - ``` ### Markdown unit test example -``` +```bash gemtext='=> http://example.org Description of the link' assert::equals "$(generate::make_link md "$gemtext")" \ '[Description of the link](http://example.org) ' diff --git a/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi.tpl b/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi.tpl index 5a8c9d5e..7d2574a1 100644 --- a/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi.tpl +++ b/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi.tpl @@ -79,7 +79,7 @@ The Bash is suitable very well for small scripts and ad-hoc automation on the co 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. -``` +```sh paul in uranus in gemtexter on 🌱 main ❯ wc -l gemtexter lib/* 117 gemtexter @@ -122,16 +122,15 @@ It has been proven quite helpful to have unit tests in place for the HTML part a ### HTML unit test example -``` +```bash gemtext='=> http://example.org Description of the link' assert::equals "$(generate::make_link html "$gemtext")" \ 'Description of the link
' - ``` ### Markdown unit test example -``` +```bash gemtext='=> http://example.org Description of the link' assert::equals "$(generate::make_link md "$gemtext")" \ '[Description of the link](http://example.org) ' diff --git a/gemfeed/2021-09-12-keep-it-simple-and-stupid.gmi b/gemfeed/2021-09-12-keep-it-simple-and-stupid.gmi index e2add227..31d43dcb 100644 --- a/gemfeed/2021-09-12-keep-it-simple-and-stupid.gmi +++ b/gemfeed/2021-09-12-keep-it-simple-and-stupid.gmi @@ -2,7 +2,7 @@ > Published at 2021-09-12T09:39:20+03:00; Updated at 2023-03-23 -``` +``` _______________ |*\_/*|_______ | ___________ | .-. .-. ||_/-\_|______ | | | | | .****. .****. | | | | diff --git a/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.gmi b/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.gmi index eb4d8d3e..7edf7b27 100644 --- a/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.gmi +++ b/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.gmi @@ -26,7 +26,7 @@ It has been around a year since I released the first version `1.0.0`. Although, 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: -``` +```bash check_dependencies () { # At least, Bash 5 is required local -i required_version=5 @@ -60,7 +60,7 @@ The Bash is not the most performant language. Gemtexter already takes a couple o 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: -``` +```sh ./gemtexter --generate '.*hello.*' ``` diff --git a/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.gmi.tpl b/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.gmi.tpl index 9c66d0ea..0deba5c5 100644 --- a/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.gmi.tpl +++ b/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.gmi.tpl @@ -26,7 +26,7 @@ It has been around a year since I released the first version `1.0.0`. Although, 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: -``` +```bash check_dependencies () { # At least, Bash 5 is required local -i required_version=5 @@ -60,7 +60,7 @@ The Bash is not the most performant language. Gemtexter already takes a couple o 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: -``` +```sh ./gemtexter --generate '.*hello.*' ``` diff --git a/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.gmi b/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.gmi index 3b20eced..c334aa08 100644 --- a/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.gmi +++ b/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.gmi @@ -95,7 +95,7 @@ You can configure `PRE_GENERATE_HOOK` and `POST_PUBLISH_HOOK` to point to script The sample config file `gemtexter.conf` includes this as an example now; these scripts will only be executed when they actually exist: -``` +```bash declare -xr PRE_GENERATE_HOOK=./pre_generate_hook.sh declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh ``` @@ -110,7 +110,7 @@ Here is the breaking change to older versions of Gemtexter. The `$BASE_CONTENT_D An example blog post without any publishing date looks like this: -``` +```sh % cat gemfeed/2023-02-26-title-here.gmi # Title here @@ -119,7 +119,7 @@ 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. -``` +```sh % cat gemfeed/2023-02-26-title-here.gmi # Title here diff --git a/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.gmi.tpl b/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.gmi.tpl index 8ae50925..e2141940 100644 --- a/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.gmi.tpl +++ b/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.gmi.tpl @@ -95,7 +95,7 @@ You can configure `PRE_GENERATE_HOOK` and `POST_PUBLISH_HOOK` to point to script The sample config file `gemtexter.conf` includes this as an example now; these scripts will only be executed when they actually exist: -``` +```bash declare -xr PRE_GENERATE_HOOK=./pre_generate_hook.sh declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh ``` @@ -110,7 +110,7 @@ Here is the breaking change to older versions of Gemtexter. The `$BASE_CONTENT_D An example blog post without any publishing date looks like this: -``` +```sh % cat gemfeed/2023-02-26-title-here.gmi # Title here @@ -119,7 +119,7 @@ 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. -``` +```sh % cat gemfeed/2023-02-26-title-here.gmi # Title here diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 408db2c3..20fcf3d5 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,6 +1,6 @@ - 2023-04-08T12:32:07+03:00 + 2023-04-09T13:33:53+03:00 foo.zone feed To be in the .zone! @@ -268,9 +268,12 @@ Blablabla...
The sample config file gemtexter.conf includes this as an example now; these scripts will only be executed when they actually exist:

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


@@ -283,22 +286,28 @@ declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh
An example blog post without any publishing date looks like this:

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

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


@@ -1304,23 +1313,26 @@ jgs (________\ \
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
+
+
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
 }
 

@@ -1338,8 +1350,11 @@ check_dependencies () {
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:

-
-./gemtexter --generate '.*hello.*'
+
+
./gemtexter --generate '.*hello.*'
 

Revamped git support


@@ -3051,7 +3066,6 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2 Published at 2022-01-01T23:36:15+00:00; Updated at 2022-01-05

-
     '\       '\                   .  .                |>18>>
       \        \              .         ' .           |
      O>>      O>>         .                 'o        |
@@ -3653,7 +3667,6 @@ PAUL:X:1000:1000:PAUL BUETOW:/HOME/PAUL:/BIN/BASH
 Published at 2021-11-29T14:06:14+00:00; Updated at 2022-01-05

-
      '\                   .  .                        |>18>>
        \              .         ' .                   |
       O>>         .                 'o                |
@@ -4219,8 +4232,10 @@ bash: line 1: 1/10.0 : syntax error: invalid arithmetic operator (error token is
         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.
         
             
-

Keep it simple and stupid

-

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

+

Keep it simple and stupid


+
+Published at 2021-09-12T09:39:20+03:00; Updated at 2023-03-23
+
   _______________                        |*\_/*|_______
   |  ___________  |     .-.     .-.      ||_/-\_|______  |
@@ -4234,49 +4249,90 @@ bash: line 1: 1/10.0 : syntax error: invalid arithmetic operator (error token is
    / ********** \                          / ********** \
  /  ************  \                      /  ************  \
 --------------------                    --------------------
-

-

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

-

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:

-Today's Students Don't Understand the Basics of Computer Operations
-

And here is something to smile about:

-https://christine.website/blog/theres-a-node-2021-10-02
-

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:

-2021-04-24-welcome-to-the-geminispace.html
-

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

-

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.

-2021-04-22-dtail-the-distributed-log-tail-program.html
-

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

-

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

-

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

-

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

-

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

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

Enough ranted for now!

-

E-Mail your comments to hi@paul.cyou :-)

-

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

-Back to the main site
+
+
+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


+
+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:
+
+Today's Students Don't Understand the Basics of Computer Operations
+
+And here is something to smile about:
+
+https://christine.website/blog/theres-a-node-2021-10-02
+
+

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:
+
+2021-04-24-welcome-to-the-geminispace.html
+
+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


+
+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.
+
+2021-04-22-dtail-the-distributed-log-tail-program.html
+
+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


+
+

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


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


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


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


+
+Is the madness ever going to end?
+Write plain text files
+
+Enough ranted for now!
+
+E-Mail your comments to hi@paul.cyou :-)
+
+Controversially, a lack of features is a feature. Enjoy your peace an quiet. - Michael W Lucas
+
+Back to the main site
@@ -4539,19 +4595,22 @@ Hello World
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
+
+
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.
@@ -4582,19 +4641,24 @@ paul in uranus in gemtexter on 🌱 main

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



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


@@ -5073,7 +5137,6 @@ fi 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 :-).

-
     /\
    /  \
   |    |
@@ -6219,8 +6282,10 @@ Notice: Finished catalog run in 206.09 seconds
         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).
         
             
-

Run Debian on your phone with Debroid

-

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

+

Run Debian on your phone with Debroid


+
+Published at 2015-12-05T16:12:57+00:00; Updated at 2021-05-16
+
  ____       _               _     _ 
 |  _ \  ___| |__  _ __ ___ (_) __| |
@@ -6228,147 +6293,193 @@ Notice: Finished catalog run in 206.09 seconds
 | |_| |  __/ |_) | | | (_) | | (_| |
 |____/ \___|_.__/|_|  \___/|_|\__,_|
                                     
-

-

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.

-

Step by step guide

-

All scripts mentioned here can be found on GitHub at:

-https://codeberg.org/snonux/debroid
-

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.

-
-sudo dnf install debootstrap
-# 5g
-dd if=/dev/zero of=jessie.img bs=$[ 1024 * 1024 ] \
-  count=$[ 1024 * 5 ]
-
-# Show used loop devices
+
+
+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.
+
+

Step by step guide


+
+All scripts mentioned here can be found on GitHub at:
+
+https://codeberg.org/snonux/debroid
+
+

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

-

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

-
-adb root && adb wait-for-device && adb shell
-mkdir -p /storage/sdcard1/Linux/jessie
-exit
+
+
+

Copy Debian image to the phone


+
+Now setup the Debian image on an external SD card on the Phone via Android Debugger as follows:
+
+ +
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
-
-# 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 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
-

-

Second debootstrap stage

-

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

-
-chroot $(pwd)/jessie /bin/bash -l
-export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
+# 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
+
+# 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
+
+# Check mounts
+mount | grep jessie
+
+
+

Second debootstrap stage


+
+This is to be performed on the Android phone itself (inside a Debian chroot):
+
+ +
chroot $(pwd)/jessie /bin/bash -l
+export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
 /debootstrap/debootstrap --second-stage
-exit # Leave chroot
-exit # Leave adb shell
-

-

Setup of various scripts

-

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.

-
-# Install script jessie.sh
-adb push storage/sdcard1/Linux/jessie.sh /storage/sdcard/Linux/jessie.sh
+exit # Leave chroot
+exit # Leave adb shell
+
+
+

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.
+
+ +
# Install script jessie.sh
+adb push storage/sdcard1/Linux/jessie.