From 2266b7e92fd04516ff2f714f616e86a93b9803e7 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 9 Apr 2023 13:36:34 +0300 Subject: Update content for html --- gemfeed/2008-06-26-perl-poetry.html | 155 +- ...12-29-using-my-nokia-n95-for-fixing-my-mta.html | 1 - ...010-05-07-lazy-evaluation-with-standarn-ml.html | 1 - .../2010-05-09-the-fype-programming-language.html | 88 +- .../2011-05-07-perl-daemon-service-framework.html | 152 +- .../2014-03-24-the-fibonacci.pl.c-polyglot.html | 203 +-- ...2-05-run-debian-on-your-phone-with-debroid.html | 182 ++- gemfeed/2021-04-24-welcome-to-the-geminispace.html | 1 - ...5-gemtexter-one-bash-script-to-rule-it-all.html | 52 +- gemfeed/2021-11-29-bash-golf-part-1.html | 1 - gemfeed/2022-01-01-bash-golf-part-2.html | 1 - ...2-08-27-gemtexter-1.1.0-lets-gemtext-again.html | 42 +- ...03-25-gemtexter-2.0.0-lets-gemtext-again-2.html | 33 +- gemfeed/atom.xml | 1560 ++++++++++++-------- 14 files changed, 1414 insertions(+), 1058 deletions(-) (limited to 'gemfeed') diff --git a/gemfeed/2008-06-26-perl-poetry.html b/gemfeed/2008-06-26-perl-poetry.html index 0482b638..d89d2d56 100644 --- a/gemfeed/2008-06-26-perl-poetry.html +++ b/gemfeed/2008-06-26-perl-poetry.html @@ -43,126 +43,135 @@ _~~|~/_|_|__/|~~~~~~~ | / ~~~~~ | | ~~~~~~~~

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



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



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


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 b49efb8c..92505228 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 @@ -13,7 +13,6 @@ Published at 2008-12-29T09:10:41+00:00; Updated at 2021-12-01

-
            _
           |E]
         .-|=====-.
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 bfb83d94..ac2506ea 100644
--- a/gemfeed/2010-05-07-lazy-evaluation-with-standarn-ml.html
+++ b/gemfeed/2010-05-07-lazy-evaluation-with-standarn-ml.html
@@ -13,7 +13,6 @@
 Published at 2010-05-07T08:17:59+01:00

-
       _____|~~\_____      _____________
   _-~               \    |    \
   _-    | )     \    |__/   \   \
diff --git a/gemfeed/2010-05-09-the-fype-programming-language.html b/gemfeed/2010-05-09-the-fype-programming-language.html
index 061c1673..fcea0664 100644
--- a/gemfeed/2010-05-09-the-fype-programming-language.html
+++ b/gemfeed/2010-05-09-the-fype-programming-language.html
@@ -33,65 +33,71 @@
 
To give you an idea of how it works here as an example is a snippet from the main Fype "class header":

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

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


diff --git a/gemfeed/2011-05-07-perl-daemon-service-framework.html b/gemfeed/2011-05-07-perl-daemon-service-framework.html index cf27a47d..d4196438 100644 --- a/gemfeed/2011-05-07-perl-daemon-service-framework.html +++ b/gemfeed/2011-05-07-perl-daemon-service-framework.html @@ -37,15 +37,18 @@

Quick Guide



-
-# Starting
- ./bin/perldaemon start (or shortcut ./control start)
-
-# Stopping
- ./bin/perldaemon stop (or shortcut ./control stop)
-
-# Alternatively: Starting in foreground 
-./bin/perldaemon start daemon.daemonize=no (or shortcut ./control foreground)
+
+
# Starting
+ ./bin/perldaemon start (or shortcut ./control start)
+
+# Stopping
+ ./bin/perldaemon stop (or shortcut ./control stop)
+
+# 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.
@@ -54,55 +57,64 @@
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":

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



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

-
-$ ./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:

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


@@ -115,48 +127,54 @@ $ ./control keys daemon.loopinterval=10 > new.conf; mv new.conf conf/perldaem
This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-).

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



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

