From 4e49fa379af7196b4fa63a6d2587f439f46c38ab Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 4 Jul 2021 18:15:54 +0100 Subject: change main domain back to buetow.org - make atomfeeds not change on domain switch --- gemfeed/atom.xml | 126 +++++++++++++++++++++++++++---------------------------- 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'gemfeed/atom.xml') diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 71db3e33..a048eb1d 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,15 +1,15 @@ - 2021-07-04T15:58:47+01:00 - snonux.de feed + 2021-07-04T18:15:40+01:00 + buetow.org feed Having fun with computers! - - - gemini://snonux.de/ + + + Having fun with computers!/ The Well-Grounded Rubyist - - gemini://snonux.de/gemfeed/2021-07-04-the-well-grounded-rubyist.gmi + The Well-Grounded Rubyist + 2021-07-04T10:51:23+01:00 Paul Buetow @@ -22,9 +22,9 @@

Written by Paul Buetow 2021-07-04

When I was a Linux System Administrator, I have been programming in Perl for years. I still maintain some personal Perl programming projects (e.g. Xerl, guprecords, Loadbars). After switching jobs a couple of years ago (becoming a Site Reliability Engineer), I found Ruby (and some Python) widely used there. As I wanted to do something new, I decided to give Ruby a go.

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

-
+

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

-
+

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

My Ruby problem domain

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