-
- 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).
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 fdc7a3f7..0b616c98 100644 --- a/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html +++ b/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html @@ -20,48 +20,51 @@
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:

-
-#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:
@@ -70,80 +73,86 @@ BEGIN {

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



-
-% 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 :-).
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 d4e04923..09b990e9 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 @@ -39,24 +39,27 @@
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 ]
+
+
sudo dnf install debootstrap
+# 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
 

@@ -64,123 +67,138 @@ sudo umount jessie
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
+
+
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



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



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



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

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



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

-
-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!
diff --git a/gemfeed/2021-04-24-welcome-to-the-geminispace.html b/gemfeed/2021-04-24-welcome-to-the-geminispace.html index 1af39899..f87b705d 100644 --- a/gemfeed/2021-04-24-welcome-to-the-geminispace.html +++ b/gemfeed/2021-04-24-welcome-to-the-geminispace.html @@ -21,7 +21,6 @@ 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 :-).

-
     /\
    /  \
   |    |
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 4b7ae78b..a7a82951 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
@@ -90,19 +90,22 @@
 
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.
@@ -133,19 +136,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


diff --git a/gemfeed/2021-11-29-bash-golf-part-1.html b/gemfeed/2021-11-29-bash-golf-part-1.html index 52a1db82..69528ab6 100644 --- a/gemfeed/2021-11-29-bash-golf-part-1.html +++ b/gemfeed/2021-11-29-bash-golf-part-1.html @@ -13,7 +13,6 @@ Published at 2021-11-29T14:06:14+00:00; Updated at 2022-01-05

-
      '\                   .  .                        |>18>>
        \              .         ' .                   |
       O>>         .                 'o                |
diff --git a/gemfeed/2022-01-01-bash-golf-part-2.html b/gemfeed/2022-01-01-bash-golf-part-2.html
index 57946256..35bf7e70 100644
--- a/gemfeed/2022-01-01-bash-golf-part-2.html
+++ b/gemfeed/2022-01-01-bash-golf-part-2.html
@@ -13,7 +13,6 @@
 Published at 2022-01-01T23:36:15+00:00; Updated at 2022-01-05

-
     '\       '\                   .  .                |>18>>
       \        \              .         ' .           |
      O>>      O>>         .                 'o        |
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 a423d4f3..efdd37df 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
@@ -36,23 +36,26 @@
 
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
+
+
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
 }
 

@@ -70,8 +73,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


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 a25f053d..b36c5c40 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 @@ -105,9 +105,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


@@ -120,22 +123,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


diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 2b23b61a..36e24b83 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.sh /storage/sdcard/Linux/jessie.sh
 adb shell
-cd /storage/sdcard1/Linux
-sh jessie.sh enter
-
-# Bashrc
-cat <<END >~/.bashrc
-export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
-export EDITOR=vim
-hostname $(cat /etc/hostname)
+cd /storage/sdcard1/Linux
+sh jessie.sh enter
+
+# Bashrc
+cat <<END >~/.bashrc
+export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
+export EDITOR=vim
+hostname $(cat /etc/hostname)
 END
 
-# 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
-

-

Entering Debroid and enable a service

-

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

-
-sh jessie.sh enter
+exit # Exit chroot
+
+
+

Entering Debroid and enable a service


+
+This enters Debroid on your phone and starts the example service uptimed:
+
+ +
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
-

-

Include to Android startup:

-

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

-
-adb push data/local/userinit.sh /data/local/userinit.sh
+chmod 0755 /etc/rc.debroid
+exit # Exit chroot
+exit # Exit adb shell
+
+
+

Include to Android startup:


+
+If you want to start Debroid automatically whenever your phone starts, then do the following:
+
+ +
adb push data/local/userinit.sh /data/local/userinit.sh
 adb shell
-chmod +x /data/local/userinit.sh
-exit
-

-

Reboot & test! Enjoy!

-

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

-Back to the main site
+chmod +x /data/local/userinit.sh +exit +
+
+Reboot & test! Enjoy!
+
+E-Mail your comments to hi@paul.cyou :-)
+
+Back to the main site
@@ -6384,134 +6495,158 @@ exit In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it.
-

The fibonacci.pl.raku.c Polyglot

-

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

-

In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it.

-https://en.wikipedia.org/wiki/Polyglot_(computing)
-

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:

-
-#include <stdio.h>
-
-#define $arg function_argument
-#define my int
-#define sub int
-#define BEGIN int main(void)
-
-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 fibonacci() {
-    my $n = $arg;
-
-    if ($n < 2) {
-        return $n;
-    }
-
-    $arg = $n - 1;
-    my $fib1 = fibonacci();
-    $arg = $n - 2;
-    my $fib2 = fibonacci();
-
-    return $fib1 + $fib2;
-}
-
-BEGIN {
-    hello();
-    my $i = 0;
-
-    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++

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

-

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

-

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

-Back to the main site
+

The fibonacci.pl.raku.c Polyglot


+
+Published at 2014-03-24T21:32:53+00:00; Updated at 2022-04-23
+
+In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it.
+
+https://en.wikipedia.org/wiki/Polyglot_(computing)
+
+

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:
+
+ +
#include <stdio.h>
+
+#define $arg function_argument
+#define my int
+#define sub int
+#define BEGIN int main(void)
+
+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 fibonacci() {
+    my $n = $arg;
+
+    if ($n < 2) {
+        return $n;
+    }
+
+    $arg = $n - 1;
+    my $fib1 = fibonacci();
+    $arg = $n - 2;
+    my $fib2 = fibonacci();
+
+    return $fib1 + $fib2;
+}
+
+BEGIN {
+    hello();
+    my $i = 0;
+
+    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++


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

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!
+
+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!
+
+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 :-).
+
+E-Mail your comments to hi@paul.cyou :-)
+
+Back to the main site
@@ -6556,15 +6691,18 @@ fib(10) = 55

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.
@@ -6573,55 +6711,64 @@ fib(10) = 55
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":

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



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

-
-$ ./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:

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


@@ -6634,48 +6781,54 @@ $ ./control keys daemon.loopinterval=10 > new.conf; mv new.conf conf/perldaem
This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-).

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



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