@@ -35,9 +35,9 @@
  • Occasionally, I write some lines of Java code for minor feature enhancements and fixes to improve the reliability of some the services.
  • Sometimes, I still program in good old C. This is for special projects (e.g. I/O Riot) or low-level PoCs or SystemTap guru mode scripts.
  • -Also have a look at my personal Bash coding style.
    -Read here about DTail - the distributed log tail program.
    -This is a magazine article about I/O Riot I wrote.
    +Also have a look at my personal Bash coding style.
    +Read here about DTail - the distributed log tail program.
    +This is a magazine article about I/O Riot I wrote.

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

    Being stuck in Ruby-mediocrity

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

    @@ -89,8 +89,8 @@ Hello World
    Gemtexter - One Bash script to rule it all - - gemini://snonux.de/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.gmi + Gemtexter - One Bash script to rule it all + 2021-06-05T19:03:32+01:00 Paul Buetow @@ -142,11 +142,11 @@ Hello World

    Written by Paul Buetow 2021-06-05

    You might have read my previous blog post about entering the Geminispace, where I pointed out the benefits of having and maintaining an internet presence there. This whole site (the blog and all other pages) is composed in the Gemtext markup language.

    -Welcome to the Geminispace
    +Welcome to the Geminispace

    This comes with the benefit that I can write content in my favourite text editor (Vim).

    Motivation

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

    -Motivational comic strip
    +Motivational comic strip

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

    https://github.com/snonux/gemtexter

    In short, Gemtexter is a static site generator and blogging engine that uses Gemtext as its input format.

    @@ -181,7 +181,7 @@ paul in uranus in gemtexter on 🌱 main

    This way, the script could grow far beyond 1000 lines of code and still be maintainable. With more features, execution speed may slowly become a problem, though. I already notice that Gemtexter doesn't produce results instantly but requires few seconds of runtime already. That's not a problem yet, though.

    Bash best practises and ShellCheck

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

    -Personal bash coding style guide
    +Personal bash coding style guide

    I followed all these best practices, and in my opinion, the result is a pretty maintainable Bash script (given that you are fluent with all the sed and grep commands I used).

    ShellCheck, a shell script analysis tool written in Haskell, is run on Gemtexter ensuring that all code is acceptable. I am pretty impressed with what ShellCheck found.

    It, for example, detected "some_command | while read var; do ...; done" loops and hinted that these create a new subprocess for the while part. The result is that all variable modifications taking place in the while-subprocess won't reflect the primary Bash process. ShellSheck then recommended rewriting the loop so that no subprocess is spawned as "while read -r var; do ...; done < <(some_command)". ShellCheck also pointed out to add a "-r" to "read"; otherwise, there could be an issue with backspaces in the loop data.

    @@ -228,8 +228,8 @@ assert::equals "$(generate::make_link md "$gemtext")" \
    Personal Bash coding style guide - - gemini://snonux.de/gemfeed/2021-05-16-personal-bash-coding-style-guide.gmi + Personal Bash coding style guide + 2021-05-16T14:51:57+01:00 Paul Buetow @@ -536,8 +536,8 @@ fi Welcome to the Geminispace - - gemini://snonux.de/gemfeed/2021-04-24-welcome-to-the-geminispace.gmi + Welcome to the Geminispace + 2021-04-24T19:28:41+01:00 Paul Buetow @@ -579,13 +579,13 @@ fi

    Discovering the Gemini internet protocol

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

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

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

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

    My own Gemini capsule

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

    This site was generated with Gemtexter. You can read more about it here:

    -Gemtexter - One Bash script to rule it all
    +Gemtexter - One Bash script to rule it all

    Gemini advantages summarised

    • Supports an alternative to the modern bloated web
    • @@ -606,8 +606,8 @@ fi DTail - The distributed log tail program - - gemini://snonux.de/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program.gmi + DTail - The distributed log tail program + 2021-04-22T19:28:41+01:00 Paul Buetow @@ -618,7 +618,7 @@ fi

      DTail - The distributed log tail program

      Written by Paul Buetow 2021-04-22, last updated 2021-04-26

      -DTail logo image
      +DTail logo image

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

      Original Mimecast Engineering Blog post at Medium

      Running a large cloud-based service requires monitoring the state of huge numbers of machines, a task for which many standard UNIX tools were not really designed. In this post, I will describe a simple program, DTail, that Mimecast has built and released as Open-Source, which enables us to monitor log files of many servers at once without the costly overhead of a full-blown log management system.

      @@ -632,7 +632,7 @@ fi

      Differentiating from log management systems

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

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

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

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

      Combining simplicity, security and efficiency

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

      @@ -648,7 +648,7 @@ fi
    • dgrep: The distributed grep client for searching text files for a regular expression pattern.
    • dmap: The distributed map-reduce client for aggregating stats from log files.
    -DGrep sample session animated gif
    +DGrep sample session animated gif

    Usage example

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

    The basic idea is to start one of the clients from the command line and provide a list of servers to connect to with –servers. You also must provide a path of remote (log) files via –files. If you want to process multiple files per server, you could either provide a comma-separated list of file paths or make use of file system globbing (or a combination of both).

    @@ -687,8 +687,8 @@ dtail –servers serverlist.txt –files ‘/var/log/*.log’ –regex ‘(?i:er
    Realistic load testing with I/O Riot for Linux - - gemini://snonux.de/gemfeed/2018-06-01-realistic-load-testing-with-ioriot-for-linux.gmi + Realistic load testing with I/O Riot for Linux + 2018-06-01T14:50:29+01:00 Paul Buetow @@ -749,7 +749,7 @@ jgs\__/'---'\__/
     % sudo ioriot -c io.capture
     
    -Screenshot I/O recording
    +Screenshot I/O recording

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

    Test preparation

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

    @@ -763,12 +763,12 @@ jgs\__/'---'\__/ % sudo ioriot -i io.replay

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

    -Screenshot test preparation
    +Screenshot test preparation

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

    Replay

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

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

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

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

     % new_scheduler=cfq
    @@ -804,10 +804,10 @@ Time ahead: 2392s
     Total time: 1213.00s
     

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

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

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

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

    I/O Riot is Open Source

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

    https://github.com/mimecast/ioriot
    @@ -826,8 +826,8 @@ Total time: 1213.00s
    Methods in C - - gemini://snonux.de/gemfeed/2016-11-20-methods-in-c.gmi + Methods in C + 2016-11-20T18:36:51+01:00 Paul Buetow @@ -906,8 +906,8 @@ mult.calculate(mult,a,b)); Spinning up my own authoritative DNS servers - - gemini://snonux.de/gemfeed/2016-05-22-spinning-up-my-own-authoritative-dns-servers.gmi + Spinning up my own authoritative DNS servers + 2016-05-22T18:59:01+01:00 Paul Buetow @@ -1131,8 +1131,8 @@ apply Service "dig6" { Offsite backup with ZFS (Part 2) - - gemini://snonux.de/gemfeed/2016-04-16-offsite-backup-with-zfs-part2.gmi + Offsite backup with ZFS (Part 2) + 2016-04-16T22:43:42+01:00 Paul Buetow @@ -1157,7 +1157,7 @@ apply Service "dig6" { \____||__|_____|__|

    Written by Paul Buetow 2016-04-16

    -Read the first part before reading any furter here...
    +Read the first part before reading any furter here...

    I enhanced the procedure a bit. From now on, I have two external 2TB USB hard drives. Both are set up precisely the same way. To decrease the probability that both drives will not fail simultaneously, they are of different brands. One drive is kept at a secret location. The other one is held at home, right next to my HP MicroServer.

    Whenever I update the offsite backup, I am doing it to the drive, which is kept locally. Afterwards, I bring it to the secret location, swap the drives, and bring the other back home. This ensures that I will always have an offsite backup available at a different location than my home - even while updating one copy of it.

    Furthermore, I added scrubbing ("zpool scrub...") to the script. It ensures that the file system is consistent and that there are no bad blocks on the disk and the file system. To increase the reliability, I also run a "zfs set copies=2 zroot". That setting is also synchronized to the offsite ZFS pool. ZFS stores every data block to disk twice now. Yes, it consumes twice as much disk space, making it better fault-tolerant against hardware errors (e.g. only individual disk sectors going bad).

    @@ -1167,8 +1167,8 @@ apply Service "dig6" {
    Jails and ZFS with Puppet on FreeBSD - - gemini://snonux.de/gemfeed/2016-04-09-jails-and-zfs-on-freebsd-with-puppet.gmi + Jails and ZFS with Puppet on FreeBSD + 2016-04-09T18:29:47+01:00 Paul Buetow @@ -1547,8 +1547,8 @@ Notice: Finished catalog run in 206.09 seconds Offsite backup with ZFS - - gemini://snonux.de/gemfeed/2016-04-03-offsite-backup-with-zfs.gmi + Offsite backup with ZFS + 2016-04-03T22:43:42+01:00 Paul Buetow @@ -1588,8 +1588,8 @@ Notice: Finished catalog run in 206.09 seconds Run Debian on your phone with Debroid - - gemini://snonux.de/gemfeed/2015-12-05-run-debian-on-your-phone-with-debroid.gmi + Run Debian on your phone with Debroid + 2015-12-05T16:12:57+00:00 Paul Buetow @@ -1609,7 +1609,7 @@ Notice: Finished catalog run in 206.09 seconds

    Written by Paul Buetow 2015-12-05, last updated 2021-05-16

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

    -
    +

    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

    @@ -1752,8 +1752,8 @@ exit
    The fibonacci.pl.c Polyglot - - gemini://snonux.de/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.gmi + The fibonacci.pl.c Polyglot + 2014-03-24T21:32:53+00:00 Paul Buetow @@ -1860,8 +1860,8 @@ fib(10) = 55 Perl Daemon (Service Framework) - - gemini://snonux.de/gemfeed/2011-05-07-perl-daemon-service-framework.gmi + Perl Daemon (Service Framework) + 2011-05-07T22:26:02+01:00 Paul Buetow @@ -2006,8 +2006,8 @@ sub do ($) { The Fype Programming Language - - gemini://snonux.de/gemfeed/2010-05-09-the-fype-programming-language.gmi + The Fype Programming Language + 2010-05-09T12:48:29+01:00 Paul Buetow @@ -2421,8 +2421,8 @@ BB Lazy Evaluation with Standard ML - - gemini://snonux.de/gemfeed/2010-05-07-lazy-evaluation-with-standarn-ml.gmi + Lazy Evaluation with Standard ML + 2010-05-07T08:17:59+01:00 Paul Buetow @@ -2521,8 +2521,8 @@ first 10 nat_pairs_not_null Standard ML and Haskell - - gemini://snonux.de/gemfeed/2010-04-09-standard-ml-and-haskell.gmi + Standard ML and Haskell + 2010-04-09T22:57:36+01:00 Paul Buetow @@ -2675,8 +2675,8 @@ my_filter f l = foldr (make_filter_fn f) [] l Perl Poetry - - gemini://snonux.de/gemfeed/2008-06-26-perl-poetry.gmi + Perl Poetry + 2008-06-26T21:43:51+01:00 Paul Buetow -- cgit v1.2.3