-
- 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).
@@ -6712,8 +6865,10 @@ sub do ($) { 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 Programming Language

-

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

+

The Fype Programming Language


+
+Published at 2010-05-09T12:48:29+01:00; Updated at 2021-05-05
+
       ____                                      _        __       
      / / _|_   _ _ __   ___    _   _  ___  __ _| |__    / _|_   _ 
@@ -6721,73 +6876,90 @@ sub do ($) {
  _ / /|  _| |_| | |_) |  __/  | |_| |  __/ (_| | | | |_|  _| |_| |
 (_)_/ |_|  \__, | .__/ \___|   \__, |\___|\__,_|_| |_(_)_|  \__, |
            |___/|_|            |___/                        |___/ 
-

-

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

-

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.

-

To give you an idea of how it works here as an example is a snippet from the main Fype "class header":

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

-
-Fype*
-fype_new() {
-   Fype *p_fype = malloc(sizeof(Fype));
+
+
+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!".
+
+

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.
+
+To give you an idea of how it works here as an example is a snippet from the main Fype "class header":
+
+ +
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":
+
+ +
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);
-}
-

-

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:

+ return (0); +} +
+
+

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:
  • integer - Specifies a number
  • double - Specifies a double-precision number
  • @@ -6796,13 +6968,19 @@ fype_run(int i_argc, char **pc_argv) {
  • any- May be any type above
  • void - No type
  • identifier - It's a variable name or a procedure name, or a function name
  • -
-

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

-

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

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


+
+

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 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:
+
 my foo = 1 + 2;
 say foo; 
@@ -6813,8 +6991,10 @@ say bar;
 
 my baz;
 say baz; # Will print out 0
-

-

You may use the "defined" keyword to check if an identifier has been defined or not:

+
+
+You may use the "defined" keyword to check if an identifier has been defined or not:
+
 ifnot defined foo {
 	say "No foo yet defined";
@@ -6826,9 +7006,12 @@ if defined foo {
 	put "foo is defined and has the value ";
 	say foo;
 }
-

-

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:

+
+
+

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:
+
 my foo = "foo";
 my bar = \foo;
@@ -6836,8 +7019,10 @@ foo = "bar";
 
 # The synonym variable should now also set to "bar"
 assert "bar" == bar;
-

-

Synonyms can be used for all kind of identifiers. It's not limited to standard variables but can also be used for function and procedure names (more about functions and procedures later).

+
+
+Synonyms can be used for all kind of identifiers. It's not limited to standard variables but can also be used for function and procedure names (more about functions and procedures later).
+
 # Create a new procedure baz
 proc baz { say "I am baz"; }
@@ -6849,8 +7034,10 @@ undef baz;
 
 # bay still has a reference of the original procedure baz
 bay; # this prints aut "I am baz" 
-

-

The "syms" keyword gives you the total number of synonyms pointing to a specific value:

+
+
+The "syms" keyword gives you the total number of synonyms pointing to a specific value:
+
 my foo = 1;
 say syms foo; # Prints 1
@@ -6861,18 +7048,26 @@ say syms baz; # Prints 2
 
 undef baz;
 say syms foo; # Prints 1
-

-

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:

+
+
+

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:
+
 my bar = 3, foo = 1 + 2; 
 say foo;
 exit foo - bar;
-

-

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

-

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

+
+
+

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


+
+Any "any" value holding a string will be automatically converted to an integer value.
+
 (any) <any> + <any>
 (any) <any> - <any>
@@ -6885,52 +7080,75 @@ exit foo - bar;
 (integer) <any> <> <any>
 (integer) <any> gt <any>
 (integer) not <any>
-

-

Bitwise expressions

+
+
+

Bitwise expressions


+
 (integer) <any> :< <any>
 (integer) <any> :> <any>
 (integer) <any> and <any>
 (integer) <any> or <any>
 (integer) <any> xor <any>
-

-

Numeric expressions

+
+
+

Numeric expressions


+
 (number) neg <number>
-

-

... returns the negative value of "number":

+
+
+... returns the negative value of "number":
+
 (integer) no <integer>
-

-

... returns 1 if the argument is 0; otherwise, it will return 0! If no argument is given, then 0 is returned!

+
+
+... returns 1 if the argument is 0; otherwise, it will return 0! If no argument is given, then 0 is returned!
+
 (integer) yes <integer>
-

-

... always returns 1. The parameter is optional. Example:

+
+
+... always returns 1. The parameter is optional. Example:
+
 # Prints out 1, because foo is not defined
 if yes { say no defined foo; } 
-

-

Control statements

-

Control statements available in Fype:

+
+
+

Control statements


+
+Control statements available in Fype:
+
 if <expression> { <statements> }
-

-

... runs the statements if the expression evaluates to a true value.

+
+
+... runs the statements if the expression evaluates to a true value.
+
 ifnot <expression> { <statements> }
-

-

... runs the statements if the expression evaluates to a false value.

+
+
+... runs the statements if the expression evaluates to a false value.
+
 while <expression> { <statements> }
-

-

... runs the statements as long as the expression evaluates to a true value.

+
+
+... runs the statements as long as the expression evaluates to a true value.
+
 until <expression> { <statements> }
-

-

... runs the statements as long as the expression evaluates to a false value.

-

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:

+
+
+... runs the statements as long as the expression evaluates to a false value.
+
+

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:
+
 my foo = 1;
 
@@ -6956,8 +7174,10 @@ my foo = 1;
 
 # Prints out 0
 say defined bar;
-

-

Another example including an actual output:

+
+
+Another example including an actual output:
+
 ./fype -e ’my global; func foo { my var4; func bar { my var2, var3; func baz { my var1; scope; } baz; } bar; } foo;’
 Scopes:
@@ -6974,30 +7194,44 @@ SYM_FUNCTION: baz
 2 level(s) up:
 SYM_VARIABLE: var4 (id=00035, line=-0001, pos=-001, type=TT_INTEGER, dval=0.000000, refs=-1)
 SYM_FUNCTION: bar
-

-

Definedness

+
+
+

Definedness


+
 (integer) defined <identifier>
-

-

... returns 1 if "identifier" has been defined. Returns 0 otherwise.

+
+
+... returns 1 if "identifier" has been defined. Returns 0 otherwise.
+
 (integer) undef <identifier>
-

-

... tries to undefine/delete the "identifier". Returns 1 if it succeeded, otherwise 0 is returned.

-

System

-

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

+
+
+... tries to undefine/delete the "identifier". Returns 1 if it succeeded, otherwise 0 is returned.
+
+

System


+
+These are some system and interpreter specific built-in functions supported:
+
 (void) end
-

-

... exits the program with the exit status of 0.

+
+
+... exits the program with the exit status of 0.
+
 (void) exit <integer>
-

-

... exits the program with the specified exit status.

+
+
+... exits the program with the specified exit status.
+
 (integer) fork
-

-

... forks a subprocess. It returns 0 for the child process and the PID of the child process otherwise! Example:

+
+
+... forks a subprocess. It returns 0 for the child process and the PID of the child process otherwise! Example:
+
 my pid = fork;
 
@@ -7008,28 +7242,42 @@ if pid {
 } ifnot pid {
 	say "I am the child process";
 }
-

-

To execute the garbage collector do:

+
+
+To execute the garbage collector do:
+
 (integer) GC
-

-

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

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


+
 (any) put <any>
-

-

... prints out the argument

+
+
+... prints out the argument
+
 (any) say <any>
-

-

is the same as put, but also includes an ending newline.

+
+
+is the same as put, but also includes an ending newline.
+
 (void) ln
-

-

... just prints a new line.

-

Procedures and functions

-

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.

+
+
+... just prints a new line.
+
+

Procedures and functions


+
+

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.
+
 proc foo {
 	say 1 + a * 3 + b;
@@ -7040,9 +7288,12 @@ my a = 2, b = 4;
 
 foo; # Run the procedure. Print out "11\n"
 say c; # Print out "6\n";
-

-

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.

+
+
+

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.
+
 proc foo {
 	say "I am foo";
@@ -7060,9 +7311,12 @@ proc foo {
 foo; # Here the procedure foo will define the procedure bar!
 bar; # Now the procedure bar is defined!
 foo; # Here the procedure foo will redefine bar again!
-

-

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

+
+
+

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).
+
 func foo {
 	say 1 + a * 3 + b;
@@ -7073,9 +7327,12 @@ my a = 2, b = 4;
 
 foo; # Run the procedure. Print out "11\n"
 say c; # Will produce an error because c is out of scope!
-

-

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!

+
+
+

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!
+
 func foo {
 	func bar {
@@ -7087,15 +7344,20 @@ func foo {
 
 foo;
 bar; # Will produce an error because bar is out of scope!
-

-

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:

+
+
+

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:
+
 func bar { say ”bar” }
 my foo = [bar, 1, 4/2, double ”3”, [”A”, [”BA”, ”BB”]]];
 say foo;
-

-

It produces the following output:

+
+
+It produces the following output:
+
 % ./fype arrays.fy
 bar
@@ -7105,14 +7367,21 @@ bar
 A
 BA
 BB
-

-

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

-

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

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

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

-Back to the main site
+
+
+

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


+
+You can find all of this on the GitHub page. There is also an "examples" folders containing some Fype scripts!
+
+https://codeberg.org/snonux/fype
+
+E-Mail your comments to hi@paul.cyou :-)
+
+Back to the main site
@@ -7466,126 +7735,135 @@ _~~|~/_|_|__/|~~~~~~~ | / ~~~~~ | | ~~~~~~~~

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



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



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


-- cgit v1.2.3