summaryrefslogtreecommitdiff
path: root/gemfeed/atom.xml
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-04-08 12:32:25 +0300
committerPaul Buetow <paul@buetow.org>2023-04-08 12:32:25 +0300
commit89f83d49ad7d4cd8baa815993d3172ca72e5b30e (patch)
treef91acfa483e4ef3a0632af7f0f91d8b45cc9d76d /gemfeed/atom.xml
parentd0098c5faf74b0b3291395114b99bc5c309718b3 (diff)
Update content for html
Diffstat (limited to 'gemfeed/atom.xml')
-rw-r--r--gemfeed/atom.xml2214
1 files changed, 1493 insertions, 721 deletions
diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml
index 13310926..2b23b61a 100644
--- a/gemfeed/atom.xml
+++ b/gemfeed/atom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
- <updated>2023-04-03T23:19:57+03:00</updated>
+ <updated>2023-04-08T12:32:07+03:00</updated>
<title>foo.zone feed</title>
<subtitle>To be in the .zone!</subtitle>
<link href="https://foo.zone/gemfeed/atom.xml" rel="self" />
@@ -18,9 +18,12 @@
<summary>These are my personal takeaways after reading 'Never split the difference' by Chris Voss. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>"Never split the difference" book notes</h1>
-<p class="quote"><i>Published at 2023-04-01T20:00:17+03:00</i></p>
-<p>These are my personal takeaways after reading "Never split the difference" by Chris Voss. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.</p>
+ <h1 style='display: inline'>"Never split the difference" book notes</h1><br />
+<br />
+<span class='quote'>Published at 2023-04-01T20:00:17+03:00</span><br />
+<br />
+<span>These are my personal takeaways after reading "Never split the difference" by Chris Voss. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.</span><br />
+<br />
<pre>
,.......... ..........,
,..,' '.' ',..,
@@ -32,77 +35,106 @@
'''''''''''''''''';''';''''''''''''''''''
'''
</pre>
-<h2>Tactical listening, spreading empathy</h2>
-<p>Be a mirror, copy each other to be comfy with each other to build up trust. Mirroring is mainly body language. A mirror is to repeat the words the other just said. Simple but effective.</p>
+<br />
+<h2 style='display: inline'>Tactical listening, spreading empathy</h2><br />
+<br />
+<span>Be a mirror, copy each other to be comfy with each other to build up trust. Mirroring is mainly body language. A mirror is to repeat the words the other just said. Simple but effective.</span><br />
+<br />
<ul>
<li>A mirror needs space and silence between the words. At least 4 seconds.</li>
<li>A mirror might be awkward to be used at first, especially with a question coupled to it.</li>
<li>We fear what's different and are drawn to what is similar.</li>
-</ul>
-<p>Mirror training is like Jedi training. Simple but effective. A mirror needs space. Be silent after "you want this?" </p>
-<h2>Mindset of discovery</h2>
-<p>Try to have multiple realities in your mind and use facts to distinguish between real and false.</p>
+</ul><br />
+<span>Mirror training is like Jedi training. Simple but effective. A mirror needs space. Be silent after "you want this?" </span><br />
+<br />
+<h2 style='display: inline'>Mindset of discovery</h2><br />
+<br />
+<span>Try to have multiple realities in your mind and use facts to distinguish between real and false.</span><br />
+<br />
<ul>
<li>Focus on what the counterpart has to say and what he needs and wants. Understanding him makes him vulnerable.</li>
<li>Empathy understanding the other person from his perspective, but it does not mean agreeing with him.</li>
<li>Detect and label the emotions of others for your powers. </li>
<li>To be understood seems to solve all problems magically.</li>
-</ul>
-<p>Try: to put a label on someone's emotion and then be silent. Wait for the other to reveal himself. "You seem unhappy about this?"</p>
-<h3>More tips </h3>
+</ul><br />
+<span>Try: to put a label on someone's emotion and then be silent. Wait for the other to reveal himself. "You seem unhappy about this?"</span><br />
+<br />
+<h3 style='display: inline'>More tips </h3><br />
+<br />
<ul>
<li>Put on a poker face and don't show emotions.</li>
<li>Slow things down. Don't be a problem solver.</li>
<li>Smile while you are talking, even on the phone. Be easy and encouraging.</li>
<li>Being right is not the key to successful negotiation; being mindful is.</li>
<li>Be in the safe zone of empathy and acknowledge bad news.</li>
-</ul>
-<h2>"No" starts the conversation</h2>
-<p>When the opponent starts with a "no", he feels in control and comfortable. That's why he has to start with "no".</p>
+</ul><br />
+<h2 style='display: inline'>"No" starts the conversation</h2><br />
+<br />
+<span>When the opponent starts with a "no", he feels in control and comfortable. That's why he has to start with "no".</span><br />
+<br />
<ul>
<li>"Yes" and "maybe" might be worthless, but "no" starts the conversation.</li>
<li>If someone is saying "no" to you, he will be open to what you have to say next.</li>
<li>"No" is not stopping the negotiation but will open up opportunities you were not thinking about before.</li>
<li>Start with "no". Great negotiators seek "no" because that's when the great discussions begin.</li>
<li>A "no" can be scary if you are not used to it. If your biggest fear is "no", then you can't negotiate.</li>
-</ul>
-<p>Get a "That's right" when negotiating. Don't get a "you're right". You can summarise the opponent to get a "that's right".</p>
-<h2>Win-win</h2>
-<p>Win-win is a naive approach when encountering the win-lose counterpart, but always cooperate. Don't compromise, and don't split the difference. We don't compromise because it's right; we do it because it is easy. You must embrace the hard stuff; that's where the great deals are.</p>
-<h2>On Deadlines</h2>
+</ul><br />
+<span>Get a "That's right" when negotiating. Don't get a "you're right". You can summarise the opponent to get a "that's right".</span><br />
+<br />
+<h2 style='display: inline'>Win-win</h2><br />
+<br />
+<span>Win-win is a naive approach when encountering the win-lose counterpart, but always cooperate. Don't compromise, and don't split the difference. We don't compromise because it's right; we do it because it is easy. You must embrace the hard stuff; that's where the great deals are.</span><br />
+<br />
+<h2 style='display: inline'>On Deadlines</h2><br />
+<br />
<ul>
<li>All deadlines are imaginary.</li>
<li>Most of the time, deadlines unsettle us without a good reason.</li>
<li>They push a deal to a conclusion.</li>
<li>They rush the counterpart to cause pressure and anxiety.</li>
-</ul>
-<h2>Analyse the opponent</h2>
+</ul><br />
+<h2 style='display: inline'>Analyse the opponent</h2><br />
+<br />
<ul>
<li>Understand the motivation of people behind the table as well.</li>
<li>Ask how affected they will be.</li>
<li>Determine your and the opposite negotiation style. Accommodation, analyst, assertive.</li>
<li>Treat them how they need to be treated.</li>
-</ul>
-<p>The person on the other side is never the issue; the problem is the issue. Keep this in mind to avoid emotional issues with the person and focus on the problem, not the person. The bond is essential; never create an enemy.</p>
-<h2>Use different ways of saying "no."</h2>
-<p class="quote"><i>I had paid my rent always in time. I had positive experiences with the building and would be sad for the landlord to lose a good tenant. I am looking for a win-win agreement between us. Pulling out the research, other neighbours offer much lower prices even if your building is a better location and services. How can I effort 200 more.... </i></p>
-<p>...then put an extreme anker.</p>
-<p>You always have to embrace thoughtful confrontation for good negotiation and life. Don't avoid honest, clear conflict. It will give you the best deals. Compromises are mostly bad deals for both sides. Most people don't negotiate a win-win but a win-lose. Know the best and worst outcomes and what is acceptable for you.</p>
-<h2>Calibrated question</h2>
-<p>Calibrated questions. Give the opponent a sense of power. Ask open-how questions to get the opponent to solve your problem and move him in your direction. Calibrated questions are the best tools. Summarise everything, and then ask, "how I am supposed to do that?". Asking for help this way with a calibrated question is a powerful tool for joint problem solving</p>
-<p>Being calm and respectful is essential. Without control of your emotions, it won't work. The counterpart will have no idea how constrained they are with your question. Avoid questions which get a yes or short answers. Use "why?".</p>
-<p>Counterparts are more involved if these are their solutions. The counterpart must answer with "that's right", not "you are right". He has to own the problem. If not, then add more why questions.</p>
+</ul><br />
+<span>The person on the other side is never the issue; the problem is the issue. Keep this in mind to avoid emotional issues with the person and focus on the problem, not the person. The bond is essential; never create an enemy.</span><br />
+<br />
+<h2 style='display: inline'>Use different ways of saying "no."</h2><br />
+<br />
+<span class='quote'>I had paid my rent always in time. I had positive experiences with the building and would be sad for the landlord to lose a good tenant. I am looking for a win-win agreement between us. Pulling out the research, other neighbours offer much lower prices even if your building is a better location and services. How can I effort 200 more.... </span><br />
+<br />
+<span>...then put an extreme anker.</span><br />
+<br />
+<span>You always have to embrace thoughtful confrontation for good negotiation and life. Don't avoid honest, clear conflict. It will give you the best deals. Compromises are mostly bad deals for both sides. Most people don't negotiate a win-win but a win-lose. Know the best and worst outcomes and what is acceptable for you.</span><br />
+<br />
+<h2 style='display: inline'>Calibrated question</h2><br />
+<br />
+<span>Calibrated questions. Give the opponent a sense of power. Ask open-how questions to get the opponent to solve your problem and move him in your direction. Calibrated questions are the best tools. Summarise everything, and then ask, "how I am supposed to do that?". Asking for help this way with a calibrated question is a powerful tool for joint problem solving</span><br />
+<br />
+<span>Being calm and respectful is essential. Without control of your emotions, it won't work. The counterpart will have no idea how constrained they are with your question. Avoid questions which get a yes or short answers. Use "why?".</span><br />
+<br />
+<span>Counterparts are more involved if these are their solutions. The counterpart must answer with "that's right", not "you are right". He has to own the problem. If not, then add more why questions.</span><br />
+<br />
<ul>
<li>Tone and body language need to align with what people are saying.</li>
<li>Deal with it via a labelled question. </li>
<li>Liers tend to talk with "them" and "their" and not with "I".</li>
<li>Also, liars tend to talk in complex sentences.</li>
-</ul>
-<p>Prepare 3 to 5 calibrated questions for your counterpart. Be curious what is really motivating the other side. You can get out the "Black Swan".</p>
-<h2>The black swan </h2>
-<p>What we don't know can break our deal. Uncovering it can bring us unexpected success. You get what you ask for in this world, but you must learn to ask correctly. Reveal the black swan by asking questions.</p>
-<h2>More</h2>
-<p>Establish a range at top places like corp. I get... (e.g. remote London on a project basis). Set a high salary range and not a number. Also, check on LinkedIn premium for the salaries.</p>
+</ul><br />
+<span>Prepare 3 to 5 calibrated questions for your counterpart. Be curious what is really motivating the other side. You can get out the "Black Swan".</span><br />
+<br />
+<h2 style='display: inline'>The black swan </h2><br />
+<br />
+<span>What we don't know can break our deal. Uncovering it can bring us unexpected success. You get what you ask for in this world, but you must learn to ask correctly. Reveal the black swan by asking questions.</span><br />
+<br />
+<h2 style='display: inline'>More</h2><br />
+<br />
+<span>Establish a range at top places like corp. I get... (e.g. remote London on a project basis). Set a high salary range and not a number. Also, check on LinkedIn premium for the salaries.</span><br />
+<br />
<ul>
<li>Give an unexpected gift, e.g. show them my pet project and publicity for engineering.</li>
<li>Use an odd number, which makes you seem to have thought a lot about the sum and calculated it.</li>
@@ -113,13 +145,17 @@
<li>Tactical empathy, listening as a martial art. It is emotional intelligence on steroids.</li>
<li>Being right isn't the key to a successful negotiation, but having the correct mindset is.</li>
<li>Don't shop the groceries when you are hungry.</li>
-</ul>
-<p>Slow.... it.... down....</p>
-<p>Other book notes of mine are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2023-04-01-never-split-the-difference-book-notes.html">2023-04-01 "Never split the difference" book notes (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html">2023-03-16 "The Pragmatic Programmer" book notes</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+</ul><br />
+<span>Slow.... it.... down....</span><br />
+<br />
+<span>Other book notes of mine are:</span><br />
+<br />
+<a class='textlink' href='./2023-04-01-never-split-the-difference-book-notes.html'>2023-04-01 "Never split the difference" book notes (You are currently reading this)</a><br />
+<a class='textlink' href='./2023-03-16-the-pragmatic-programmer-book-notes.html'>2023-03-16 "The Pragmatic Programmer" book notes</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -135,8 +171,10 @@
<summary>I proudly announce that I've released Gemtexter version `2.0.0`. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Gemtexter 2.0.0 - Let's Gemtext again^2</h1>
-<p class="quote"><i>Published at 2023-03-25T17:50:32+02:00</i></p>
+ <h1 style='display: inline'>Gemtexter 2.0.0 - Let's Gemtext again^2</h1><br />
+<br />
+<span class='quote'>Published at 2023-03-25T17:50:32+02:00</span><br />
+<br />
<pre>
-=[ typewriters ]=- 1/98
@@ -149,14 +187,23 @@
jgs `"""""""""` |o=======.|
mod. by Paul Buetow `"""""""""`
</pre>
-<p>I proudly announce that I've released Gemtexter version <span class="inlinecode">2.0.0</span>. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.</p>
-<a class="textlink" href="https://codeberg.org/snonux/gemtexter">https://codeberg.org/snonux/gemtexter</a><br />
-<p>This is a new major release, so it contains a breaking change (see "Meta cache made obsolete").</p>
-<p>Let's list what's new!</p>
-<h2>Minimal template engine</h2>
-<p>Gemtexter now supports templating, enabling dynamically generated content to <span class="inlinecode">.gmi</span> files before converting anything to any output format like HTML and Markdown.</p>
-<p>A template file name must have the suffix <span class="inlinecode">gmi.tpl</span>. A template must be put into the same directory as the Gemtext <span class="inlinecode">.gmi</span> file to be generated. Gemtexter will generate a Gemtext file <span class="inlinecode">index.gmi</span> from a given template <span class="inlinecode">index.gmi.tpl</span>. A <span class="inlinecode">&lt;&lt;&lt;</span> and <span class="inlinecode">&gt;&gt;&gt;</span> encloses a multiline template. All lines starting with <span class="inlinecode">&lt;&lt; </span> will be evaluated as a single line of Bash code and the output will be written into the resulting Gemtext file.</p>
-<p>For example, the template <span class="inlinecode">index.gmi.tpl</span>:</p>
+<br />
+<span>I proudly announce that I've released Gemtexter version <span class='inlinecode'>2.0.0</span>. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.</span><br />
+<br />
+<a class='textlink' href='https://codeberg.org/snonux/gemtexter'>https://codeberg.org/snonux/gemtexter</a><br />
+<br />
+<span>This is a new major release, so it contains a breaking change (see "Meta cache made obsolete").</span><br />
+<br />
+<span>Let's list what's new!</span><br />
+<br />
+<h2 style='display: inline'>Minimal template engine</h2><br />
+<br />
+<span>Gemtexter now supports templating, enabling dynamically generated content to <span class='inlinecode'>.gmi</span> files before converting anything to any output format like HTML and Markdown.</span><br />
+<br />
+<span>A template file name must have the suffix <span class='inlinecode'>gmi.tpl</span>. A template must be put into the same directory as the Gemtext <span class='inlinecode'>.gmi</span> file to be generated. Gemtexter will generate a Gemtext file <span class='inlinecode'>index.gmi</span> from a given template <span class='inlinecode'>index.gmi.tpl</span>. A <span class='inlinecode'>&lt;&lt;&lt;</span> and <span class='inlinecode'>&gt;&gt;&gt;</span> encloses a multiline template. All lines starting with <span class='inlinecode'>&lt;&lt; </span> will be evaluated as a single line of Bash code and the output will be written into the resulting Gemtext file.</span><br />
+<br />
+<span>For example, the template <span class='inlinecode'>index.gmi.tpl</span>:</span><br />
+<br />
<pre>
# Hello world
@@ -170,7 +217,9 @@ Welcome to this capsule!
done
&gt;&gt;&gt;
</pre>
-<p>... results into the following <span class="inlinecode">index.gmi</span> after running <span class="inlinecode">./gemtexter --generate</span> (or <span class="inlinecode">./gemtexter --template</span>, which instructs to do only template processing and nothing else):</p>
+<br />
+<span>... results into the following <span class='inlinecode'>index.gmi</span> after running <span class='inlinecode'>./gemtexter --generate</span> (or <span class='inlinecode'>./gemtexter --template</span>, which instructs to do only template processing and nothing else):</span><br />
+<br />
<pre>
# Hello world
@@ -189,7 +238,9 @@ Multiline template line 8
Multiline template line 9
Multiline template line 10
</pre>
-<p>Another thing you can do is insert an index with links to similar blog posts. E.g.:</p>
+<br />
+<span>Another thing you can do is insert an index with links to similar blog posts. E.g.:</span><br />
+<br />
<pre>
See more entries about DTail and Golang:
@@ -197,7 +248,9 @@ See more entries about DTail and Golang:
Blablabla...
</pre>
-<p>... scans all other post entries with <span class="inlinecode">dtail</span> and <span class="inlinecode">golang</span> in the file name and generates a link list like this:</p>
+<br />
+<span>... scans all other post entries with <span class='inlinecode'>dtail</span> and <span class='inlinecode'>golang</span> in the file name and generates a link list like this:</span><br />
+<br />
<pre>
See more entries about DTail and Golang:
@@ -208,25 +261,37 @@ See more entries about DTail and Golang:
Blablabla...
</pre>
-<h2>Added hooks</h2>
-<p>You can configure <span class="inlinecode">PRE_GENERATE_HOOK</span> and <span class="inlinecode">POST_PUBLISH_HOOK</span> to point to scripts to be executed before running <span class="inlinecode">--generate</span>, or after running <span class="inlinecode">--publish</span>. E.g. you could populate some of the content by an external script before letting Gemtexter do its thing or you could automatically deploy the site after running <span class="inlinecode">--publish</span>.</p>
-<p>The sample config file <span class="inlinecode">gemtexter.conf</span> includes this as an example now; these scripts will only be executed when they actually exist:</p>
+<br />
+<h2 style='display: inline'>Added hooks</h2><br />
+<br />
+<span>You can configure <span class='inlinecode'>PRE_GENERATE_HOOK</span> and <span class='inlinecode'>POST_PUBLISH_HOOK</span> to point to scripts to be executed before running <span class='inlinecode'>--generate</span>, or after running <span class='inlinecode'>--publish</span>. E.g. you could populate some of the content by an external script before letting Gemtexter do its thing or you could automatically deploy the site after running <span class='inlinecode'>--publish</span>.</span><br />
+<br />
+<span>The sample config file <span class='inlinecode'>gemtexter.conf</span> includes this as an example now; these scripts will only be executed when they actually exist:</span><br />
+<br />
<pre>
declare -xr PRE_GENERATE_HOOK=./pre_generate_hook.sh
declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh
</pre>
-<h2>Use of safer Bash options</h2>
-<p>Gemtexter now does <span class="inlinecode">set -euf -o pipefile</span>, which helps to eliminate bugs and to catch scripting errors sooner. Previous versions only <span class="inlinecode">set -e</span>.</p>
-<h2>Meta cache made obsolete</h2>
-<p>Here is the breaking change to older versions of Gemtexter. The <span class="inlinecode">$BASE_CONTENT_DIR/meta</span> directory was made obsolete. <span class="inlinecode">meta</span> was used to store various information about all the blog post entries to make generating an Atom feed in Bash easier. Especially the publishing dates of each post were stored there. Instead, the publishing date is now encoded in the <span class="inlinecode">.gmi</span> file. And if it is missing, Gemtexter will set it to the current date and time at first run.</p>
-<p>An example blog post without any publishing date looks like this:</p>
+<br />
+<h2 style='display: inline'>Use of safer Bash options</h2><br />
+<br />
+<span>Gemtexter now does <span class='inlinecode'>set -euf -o pipefile</span>, which helps to eliminate bugs and to catch scripting errors sooner. Previous versions only <span class='inlinecode'>set -e</span>.</span><br />
+<br />
+<h2 style='display: inline'>Meta cache made obsolete</h2><br />
+<br />
+<span>Here is the breaking change to older versions of Gemtexter. The <span class='inlinecode'>$BASE_CONTENT_DIR/meta</span> directory was made obsolete. <span class='inlinecode'>meta</span> was used to store various information about all the blog post entries to make generating an Atom feed in Bash easier. Especially the publishing dates of each post were stored there. Instead, the publishing date is now encoded in the <span class='inlinecode'>.gmi</span> file. And if it is missing, Gemtexter will set it to the current date and time at first run.</span><br />
+<br />
+<span>An example blog post without any publishing date looks like this:</span><br />
+<br />
<pre>
% cat gemfeed/2023-02-26-title-here.gmi
# Title here
The remaining content of the Gemtext file...
</pre>
-<p>Gemtexter will add a line starting with <span class="inlinecode">&gt; Published at ...</span> now. Any subsequent Atom feed generation will then use that date.</p>
+<br />
+<span>Gemtexter will add a line starting with <span class='inlinecode'>&gt; Published at ...</span> now. Any subsequent Atom feed generation will then use that date.</span><br />
+<br />
<pre>
% cat gemfeed/2023-02-26-title-here.gmi
# Title here
@@ -235,17 +300,25 @@ The remaining content of the Gemtext file...
The remaining content of the Gemtext file...
</pre>
-<h2>XMLLint support</h2>
-<p>Optionally, when the <span class="inlinecode">xmllint</span> binary is installed, Gemtexter will perform a simple XML lint check against the Atom feed generated. This is a double-check of whether the Atom feed is a valid XML.</p>
-<h2>More</h2>
-<p>Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made. </p>
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html">2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again^2 (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html">2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html">2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-04-24-welcome-to-the-geminispace.html">2021-04-24 Welcome to the Geminispace</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+<br />
+<h2 style='display: inline'>XMLLint support</h2><br />
+<br />
+<span>Optionally, when the <span class='inlinecode'>xmllint</span> binary is installed, Gemtexter will perform a simple XML lint check against the Atom feed generated. This is a double-check of whether the Atom feed is a valid XML.</span><br />
+<br />
+<h2 style='display: inline'>More</h2><br />
+<br />
+<span>Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made. </span><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html'>2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again^2 (You are currently reading this)</a><br />
+<a class='textlink' href='./2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html'>2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again</a><br />
+<a class='textlink' href='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html'>2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
+<a class='textlink' href='./2021-04-24-welcome-to-the-geminispace.html'>2021-04-24 Welcome to the Geminispace</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -261,9 +334,12 @@ The remaining content of the Gemtext file...
<summary>These are my personal takeaways after reading 'The Pragmatic Programmer' by David Thomas and Andrew Hunt. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>"The Pragmatic Programmer" book notes</h1>
-<p class="quote"><i>Published at 2023-03-16T00:55:20+02:00</i></p>
-<p>These are my personal takeaways after reading "The Pragmatic Programmer" by David Thomas and Andrew Hunt. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.</p>
+ <h1 style='display: inline'>"The Pragmatic Programmer" book notes</h1><br />
+<br />
+<span class='quote'>Published at 2023-03-16T00:55:20+02:00</span><br />
+<br />
+<span>These are my personal takeaways after reading "The Pragmatic Programmer" by David Thomas and Andrew Hunt. Note that the book contains much more knowledge wisdom and that these notes only contain points I personally found worth writing down. This is mainly for my own use, but you might find it helpful too.</span><br />
+<br />
<pre>
,.......... ..........,
,..,' '.' ',..,
@@ -275,58 +351,81 @@ The remaining content of the Gemtext file...
'''''''''''''''''';''';''''''''''''''''''
'''
</pre>
-<p>Think about your work while doing it - every day on every project. Have a feeling of continuous improvement. </p>
+<br />
+<span>Think about your work while doing it - every day on every project. Have a feeling of continuous improvement. </span><br />
+<br />
<ul>
<li>Be a realist.</li>
<li>Smell challenges.</li>
<li>Care about your craft.</li>
<li>Code can always be flawed, but it can meet the requirements.</li>
<li>You should be proud of your code, though.</li>
-</ul>
-<p>No one writes perfect code, including you. However:</p>
+</ul><br />
+<span>No one writes perfect code, including you. However:</span><br />
+<br />
<ul>
<li>Paranoia is good thinking.</li>
<li>Practice defensive programming and crash early.</li>
<li>Crashing is often the best thing you can do. </li>
<li>Changes should be reversible.</li>
-</ul>
-<p>Erlang: Defensive programming is a waste of time. Let it crash. "This can never happen" - don't practise that kind of self-deception when programming. </p>
-<p>Leave assertions in the code, even in production. Only leave out the assertions causing the performance issues.</p>
-<p>Take small steps, always. Get feedback, too, for each of the steps the code does. Avoid fortune telling. If you have to involve in it, then the step is too large.</p>
-<p>Decouple the code (e.g. OOP or functional programming). Prefer interfaces for types and mixins for a class extension over class inheritance.</p>
+</ul><br />
+<span>Erlang: Defensive programming is a waste of time. Let it crash. "This can never happen" - don't practise that kind of self-deception when programming. </span><br />
+<br />
+<span>Leave assertions in the code, even in production. Only leave out the assertions causing the performance issues.</span><br />
+<br />
+<span>Take small steps, always. Get feedback, too, for each of the steps the code does. Avoid fortune telling. If you have to involve in it, then the step is too large.</span><br />
+<br />
+<span>Decouple the code (e.g. OOP or functional programming). Prefer interfaces for types and mixins for a class extension over class inheritance.</span><br />
+<br />
<ul>
<li>Refactor now and not later.</li>
<li>Later, it will be even more painful.</li>
-</ul>
-<p>Don't think outside the box. Find the box. The box is more extensive than you think. Think about the hard problem at hand. Do you have to do it a certain way, or do you have to do it at all?</p>
-<p>Do what works and not what's fashionable. E.g. does SCRUM make sense? The goal is to deliver deliverables and not to "become" agile.</p>
-<h2>Continuous learning</h2>
-<p>Add new tools to your repertoire every day and keep the momentum up. Learning new things is your most crucial aspect. Invest regularly in your knowledge portfolio. The learning process extends your thinking. It does not matter if you will never use it.</p>
+</ul><br />
+<span>Don't think outside the box. Find the box. The box is more extensive than you think. Think about the hard problem at hand. Do you have to do it a certain way, or do you have to do it at all?</span><br />
+<br />
+<span>Do what works and not what's fashionable. E.g. does SCRUM make sense? The goal is to deliver deliverables and not to "become" agile.</span><br />
+<br />
+<h2 style='display: inline'>Continuous learning</h2><br />
+<br />
+<span>Add new tools to your repertoire every day and keep the momentum up. Learning new things is your most crucial aspect. Invest regularly in your knowledge portfolio. The learning process extends your thinking. It does not matter if you will never use it.</span><br />
+<br />
<ul>
<li>Learn a new programming language every year.</li>
<li>Read a technical book every month.</li>
<li>Take courses.</li>
-</ul>
-<p>Think critically about everything you learn. Use paper for your notes. There is something special about it.</p>
-<h2>Stay connected</h2>
-<p>It's your life, and you own it. Bruce Lee once said: </p>
-<p class="quote"><i>"I am not on the world to life after your expectations, neither are you to life after mine."</i></p>
+</ul><br />
+<span>Think critically about everything you learn. Use paper for your notes. There is something special about it.</span><br />
+<br />
+<h2 style='display: inline'>Stay connected</h2><br />
+<br />
+<span>It's your life, and you own it. Bruce Lee once said: </span><br />
+<br />
+<span class='quote'>"I am not on the world to life after your expectations, neither are you to life after mine."</span><br />
+<br />
<ul>
<li>Go to meet-ups and actively engage.</li>
<li>Stay current.</li>
<li>Dealing with computers is hard. Dealing with people is harder. </li>
-</ul>
-<p>It's your life. Share it, celebrate it, be proud and have fun.</p>
-<h2>The story of stone soup</h2>
-<p>How to motivate others to contribute something (e.g. ideas to a startup):</p>
-<p class="quote"><i>A kindly, old stranger was walking through the land when he came upon a village. As he entered, the villagers moved towards their homes, locking doors and windows. The stranger smiled and asked, why are you all so frightened. I am a simple traveler, looking for a soft place to stay for the night and a warm place for a meal. "There's not a bite to eat in the whole province," he was told. "We are weak and our children are starving. Better keep moving on." "Oh, I have everything I need," he said. "In fact, I was thinking of making some stone soup to share with all of you." He pulled an iron cauldron from his cloak, filled it with water, and began to build a fire under it. Then, with great ceremony, he drew an ordinary-looking stone from a silken bag and dropped it into the water. By now, hearing the rumor of food, most of the villagers had come out of their homes or watched from their windows. As the stranger sniffed the "broth" and licked his lips in anticipation, hunger began to overcome their fear. "Ahh," the stranger said to himself rather loudly, "I do like a tasty stone soup. Of course, stone soup with cabbage -- that's hard to beat." Soon a villager approached hesitantly, holding a small cabbage he'd retrieved from its hiding place, and added it to the pot. "Wonderful!!" cried the stranger. "You know, I once had stone soup with cabbage and a bit of salt beef as well, and it was fit for a king." The village butcher managed to find some salt beef . . . And so it went, through potatoes, onions, carrots, mushrooms, and so on, until there was indeed a delicious meal for everyone in the village to share. The village elder offered the stranger a great deal of money for the magic stone, but he refused to sell it and traveled on the next day. As he left, the stranger came upon a group of village children standing near the road. He gave the silken bag containing the stone to the youngest child, whispering to a group, "It was not the stone, but the villagers that had performed the magic." </i></p>
-<p>By working together, everyone contributes what they can, achieving a greater good together.</p>
-<p>Other book notes of mine are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2023-04-01-never-split-the-difference-book-notes.html">2023-04-01 "Never split the difference" book notes</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html">2023-03-16 "The Pragmatic Programmer" book notes (You are currently reading this)</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../resources.html">More books and other resources I found useful.</a><br />
-<a class="textlink" href="../">Back to the main site</a><br />
+</ul><br />
+<span>It's your life. Share it, celebrate it, be proud and have fun.</span><br />
+<br />
+<h2 style='display: inline'>The story of stone soup</h2><br />
+<br />
+<span>How to motivate others to contribute something (e.g. ideas to a startup):</span><br />
+<br />
+<span class='quote'>A kindly, old stranger was walking through the land when he came upon a village. As he entered, the villagers moved towards their homes, locking doors and windows. The stranger smiled and asked, why are you all so frightened. I am a simple traveler, looking for a soft place to stay for the night and a warm place for a meal. "There's not a bite to eat in the whole province," he was told. "We are weak and our children are starving. Better keep moving on." "Oh, I have everything I need," he said. "In fact, I was thinking of making some stone soup to share with all of you." He pulled an iron cauldron from his cloak, filled it with water, and began to build a fire under it. Then, with great ceremony, he drew an ordinary-looking stone from a silken bag and dropped it into the water. By now, hearing the rumor of food, most of the villagers had come out of their homes or watched from their windows. As the stranger sniffed the "broth" and licked his lips in anticipation, hunger began to overcome their fear. "Ahh," the stranger said to himself rather loudly, "I do like a tasty stone soup. Of course, stone soup with cabbage -- that's hard to beat." Soon a villager approached hesitantly, holding a small cabbage he'd retrieved from its hiding place, and added it to the pot. "Wonderful!!" cried the stranger. "You know, I once had stone soup with cabbage and a bit of salt beef as well, and it was fit for a king." The village butcher managed to find some salt beef . . . And so it went, through potatoes, onions, carrots, mushrooms, and so on, until there was indeed a delicious meal for everyone in the village to share. The village elder offered the stranger a great deal of money for the magic stone, but he refused to sell it and traveled on the next day. As he left, the stranger came upon a group of village children standing near the road. He gave the silken bag containing the stone to the youngest child, whispering to a group, "It was not the stone, but the villagers that had performed the magic." </span><br />
+<br />
+<span>By working together, everyone contributes what they can, achieving a greater good together.</span><br />
+<br />
+<span>Other book notes of mine are:</span><br />
+<br />
+<a class='textlink' href='./2023-04-01-never-split-the-difference-book-notes.html'>2023-04-01 "Never split the difference" book notes</a><br />
+<a class='textlink' href='./2023-03-16-the-pragmatic-programmer-book-notes.html'>2023-03-16 "The Pragmatic Programmer" book notes (You are currently reading this)</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../resources.html'>More books and other resources I found useful.</a><br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -737,8 +836,10 @@ nmap ,j :call OpenJournalPage()&lt;CR&gt;
<summary>This will be a quick blog post, as I am busy with my personal life now. I have relocated to a different country and am still busy arranging things. So bear with me :-)</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Installing DTail on OpenBSD</h1>
-<p class="quote"><i>Published at 2022-10-30T11:03:19+02:00</i></p>
+ <h1 style='display: inline'>Installing DTail on OpenBSD</h1><br />
+<br />
+<span class='quote'>Published at 2022-10-30T11:03:19+02:00</span><br />
+<br />
<pre>
,_---~~~~~----._
_,,_,*^____ _____``*g*\"*,
@@ -775,18 +876,29 @@ nmap ,j :call OpenJournalPage()&lt;CR&gt;
/ `._____V_____V'
' '
</pre>
-<p>This will be a quick blog post, as I am busy with my personal life now. I have relocated to a different country and am still busy arranging things. So bear with me :-)</p>
-<p> In this post, I want to give a quick overview (or how-to) about installing DTail on OpenBSD, as the official documentation only covers Red Hat and Fedora Linux! And this blog post will also be used as my reference!</p>
-<a class="textlink" href="https://dtail.dev">https://dtail.dev</a><br />
-<p>I am using Rexify for my OpenBSD automation. Check out the following article covering my Rex setup in a little bit more detail:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-07-30-lets-encrypt-with-openbsd-and-rex.html">Let's Encrypt with OpenBSD and Rex</a><br />
-<p>I will also mention some relevant <span class="inlinecode">Rexfile</span> snippets in this post!</p>
-<h2>Compile it</h2>
-<p>First of all, DTail needs to be downloaded and compiled. For that, <span class="inlinecode">git</span>, <span class="inlinecode">go</span>, and <span class="inlinecode">gmake</span> are required:</p>
+<br />
+<span>This will be a quick blog post, as I am busy with my personal life now. I have relocated to a different country and am still busy arranging things. So bear with me :-)</span><br />
+<br />
+<span> In this post, I want to give a quick overview (or how-to) about installing DTail on OpenBSD, as the official documentation only covers Red Hat and Fedora Linux! And this blog post will also be used as my reference!</span><br />
+<br />
+<a class='textlink' href='https://dtail.dev'>https://dtail.dev</a><br />
+<br />
+<span>I am using Rexify for my OpenBSD automation. Check out the following article covering my Rex setup in a little bit more detail:</span><br />
+<br />
+<a class='textlink' href='./2022-07-30-lets-encrypt-with-openbsd-and-rex.html'>Let's Encrypt with OpenBSD and Rex</a><br />
+<br />
+<span>I will also mention some relevant <span class='inlinecode'>Rexfile</span> snippets in this post!</span><br />
+<br />
+<h2 style='display: inline'>Compile it</h2><br />
+<br />
+<span>First of all, DTail needs to be downloaded and compiled. For that, <span class='inlinecode'>git</span>, <span class='inlinecode'>go</span>, and <span class='inlinecode'>gmake</span> are required:</span><br />
+<br />
<pre>
$ doas pkg_add git go gmake
</pre>
-<p>I am happy that the Go Programming Language is readily available in the OpenBSD packaging system. Once the dependencies got installed, clone DTail and compile it:</p>
+<br />
+<span>I am happy that the Go Programming Language is readily available in the OpenBSD packaging system. Once the dependencies got installed, clone DTail and compile it:</span><br />
+<br />
<pre>
$ mkdir git
$ cd git
@@ -794,32 +906,44 @@ $ git clone https://github.com/mimecast/dtail
$ cd dtail
$ gmake
</pre>
-<p>You can verify the version by running the following command:</p>
+<br />
+<span>You can verify the version by running the following command:</span><br />
+<br />
<pre>
$ ./dtail --version
DTail 4.1.0 Protocol 4.1 Have a lot of fun!
$ file dtail
dtail: ELF 64-bit LSB executable, x86-64, version 1
</pre>
-<p>Now, there isn't any need anymore to keep <span class="inlinecode">git</span>, <span class="inlinecode">go</span> and <span class="inlinecode">gmake</span>, so they can be deinstalled now:</p>
+<br />
+<span>Now, there isn't any need anymore to keep <span class='inlinecode'>git</span>, <span class='inlinecode'>go</span> and <span class='inlinecode'>gmake</span>, so they can be deinstalled now:</span><br />
+<br />
<pre>
$ doas pkg_delete git go gmake
</pre>
-<p>One day I shall create an official OpenBSD port for DTail.</p>
-<h2>Install it</h2>
-<p>Installing the binaries is now just a matter of copying them to <span class="inlinecode">/usr/local/bin</span> as follows:</p>
+<br />
+<span>One day I shall create an official OpenBSD port for DTail.</span><br />
+<br />
+<h2 style='display: inline'>Install it</h2><br />
+<br />
+<span>Installing the binaries is now just a matter of copying them to <span class='inlinecode'>/usr/local/bin</span> as follows:</span><br />
+<br />
<pre>
$ for bin in dserver dcat dgrep dmap dtail dtailhealth; do
doas cp -p $bin /usr/local/bin/$bin
doas chown root:wheel /usr/local/bin/$bin
done
</pre>
-<p>Also, we will be creating the <span class="inlinecode">_dserver</span> service user:</p>
+<br />
+<span>Also, we will be creating the <span class='inlinecode'>_dserver</span> service user:</span><br />
+<br />
<pre>
$ doas adduser -class nologin -group _dserver -batch _dserver
$ doas usermod -d /var/run/dserver/ _dserver
</pre>
-<p>The OpenBSD init script is created from scratch (not part of the official DTail project). Run the following to install the bespoke script:</p>
+<br />
+<span>The OpenBSD init script is created from scratch (not part of the official DTail project). Run the following to install the bespoke script:</span><br />
+<br />
<pre>
$ cat &lt;&lt;'END' | doas tee /etc/rc.d/dserver
#!/bin/ksh
@@ -841,8 +965,11 @@ rc_cmd $1 &amp;
END
$ doas chmod 755 /etc/rc.d/dserver
</pre>
-<h3>Rexification</h3>
-<p>This is the task for setting it up via Rex. Note the <span class="inlinecode">. . . .</span>, that's a placeholder which we will fill up more and more during this blog post:</p>
+<br />
+<h3 style='display: inline'>Rexification</h3><br />
+<br />
+<span>This is the task for setting it up via Rex. Note the <span class='inlinecode'>. . . .</span>, that's a placeholder which we will fill up more and more during this blog post:</span><br />
+<br />
<pre>
desc 'Setup DTail';
task 'dtail', group =&gt; 'frontends',
@@ -865,14 +992,19 @@ task 'dtail', group =&gt; 'frontends',
service 'dserver', ensure =&gt; 'started';
};
</pre>
-<h2>Configure it</h2>
-<p>Now, DTail is fully installed but still needs to be configured. Grab the default config file from GitHub ...</p>
+<br />
+<h2 style='display: inline'>Configure it</h2><br />
+<br />
+<span>Now, DTail is fully installed but still needs to be configured. Grab the default config file from GitHub ...</span><br />
+<br />
<pre>
$ doas mkdir /etc/dserver
$ curl https://raw.githubusercontent.com/mimecast/dtail/master/samples/dtail.json.sample |
doas tee /etc/dserver/dtail.json
</pre>
-<p>... and then edit it and adjust <span class="inlinecode">LogDir</span> in the <span class="inlinecode">Common</span> section to <span class="inlinecode">/var/log/dserver</span>. The result will look like this:</p>
+<br />
+<span>... and then edit it and adjust <span class='inlinecode'>LogDir</span> in the <span class='inlinecode'>Common</span> section to <span class='inlinecode'>/var/log/dserver</span>. The result will look like this:</span><br />
+<br />
<pre>
"Common": {
"LogDir": "/var/log/dserver",
@@ -883,8 +1015,11 @@ $ curl https://raw.githubusercontent.com/mimecast/dtail/master/samples/dtail.jso
"LogLevel": "Info"
}
</pre>
-<h3>Rexification</h3>
-<p>That's as simple as adding the following to the Rex task:</p>
+<br />
+<h3 style='display: inline'>Rexification</h3><br />
+<br />
+<span>That's as simple as adding the following to the Rex task:</span><br />
+<br />
<pre>
file '/etc/dserver',
ensure =&gt; 'directory';
@@ -896,9 +1031,13 @@ file '/etc/dserver/dtail.json',
mode =&gt; '755',
on_change =&gt; sub { $restart = TRUE };
</pre>
-<h2>Update the key cache for it</h2>
-<p>DTail relies on SSH for secure authentication and communication. However, the system user <span class="inlinecode">_dserver</span> has no permission to read the SSH public keys from the user's home directories, so the DTail server also checks for available public keys in an alternative path <span class="inlinecode">/var/run/dserver/cache</span>. </p>
-<p>The following script, populating the DTail server key cache, can be run periodically via <span class="inlinecode">CRON</span>:</p>
+<br />
+<h2 style='display: inline'>Update the key cache for it</h2><br />
+<br />
+<span>DTail relies on SSH for secure authentication and communication. However, the system user <span class='inlinecode'>_dserver</span> has no permission to read the SSH public keys from the user's home directories, so the DTail server also checks for available public keys in an alternative path <span class='inlinecode'>/var/run/dserver/cache</span>. </span><br />
+<br />
+<span>The following script, populating the DTail server key cache, can be run periodically via <span class='inlinecode'>CRON</span>:</span><br />
+<br />
<pre>
$ cat &lt;&lt;'END' | doas tee /usr/local/bin/dserver-update-key-cache.sh
#!/bin/ksh
@@ -938,13 +1077,18 @@ echo 'All set...'
END
$ doas chmod 500 /usr/local/bin/dserver-update-key-cache.sh
</pre>
-<p>Note that the script above is a slight variation of the official DTail script. The official DTail one is a <span class="inlinecode">bash</span> script, but on OpenBSD, there's <span class="inlinecode">ksh</span>. I run it once daily by adding it to the <span class="inlinecode">daily.local</span>:</p>
+<br />
+<span>Note that the script above is a slight variation of the official DTail script. The official DTail one is a <span class='inlinecode'>bash</span> script, but on OpenBSD, there's <span class='inlinecode'>ksh</span>. I run it once daily by adding it to the <span class='inlinecode'>daily.local</span>:</span><br />
+<br />
<pre>
$ echo /usr/local/bin/dserver-update-key-cache.sh | doas tee -a /etc/daily.local
/usr/local/bin/dserver-update-key-cache.sh
</pre>
-<h3>Rexification</h3>
-<p>That's done by adding ...</p>
+<br />
+<h3 style='display: inline'>Rexification</h3><br />
+<br />
+<span>That's done by adding ...</span><br />
+<br />
<pre>
file '/usr/local/bin/dserver-update-key-cache.sh',
content =&gt; template('./scripts/dserver-update-key-cache.sh.tpl'),
@@ -954,9 +1098,13 @@ file '/usr/local/bin/dserver-update-key-cache.sh',
append_if_no_such_line '/etc/daily.local', '/usr/local/bin/dserver-update-key-cache.sh';
</pre>
-<p>... to the Rex task!</p>
-<h2>Start it</h2>
-<p>Now, it's time to enable and start the DTail server:</p>
+<br />
+<span>... to the Rex task!</span><br />
+<br />
+<h2 style='display: inline'>Start it</h2><br />
+<br />
+<span>Now, it's time to enable and start the DTail server:</span><br />
+<br />
<pre>
$ sudo rcctl enable dserver
$ sudo rcctl start dserver
@@ -978,7 +1126,9 @@ INFO|1022-090739|86050|stats.go:53|2|11|7|||MAPREDUCE:STATS|currentConnections=0
.
Ctr+C
</pre>
-<p>As we don't want to wait until tomorrow, let's populate the key cache manually:</p>
+<br />
+<span>As we don't want to wait until tomorrow, let's populate the key cache manually:</span><br />
+<br />
<pre>
$ doas /usr/local/bin/dserver-update-key-cache.sh
Updating SSH key cache
@@ -990,9 +1140,13 @@ Caching /home/paul/.ssh/authorized_keys -&gt; /var/cache/dserver/paul.authorized
Caching /home/rex/.ssh/authorized_keys -&gt; /var/cache/dserver/rex.authorized_keys
All set...
</pre>
-<h2>Use it</h2>
-<p>The DTail server is now ready to serve connections. You can use any DTail commands, such as <span class="inlinecode">dtail</span>, <span class="inlinecode">dgrep</span>, <span class="inlinecode">dmap</span>, <span class="inlinecode">dcat</span>, <span class="inlinecode">dtailhealth</span>, to do so. Checkout out all the usage examples on the official DTail page.</p>
-<p>I have installed DTail server this way on my personal OpenBSD frontends <span class="inlinecode">blowfish</span>, and <span class="inlinecode">fishfinger</span>, and the following command connects as user <span class="inlinecode">rex</span> to both machines and greps the file <span class="inlinecode">/etc/fstab</span> for the string <span class="inlinecode">local</span>:</p>
+<br />
+<h2 style='display: inline'>Use it</h2><br />
+<br />
+<span>The DTail server is now ready to serve connections. You can use any DTail commands, such as <span class='inlinecode'>dtail</span>, <span class='inlinecode'>dgrep</span>, <span class='inlinecode'>dmap</span>, <span class='inlinecode'>dcat</span>, <span class='inlinecode'>dtailhealth</span>, to do so. Checkout out all the usage examples on the official DTail page.</span><br />
+<br />
+<span>I have installed DTail server this way on my personal OpenBSD frontends <span class='inlinecode'>blowfish</span>, and <span class='inlinecode'>fishfinger</span>, and the following command connects as user <span class='inlinecode'>rex</span> to both machines and greps the file <span class='inlinecode'>/etc/fstab</span> for the string <span class='inlinecode'>local</span>:</span><br />
+<br />
<pre>
❯ ./dgrep -user rex -servers blowfish.buetow.org,fishfinger.buetow.org --regex local /etc/fstab
CLIENT|earth|WARN|Encountered unknown host|{blowfish.buetow.org:2222 0xc0000a00f0 0xc0000a61e0 [blowfish.buetow.org]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9ZnF/LAk14SgqCzk38yENVTNfqibcluMTuKx1u53cKSp2xwHWzy0Ni5smFPpJDIQQljQEJl14ZdXvhhjp1kKHxJ79ubqRtIXBlC0PhlnP8Kd+mVLLHYpH9VO4rnaSfHE1kBjWkI7U6lLc6ks4flgAgGTS5Bb7pLAjwdWg794GWcnRh6kSUEQd3SftANqQLgCunDcP2Vc4KR9R78zBmEzXH/OPzl/ANgNA6wWO2OoKKy2VrjwVAab6FW15h3Lr6rYIw3KztpG+UMmEj5ReexIjXi/jUptdnUFWspvAmzIl6kwzzF8ExVyT9D75JRuHvmxXKKjyJRxqb8UnSh2JD4JN [23.88.35.144]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9ZnF/LAk14SgqCzk38yENVTNfqibcluMTuKx1u53cKSp2xwHWzy0Ni5smFPpJDIQQljQEJl14ZdXvhhjp1kKHxJ79ubqRtIXBlC0PhlnP8Kd+mVLLHYpH9VO4rnaSfHE1kBjWkI7U6lLc6ks4flgAgGTS5Bb7pLAjwdWg794GWcnRh6kSUEQd3SftANqQLgCunDcP2Vc4KR9R78zBmEzXH/OPzl/ANgNA6wWO2OoKKy2VrjwVAab6FW15h3Lr6rYIw3KztpG+UMmEj5ReexIjXi/jUptdnUFWspvAmzIl6kwzzF8ExVyT9D75JRuHvmxXKKjyJRxqb8UnSh2JD4JN 0xc0000a2180}
@@ -1004,24 +1158,34 @@ CLIENT|earth|INFO|Added hosts to known hosts file|/home/paul/.ssh/known_hosts
REMOTE|blowfish|100|7|fstab|31bfd9d9a6788844.h /usr/local ffs rw,wxallowed,nodev 1 2
REMOTE|fishfinger|100|7|fstab|093f510ec5c0f512.h /usr/local ffs rw,wxallowed,nodev 1 2
</pre>
-<p>Running it the second time, and given that you trusted the keys the first time, it won't prompt you for the host keys anymore:</p>
+<br />
+<span>Running it the second time, and given that you trusted the keys the first time, it won't prompt you for the host keys anymore:</span><br />
+<br />
<pre>
❯ ./dgrep -user rex -servers blowfish.buetow.org,fishfinger.buetow.org --regex local /etc/fstab
REMOTE|blowfish|100|7|fstab|31bfd9d9a6788844.h /usr/local ffs rw,wxallowed,nodev 1 2
REMOTE|fishfinger|100|7|fstab|093f510ec5c0f512.h /usr/local ffs rw,wxallowed,nodev 1 2
</pre>
-<h2>Conclusions</h2>
-<p>It's a bit of manual work, but it's ok on this small scale! I shall invest time in creating an official OpenBSD port, though. That would render most of the manual steps obsolete, as outlined in this post!</p>
-<p>Check out the following for more information:</p>
-<a class="textlink" href="https://dtail.dev">https://dtail.dev</a><br />
-<a class="textlink" href="https://github.com/mimecast/dtail">https://github.com/mimecast/dtail</a><br />
-<a class="textlink" href="https://www.rexify.org">https://www.rexify.org</a><br />
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-10-30-installing-dtail-on-openbsd.html">2022-10-30 Installing DTail on OpenBSD (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html">2022-03-06 The release of DTail 4.0.0</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program.html">2021-04-22 DTail - The distributed log tail program</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+<br />
+<h2 style='display: inline'>Conclusions</h2><br />
+<br />
+<span>It's a bit of manual work, but it's ok on this small scale! I shall invest time in creating an official OpenBSD port, though. That would render most of the manual steps obsolete, as outlined in this post!</span><br />
+<br />
+<span>Check out the following for more information:</span><br />
+<br />
+<a class='textlink' href='https://dtail.dev'>https://dtail.dev</a><br />
+<a class='textlink' href='https://github.com/mimecast/dtail'>https://github.com/mimecast/dtail</a><br />
+<a class='textlink' href='https://www.rexify.org'>https://www.rexify.org</a><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2022-10-30-installing-dtail-on-openbsd.html'>2022-10-30 Installing DTail on OpenBSD (You are currently reading this)</a><br />
+<a class='textlink' href='./2022-03-06-the-release-of-dtail-4.0.0.html'>2022-03-06 The release of DTail 4.0.0</a><br />
+<a class='textlink' href='./2021-04-22-dtail-the-distributed-log-tail-program.html'>2021-04-22 DTail - The distributed log tail program</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -1112,8 +1276,10 @@ jgs (________\ \
<summary>I proudly announce that I've released Gemtexter version `1.1.0`. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Gemtexter 1.1.0 - Let's Gemtext again</h1>
-<p class="quote"><i>Published at 2022-08-27T18:25:57+01:00</i></p>
+ <h1 style='display: inline'>Gemtexter 1.1.0 - Let's Gemtext again</h1><br />
+<br />
+<span class='quote'>Published at 2022-08-27T18:25:57+01:00</span><br />
+<br />
<pre>
-=[ typewriter ]=- 1/98
@@ -1125,12 +1291,19 @@ jgs (________\ \
|o=======.|
jgs `"""""""""`
</pre>
-<p>I proudly announce that I've released Gemtexter version <span class="inlinecode">1.1.0</span>. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.</p>
-<a class="textlink" href="https://codeberg.org/snonux/gemtexter">https://codeberg.org/snonux/gemtexter</a><br />
-<p>It has been around a year since I released the first version <span class="inlinecode">1.0.0</span>. Although, there aren't any groundbreaking changes, there have been a couple of smaller commits and adjustments. I was quite surprised that I received a bunch of feedback and requests about Gemtexter so it means that I am not the only person in the universe actually using it.</p>
-<h2>What's new?</h2>
-<h3>Automatic check for GNU version requirements</h3>
-<p>Gemtexter relies on the GNU versions of the tools <span class="inlinecode">grep</span>, <span class="inlinecode">sed</span> and <span class="inlinecode">date</span> and it also requires the Bash shell in version 5 at least. That's now done in the <span class="inlinecode">check_dependencies()</span> function:</p>
+<br />
+<span>I proudly announce that I've released Gemtexter version <span class='inlinecode'>1.1.0</span>. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown written in GNU Bash.</span><br />
+<br />
+<a class='textlink' href='https://codeberg.org/snonux/gemtexter'>https://codeberg.org/snonux/gemtexter</a><br />
+<br />
+<span>It has been around a year since I released the first version <span class='inlinecode'>1.0.0</span>. Although, there aren't any groundbreaking changes, there have been a couple of smaller commits and adjustments. I was quite surprised that I received a bunch of feedback and requests about Gemtexter so it means that I am not the only person in the universe actually using it.</span><br />
+<br />
+<h2 style='display: inline'>What's new?</h2><br />
+<br />
+<h3 style='display: inline'>Automatic check for GNU version requirements</h3><br />
+<br />
+<span>Gemtexter relies on the GNU versions of the tools <span class='inlinecode'>grep</span>, <span class='inlinecode'>sed</span> and <span class='inlinecode'>date</span> and it also requires the Bash shell in version 5 at least. That's now done in the <span class='inlinecode'>check_dependencies()</span> function:</span><br />
+<br />
<pre>
check_dependencies () {
# At least, Bash 5 is required
@@ -1150,34 +1323,56 @@ check_dependencies () {
done
}
</pre>
-<p>Especially macOS users didn't read the <span class="inlinecode">README</span> carefully enough to install GNU Grep, GNU Sed and GNU Date before using Gemtexter.</p>
-<h3>Backticks now produce <span class="inlinecode">inline code blocks</span> in the HTML output</h3>
-<p>The Gemtext format doesn't support inline code blocks, but Gemtexter now produces <span class="inlinecode">inline code blocks</span> (means, small code fragments can be placed in the middle of a paragraph) in the HTML output when the code block is enclosed with Backticks. There were no adjustments required for the Markdown output format, because Markdown supports it already out of the box.</p>
-<h3>Cache for Atom feed generation</h3>
-<p>The Bash is not the most performant language. Gemtexter already takes a couple of seconds only to generate the Atom feed for around two hand full of articles on my slightly underpowered Surface Go 2 Linux tablet. Therefore, I introduced a cache, so that subsequent Atom feed generation runs finish much quicker. The cache uses a checksum of the Gemtext <span class="inlinecode">.gmi</span> file to decide whether anything of the content has changed or not.</p>
-<h3>Input filter support</h3>
-<p>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:</p>
+<br />
+<span>Especially macOS users didn't read the <span class='inlinecode'>README</span> carefully enough to install GNU Grep, GNU Sed and GNU Date before using Gemtexter.</span><br />
+<br />
+<h3 style='display: inline'>Backticks now produce <span class='inlinecode'>inline code blocks</span> in the HTML output</h3><br />
+<br />
+<span>The Gemtext format doesn't support inline code blocks, but Gemtexter now produces <span class='inlinecode'>inline code blocks</span> (means, small code fragments can be placed in the middle of a paragraph) in the HTML output when the code block is enclosed with Backticks. There were no adjustments required for the Markdown output format, because Markdown supports it already out of the box.</span><br />
+<br />
+<h3 style='display: inline'>Cache for Atom feed generation</h3><br />
+<br />
+<span>The Bash is not the most performant language. Gemtexter already takes a couple of seconds only to generate the Atom feed for around two hand full of articles on my slightly underpowered Surface Go 2 Linux tablet. Therefore, I introduced a cache, so that subsequent Atom feed generation runs finish much quicker. The cache uses a checksum of the Gemtext <span class='inlinecode'>.gmi</span> file to decide whether anything of the content has changed or not.</span><br />
+<br />
+<h3 style='display: inline'>Input filter support</h3><br />
+<br />
+<span>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:</span><br />
+<br />
<pre>
./gemtexter --generate '.*hello.*'
</pre>
-<h3>Revamped <span class="inlinecode">git</span> support</h3>
-<p>The Git support has been completely rewritten. It's now more reliable and faster too. Have a look at the <span class="inlinecode">README</span> for more information.</p>
-<h3>Addition of <span class="inlinecode">htmlextras</span> and web font support</h3>
-<p>The <span class="inlinecode">htmlextras</span> folder now contains all extra files required for the HTML output format such as cascading style sheet (CSS) files and web fonts.</p>
-<h3>Sub-section support</h3>
-<p>It's now possible to define sub-sections within a Gemtexter capsule. For the HTML output, each sub-section can use its own CSS and web font definitions. E.g.:</p>
-<a class="textlink" href="https://foo.zone">The foo.zone main site</a><br />
-<a class="textlink" href="https://foo.zone/notes">The notes sub-section (with different fonts)</a><br />
-<h3>More</h3>
-<p>Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made. </p>
-<p>Overall I think it's a pretty solid <span class="inlinecode">1.1.0</span> release without anything groundbreaking (therefore no major version jump). But I am happy about it.</p>
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html">2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again^2</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html">2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html">2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-04-24-welcome-to-the-geminispace.html">2021-04-24 Welcome to the Geminispace</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+<br />
+<h3 style='display: inline'>Revamped <span class='inlinecode'>git</span> support</h3><br />
+<br />
+<span>The Git support has been completely rewritten. It's now more reliable and faster too. Have a look at the <span class='inlinecode'>README</span> for more information.</span><br />
+<br />
+<h3 style='display: inline'>Addition of <span class='inlinecode'>htmlextras</span> and web font support</h3><br />
+<br />
+<span>The <span class='inlinecode'>htmlextras</span> folder now contains all extra files required for the HTML output format such as cascading style sheet (CSS) files and web fonts.</span><br />
+<br />
+<h3 style='display: inline'>Sub-section support</h3><br />
+<br />
+<span>It's now possible to define sub-sections within a Gemtexter capsule. For the HTML output, each sub-section can use its own CSS and web font definitions. E.g.:</span><br />
+<br />
+<a class='textlink' href='https://foo.zone'>The foo.zone main site</a><br />
+<a class='textlink' href='https://foo.zone/notes'>The notes sub-section (with different fonts)</a><br />
+<br />
+<h3 style='display: inline'>More</h3><br />
+<br />
+<span>Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made. </span><br />
+<br />
+<span>Overall I think it's a pretty solid <span class='inlinecode'>1.1.0</span> release without anything groundbreaking (therefore no major version jump). But I am happy about it.</span><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html'>2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again^2</a><br />
+<a class='textlink' href='./2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html'>2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again (You are currently reading this)</a><br />
+<a class='textlink' href='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html'>2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
+<a class='textlink' href='./2021-04-24-welcome-to-the-geminispace.html'>2021-04-24 Welcome to the Geminispace</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -2043,105 +2238,156 @@ v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs
<summary>Perl (the Practical Extraction and Report Language) is a battle-tested, mature, multi-paradigm dynamic programming language. Note that it's not called PERL, neither P.E.R.L. nor Pearl. 'Perl' is the name of the language and `perl` the name of the interpreter or the interpreter command.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Perl is still a great choice</h1>
-<p class="quote"><i>Published at 2022-05-27T07:50:12+01:00; Updated at 2023-01-28</i></p>
-<a href="https://foo.zone/gemfeed/2022-05-27-perl-is-still-a-great-choice/regular_expressions.png"><img alt="Comic source: XKCD" title="Comic source: XKCD" src="https://foo.zone/gemfeed/2022-05-27-perl-is-still-a-great-choice/regular_expressions.png" /></a><br />
-<p>Perl (the Practical Extraction and Report Language) is a battle-tested, mature, multi-paradigm dynamic programming language. Note that it's not called PERL, neither P.E.R.L. nor Pearl. "Perl" is the name of the language and <span class="inlinecode">perl</span> the name of the interpreter or the interpreter command.</p>
-<p>Unfortunately (it makes me sad), Perl's popularity has been declining over the last years as Google trends shows:</p>
-<a href="https://foo.zone/gemfeed/2022-05-27-perl-is-still-a-great-choice/googletrendsperl.jpg"><img src="https://foo.zone/gemfeed/2022-05-27-perl-is-still-a-great-choice/googletrendsperl.jpg" /></a><br />
-<p>So why is that? Once the de-facto standard super-glue language for the web nowadays seems to have a bad reputation. Often, people state:</p>
+ <h1 style='display: inline'>Perl is still a great choice</h1><br />
+<br />
+<span class='quote'>Published at 2022-05-27T07:50:12+01:00; Updated at 2023-01-28</span><br />
+<br />
+<a href='./2022-05-27-perl-is-still-a-great-choice/regular_expressions.png'><img alt='Comic source: XKCD' title='Comic source: XKCD' src='./2022-05-27-perl-is-still-a-great-choice/regular_expressions.png' /></a><br />
+<br />
+<span>Perl (the Practical Extraction and Report Language) is a battle-tested, mature, multi-paradigm dynamic programming language. Note that it's not called PERL, neither P.E.R.L. nor Pearl. "Perl" is the name of the language and <span class='inlinecode'>perl</span> the name of the interpreter or the interpreter command.</span><br />
+<br />
+<span>Unfortunately (it makes me sad), Perl's popularity has been declining over the last years as Google trends shows:</span><br />
+<br />
+<a href='./2022-05-27-perl-is-still-a-great-choice/googletrendsperl.jpg'><img src='./2022-05-27-perl-is-still-a-great-choice/googletrendsperl.jpg' /></a><br />
+<br />
+<span>So why is that? Once the de-facto standard super-glue language for the web nowadays seems to have a bad reputation. Often, people state:</span><br />
+<br />
<ul>
<li>Perl is a write-only language. Nobody can read Perl code.</li>
<li>Perl? Isn't it abandoned? It's still at version 5!</li>
<li>Why use Perl as there are better alternatives?</li>
<li>Why all the sigils? It looks like an exploding ASCII factory!!</li>
-</ul>
-<h2>Write-only language</h2>
-<p>Is Perl really a write-only language? You have to understand that Perl 5 was released in 1994 (28 years ago as of this writing) and when we refer to Perl we usually mean Perl 5. That's many years, and there are many old scripts not following the modern Perl best practices (as they didn't exist yet). So yes, legacy scripts may be difficult to read. Japanese may be difficult to read too if you don't know Japanese, though.</p>
-<p>To come back to the question: Is Perl a write-only language? I don't think so. Like in any other language, you have to apply best practices in order to keep your code maintainable. Some other programming languages enforce best practices, but that makes these languages less expressive. Perl follows the principles "there is more than one way to do it" (aka TIMTOWDI) and "making easy things easy and hard things possible".</p>
-<p>Perl gives the programmer more flexibility in how to do things, and this results in a stronger learning curve than for lesser expressive languages like for example Go or Python. But, like in everything in life, common sense has to be applied. You should not take TIMTOWDI to the extreme in a production piece of code. In my personal opinion, it is also more satisfying to program in an expressive language.</p>
-<p>Some good books on "good" Perl I can recommend are:</p>
-<a class="textlink" href="http://modernperlbooks.com">Modern Perl</a><br />
-<a class="textlink" href="https://hop.perl.plover.com">Higher Order Perl</a><br />
-<p>Due to Perl's expressiveness you will find a lot of obscure code in the interweb in form of obfuscation, fancy email signatures (JAPHs), art, polyglots and even poetry in Perl syntax. But that's not what you will find in production code. That's only people having fun with the language which is different to "getting things done". The expressiveness is a bonus. It makes the Perl programmers love Perl.</p>
-<a class="textlink" href="https://en.wikipedia.org/wiki/Just_another_Perl_hacker">JAPH</a><br />
-<a class="textlink" href="http://www.cpan.org/misc/japh">http://www.cpan.org/misc/japh</a><br />
-<a class="textlink" href="https://www.perlmonks.org/index.pl?next=20;node_id=1590">Perl Poetry</a><br />
-<p>Even I personally have written some poetry in Perl and experimented with a polyglot script:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2008-06-26-perl-poetry.html">My very own Perl Poetry</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html">A Perl-Raku-C polyglot generating the Fibonacci sequence</a><br />
-<p>This all doesn't mean that you can't "get things done" with Perl. Quite the opposite is the case. Perl is a very pragmatic programming language and is suitable very well for rapid prototyping and any kind of small to medium-sized scripts and programs. You can write large enterprise scale application in Perl too, but that wasn't the original intend of why Perl was invented (more on that later).</p>
-<h2>Is Perl abandoned?</h2>
-<p>As I pointed out in the previous section, Perl 5 is around for quite some time without any new major version released. This can lead to the impression that development is not progressing and that the project is abandoned. Nothing can be further from the truth. Perl 5.000 was released in 1994 and the latest version (as of this writing) Perl 5.34.1 was released two months ago in 2022. You can check the version history on Wikipedia. You will notice releases being made regularly:</p>
-<a class="textlink" href="https://en.wikipedia.org/wiki/Perl_5_version_history">Perl 5 version history</a><br />
-<p>As you can see, Perl 5 is under active development. I can also recommend to have a look at the following book, it summarizes all new Perl features which showed up after Perl v5.10:</p>
-<a class="textlink" href="https://perlschool.com/books/perl-new-features/">Perl New Features by Joshua McAdams and brian d foy</a><br />
-<p>Actually, Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was officially changed to Raku in October 2019 as the differences between Perl 5 and Perl 6 were too groundbreaking. Raku would be a different topic (mostly out of scope of this blog article) but I at least wanted it to mention here. In my opinion, Raku is the "most powerful" programming language out there (I recently started learning it and intend to use it for some of my future personal programming projects):</p>
-<a class="textlink" href="https://raku.org">The Raku Programming Language</a><br />
-<p>So it means that Perl and Raku now exist in parallel. They influence each other, but are different programming languages now. So why not just all use Raku instead of Perl? There are still a couple of reasons of why to choose Perl over Raku:</p>
+</ul><br />
+<h2 style='display: inline'>Write-only language</h2><br />
+<br />
+<span>Is Perl really a write-only language? You have to understand that Perl 5 was released in 1994 (28 years ago as of this writing) and when we refer to Perl we usually mean Perl 5. That's many years, and there are many old scripts not following the modern Perl best practices (as they didn't exist yet). So yes, legacy scripts may be difficult to read. Japanese may be difficult to read too if you don't know Japanese, though.</span><br />
+<br />
+<span>To come back to the question: Is Perl a write-only language? I don't think so. Like in any other language, you have to apply best practices in order to keep your code maintainable. Some other programming languages enforce best practices, but that makes these languages less expressive. Perl follows the principles "there is more than one way to do it" (aka TIMTOWDI) and "making easy things easy and hard things possible".</span><br />
+<br />
+<span>Perl gives the programmer more flexibility in how to do things, and this results in a stronger learning curve than for lesser expressive languages like for example Go or Python. But, like in everything in life, common sense has to be applied. You should not take TIMTOWDI to the extreme in a production piece of code. In my personal opinion, it is also more satisfying to program in an expressive language.</span><br />
+<br />
+<span>Some good books on "good" Perl I can recommend are:</span><br />
+<br />
+<a class='textlink' href='http://modernperlbooks.com'>Modern Perl</a><br />
+<a class='textlink' href='https://hop.perl.plover.com'>Higher Order Perl</a><br />
+<br />
+<span>Due to Perl's expressiveness you will find a lot of obscure code in the interweb in form of obfuscation, fancy email signatures (JAPHs), art, polyglots and even poetry in Perl syntax. But that's not what you will find in production code. That's only people having fun with the language which is different to "getting things done". The expressiveness is a bonus. It makes the Perl programmers love Perl.</span><br />
+<br />
+<a class='textlink' href='https://en.wikipedia.org/wiki/Just_another_Perl_hacker'>JAPH</a><br />
+<a class='textlink' href='http://www.cpan.org/misc/japh'>http://www.cpan.org/misc/japh</a><br />
+<a class='textlink' href='https://www.perlmonks.org/index.pl?next=20;node_id=1590'>Perl Poetry</a><br />
+<br />
+<span>Even I personally have written some poetry in Perl and experimented with a polyglot script:</span><br />
+<br />
+<a class='textlink' href='./2008-06-26-perl-poetry.html'>My very own Perl Poetry</a><br />
+<a class='textlink' href='./2014-03-24-the-fibonacci.pl.c-polyglot.html'>A Perl-Raku-C polyglot generating the Fibonacci sequence</a><br />
+<br />
+<span>This all doesn't mean that you can't "get things done" with Perl. Quite the opposite is the case. Perl is a very pragmatic programming language and is suitable very well for rapid prototyping and any kind of small to medium-sized scripts and programs. You can write large enterprise scale application in Perl too, but that wasn't the original intend of why Perl was invented (more on that later).</span><br />
+<br />
+<h2 style='display: inline'>Is Perl abandoned?</h2><br />
+<br />
+<span>As I pointed out in the previous section, Perl 5 is around for quite some time without any new major version released. This can lead to the impression that development is not progressing and that the project is abandoned. Nothing can be further from the truth. Perl 5.000 was released in 1994 and the latest version (as of this writing) Perl 5.34.1 was released two months ago in 2022. You can check the version history on Wikipedia. You will notice releases being made regularly:</span><br />
+<br />
+<a class='textlink' href='https://en.wikipedia.org/wiki/Perl_5_version_history'>Perl 5 version history</a><br />
+<br />
+<span>As you can see, Perl 5 is under active development. I can also recommend to have a look at the following book, it summarizes all new Perl features which showed up after Perl v5.10:</span><br />
+<br />
+<a class='textlink' href='https://perlschool.com/books/perl-new-features/'>Perl New Features by Joshua McAdams and brian d foy</a><br />
+<br />
+<span>Actually, Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was officially changed to Raku in October 2019 as the differences between Perl 5 and Perl 6 were too groundbreaking. Raku would be a different topic (mostly out of scope of this blog article) but I at least wanted it to mention here. In my opinion, Raku is the "most powerful" programming language out there (I recently started learning it and intend to use it for some of my future personal programming projects):</span><br />
+<br />
+<a class='textlink' href='https://raku.org'>The Raku Programming Language</a><br />
+<br />
+<span>So it means that Perl and Raku now exist in parallel. They influence each other, but are different programming languages now. So why not just all use Raku instead of Perl? There are still a couple of reasons of why to choose Perl over Raku:</span><br />
+<br />
<ul>
<li>Many programmers already know Perl and many scripts are already written in Perl. It's possible to call Perl code from Raku (either inline or as a library) and it is also possible to auto-convert Perl code into Raku code, but that's either a workaround or involves some kind of additional work.</li>
-<li>Perl 5 comes with a great backwards compatibility. Perl scripts from 5.000 will generally still work on a recent version of Perl. New features usually have to be enabled via a so-called "use pragmas". For example, in order to enable sub signatures, <span class="inlinecode">use signatures;</span> has to be specified.</li>
+<li>Perl 5 comes with a great backwards compatibility. Perl scripts from 5.000 will generally still work on a recent version of Perl. New features usually have to be enabled via a so-called "use pragmas". For example, in order to enable sub signatures, <span class='inlinecode'>use signatures;</span> has to be specified.</li>
<li>Perl is pre-installed almost everywhere. Fancy running a quick one-off script? In almost all cases, there's no need to install Perl first - it's already there on almost any Linux or *BSD or Unix or other Unix like operating system!</li>
<li>Perl has been ported to "zillions" of platforms. One day I found myself on a VMS box. Perl doesn't come installed by default on VMS, but the admin installed Perl there already. The whole operating system was very strange to me, but I was able to write "shell scripts" in Perl and became productive pretty quickly on VMS without knowing almost anything about VMS :-).</li>
<li>Perl is reliable. It has been proven itself "millions" of times, over and over again. Large enterprises, such as booking.com, heavily rely on Perl. Did you know that the package manager of the OpenBSD operating system is programmed in Perl, too?</li>
<li>Perl is a great language to program in (given that you follow the modern best practices). Don't get confused when Perl is doing some things differently than other programming languages.</li>
-</ul>
-<a class="textlink" href="https://perldoc.perl.org/feature">Perl feature pragmas</a><br />
-<a class="textlink" href="https://www.OpenBSD.org">The OpenBSD Operating System</a><br />
-<a class="textlink" href="https://news.ycombinator.com/item?id=23360338">Why does OpenBSD still include Perl in its base installation?</a><br />
-<p>The renaming of Perl 6 to Raku has now opened the door for a future Perl 7. As far as I understand, Perl 7 will be Perl 5 but with modern features enabled by default (e.g. pragmas <span class="inlinecode">use strict;</span>, <span class="inlinecode">use warnings;</span>, <span class="inlinecode">use signatures;</span> and so on. Also, the hope is that a Perl 7 with modern standards will attract more beginners. There aren't many Perl jobs out there nowadays. That's mostly due to Perl's bad (bad for no real reasons) reputation.</p>
-<p class="quote"><i>Update 2022-12-10: A reader pointed out, that <span class="inlinecode">use v5.36;</span> already turns strict, warnings and signatures pragmas automatically on! </i></p>
-<a class="textlink" href="https://www.perl.com/article/announcing-perl-7/">Announcing Perl 7</a><br />
-<a class="textlink" href="http://blogs.perl.org/users/psc/2022/05/what-happened-to-perl-7.html">What happened to Perl 7? (maybe have to use <span class="inlinecode">use v7;</span>)</a><br />
-<p class="quote"><i>Update 2022-12-10: A reader pointed out, that Perl 7 needs to provide a big improvement to earn and keep the attention for a major version bump.</i></p>
-<p class="quote"><i>Update 2023-01-28: Meanwhile, I was also reading brian d foy's Perl New Feature book. It nicely presents all new features added to Perl since <span class="inlinecode">v5.10</span>.</i></p>
-<a class="textlink" href="https://www.leanpub.com/perl_new_features">Perl New Features</a><br />
-<h2>Why use Perl as there are better alternatives?</h2>
-<p>Here, common sense must be applied. I don't believe there is anything like "the perfect" programming language. Everyone has got his preferred (or a set of preferred) programming language to chose from. All programming languages come with their own set of strengths and weaknesses. These are the strengths making Perl shine, and you (technically) don't need to bother to look for "better" alternatives:</p>
+</ul><br />
+<a class='textlink' href='https://perldoc.perl.org/feature'>Perl feature pragmas</a><br />
+<a class='textlink' href='https://www.OpenBSD.org'>The OpenBSD Operating System</a><br />
+<a class='textlink' href='https://news.ycombinator.com/item?id=23360338'>Why does OpenBSD still include Perl in its base installation?</a><br />
+<br />
+<span>The renaming of Perl 6 to Raku has now opened the door for a future Perl 7. As far as I understand, Perl 7 will be Perl 5 but with modern features enabled by default (e.g. pragmas <span class='inlinecode'>use strict;</span>, <span class='inlinecode'>use warnings;</span>, <span class='inlinecode'>use signatures;</span> and so on. Also, the hope is that a Perl 7 with modern standards will attract more beginners. There aren't many Perl jobs out there nowadays. That's mostly due to Perl's bad (bad for no real reasons) reputation.</span><br />
+<br />
+<span class='quote'>Update 2022-12-10: A reader pointed out, that <span class='inlinecode'>use v5.36;</span> already turns strict, warnings and signatures pragmas automatically on! </span><br />
+<br />
+<a class='textlink' href='https://www.perl.com/article/announcing-perl-7/'>Announcing Perl 7</a><br />
+<a class='textlink' href='http://blogs.perl.org/users/psc/2022/05/what-happened-to-perl-7.html'>What happened to Perl 7? (maybe have to use <span class='inlinecode'>use v7;</span>)</a><br />
+<br />
+<span class='quote'>Update 2022-12-10: A reader pointed out, that Perl 7 needs to provide a big improvement to earn and keep the attention for a major version bump.</span><br />
+<br />
+<span class='quote'>Update 2023-01-28: Meanwhile, I was also reading brian d foy's Perl New Feature book. It nicely presents all new features added to Perl since <span class='inlinecode'>v5.10</span>.</span><br />
+<br />
+<a class='textlink' href='https://www.leanpub.com/perl_new_features'>Perl New Features</a><br />
+<br />
+<h2 style='display: inline'>Why use Perl as there are better alternatives?</h2><br />
+<br />
+<span>Here, common sense must be applied. I don't believe there is anything like "the perfect" programming language. Everyone has got his preferred (or a set of preferred) programming language to chose from. All programming languages come with their own set of strengths and weaknesses. These are the strengths making Perl shine, and you (technically) don't need to bother to look for "better" alternatives:</span><br />
+<br />
<ul>
-<li>Perl is better than Shell/AWK/SED scripts. There's a point where shell scripts become fairly complex. The next step-up is to switch to Perl. There are many different versions of shells and AWK and SED interpreters. Do you always know which versions (<span class="inlinecode">mawk</span>, <span class="inlinecode">nawk</span>, <span class="inlinecode">gawk</span>, <span class="inlinecode">sed</span>, <span class="inlinecode">gsed</span>, <span class="inlinecode">grep</span>, <span class="inlinecode">ggrep</span>...) are currently installed? These commands aren't fully compatible to each other. However, there is only one Perl 5. Simply: Perl is faster, more powerful, more expressive than any shell script can ever be, and it is also extendible through CPAN. Perl can directly talk to databases, which shell scripts can't.</li>
+<li>Perl is better than Shell/AWK/SED scripts. There's a point where shell scripts become fairly complex. The next step-up is to switch to Perl. There are many different versions of shells and AWK and SED interpreters. Do you always know which versions (<span class='inlinecode'>mawk</span>, <span class='inlinecode'>nawk</span>, <span class='inlinecode'>gawk</span>, <span class='inlinecode'>sed</span>, <span class='inlinecode'>gsed</span>, <span class='inlinecode'>grep</span>, <span class='inlinecode'>ggrep</span>...) are currently installed? These commands aren't fully compatible to each other. However, there is only one Perl 5. Simply: Perl is faster, more powerful, more expressive than any shell script can ever be, and it is also extendible through CPAN. Perl can directly talk to databases, which shell scripts can't.</li>
<li>Perl code tends to be compact so that it's much better suitable for "shell scripting" and quick "one-liners" than other languages. In my own experience: Ruby and Python code tends to blow up quickly. It doesn't mean that Ruby and Python are not suitable for this task, but I think Perl does much better.</li>
<li>Perl 5 has proven itself for decades and is a very stable/robust language. It is a battle-tested and mature as something can ever become.</li>
<li>Perl is the reference standard for regular expressions. Even so much that there is a PCRE library (Perl Compatible Regular Expressions) used by many other languages now. Perl fully integrates regular expression syntax into the language, which doesn't feel like an odd add-on like in most other languages.</li>
<li>Perl 5 is the master of text processing (well, maybe after Raku now. But you might not have the latest Raku available everywhere). The chief objective of developing the language was for text processing, and this is where Perl (Practical extraction and report language) really shines.</li>
<li>Perl is a "deep" language. That means Perl got a lot of features and syntactic sugar and magic. Depending on the perspective, this could be interpreted as a downside too. But IMHO mastery of a "deep" language brings big rewards. The code can be very compact, and it is fun to code in it.</li>
<li>Perl is the only language I know which can do "taint checking". Running a script in taint mode makes Perl sanitize all external input and that's a great security feature. Ruby used to have this feature too, but it got removed (as I understand there were some problems with the implementation not completely safe and it was easier just to remove it from the language than to fix it).</li>
-</ul>
-<p>About the first point, using Perl for better "shell" scripts was actually the original intend of why Perl was invented in the first place.</p>
-<a class="textlink" href="https://nostarch.com/perloneliners">Perl one-liners</a><br />
-<a class="textlink" href="http://regex.info/book.html">Mastering Regular Expressions</a><br />
-<a class="textlink" href="https://en.wikipedia.org/wiki/Taint_checking">Taint checking</a><br />
-<p>Here are some reasons why not to chose Perl and look for "better" alternatives:</p>
+</ul><br />
+<span>About the first point, using Perl for better "shell" scripts was actually the original intend of why Perl was invented in the first place.</span><br />
+<br />
+<a class='textlink' href='https://nostarch.com/perloneliners'>Perl one-liners</a><br />
+<a class='textlink' href='http://regex.info/book.html'>Mastering Regular Expressions</a><br />
+<a class='textlink' href='https://en.wikipedia.org/wiki/Taint_checking'>Taint checking</a><br />
+<br />
+<span>Here are some reasons why not to chose Perl and look for "better" alternatives:</span><br />
+<br />
<ul>
<li>If performance is your main objectives, then Perl might not be the language to use. Perl is a dynamic interpreted language, and it will generally never be as fast as statically typed languages compiled to native binaries (e.g. C/C++/Rust/Haskell) or statically typed languages run in a VM with JIT (e.g. Java) or gradually typed languages run in a VM (e.g. Raku) or languages like Golang (statically typed, compiled to a binary but still with a runtime in the binary). Perl might be still faster than the other language listed here in certain circumstances (e.g. faster startup time than Java or faster regular expressions engine), but usually it's not. It's not a problem of Perl, it's a problem of all dynamic scripting languages including Python, Ruby, ....</li>
<li>Don't use Perl (just yet) if you want to code object-oriented. Perl supports OOP, but it feels clunky and odd to use (blessed references to any data types are objects) and doesn't support real encapsulation out of the box. There are many (many) extensions available on CPAN to make OOP better, but that's totally fragmented. The most popular extension, Moose, comes with a huge dependency tree. But wait for Perl 7. It will maybe come with a new object system (an object system inspired by Raku).</li>
<li>It's possible to write large programs in Perl (make difficult things possible), but it might not be the best choice here. This also leads back to the clunky object system Perl has. You could write your projects in a procedural or functional style (Perl perfectly fits here), but OOP seems to be the gold standard for large projects nowadays. Functional programming requires a different mindset, and pure procedural programming lacks abstractions.</li>
<li>Apply common sense. What is the skill set your team has? What's already widely used and supported at work? Which languages comes with the best modules for the things you want to work on? Maybe Python is the answer (better machine learning modules). Maybe Perl is the better choice (better Bioinformatic modules). Perhaps Ruby is already the de-facto standard at work and everyone knows at least a little Ruby (as it happened to be at my workplace) and Ruby is "good enough" for all the tasks already. But that's not a hindrance to throw in a Perl one-liner once in a while :P.</li>
-</ul>
-<a class="textlink" href="https://github.com/Ovid/Cor">Cor - Bringing modern OOP to the Perl Core</a><br />
-<h2>Why all the sigils? It looks like an exploding ASCII factory!!</h2>
-<p>The sigils <span class="inlinecode">$ @ % &amp;</span> (where Perl is famously known for) serve a purpose. They seem confusing at first, but they actually make the code better readable. <span class="inlinecode">$scalar</span> is a scalar variable (holding a single value), <span class="inlinecode">@array</span> is an array (holding a list of values), <span class="inlinecode">%hash</span> holds a list of key-value pairs and <span class="inlinecode">&amp;sub</span> is for subroutines. A given variable <span class="inlinecode">$ref</span> can also hold reference to something. <span class="inlinecode">@$arrayref</span> dereferences a reference to an array, <span class="inlinecode">%$hashref</span> to a hash, <span class="inlinecode">$$scalarref</span> to a scalar, <span class="inlinecode">&amp;$subref</span> dereferences a referene to a subroutine, etc. That can be encapsulated as deep as you want. (This paragraph only scratched the surface here of what Perl can do, and there is a lot of syntactic sugar not mentioned here).</p>
-<p>In most other programming languages, you won't know instantly what's the "basic type" of a given variable without looking at the variable declaration or the variable name (If named intelligently, e.g. a variable name containing a list of cats is <span class="inlinecode">cat_list</span>). Even Ruby makes some use of sigils (<span class="inlinecode">@</span>, <span class="inlinecode">@@</span> and <span class="inlinecode">$</span>), but that's for a different purpose than in Perl (in Ruby it is about object scope, class scope and global scope). Raku uses all the sigils Perl uses plus an additional bunch of twigils, e.g. <span class="inlinecode">$.foo</span> for a scalar object variable with public accessors, <span class="inlinecode">$!foo</span> for a private scalar object variable, <span class="inlinecode">@.foo</span>, <span class="inlinecode">@!foo</span>, <span class="inlinecode">%.foo</span>, <span class="inlinecode">%!foo</span> and so on. Sigils (and twigils) are very convenient once you get used to them. Don't let them scare you off - they are there to help you!</p>
-<a class="textlink" href="https://www.perl.com/article/on-sigils/">https://www.perl.com/article/on-sigils/</a><br />
-<h2>Where do I personally still use perl?</h2>
+</ul><br />
+<a class='textlink' href='https://github.com/Ovid/Cor'>Cor - Bringing modern OOP to the Perl Core</a><br />
+<br />
+<h2 style='display: inline'>Why all the sigils? It looks like an exploding ASCII factory!!</h2><br />
+<br />
+<span>The sigils <span class='inlinecode'>$ @ % &amp;</span> (where Perl is famously known for) serve a purpose. They seem confusing at first, but they actually make the code better readable. <span class='inlinecode'>$scalar</span> is a scalar variable (holding a single value), <span class='inlinecode'>@array</span> is an array (holding a list of values), <span class='inlinecode'>%hash</span> holds a list of key-value pairs and <span class='inlinecode'>&amp;sub</span> is for subroutines. A given variable <span class='inlinecode'>$ref</span> can also hold reference to something. <span class='inlinecode'>@$arrayref</span> dereferences a reference to an array, <span class='inlinecode'>%$hashref</span> to a hash, <span class='inlinecode'>$$scalarref</span> to a scalar, <span class='inlinecode'>&amp;$subref</span> dereferences a referene to a subroutine, etc. That can be encapsulated as deep as you want. (This paragraph only scratched the surface here of what Perl can do, and there is a lot of syntactic sugar not mentioned here).</span><br />
+<br />
+<span>In most other programming languages, you won't know instantly what's the "basic type" of a given variable without looking at the variable declaration or the variable name (If named intelligently, e.g. a variable name containing a list of cats is <span class='inlinecode'>cat_list</span>). Even Ruby makes some use of sigils (<span class='inlinecode'>@</span>, <span class='inlinecode'>@@</span> and <span class='inlinecode'>$</span>), but that's for a different purpose than in Perl (in Ruby it is about object scope, class scope and global scope). Raku uses all the sigils Perl uses plus an additional bunch of twigils, e.g. <span class='inlinecode'>$.foo</span> for a scalar object variable with public accessors, <span class='inlinecode'>$!foo</span> for a private scalar object variable, <span class='inlinecode'>@.foo</span>, <span class='inlinecode'>@!foo</span>, <span class='inlinecode'>%.foo</span>, <span class='inlinecode'>%!foo</span> and so on. Sigils (and twigils) are very convenient once you get used to them. Don't let them scare you off - they are there to help you!</span><br />
+<br />
+<a class='textlink' href='https://www.perl.com/article/on-sigils/'>https://www.perl.com/article/on-sigils/</a><br />
+<br />
+<h2 style='display: inline'>Where do I personally still use perl?</h2><br />
+<br />
<ul>
<li>I use Rexify for my OpenBSD server automation. Rexify is a configuration management system developed in Perl with similar features to Ansible but less bloated. It suits my personal needs perfectly.</li>
<li>I have written a couple of smaller to medium-sized Perl scripts which I (mostly) still use regularly. You can find them on my Codeberg page.</li>
<li>My day-to-day workflow heavily relies on "ack-grep". Ack is a tool developed in Perl aimed at programmers and can be used for quick searches on source code at the command line.</li>
<li>I aim to leave my OpenBSD servers as "vanilla" as possible (trying to rely only on the standard/base installation without installing additional software from the packaging system or ports tree). All my scripts are written either Bourne shell or in Perl here. So there is no need to install additional interpreters.</li>
<li>Here and there, I drop a Perl one-liner in order to get stuff done (work and personally). A wise Perl Monk would say: "One one-liner a day keeps the troubles away".</li>
-</ul>
-<p>Btw.: Did you know that the first version of PHP was a set of Perl snippets? Only later, PHP became an independent programming language.</p>
-<a class="textlink" href="https://www.perl.org">https://www.perl.org</a><br />
-<p class="quote"><i>Update 2022-12-17: The following is another related post. I don't agree to the statement made there, that Python code tends to be shorter than Perl code, though!</i></p>
-<a class="textlink" href="https://stackoverflow.blog/2022/07/06/why-perl-is-still-relevant-in-2022/">Why Perl is still relevant in 2022</a><br />
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-05-27-perl-is-still-a-great-choice.html">2022-05-27 Perl is still a great choice (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2011-05-07-perl-daemon-service-framework.html">2011-05-07 Perl Daemon (Service Framework)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2008-06-26-perl-poetry.html">2008-06-26 Perl Poetry</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+</ul><br />
+<span>Btw.: Did you know that the first version of PHP was a set of Perl snippets? Only later, PHP became an independent programming language.</span><br />
+<br />
+<a class='textlink' href='https://www.perl.org'>https://www.perl.org</a><br />
+<br />
+<span class='quote'>Update 2022-12-17: The following is another related post. I don't agree to the statement made there, that Python code tends to be shorter than Perl code, though!</span><br />
+<br />
+<a class='textlink' href='https://stackoverflow.blog/2022/07/06/why-perl-is-still-relevant-in-2022/'>Why Perl is still relevant in 2022</a><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2022-05-27-perl-is-still-a-great-choice.html'>2022-05-27 Perl is still a great choice (You are currently reading this)</a><br />
+<a class='textlink' href='./2011-05-07-perl-daemon-service-framework.html'>2011-05-07 Perl Daemon (Service Framework)</a><br />
+<a class='textlink' href='./2008-06-26-perl-poetry.html'>2008-06-26 Perl Poetry</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -2265,8 +2511,10 @@ learn () {
<summary>I have recently released DTail 4.0.0 and this blog post goes through all the new goodies. If you want to jump directly to DTail, do it here (there are nice animated gifs which demonstrates the usage pretty well):</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>The release of DTail 4.0.0</h1>
-<p class="quote"><i>Published at 2022-03-06T18:11:39+00:00</i></p>
+ <h1 style='display: inline'>The release of DTail 4.0.0</h1><br />
+<br />
+<span class='quote'>Published at 2022-03-06T18:11:39+00:00</span><br />
+<br />
<pre>
,_---~~~~~----._
_,,_,*^____ _____``*g*\"*,
@@ -2280,13 +2528,21 @@ learn () {
| |
| |
</pre>
-<p>I have recently released DTail 4.0.0 and this blog post goes through all the new goodies. If you want to jump directly to DTail, do it here (there are nice animated gifs which demonstrates the usage pretty well):</p>
-<a class="textlink" href="https://dtail.dev">https://dtail.dev</a><br />
-<h2>So, what's new in 4.0.0?</h2>
-<h3>Rewritten logging</h3>
-<p>For DTail 4, logging has been completely rewritten. The new package name is "internal/io/dlog". I rewrote the logging because DTail is a special case here: There are logs processed by DTail, there are logs produced by the DTail server itself, there are logs produced by a DTail client itself, there are logs only logged by a DTail client, there are logs only logged by the DTail server, and there are logs logged by both, server and client. There are also different logging levels and outputs involved.</p>
-<p>As you can imagine, it becomes fairly complex. There is no ready Go off-shelf logging library which suits my needs and the logging code in DTail 3 was just one big source code file with global variables and it wasn't sustainable to maintain anymore. So why not rewrite it for profit and fun? </p>
-<p>There's a are new log level structure now (The log level now can be specified with the "-logLevel" command line flag):</p>
+<br />
+<span>I have recently released DTail 4.0.0 and this blog post goes through all the new goodies. If you want to jump directly to DTail, do it here (there are nice animated gifs which demonstrates the usage pretty well):</span><br />
+<br />
+<a class='textlink' href='https://dtail.dev'>https://dtail.dev</a><br />
+<br />
+<h2 style='display: inline'>So, what's new in 4.0.0?</h2><br />
+<br />
+<h3 style='display: inline'>Rewritten logging</h3><br />
+<br />
+<span>For DTail 4, logging has been completely rewritten. The new package name is "internal/io/dlog". I rewrote the logging because DTail is a special case here: There are logs processed by DTail, there are logs produced by the DTail server itself, there are logs produced by a DTail client itself, there are logs only logged by a DTail client, there are logs only logged by the DTail server, and there are logs logged by both, server and client. There are also different logging levels and outputs involved.</span><br />
+<br />
+<span>As you can imagine, it becomes fairly complex. There is no ready Go off-shelf logging library which suits my needs and the logging code in DTail 3 was just one big source code file with global variables and it wasn't sustainable to maintain anymore. So why not rewrite it for profit and fun? </span><br />
+<br />
+<span>There's a are new log level structure now (The log level now can be specified with the "-logLevel" command line flag):</span><br />
+<br />
<pre>
// Available log levels.
const (
@@ -2303,10 +2559,15 @@ const (
All level = iota
)
</pre>
-<p>DTail also supports multiple log outputs (e.g. to file or to stdout). More are now easily pluggable with the new logging package. The output can also be "enriched" (default) or "plain" (read more about that further below).</p>
-<h3>Configurable terminal color codes</h3>
-<p>A complaint I received from the users of DTail 3 were the terminal colors used for the output. Under some circumstances (terminal configuration) it made the output difficult to read so that users defaulted to "--noColor" (disabling colored output completely). I toke it by heart and also rewrote the color handling. It's now possible to configure the foreground and background colors and an attribute (e.g. dim, bold, ...).</p>
-<p>The example "dtail.json" configuration file represents the default (now, more reasonable default) color codes used, and it is free to the user to customize them:</p>
+<br />
+<span>DTail also supports multiple log outputs (e.g. to file or to stdout). More are now easily pluggable with the new logging package. The output can also be "enriched" (default) or "plain" (read more about that further below).</span><br />
+<br />
+<h3 style='display: inline'>Configurable terminal color codes</h3><br />
+<br />
+<span>A complaint I received from the users of DTail 3 were the terminal colors used for the output. Under some circumstances (terminal configuration) it made the output difficult to read so that users defaulted to "--noColor" (disabling colored output completely). I toke it by heart and also rewrote the color handling. It's now possible to configure the foreground and background colors and an attribute (e.g. dim, bold, ...).</span><br />
+<br />
+<span>The example "dtail.json" configuration file represents the default (now, more reasonable default) color codes used, and it is free to the user to customize them:</span><br />
+<br />
<pre>
{
"Client": {
@@ -2401,76 +2662,111 @@ const (
...
}
</pre>
-<p>You notice the different sections - these are different contexts:</p>
+<br />
+<span>You notice the different sections - these are different contexts:</span><br />
+<br />
<ul>
<li>Remote: Color configuration for all log lines sent remotely from the server to the client. </li>
<li>Client: Color configuration for all lines produced by a DTail client by itself (e.g. status information).</li>
<li>Server: Color configuration for all lines produced by the DTail server by itself and sent to the client (e.g. server warnings or errors)</li>
<li>MaprTable: Color configuration for the map-reduce table output.</li>
<li>Common: Common color configuration used in various places (e.g. when it's not clear what's the current context of a line).</li>
-</ul>
-<p>When you do so, make sure that you check your "dtail.json" against the JSON schema file. This is to ensure that you don't configure an invalid color accidentally (requires "jsonschema" to be installed on your computer). Furthermore, the schema file is also a good reference for all possible colors available:</p>
+</ul><br />
+<span>When you do so, make sure that you check your "dtail.json" against the JSON schema file. This is to ensure that you don't configure an invalid color accidentally (requires "jsonschema" to be installed on your computer). Furthermore, the schema file is also a good reference for all possible colors available:</span><br />
+<br />
<pre>
jsonschema -i dtail.json schemas/dtail.schema.json
</pre>
-<h3>Serverless mode</h3>
-<p>All DTail commands can now operate on log files (and other text files) directly without any DTail server running. So there isn't a need anymore to install a DTail server when you are on the target server already anyway, like the following example shows:</p>
+<br />
+<h3 style='display: inline'>Serverless mode</h3><br />
+<br />
+<span>All DTail commands can now operate on log files (and other text files) directly without any DTail server running. So there isn't a need anymore to install a DTail server when you are on the target server already anyway, like the following example shows:</span><br />
+<br />
<pre>
% dtail --files /var/log/foo.log
</pre>
-<p>or</p>
+<br />
+<span>or</span><br />
+<br />
<pre>
% dmap --files /var/log/foo.log --query 'from TABLE select .... outfile result.csv'
</pre>
-<p>The way it works in Go code is that a connection to a server is managed through an interface and in serverless mode DTail calls through that interface to the server code directly without any TCP/IP and SSH connection made in the background. This means, that the binaries are a bit larger (also ship with the code which normally would be executed by the server) but the increase of binary size is not much.</p>
-<h3>Shorthand flags</h3>
-<p>The "--files" from the previous example is now redundant. As a shorthand, It is now possible to do the following instead:</p>
+<br />
+<span>The way it works in Go code is that a connection to a server is managed through an interface and in serverless mode DTail calls through that interface to the server code directly without any TCP/IP and SSH connection made in the background. This means, that the binaries are a bit larger (also ship with the code which normally would be executed by the server) but the increase of binary size is not much.</span><br />
+<br />
+<h3 style='display: inline'>Shorthand flags</h3><br />
+<br />
+<span>The "--files" from the previous example is now redundant. As a shorthand, It is now possible to do the following instead:</span><br />
+<br />
<pre>
% dtail /var/log/foo.log
</pre>
-<p>Of course, this also works with all other DTail client commands (dgrep, dcat, ... etc).</p>
-<h3>Spartan (aka plain) mode</h3>
-<p>There's a plain mode, which makes DTail only print out the "plain" text of the files operated on (without any DTail specific enriched output). E.g.:</p>
+<br />
+<span>Of course, this also works with all other DTail client commands (dgrep, dcat, ... etc).</span><br />
+<br />
+<h3 style='display: inline'>Spartan (aka plain) mode</h3><br />
+<br />
+<span>There's a plain mode, which makes DTail only print out the "plain" text of the files operated on (without any DTail specific enriched output). E.g.:</span><br />
+<br />
<pre>
% dcat --plain /etc/passwd &gt; /etc/test
% diff /etc/test /etc/passwd # Same content, no diff
</pre>
-<p>This might be useful if you wanted to post-process the output. </p>
-<h3>Standard input pipe</h3>
-<p>In serverless mode, you might want to process your data in a pipeline. You can do that now too through an input pipe:</p>
+<br />
+<span>This might be useful if you wanted to post-process the output. </span><br />
+<br />
+<h3 style='display: inline'>Standard input pipe</h3><br />
+<br />
+<span>In serverless mode, you might want to process your data in a pipeline. You can do that now too through an input pipe:</span><br />
+<br />
<pre>
% dgrep --plain --regex 'somethingspecial' /var/log/foo.log |
dmap --query 'from TABLE select .... outfile result.csv'
</pre>
-<p>Or, use any other "standard" tool:</p>
+<br />
+<span>Or, use any other "standard" tool:</span><br />
+<br />
<pre>
% awk '.....' &lt; /some/file | dtail ....
</pre>
-<h3>New command dtailhealth</h3>
-<p>Prior to DTail 4, there was a flag for the "dtail" command to check the health of a remote DTail server (for use with monitoring system such as Nagios). That has been moved out to a separate binary to reduce complexity of the "dtail" command. The following checks whether DTail is operational on the current machine (you could also check a remote instance of DTail server, just adjust the server address).</p>
+<br />
+<h3 style='display: inline'>New command dtailhealth</h3><br />
+<br />
+<span>Prior to DTail 4, there was a flag for the "dtail" command to check the health of a remote DTail server (for use with monitoring system such as Nagios). That has been moved out to a separate binary to reduce complexity of the "dtail" command. The following checks whether DTail is operational on the current machine (you could also check a remote instance of DTail server, just adjust the server address).</span><br />
+<br />
<pre>
% cat check_dtail.sh
#!/bin/sh
exec /usr/local/bin/dtailhealth --server localhost:2222
</pre>
-<h3>Improved documentation</h3>
-<p>Some features, such as custom log formats and the map-reduce query language, are now documented. Also, the examples have been updated to reflect the new features added. This also includes the new animated example Gifs (plus documentation how they were created).</p>
-<p>I must admit that not all features are documented yet:</p>
+<br />
+<h3 style='display: inline'>Improved documentation</h3><br />
+<br />
+<span>Some features, such as custom log formats and the map-reduce query language, are now documented. Also, the examples have been updated to reflect the new features added. This also includes the new animated example Gifs (plus documentation how they were created).</span><br />
+<br />
+<span>I must admit that not all features are documented yet:</span><br />
+<br />
<ul>
<li>Server side scheduled map-reduce queries</li>
<li>Server side continuous map-reduce queries</li>
<li>Some more docs about terminal color customization</li>
<li>Some more docs about log levels</li>
-</ul>
-<p>That will be added in one of the future releases. </p>
-<h3>Integration testing suite</h3>
-<p>DTail comes already with some unit tests, but what's new is a full integration testing suite which covers all common use cases of all the commands (dtail, dcat, dgrep, dmap) with a server backend and also in serverless mode.</p>
-<p>How are the tests implemented? All integration tests are simply unit tests in the "./integrationtests" folder. They must be explicitly activated with:</p>
+</ul><br />
+<span>That will be added in one of the future releases. </span><br />
+<br />
+<h3 style='display: inline'>Integration testing suite</h3><br />
+<br />
+<span>DTail comes already with some unit tests, but what's new is a full integration testing suite which covers all common use cases of all the commands (dtail, dcat, dgrep, dmap) with a server backend and also in serverless mode.</span><br />
+<br />
+<span>How are the tests implemented? All integration tests are simply unit tests in the "./integrationtests" folder. They must be explicitly activated with:</span><br />
+<br />
<pre>
% export DTAIL_INTEGRATION_TEST_RUN_MODE=yes
</pre>
-<p>Once done, first compile all commands, and then run the integration tests:</p>
+<br />
+<span>Once done, first compile all commands, and then run the integration tests:</span><br />
+<br />
<pre>
% make
.
@@ -2479,32 +2775,47 @@ exec /usr/local/bin/dtailhealth --server localhost:2222
% go clean -testcache
% go test -race -v ./integrationtests
</pre>
-<h3>Improved code</h3>
-<p>Not that the code quality of DTail has been bad (I have been using Go vet and Go lint for previous releases and will keep using these), but this time I had new tools (such as SonarQube and BlackDuck) in my arsenal to:</p>
+<br />
+<h3 style='display: inline'>Improved code</h3><br />
+<br />
+<span>Not that the code quality of DTail has been bad (I have been using Go vet and Go lint for previous releases and will keep using these), but this time I had new tools (such as SonarQube and BlackDuck) in my arsenal to:</span><br />
+<br />
<ul>
<li>Reduce the complexity of a couple of functions (splitting code up into several smaller functions)</li>
<li>Avoid repeating code (this version of DTail doesn't use Go generics yet, though).</li>
-</ul>
-<p>Other than that, a lot of other code has been refactored as I saw fit.</p>
-<h3>Use of memory pools</h3>
-<p>DTail makes excessive use of string builder and byte buffer objects. For performance reasons, those are now re-used from memory pools.</p>
-<h2>What's next</h2>
-<p>DTail 5 won't be released any time soon I guess, but some 4.x.y releases will follow this year fore sure. I can think of:</p>
+</ul><br />
+<span>Other than that, a lot of other code has been refactored as I saw fit.</span><br />
+<br />
+<h3 style='display: inline'>Use of memory pools</h3><br />
+<br />
+<span>DTail makes excessive use of string builder and byte buffer objects. For performance reasons, those are now re-used from memory pools.</span><br />
+<br />
+<h2 style='display: inline'>What's next</h2><br />
+<br />
+<span>DTail 5 won't be released any time soon I guess, but some 4.x.y releases will follow this year fore sure. I can think of:</span><br />
+<br />
<ul>
<li>New (but backwards compatible) features which don't require a new major version bump (some features have been requested at work internally).</li>
<li>Even more improved documentation.</li>
<li>Dependency updates.</li>
-</ul>
-<p>I use usually DTail at work, but I have recently installed it on my personal OpenBSD machines too. I might write a small tutorial here (and I might also add the rc scripts as examples to one of the next DTail releases).</p>
-<p>I am a bit busy at the moment with two other pet projects of mine (one internal work-project, and one personal one, the latter you will read about in the next couple of months). If you have ideas (or even a patch), then please don't hesitate to contact me (either via E-Mail or a request at GitHub).</p>
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-10-30-installing-dtail-on-openbsd.html">2022-10-30 Installing DTail on OpenBSD</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html">2022-03-06 The release of DTail 4.0.0 (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program.html">2021-04-22 DTail - The distributed log tail program</a><br />
-<p>Thanks!</p>
-<p>Paul</p>
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+</ul><br />
+<span>I use usually DTail at work, but I have recently installed it on my personal OpenBSD machines too. I might write a small tutorial here (and I might also add the rc scripts as examples to one of the next DTail releases).</span><br />
+<br />
+<span>I am a bit busy at the moment with two other pet projects of mine (one internal work-project, and one personal one, the latter you will read about in the next couple of months). If you have ideas (or even a patch), then please don't hesitate to contact me (either via E-Mail or a request at GitHub).</span><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2022-10-30-installing-dtail-on-openbsd.html'>2022-10-30 Installing DTail on OpenBSD</a><br />
+<a class='textlink' href='./2022-03-06-the-release-of-dtail-4.0.0.html'>2022-03-06 The release of DTail 4.0.0 (You are currently reading this)</a><br />
+<a class='textlink' href='./2021-04-22-dtail-the-distributed-log-tail-program.html'>2021-04-22 DTail - The distributed log tail program</a><br />
+<br />
+<span>Thanks!</span><br />
+<br />
+<span>Paul</span><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -2735,8 +3046,10 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2
<summary>This is the second blog post about my Bash Golf series. This series is random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Bash Golf Part 2</h1>
-<p class="quote"><i>Published at 2022-01-01T23:36:15+00:00; Updated at 2022-01-05</i></p>
+ <h1 style='display: inline'>Bash Golf Part 2</h1><br />
+<br />
+<span class='quote'>Published at 2022-01-01T23:36:15+00:00; Updated at 2022-01-05</span><br />
+<br />
<pre>
'\ '\ . . |&gt;18&gt;&gt;
@@ -2748,17 +3061,23 @@ GNU/kFreeBSD rhea.buetow.org 8.0-RELEASE-p5 FreeBSD 8.0-RELEASE-p5 #2: Sat Nov 2
jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Art by Joan Stark, mod. by Paul Buetow
</pre>
-<p>This is the second blog post about my Bash Golf series. This series is random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-01-01-bash-golf-part-2.html">2022-01-01 Bash Golf Part 2 (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-11-29-bash-golf-part-1.html">2021-11-29 Bash Golf Part 1</a><br />
-<h2>Redirection</h2>
-<p>Let's have a closer look at Bash redirection. As you might already know that there are 3 standard file descriptors:</p>
+<br />
+<span>This is the second blog post about my Bash Golf series. This series is random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.</span><br />
+<br />
+<a class='textlink' href='./2022-01-01-bash-golf-part-2.html'>2022-01-01 Bash Golf Part 2 (You are currently reading this)</a><br />
+<a class='textlink' href='./2021-11-29-bash-golf-part-1.html'>2021-11-29 Bash Golf Part 1</a><br />
+<br />
+<h2 style='display: inline'>Redirection</h2><br />
+<br />
+<span>Let's have a closer look at Bash redirection. As you might already know that there are 3 standard file descriptors:</span><br />
+<br />
<ul>
<li>0 aka stdin (standard input)</li>
<li>1 aka stdout (standard output)</li>
<li>2 aka stderr (standard error output)</li>
-</ul>
-<p>These are most certainly the ones you are using on regular basis. "/proc/self/fd" lists all file descriptors which are open by the current process (in this case: the current Bash shell itself):</p>
+</ul><br />
+<span>These are most certainly the ones you are using on regular basis. "/proc/self/fd" lists all file descriptors which are open by the current process (in this case: the current Bash shell itself):</span><br />
+<br />
<pre>
❯ ls -l /proc/self/fd/
total 0
@@ -2767,32 +3086,44 @@ lrwx------. 1 paul paul 64 Nov 23 09:46 1 -&gt; /dev/pts/9
lrwx------. 1 paul paul 64 Nov 23 09:46 2 -&gt; /dev/pts/9
lr-x------. 1 paul paul 64 Nov 23 09:46 3 -&gt; /proc/162912/fd
</pre>
-<p>The following examples demonstrate two different ways to accomplish the same thing. The difference is that the first command is directly printing out "Foo" to stdout and the second command is explicitly redirecting stdout to its own stdout file descriptor:</p>
+<br />
+<span>The following examples demonstrate two different ways to accomplish the same thing. The difference is that the first command is directly printing out "Foo" to stdout and the second command is explicitly redirecting stdout to its own stdout file descriptor:</span><br />
+<br />
<pre>
❯ echo Foo
Foo
❯ echo Foo &gt; /proc/self/fd/0
Foo
</pre>
-<p>Other useful redirections are:</p>
+<br />
+<span>Other useful redirections are:</span><br />
+<br />
<ul>
<li>Redirect stderr to stdin: "echo foo 2&gt;&amp;1"</li>
<li>Redirect stdin to stderr: "echo foo &gt;&amp;2"</li>
-</ul>
-<p>It is, however, not possible to redirect multiple times within the same command. E.g. the following won't work. You would expect stdin to be redirected to stderr and then stderr to be redirected to /dev/null. But as the example shows, Foo is still printed out:</p>
+</ul><br />
+<span>It is, however, not possible to redirect multiple times within the same command. E.g. the following won't work. You would expect stdin to be redirected to stderr and then stderr to be redirected to /dev/null. But as the example shows, Foo is still printed out:</span><br />
+<br />
<pre>
❯ echo Foo 1&gt;&amp;2 2&gt;/dev/null
Foo
</pre>
-<p class="quote"><i>Update: A reader sent me an email and pointed out that the order of the redirections is important. </i></p>
-<p>As you can see, the following will not print out anything:</p>
+<br />
+<span class='quote'>Update: A reader sent me an email and pointed out that the order of the redirections is important. </span><br />
+<br />
+<span>As you can see, the following will not print out anything:</span><br />
+<br />
<pre>
❯ echo Foo 2&gt;/dev/null 1&gt;&amp;2
</pre>
-<p>A good description (also pointed out by the reader) can be found here:</p>
-<a class="textlink" href="https://wiki.bash-hackers.org/howto/redirection_tutorial#order_of_redirection_ie_file_2_1_vs_2_1_file">Order of redirection</a><br />
-<p>Ok, back to the original blog post. You can also use grouping here (neither of these commands will print out anything to stdout):</p>
+<br />
+<span>A good description (also pointed out by the reader) can be found here:</span><br />
+<br />
+<a class='textlink' href='https://wiki.bash-hackers.org/howto/redirection_tutorial#order_of_redirection_ie_file_2_1_vs_2_1_file'>Order of redirection</a><br />
+<br />
+<span>Ok, back to the original blog post. You can also use grouping here (neither of these commands will print out anything to stdout):</span><br />
+<br />
<pre>
❯ { echo Foo 1&gt;&amp;2; } 2&gt;/dev/null
❯ ( echo Foo 1&gt;&amp;2; ) 2&gt;/dev/null
@@ -2800,7 +3131,9 @@ Foo
❯ ( ( ( echo Foo 1&gt;&amp;2; ) 2&gt;&amp;1; ) 1&gt;&amp;2; ) 2&gt;/dev/null
</pre>
-<p>A handy way to list all open file descriptors is to use the "lsof" command (that's not a Bash built-in), whereas $$ is the process id (pid) of the current shell process:</p>
+<br />
+<span>A handy way to list all open file descriptors is to use the "lsof" command (that's not a Bash built-in), whereas $$ is the process id (pid) of the current shell process:</span><br />
+<br />
<pre>
❯ lsof -a -p $$ -d0,1,2
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
@@ -2808,7 +3141,9 @@ bash 62676 paul 0u CHR 136,9 0t0 12 /dev/pts/9
bash 62676 paul 1u CHR 136,9 0t0 12 /dev/pts/9
bash 62676 paul 2u CHR 136,9 0t0 12 /dev/pts/9
</pre>
-<p>Let's create our own descriptor "3" for redirection to a file named "foo":</p>
+<br />
+<span>Let's create our own descriptor "3" for redirection to a file named "foo":</span><br />
+<br />
<pre>
❯ touch foo
❯ exec 3&gt;foo # This opens fd 3 and binds it to file foo.
@@ -2823,7 +3158,9 @@ Bratwurst
❯ echo Steak &gt;&amp;3
-bash: 3: Bad file descriptor
</pre>
-<p>You can also override the default file descriptors, as the following example script demonstrates:</p>
+<br />
+<span>You can also override the default file descriptors, as the following example script demonstrates:</span><br />
+<br />
<pre>
❯ cat grandmaster.sh
#!/usr/bin/env bash
@@ -2850,15 +3187,20 @@ echo Second line: $LINE2
# Restore default stdin and delete fd 6
exec 0&lt;&amp;6 6&lt;&amp;-
</pre>
-<p>Let's execute it:</p>
+<br />
+<span>Let's execute it:</span><br />
+<br />
<pre>
❯ chmod 750 ./grandmaster.sh
❯ ./grandmaster.sh
First line: Learn You a Haskell
Second line: for Great Good
</pre>
-<h2>HERE</h2>
-<p>I have mentioned HERE-documents and HERE-strings already in this post. Let's do some more examples. The following "cat" receives a multi line string from stdin. In this case, the input multi line string is a HERE-document. As you can see, it also interpolates variables (in this case the output of "date" running in a subshell).</p>
+<br />
+<h2 style='display: inline'>HERE</h2><br />
+<br />
+<span>I have mentioned HERE-documents and HERE-strings already in this post. Let's do some more examples. The following "cat" receives a multi line string from stdin. In this case, the input multi line string is a HERE-document. As you can see, it also interpolates variables (in this case the output of "date" running in a subshell).</span><br />
+<br />
<pre>
❯ cat &lt;&lt;END
&gt; Hello World
@@ -2867,7 +3209,9 @@ Second line: for Great Good
Hello World
It's Fri 26 Nov 08:46:52 GMT 2021
</pre>
-<p>You can also write it the following way, but that's less readable (it's good for an obfuscation contest):</p>
+<br />
+<span>You can also write it the following way, but that's less readable (it's good for an obfuscation contest):</span><br />
+<br />
<pre>
❯ &lt;&lt;END cat
&gt; Hello Universe
@@ -2876,7 +3220,9 @@ It's Fri 26 Nov 08:46:52 GMT 2021
Hello Universe
It's Fri 26 Nov 08:47:32 GMT 2021
</pre>
-<p>Besides of an HERE-document, there is also a so-called HERE-string. Besides of...</p>
+<br />
+<span>Besides of an HERE-document, there is also a so-called HERE-string. Besides of...</span><br />
+<br />
<pre>
❯ declare VAR=foo
❯ if echo "$VAR" | grep -q foo; then
@@ -2884,24 +3230,32 @@ It's Fri 26 Nov 08:47:32 GMT 2021
&gt; fi
$VAR ontains foo
</pre>
-<p>...you can use a HERE-string like that:</p>
+<br />
+<span>...you can use a HERE-string like that:</span><br />
+<br />
<pre>
❯ if grep -q foo &lt;&lt;&lt; "$VAR"; then
&gt; echo '$VAR contains foo'
&gt; fi
$VAR contains foo
</pre>
-<p>Or even shorter, you can do:</p>
+<br />
+<span>Or even shorter, you can do:</span><br />
+<br />
<pre>
❯ grep -q foo &lt;&lt;&lt; "$VAR" &amp;&amp; echo '$VAR contains foo'
$VAR contains foo
</pre>
-<p>You can also use a Bash regex to accomplish the same thing, but the points of the examples so far were to demonstrate HERE-{documents,strings} and not Bash regular expressions:</p>
+<br />
+<span>You can also use a Bash regex to accomplish the same thing, but the points of the examples so far were to demonstrate HERE-{documents,strings} and not Bash regular expressions:</span><br />
+<br />
<pre>
❯ if [[ "$VAR" =~ foo ]]; then echo yay; fi
yay
</pre>
-<p>You can also use it with "read":</p>
+<br />
+<span>You can also use it with "read":</span><br />
+<br />
<pre>
❯ read a &lt;&lt;&lt; ja
❯ echo $a
@@ -2916,15 +3270,20 @@ Learn
❯ echo ${words[3]}
Golang
</pre>
-<p>The following is good for an obfuscation contest too:</p>
+<br />
+<span>The following is good for an obfuscation contest too:</span><br />
+<br />
<pre>
❯ echo 'I like Perl too' &gt; perllove.txt
❯ cat - perllove.txt &lt;&lt;&lt; "$dumdidumstring"
Learn you a Golang for Great Good
I like Perl too
</pre>
-<h2>RANDOM</h2>
-<p>Random is a special built-in variable containing a different pseudo random number each time it's used.</p>
+<br />
+<h2 style='display: inline'>RANDOM</h2><br />
+<br />
+<span>Random is a special built-in variable containing a different pseudo random number each time it's used.</span><br />
+<br />
<pre>
❯ echo $RANDOM
11811
@@ -2933,8 +3292,11 @@ I like Perl too
❯ echo $RANDOM
9104
</pre>
-<p>That's very useful if you want to randomly delay the execution of your scripts when you run it on many servers concurrently, just to spread the server load (which might be caused by the script run) better.</p>
-<p>Let's say you want to introduce a random delay of 1 minute. You can accomplish it with:</p>
+<br />
+<span>That's very useful if you want to randomly delay the execution of your scripts when you run it on many servers concurrently, just to spread the server load (which might be caused by the script run) better.</span><br />
+<br />
+<span>Let's say you want to introduce a random delay of 1 minute. You can accomplish it with:</span><br />
+<br />
<pre>
❯ cat ./calc_answer_to_ultimate_question_in_life.sh
#!/usr/bin/env bash
@@ -2962,10 +3324,15 @@ main
Delaying script execution for 42 seconds...
Continuing script execution...
</pre>
-<h2>set -x and set -e and pipefile</h2>
-<p>In my opinion, -x and -e and pipefile are the most useful Bash options. Let's have a look at them one after another.</p>
-<h3>-x</h3>
-<p>-x prints commands and their arguments as they are executed. This helps to develop and debug your Bash code:</p>
+<br />
+<h2 style='display: inline'>set -x and set -e and pipefile</h2><br />
+<br />
+<span>In my opinion, -x and -e and pipefile are the most useful Bash options. Let's have a look at them one after another.</span><br />
+<br />
+<h3 style='display: inline'>-x</h3><br />
+<br />
+<span>-x prints commands and their arguments as they are executed. This helps to develop and debug your Bash code:</span><br />
+<br />
<pre>
❯ set -x
❯ square () { local -i num=$1; echo $((num*num)); }
@@ -2977,11 +3344,15 @@ Continuing script execution...
+ echo 'Square of 11 is 121'
Square of 11 is 121
</pre>
-<p>You can also set it when calling an external script without modifying the script itself:</p>
+<br />
+<span>You can also set it when calling an external script without modifying the script itself:</span><br />
+<br />
<pre>
❯ bash -x ./half_broken_script_to_be_debugged.sh
</pre>
-<p>Let's do that on one of the example scripts we covered earlier:</p>
+<br />
+<span>Let's do that on one of the example scripts we covered earlier:</span><br />
+<br />
<pre>
❯ bash -x ./grandmaster.sh
+ bash -x ./grandmaster.sh
@@ -2999,21 +3370,29 @@ Second line: for Great Good
+ exec
</pre>
-<h3>-e</h3>
-<p>This is a very important option you want to use when you are paranoid. This means, you should always "set -e" in your scripts when you need to make absolutely sure that your script runs successfully (with that I mean that no command should exit with an unexpected status code).</p>
-<p>Ok, let's dig deeper:</p>
+<br />
+<h3 style='display: inline'>-e</h3><br />
+<br />
+<span>This is a very important option you want to use when you are paranoid. This means, you should always "set -e" in your scripts when you need to make absolutely sure that your script runs successfully (with that I mean that no command should exit with an unexpected status code).</span><br />
+<br />
+<span>Ok, let's dig deeper:</span><br />
+<br />
<pre>
❯ help set | grep -- -e
-e Exit immediately if a command exits with a non-zero status.
</pre>
-<p>As you can see in the following example, the Bash terminates after the execution of "grep" as "foo" is not matching "bar". Therefore, grep exits with 1 (unsuccessfully) and the shell aborts. And therefore, "bar" will not be printed out anymore:</p>
+<br />
+<span>As you can see in the following example, the Bash terminates after the execution of "grep" as "foo" is not matching "bar". Therefore, grep exits with 1 (unsuccessfully) and the shell aborts. And therefore, "bar" will not be printed out anymore:</span><br />
+<br />
<pre>
❯ bash -c 'set -e; echo hello; grep -q bar &lt;&lt;&lt; foo; echo bar'
hello
❯ echo $?
1
</pre>
-<p>Whereas the outcome changes when the regex matches:</p>
+<br />
+<span>Whereas the outcome changes when the regex matches:</span><br />
+<br />
<pre>
❯ bash -c 'set -e; echo hello; grep -q bar &lt;&lt;&lt; barman; echo bar'
hello
@@ -3021,7 +3400,9 @@ bar
❯ echo $?
0
</pre>
-<p>So does it mean that grep will always make the shell terminate whenever its exit code isn't 0? This will render "set -e" quite unusable. Frankly, there are other commands where an exit status other than 0 should not terminate the whole script abruptly. Usually, what you want is to branch your code based on the outcome (exit code) of a command:</p>
+<br />
+<span>So does it mean that grep will always make the shell terminate whenever its exit code isn't 0? This will render "set -e" quite unusable. Frankly, there are other commands where an exit status other than 0 should not terminate the whole script abruptly. Usually, what you want is to branch your code based on the outcome (exit code) of a command:</span><br />
+<br />
<pre>
❯ bash -c 'set -e
&gt; grep -q bar &lt;&lt;&lt; foo
@@ -3033,8 +3414,11 @@ bar
❯ echo $?
1
</pre>
-<p>...but the example above won't reach any of the branches and won't print out anything, as the script terminates right after grep.</p>
-<p>The proper solution is to use grep as an expression in a conditional (e.g. in an if-else statement):</p>
+<br />
+<span>...but the example above won't reach any of the branches and won't print out anything, as the script terminates right after grep.</span><br />
+<br />
+<span>The proper solution is to use grep as an expression in a conditional (e.g. in an if-else statement):</span><br />
+<br />
<pre>
❯ bash -c 'set -e
&gt; if grep -q bar &lt;&lt;&lt; foo; then
@@ -3055,7 +3439,9 @@ matching
❯ echo $?
0
</pre>
-<p>You can also temporally undo "set -e" if there is no other way:</p>
+<br />
+<span>You can also temporally undo "set -e" if there is no other way:</span><br />
+<br />
<pre>
❯ cat ./e.sh
#!/usr/bin/env bash
@@ -3097,25 +3483,35 @@ Hello World
Hello Universe
Hello You!
</pre>
-<p>Why does calling "foo" with no arguments make the script terminate? Because as no argument was given, the "shift" won't have anything to do as the argument list $@ is empty, and therefore "shift" fails with a non-zero status.</p>
-<p>Why would you want to use "shift" after function-local variable assignments? Have a look at my personal Bash coding style guide for an explanation :-):</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2021-05-16-personal-bash-coding-style-guide.html">./2021-05-16-personal-bash-coding-style-guide.html</a><br />
-<h3>pipefail</h3>
-<p>The pipefail option makes it so that not only the exit code of the last command of the pipe counts regards its exit code but any command of the pipe:</p>
+<br />
+<span>Why does calling "foo" with no arguments make the script terminate? Because as no argument was given, the "shift" won't have anything to do as the argument list $@ is empty, and therefore "shift" fails with a non-zero status.</span><br />
+<br />
+<span>Why would you want to use "shift" after function-local variable assignments? Have a look at my personal Bash coding style guide for an explanation :-):</span><br />
+<br />
+<a class='textlink' href='./2021-05-16-personal-bash-coding-style-guide.html'>./2021-05-16-personal-bash-coding-style-guide.html</a><br />
+<br />
+<h3 style='display: inline'>pipefail</h3><br />
+<br />
+<span>The pipefail option makes it so that not only the exit code of the last command of the pipe counts regards its exit code but any command of the pipe:</span><br />
+<br />
<pre>
❯ help set | grep pipefail -A 2
pipefail the return value of a pipeline is the status of
the last command to exit with a non-zero status,
or zero if no command exited with a non-zero status
</pre>
-<p>The following greps for paul in passwd and converts all lowercase letters to uppercase letters. The exit code of the pipe is 0, as the last command of the pipe (converting from lowercase to uppercase) succeeded:</p>
+<br />
+<span>The following greps for paul in passwd and converts all lowercase letters to uppercase letters. The exit code of the pipe is 0, as the last command of the pipe (converting from lowercase to uppercase) succeeded:</span><br />
+<br />
<pre>
❯ grep paul /etc/passwd | tr '[a-z]' '[A-Z]'
PAUL:X:1000:1000:PAUL BUETOW:/HOME/PAUL:/BIN/BASH
❯ echo $?
0
</pre>
-<p>Let's look at another example, where "TheRock" doesn't exist in the passwd file. However, the pipes exit status is still 0 (success). This is so because the last command ("tr" in this case) still succeeded. It is just that it didn't get any input on stdin to process:</p>
+<br />
+<span>Let's look at another example, where "TheRock" doesn't exist in the passwd file. However, the pipes exit status is still 0 (success). This is so because the last command ("tr" in this case) still succeeded. It is just that it didn't get any input on stdin to process:</span><br />
+<br />
<pre>
❯ grep TheRock /etc/passwd
❯ echo $?
@@ -3124,20 +3520,26 @@ PAUL:X:1000:1000:PAUL BUETOW:/HOME/PAUL:/BIN/BASH
❯ echo $?
0
</pre>
-<p>To change this behaviour, pipefile can be used. Now, the pipes exit status is 1 (fail), because the pipe contains at least one command (in this case grep) which exited with status 1:</p>
+<br />
+<span>To change this behaviour, pipefile can be used. Now, the pipes exit status is 1 (fail), because the pipe contains at least one command (in this case grep) which exited with status 1:</span><br />
+<br />
<pre>
❯ set -o pipefail
❯ grep TheRock /etc/passwd | tr '[a-z]' '[A-Z]'
❯ echo $?
1
</pre>
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-01-01-bash-golf-part-2.html">2022-01-01 Bash Golf Part 2 (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-11-29-bash-golf-part-1.html">2021-11-29 Bash Golf Part 1</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html">2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-05-16-personal-bash-coding-style-guide.html">2021-05-16 Personal Bash coding style guide</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2022-01-01-bash-golf-part-2.html'>2022-01-01 Bash Golf Part 2 (You are currently reading this)</a><br />
+<a class='textlink' href='./2021-11-29-bash-golf-part-1.html'>2021-11-29 Bash Golf Part 1</a><br />
+<a class='textlink' href='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html'>2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
+<a class='textlink' href='./2021-05-16-personal-bash-coding-style-guide.html'>2021-05-16 Personal Bash coding style guide</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -3246,8 +3648,10 @@ PAUL:X:1000:1000:PAUL BUETOW:/HOME/PAUL:/BIN/BASH
<summary>This is the first blog post about my Bash Golf series. This series is about random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Bash Golf Part 1</h1>
-<p class="quote"><i>Published at 2021-11-29T14:06:14+00:00; Updated at 2022-01-05</i></p>
+ <h1 style='display: inline'>Bash Golf Part 1</h1><br />
+<br />
+<span class='quote'>Published at 2021-11-29T14:06:14+00:00; Updated at 2022-01-05</span><br />
+<br />
<pre>
'\ . . |&gt;18&gt;&gt;
@@ -3259,19 +3663,28 @@ PAUL:X:1000:1000:PAUL BUETOW:/HOME/PAUL:/BIN/BASH
jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Art by Joan Stark
</pre>
-<p>This is the first blog post about my Bash Golf series. This series is about random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-01-01-bash-golf-part-2.html">2022-01-01 Bash Golf Part 2</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-11-29-bash-golf-part-1.html">2021-11-29 Bash Golf Part 1 (You are currently reading this)</a><br />
-<h2>TCP/IP networking</h2>
-<p>You probably know the Netcat tool, which is a swiss army knife for TCP/IP networking on the command line. But did you know that the Bash natively supports TCP/IP networking?</p>
-<p>Have a look here how that works:</p>
+<br />
+<span>This is the first blog post about my Bash Golf series. This series is about random Bash tips, tricks and weirdnesses I came across. It's a collection of smaller articles I wrote in an older (in German language) blog, which I translated and refreshed with some new content.</span><br />
+<br />
+<a class='textlink' href='./2022-01-01-bash-golf-part-2.html'>2022-01-01 Bash Golf Part 2</a><br />
+<a class='textlink' href='./2021-11-29-bash-golf-part-1.html'>2021-11-29 Bash Golf Part 1 (You are currently reading this)</a><br />
+<br />
+<h2 style='display: inline'>TCP/IP networking</h2><br />
+<br />
+<span>You probably know the Netcat tool, which is a swiss army knife for TCP/IP networking on the command line. But did you know that the Bash natively supports TCP/IP networking?</span><br />
+<br />
+<span>Have a look here how that works:</span><br />
+<br />
<pre>
❯ cat &lt; /dev/tcp/time.nist.gov/13
59536 21-11-18 08:09:16 00 0 0 153.6 UTC(NIST) *
</pre>
-<p>The Bash treats /dev/tcp/HOST/PORT in a special way so that it is actually establishing a TCP connection to HOST:PORT. The example above redirects the TCP output of the time-server to cat and cat is printing it on standard output (stdout).</p>
-<p>A more sophisticated example is firing up an HTTP request. Let's create a new read-write (rw) file descriptor (fd) 5, redirect the HTTP request string to it, and then read the response back:</p>
+<br />
+<span>The Bash treats /dev/tcp/HOST/PORT in a special way so that it is actually establishing a TCP connection to HOST:PORT. The example above redirects the TCP output of the time-server to cat and cat is printing it on standard output (stdout).</span><br />
+<br />
+<span>A more sophisticated example is firing up an HTTP request. Let's create a new read-write (rw) file descriptor (fd) 5, redirect the HTTP request string to it, and then read the response back:</span><br />
+<br />
<pre>
❯ exec 5&lt;&gt;/dev/tcp/google.de/80
❯ echo -e "GET / HTTP/1.1\nhost: google.de\n\n" &gt;&amp;5
@@ -3287,9 +3700,13 @@ Content-Length: 218
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
</pre>
-<p>You would assume that this also works with the ZSH, but it doesn't. This is one of the few things which don't work with the ZSH but in the Bash. There might be plugins you could use for ZSH to do something similar, though.</p>
-<h2>Process substitution</h2>
-<p>The idea here is, that you can read the output (stdout) of a command from a file descriptor:</p>
+<br />
+<span>You would assume that this also works with the ZSH, but it doesn't. This is one of the few things which don't work with the ZSH but in the Bash. There might be plugins you could use for ZSH to do something similar, though.</span><br />
+<br />
+<h2 style='display: inline'>Process substitution</h2><br />
+<br />
+<span>The idea here is, that you can read the output (stdout) of a command from a file descriptor:</span><br />
+<br />
<pre>
❯ uptime # Without process substitution
10:58:03 up 4 days, 22:08, 1 user, load average: 0.16, 0.34, 0.41
@@ -3308,8 +3725,11 @@ Modify: 2021-11-20 10:59:31.482411961 +0000
Change: 2021-11-20 10:59:31.482411961 +0000
Birth: -
</pre>
-<p>This example doesn't make any sense practically speaking, but it clearly demonstrates how process substitution works. The standard output pipe of "uptime" is redirected to an anonymous file descriptor. That fd then is opened by the "cat" command as a regular file.</p>
-<p>A useful use case is displaying the differences of two sorted files:</p>
+<br />
+<span>This example doesn't make any sense practically speaking, but it clearly demonstrates how process substitution works. The standard output pipe of "uptime" is redirected to an anonymous file descriptor. That fd then is opened by the "cat" command as a regular file.</span><br />
+<br />
+<span>A useful use case is displaying the differences of two sorted files:</span><br />
+<br />
<pre>
❯ echo a &gt; /tmp/file-a.txt
❯ echo b &gt;&gt; /tmp/file-a.txt
@@ -3330,11 +3750,15 @@ Change: 2021-11-20 10:59:31.482411961 +0000
❯ diff -u &lt;(sort /tmp/file-a.txt) &lt;(sort /tmp/file-b.txt)
</pre>
-<p>Another example is displaying the differences of two directories:</p>
+<br />
+<span>Another example is displaying the differences of two directories:</span><br />
+<br />
<pre>
❯ diff -u &lt;(ls ./dir1/ | sort) &lt;(ls ./dir2/ | sort)
</pre>
-<p>More (Bash golfing) examples:</p>
+<br />
+<span>More (Bash golfing) examples:</span><br />
+<br />
<pre>
❯ wc -l &lt;(ls /tmp/) /etc/passwd &lt;(env)
24 /dev/fd/63
@@ -3349,21 +3773,29 @@ Change: 2021-11-20 10:59:31.482411961 +0000
foo bar baz
</pre>
-<p>So far, we only used process substitution for stdout redirection. But it also works for stdin. The following two commands result into the same outcome, but the second one is writing the tar data stream to an anonymous file descriptor which is substituted by the "bzip2" command reading the data stream from stdin and compressing it to its own stdout, which then gets redirected to a file:</p>
+<br />
+<span>So far, we only used process substitution for stdout redirection. But it also works for stdin. The following two commands result into the same outcome, but the second one is writing the tar data stream to an anonymous file descriptor which is substituted by the "bzip2" command reading the data stream from stdin and compressing it to its own stdout, which then gets redirected to a file:</span><br />
+<br />
<pre>
❯ tar cjf file.tar.bz2 foo
❯ tar cjf &gt;(bzip2 -c &gt; file.tar.bz2) foo
</pre>
-<p>Just think a while and see whether you understand fully what is happening here.</p>
-<h2>Grouping</h2>
-<p>Command grouping can be quite useful for combining the output of multiple commands:</p>
+<br />
+<span>Just think a while and see whether you understand fully what is happening here.</span><br />
+<br />
+<h2 style='display: inline'>Grouping</h2><br />
+<br />
+<span>Command grouping can be quite useful for combining the output of multiple commands:</span><br />
+<br />
<pre>
❯ { ls /tmp; cat /etc/passwd; env; } | wc -l
97
❯ ( ls /tmp; cat /etc/passwd; env; ) | wc -l
97
</pre>
-<p>But wait, what is the difference between curly braces and normal braces? I assumed that the normal braces create a subprocess whereas the curly ones don't, but I was wrong:</p>
+<br />
+<span>But wait, what is the difference between curly braces and normal braces? I assumed that the normal braces create a subprocess whereas the curly ones don't, but I was wrong:</span><br />
+<br />
<pre>
❯ echo $$
62676
@@ -3372,7 +3804,9 @@ foo bar baz
❯ ( echo $$; )
62676
</pre>
-<p>One difference is, that the curly braces require you to end the last statement with a semicolon, whereas with the normal braces you can omit the last semicolon:</p>
+<br />
+<span>One difference is, that the curly braces require you to end the last statement with a semicolon, whereas with the normal braces you can omit the last semicolon:</span><br />
+<br />
<pre>
❯ ( env; ls ) | wc -l
27
@@ -3380,8 +3814,11 @@ foo bar baz
&gt;
&gt; ^C
</pre>
-<p>In case you know more (subtle) differences, please write me an E-Mail and let me know.</p>
-<p class="quote"><i>Update: A reader sent me an E-Mail and pointed me to the Bash manual page, which explains the difference between () and {} (I should have checked that by myself):</i></p>
+<br />
+<span>In case you know more (subtle) differences, please write me an E-Mail and let me know.</span><br />
+<br />
+<span class='quote'>Update: A reader sent me an E-Mail and pointed me to the Bash manual page, which explains the difference between () and {} (I should have checked that by myself):</span><br />
+<br />
<pre>
(list) list is executed in a subshell environment (see COMMAND EXECUTION ENVIRONMENT
below). Variable assignments and builtin commands that affect the shell's
@@ -3396,20 +3833,27 @@ foo bar baz
is permitted to be recognized. Since they do not cause a word break, they
must be separated from list by whitespace or another shell metacharacter.
</pre>
-<p>So I was right that () is executed in a subprocess. But why does $$ not show a different PID? Also here (as pointed out by the reader) is the answer in the manual page:</p>
+<br />
+<span>So I was right that () is executed in a subprocess. But why does $$ not show a different PID? Also here (as pointed out by the reader) is the answer in the manual page:</span><br />
+<br />
<pre>
$ Expands to the process ID of the shell. In a () subshell, it expands to the
process ID of the current shell, not the subshell.
</pre>
-<p>If we want print the subprocess PID, we can use the BASHPID variable:</p>
+<br />
+<span>If we want print the subprocess PID, we can use the BASHPID variable:</span><br />
+<br />
<pre>
❯ echo $BASHPID; { echo $BASHPID; }; ( echo $BASHPID; )
1028465
1028465
1028739
</pre>
-<h2>Expansions</h2>
-<p>Let's start with simple examples:</p>
+<br />
+<h2 style='display: inline'>Expansions</h2><br />
+<br />
+<span>Let's start with simple examples:</span><br />
+<br />
<pre>
❯ echo {0..5}
0 1 2 3 4 5
@@ -3421,7 +3865,9 @@ $ Expands to the process ID of the shell. In a () subshell, it expands to
4
5
</pre>
-<p>You can also add leading 0 or expand to any number range:</p>
+<br />
+<span>You can also add leading 0 or expand to any number range:</span><br />
+<br />
<pre>
❯ echo {00..05}
00 01 02 03 04 05
@@ -3430,30 +3876,41 @@ $ Expands to the process ID of the shell. In a () subshell, it expands to
❯ echo {201..205}
201 202 203 204 205
</pre>
-<p>It also works with letters:</p>
+<br />
+<span>It also works with letters:</span><br />
+<br />
<pre>
❯ echo {a..e}
a b c d e
</pre>
-<p>Now it gets interesting. The following takes a list of words and expands it so that all words are quoted:</p>
+<br />
+<span>Now it gets interesting. The following takes a list of words and expands it so that all words are quoted:</span><br />
+<br />
<pre>
❯ echo \"{These,words,are,quoted}\"
"These" "words" "are" "quoted"
</pre>
-<p>Let's also expand to the cross product of two given lists:</p>
+<br />
+<span>Let's also expand to the cross product of two given lists:</span><br />
+<br />
<pre>
❯ echo {one,two}\:{A,B,C}
one:A one:B one:C two:A two:B two:C
❯ echo \"{one,two}\:{A,B,C}\"
"one:A" "one:B" "one:C" "two:A" "two:B" "two:C"
</pre>
-<p>Just because we can:</p>
+<br />
+<span>Just because we can:</span><br />
+<br />
<pre>
❯ echo Linux-{one,two,three}\:{A,B,C}-FreeBSD
Linux-one:A-FreeBSD Linux-one:B-FreeBSD Linux-one:C-FreeBSD Linux-two:A-FreeBSD Linux-two:B-FreeBSD Linux-two:C-FreeBSD Linux-three:A-FreeBSD Linux-three:B-FreeBSD Linux-three:C-FreeBSD
</pre>
-<h2>- aka stdin and stdout placeholder</h2>
-<p>Some commands and Bash builtins use "-" as a placeholder for stdin and stdout:</p>
+<br />
+<h2 style='display: inline'>- aka stdin and stdout placeholder</h2><br />
+<br />
+<span>Some commands and Bash builtins use "-" as a placeholder for stdin and stdout:</span><br />
+<br />
<pre>
❯ echo Hello world
Hello world
@@ -3466,24 +3923,31 @@ Hello world
❯ cat - &lt;&lt;&lt; 'Hello world'
Hello world
</pre>
-<p>Let's walk through all three examples from the above snippet:</p>
+<br />
+<span>Let's walk through all three examples from the above snippet:</span><br />
+<br />
<ul>
<li>The first example is obvious (the Bash builtin "echo" prints its arguments to stdout).</li>
<li>The second pipes "Hello world" via stdout to stdin of the "cat" command. As cat's argument is "-" it reads its data from stdin and not from a regular file named "-". So "-" has a special meaning for cat.</li>
<li>The third and fourth examples are interesting as we don't use a pipe as of "|" but a so-called HERE-document and a HERE-string. But the end results are the same.</li>
-</ul>
-<p>The "tar" command understands "-" too. The following example tars up some local directory and sends the data to stdout (this is what "-f -" commands it to do). stdout then is piped via an SSH session to a remote tar process (running on buetow.org) and reads the data from stdin and extracts all the data coming from stdin (as we told tar with "-f -") on the remote machine:</p>
+</ul><br />
+<span>The "tar" command understands "-" too. The following example tars up some local directory and sends the data to stdout (this is what "-f -" commands it to do). stdout then is piped via an SSH session to a remote tar process (running on buetow.org) and reads the data from stdin and extracts all the data coming from stdin (as we told tar with "-f -") on the remote machine:</span><br />
+<br />
<pre>
❯ tar -czf - /some/dir | ssh hercules@buetow.org tar -xzvf -
</pre>
-<p>This is yet another example of using "-", but this time using the "file" command:</p>
+<br />
+<span>This is yet another example of using "-", but this time using the "file" command:</span><br />
+<br />
<pre>
$ head -n 1 grandmaster.sh
#!/usr/bin/env bash
$ file - &lt; &lt;(head -n 1 grandmaster.sh)
/dev/stdin: a /usr/bin/env bash script, ASCII text executable
</pre>
-<p>Some more golfing:</p>
+<br />
+<span>Some more golfing:</span><br />
+<br />
<pre>
$ cat -
hello
@@ -3493,8 +3957,11 @@ $ file -
#!/usr/bin/perl
/dev/stdin: Perl script text executable
</pre>
-<h2>Alternative argument passing</h2>
-<p>This is a quite unusual way of passing arguments to a Bash script:</p>
+<br />
+<h2 style='display: inline'>Alternative argument passing</h2><br />
+<br />
+<span>This is a quite unusual way of passing arguments to a Bash script:</span><br />
+<br />
<pre>
❯ cat foo.sh
#/usr/bin/env bash
@@ -3502,7 +3969,9 @@ declare -r USER=${USER:?Missing the username}
declare -r PASS=${PASS:?Missing the secret password for $USER}
echo $USER:$PASS
</pre>
-<p>So what we are doing here is to pass the arguments via environment variables to the script. The script will abort with an error when there's an undefined argument.</p>
+<br />
+<span>So what we are doing here is to pass the arguments via environment variables to the script. The script will abort with an error when there's an undefined argument.</span><br />
+<br />
<pre>
❯ chmod +x foo.sh
❯ ./foo.sh
@@ -3514,19 +3983,27 @@ echo $USER:$PASS
❯ USER=paul PASS=secret ./foo.sh
paul:secret
</pre>
-<p>You have probably noticed this *strange* syntax:</p>
+<br />
+<span>You have probably noticed this *strange* syntax:</span><br />
+<br />
<pre>
❯ VARIABLE1=value1 VARIABLE2=value2 ./script.sh
</pre>
-<p>That's just another way to pass environment variables to a script. You can write it as well as like this:</p>
+<br />
+<span>That's just another way to pass environment variables to a script. You can write it as well as like this:</span><br />
+<br />
<pre>
❯ export VARIABLE1=value1
❯ export VARIABLE2=value2
❯ ./script.sh
</pre>
-<p>But the downside of it is that the variables will also be defined in your current shell environment and not just in the scripts sub-process.</p>
-<h2>: aka the null command</h2>
-<p>First, let's use the "help" Bash built-in to see what it says about the null command:</p>
+<br />
+<span>But the downside of it is that the variables will also be defined in your current shell environment and not just in the scripts sub-process.</span><br />
+<br />
+<h2 style='display: inline'>: aka the null command</h2><br />
+<br />
+<span>First, let's use the "help" Bash built-in to see what it says about the null command:</span><br />
+<br />
<pre>
❯ help :
:: :
@@ -3537,14 +4014,19 @@ paul:secret
Exit Status:
Always succeeds.
</pre>
-<p>PS: IMHO, people should use the Bash help more often. It is a very useful Bash reference. Too many fallbacks to a Google search and then land on Stack Overflow. Sadly, there's no help built-in for the ZSH shell though (so even when I am using the ZSH I make use of the Bash help as most of the built-ins are compatible). </p>
-<p>OK, back to the null command. What happens when you try to run it? As you can see, absolutely nothing. And its exit status is 0 (success):</p>
+<br />
+<span>PS: IMHO, people should use the Bash help more often. It is a very useful Bash reference. Too many fallbacks to a Google search and then land on Stack Overflow. Sadly, there's no help built-in for the ZSH shell though (so even when I am using the ZSH I make use of the Bash help as most of the built-ins are compatible). </span><br />
+<br />
+<span>OK, back to the null command. What happens when you try to run it? As you can see, absolutely nothing. And its exit status is 0 (success):</span><br />
+<br />
<pre>
❯ :
❯ echo $?
0
</pre>
-<p>Why would that be useful? You can use it as a placeholder in an endless while-loop:</p>
+<br />
+<span>Why would that be useful? You can use it as a placeholder in an endless while-loop:</span><br />
+<br />
<pre>
❯ while : ; do date; sleep 1; done
Sun 21 Nov 12:08:31 GMT 2021
@@ -3553,7 +4035,9 @@ Sun 21 Nov 12:08:33 GMT 2021
^C
</pre>
-<p>You can also use it as a placeholder for a function body not yet fully implemented, as an empty function ill result in a syntax error:</p>
+<br />
+<span>You can also use it as a placeholder for a function body not yet fully implemented, as an empty function ill result in a syntax error:</span><br />
+<br />
<pre>
❯ foo () { }
-bash: syntax error near unexpected token `}'
@@ -3561,11 +4045,15 @@ Sun 21 Nov 12:08:33 GMT 2021
❯ foo
</pre>
-<p>Or use it as a placeholder for not yet implemented conditional branches:</p>
+<br />
+<span>Or use it as a placeholder for not yet implemented conditional branches:</span><br />
+<br />
<pre>
❯ if foo; then :; else echo bar; fi
</pre>
-<p>Or (not recommended) as a fancy way to comment your Bash code:</p>
+<br />
+<span>Or (not recommended) as a fancy way to comment your Bash code:</span><br />
+<br />
<pre>
❯ : I am a comment and have no other effect
❯ : I am a comment and result in a syntax error ()
@@ -3573,7 +4061,9 @@ Sun 21 Nov 12:08:33 GMT 2021
❯ : "I am a comment and don't result in a syntax error ()"
</pre>
-<p>As you can see in the previous example, the Bash still tries to interpret some syntax of all text following after ":". This can be exploited (also not recommended) like this:</p>
+<br />
+<span>As you can see in the previous example, the Bash still tries to interpret some syntax of all text following after ":". This can be exploited (also not recommended) like this:</span><br />
+<br />
<pre>
❯ declare i=0
❯ $[ i = i + 1 ]
@@ -3584,7 +4074,9 @@ bash: 1: command not found...
❯ echo $i
4
</pre>
-<p>For these kinds of expressions it's always better to use "let" though. And you should also use $((...expression...)) instead of the old (deprecated) way $[ ...expression... ] like this example demonstrates:</p>
+<br />
+<span>For these kinds of expressions it's always better to use "let" though. And you should also use $((...expression...)) instead of the old (deprecated) way $[ ...expression... ] like this example demonstrates:</span><br />
+<br />
<pre>
❯ declare j=0
❯ let j=$((j + 1))
@@ -3594,8 +4086,11 @@ bash: 1: command not found...
❯ echo $j
4
</pre>
-<h2>(No) floating point support</h2>
-<p>I have to give a plus-point to the ZSH here. As the ZSH supports floating point calculation, whereas the Bash doesn't:</p>
+<br />
+<h2 style='display: inline'>(No) floating point support</h2><br />
+<br />
+<span>I have to give a plus-point to the ZSH here. As the ZSH supports floating point calculation, whereas the Bash doesn't:</span><br />
+<br />
<pre>
❯ bash -c 'echo $(( 1/10 ))'
0
@@ -3607,20 +4102,28 @@ bash: line 1: 1/10.0 : syntax error: invalid arithmetic operator (error token is
0.10000000000000001
</pre>
-<p>It would be nice to have native floating point support for the Bash too, but you don't want to use the shell for complicated calculations anyway. So it's fine that Bash doesn't have that, I guess. </p>
-<p>In the Bash you will have to fall back to an external command like "bc" (the arbitrary precision calculator language):</p>
+<br />
+<span>It would be nice to have native floating point support for the Bash too, but you don't want to use the shell for complicated calculations anyway. So it's fine that Bash doesn't have that, I guess. </span><br />
+<br />
+<span>In the Bash you will have to fall back to an external command like "bc" (the arbitrary precision calculator language):</span><br />
+<br />
<pre>
❯ bc &lt;&lt;&lt; 'scale=2; 1/10'
.10
</pre>
-<p>See you later for the next post of this series.</p>
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-01-01-bash-golf-part-2.html">2022-01-01 Bash Golf Part 2</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-11-29-bash-golf-part-1.html">2021-11-29 Bash Golf Part 1 (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html">2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-05-16-personal-bash-coding-style-guide.html">2021-05-16 Personal Bash coding style guide</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+<br />
+<span>See you later for the next post of this series.</span><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2022-01-01-bash-golf-part-2.html'>2022-01-01 Bash Golf Part 2</a><br />
+<a class='textlink' href='./2021-11-29-bash-golf-part-1.html'>2021-11-29 Bash Golf Part 1 (You are currently reading this)</a><br />
+<a class='textlink' href='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html'>2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
+<a class='textlink' href='./2021-05-16-personal-bash-coding-style-guide.html'>2021-05-16 Personal Bash coding style guide</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -3954,8 +4457,10 @@ Hello World
<summary>You might have read my previous blog posts about entering the Geminispace, where I pointed out the benefits of having and maintaining an internet presence there. This whole site (the blog and all other pages) is composed in the Gemtext markup language.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Gemtexter - One Bash script to rule it all</h1>
-<p class="quote"><i>Published at 2021-06-05T19:03:32+01:00</i></p>
+ <h1 style='display: inline'>Gemtexter - One Bash script to rule it all</h1><br />
+<br />
+<span class='quote'>Published at 2021-06-05T19:03:32+01:00</span><br />
+<br />
<pre>
o .,&lt;&gt;., o
|\/\/\/\/|
@@ -3996,28 +4501,44 @@ Hello World
\___.&gt;`''-.||:.__,' SSt |_______`&gt; &lt;_____:::. . . \ _/
`+a:f:......jrei'''
</pre>
-<p>You might have read my previous blog posts about entering the Geminispace, where I pointed out the benefits of having and maintaining an internet presence there. This whole site (the blog and all other pages) is composed in the Gemtext markup language.</p>
-<p>This comes with the benefit that I can write content in my favourite text editor (Vim). </p>
-<h2>Motivation</h2>
-<p>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.</p>
-<a href="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg"><img alt="Motivational comic strip" title="Motivational comic strip" src="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg" /></a><br />
-<p>I have exactly done that - I wrote a Bash script, named Gemtexter, for that:</p>
-<a class="textlink" href="https://codeberg.org/snonux/gemtexter">https://codeberg.org/snonux/gemtexter</a><br />
-<p>In short, Gemtexter is a static site generator and blogging engine that uses Gemtext as its input format.</p>
-<h2>Output formats</h2>
-<p>Gemtexter takes the Gemtext Markup files as the input and generates the following outputs from it (you find examples for each of these output formats on the Gemtexter GitHub page):</p>
+<br />
+<span>You might have read my previous blog posts about entering the Geminispace, where I pointed out the benefits of having and maintaining an internet presence there. This whole site (the blog and all other pages) is composed in the Gemtext markup language.</span><br />
+<br />
+<span>This comes with the benefit that I can write content in my favourite text editor (Vim). </span><br />
+<br />
+<h2 style='display: inline'>Motivation</h2><br />
+<br />
+<span>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.</span><br />
+<br />
+<a href='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg'><img alt='Motivational comic strip' title='Motivational comic strip' src='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all/blog-engine.jpg' /></a><br />
+<br />
+<span>I have exactly done that - I wrote a Bash script, named Gemtexter, for that:</span><br />
+<br />
+<a class='textlink' href='https://codeberg.org/snonux/gemtexter'>https://codeberg.org/snonux/gemtexter</a><br />
+<br />
+<span>In short, Gemtexter is a static site generator and blogging engine that uses Gemtext as its input format.</span><br />
+<br />
+<h2 style='display: inline'>Output formats</h2><br />
+<br />
+<span>Gemtexter takes the Gemtext Markup files as the input and generates the following outputs from it (you find examples for each of these output formats on the Gemtexter GitHub page):</span><br />
+<br />
<ul>
<li>HTML files for my website</li>
<li>Markdown files for a GitHub page</li>
<li>A Gemtext Atom feed for my blog posts</li>
<li>A Gemfeed for my blog posts (a particular feed format commonly used in Geminispace. The Gemfeed can be used as an alternative to the Atom feed).</li>
<li>An HTML Atom feed of my blog posts</li>
-</ul>
-<p>I could have done all of that with a more robust language than Bash (such as Perl, Ruby, Go...), but I didn't. The purpose of this exercise was to challenge what I can do with a "simple" Bash script and learn new things.</p>
-<h2>Taking it as far as I should, but no farther</h2>
-<p>The Bash is suitable very well for small scripts and ad-hoc automation on the command line. But it is for sure not a robust programming language. Writing this blog post, Gemtexter is nearing 1000 lines of code, which is actually a pretty large Bash script.</p>
-<h3>Modularization </h3>
-<p>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. </p>
+</ul><br />
+<span>I could have done all of that with a more robust language than Bash (such as Perl, Ruby, Go...), but I didn't. The purpose of this exercise was to challenge what I can do with a "simple" Bash script and learn new things.</span><br />
+<br />
+<h2 style='display: inline'>Taking it as far as I should, but no farther</h2><br />
+<br />
+<span>The Bash is suitable very well for small scripts and ad-hoc automation on the command line. But it is for sure not a robust programming language. Writing this blog post, Gemtexter is nearing 1000 lines of code, which is actually a pretty large Bash script.</span><br />
+<br />
+<h3 style='display: inline'>Modularization </h3><br />
+<br />
+<span>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. </span><br />
+<br />
<pre>
paul in uranus in gemtexter on 🌱 main
❯ wc -l gemtexter lib/*
@@ -4032,60 +4553,91 @@ paul in uranus in gemtexter on 🌱 main
63 lib/md.source.sh
834 total
</pre>
-<p>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. </p>
-<h3>Bash best practises and ShellCheck</h3>
-<p>While working on Gemtexter, I also had a look at the Google Shell Style Guide and wrote a blog post on that:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2021-05-16-personal-bash-coding-style-guide.html">Personal bash coding style guide</a><br />
-<p>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).</p>
-<p>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. </p>
-<p>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 &lt; &lt;(some_command)". ShellCheck also pointed out to add a "-r" to "read"; otherwise, there could be an issue with backspaces in the loop data.</p>
-<p>Furthermore, ShellCheck recommended many more improvements. Declaration of unused variables and missing variable and string quotations were the most common ones. ShellSheck immensely helped to improve the robustness of the script.</p>
-<a class="textlink" href="https://shellcheck.net">https://shellcheck.net</a><br />
-<h3>Unit testing</h3>
-<p>There is a basic unit test module in ./lib/assert.source.sh, which is used for unit testing. I found this to be very beneficial for cross-platform development. For example, I noticed that some unit tests failed on macOS while everything still worked fine on my Fedora Linux laptop. </p>
-<p>After digging a bit, I noticed that I had to install the GNU versions of the sed and grep commands on macOS and a newer version of the Bash to make all unit tests pass and Gemtexter work.</p>
-<p>It has been proven quite helpful to have unit tests in place for the HTML part already when working on the Markdown generator part. To test the Markdown part, I copied the HTML unit tests and changed the expected outcome in the assertions. This way, I could implement the Markdown generator in a test-driven way (writing the test first and afterwards the implementation).</p>
-<h3>HTML unit test example</h3>
+<br />
+<span>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. </span><br />
+<br />
+<h3 style='display: inline'>Bash best practises and ShellCheck</h3><br />
+<br />
+<span>While working on Gemtexter, I also had a look at the Google Shell Style Guide and wrote a blog post on that:</span><br />
+<br />
+<a class='textlink' href='./2021-05-16-personal-bash-coding-style-guide.html'>Personal bash coding style guide</a><br />
+<br />
+<span>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).</span><br />
+<br />
+<span>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. </span><br />
+<br />
+<span>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 &lt; &lt;(some_command)". ShellCheck also pointed out to add a "-r" to "read"; otherwise, there could be an issue with backspaces in the loop data.</span><br />
+<br />
+<span>Furthermore, ShellCheck recommended many more improvements. Declaration of unused variables and missing variable and string quotations were the most common ones. ShellSheck immensely helped to improve the robustness of the script.</span><br />
+<br />
+<a class='textlink' href='https://shellcheck.net'>https://shellcheck.net</a><br />
+<br />
+<h3 style='display: inline'>Unit testing</h3><br />
+<br />
+<span>There is a basic unit test module in ./lib/assert.source.sh, which is used for unit testing. I found this to be very beneficial for cross-platform development. For example, I noticed that some unit tests failed on macOS while everything still worked fine on my Fedora Linux laptop. </span><br />
+<br />
+<span>After digging a bit, I noticed that I had to install the GNU versions of the sed and grep commands on macOS and a newer version of the Bash to make all unit tests pass and Gemtexter work.</span><br />
+<br />
+<span>It has been proven quite helpful to have unit tests in place for the HTML part already when working on the Markdown generator part. To test the Markdown part, I copied the HTML unit tests and changed the expected outcome in the assertions. This way, I could implement the Markdown generator in a test-driven way (writing the test first and afterwards the implementation).</span><br />
+<br />
+<h3 style='display: inline'>HTML unit test example</h3><br />
+<br />
<pre>
gemtext='=&gt; http://example.org Description of the link'
assert::equals "$(generate::make_link html "$gemtext")" \
'&lt;a class="textlink" href="http://example.org"&gt;Description of the link&lt;/a&gt;&lt;br /&gt;'
</pre>
-<h3>Markdown unit test example</h3>
+<br />
+<h3 style='display: inline'>Markdown unit test example</h3><br />
+<br />
<pre>
gemtext='=&gt; http://example.org Description of the link'
assert::equals "$(generate::make_link md "$gemtext")" \
'[Description of the link](http://example.org) '
</pre>
-<h2>Handcrafted HTML styles</h2>
-<p>I had a look at some ready off the shelf CSS styles, but they all seemed too bloated. There is a whole industry selling CSS styles on the interweb. I preferred an effortless and minimalist style for the HTML site. So I handcrafted the Cascading Style Sheets manually with love and included them in the HTML header template. </p>
-<p>For now, I have to re-generate all HTML files whenever the CSS changes. That should not be an issue now, but I might move the CSS into a separate file one day.</p>
-<p>It's worth mentioning that all generated HTML files and Atom feeds pass the W3C validation tests.</p>
-<p> </p>
-<h2>Configurability</h2>
-<p>In case someone else than me wants to use Gemtexter for his own site, it is pretty much configurable. It is possible to specify your own configuration file and your own HTML templates. Have a look at the GitHub page for examples.</p>
-<h2>Future features</h2>
-<p>I could think of the following features added to a future version of Gemtexter:</p>
+<br />
+<h2 style='display: inline'>Handcrafted HTML styles</h2><br />
+<br />
+<span>I had a look at some ready off the shelf CSS styles, but they all seemed too bloated. There is a whole industry selling CSS styles on the interweb. I preferred an effortless and minimalist style for the HTML site. So I handcrafted the Cascading Style Sheets manually with love and included them in the HTML header template. </span><br />
+<br />
+<span>For now, I have to re-generate all HTML files whenever the CSS changes. That should not be an issue now, but I might move the CSS into a separate file one day.</span><br />
+<br />
+<span>It's worth mentioning that all generated HTML files and Atom feeds pass the W3C validation tests.</span><br />
+<span> </span><br />
+<h2 style='display: inline'>Configurability</h2><br />
+<br />
+<span>In case someone else than me wants to use Gemtexter for his own site, it is pretty much configurable. It is possible to specify your own configuration file and your own HTML templates. Have a look at the GitHub page for examples.</span><br />
+<br />
+<h2 style='display: inline'>Future features</h2><br />
+<br />
+<span>I could think of the following features added to a future version of Gemtexter:</span><br />
+<br />
<ul>
<li>Templating of Gemtext files so that the .html files are generated from .gmi.tpl files. The template engine could do such things as an automatic table of contents and sitemap generation. It could also include the output of inlined shell code, e.g. a fortune quote. </li>
<li>Add support for more output formats, such as Groff, PDF, plain text, Gopher, etc.</li>
<li>External CSS file for HTML.</li>
<li>Improve speed by introducing parallelism and/or concurrency and/or better caching.</li>
-</ul>
-<h2>Conclusion</h2>
-<p>It was quite a lot of fun writing Gemtexter. It's a relatively small project, but given that I worked on that in my spare time once in a while, it kept me busy for several weeks. </p>
-<p>I finally revamped my personal internet site and started to blog again. I wanted the result to be exactly how it is now: A slightly retro-inspired internet site built for fun with unconventional tools. </p>
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html">2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again^2</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html">2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2022-01-01-bash-golf-part-2.html">2022-01-01 Bash Golf Part 2</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-11-29-bash-golf-part-1.html">2021-11-29 Bash Golf Part 1</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html">2021-06-05 Gemtexter - One Bash script to rule it all (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-05-16-personal-bash-coding-style-guide.html">2021-05-16 Personal Bash coding style guide</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-04-24-welcome-to-the-geminispace.html">2021-04-24 Welcome to the Geminispace</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+</ul><br />
+<h2 style='display: inline'>Conclusion</h2><br />
+<br />
+<span>It was quite a lot of fun writing Gemtexter. It's a relatively small project, but given that I worked on that in my spare time once in a while, it kept me busy for several weeks. </span><br />
+<br />
+<span>I finally revamped my personal internet site and started to blog again. I wanted the result to be exactly how it is now: A slightly retro-inspired internet site built for fun with unconventional tools. </span><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html'>2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again^2</a><br />
+<a class='textlink' href='./2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html'>2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again</a><br />
+<a class='textlink' href='./2022-01-01-bash-golf-part-2.html'>2022-01-01 Bash Golf Part 2</a><br />
+<a class='textlink' href='./2021-11-29-bash-golf-part-1.html'>2021-11-29 Bash Golf Part 1</a><br />
+<a class='textlink' href='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html'>2021-06-05 Gemtexter - One Bash script to rule it all (You are currently reading this)</a><br />
+<a class='textlink' href='./2021-05-16-personal-bash-coding-style-guide.html'>2021-05-16 Personal Bash coding style guide</a><br />
+<a class='textlink' href='./2021-04-24-welcome-to-the-geminispace.html'>2021-04-24 Welcome to the Geminispace</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -4101,8 +4653,10 @@ assert::equals "$(generate::make_link md "$gemtext")" \
<summary>Lately, I have been polishing and writing a lot of Bash code. Not that I never wrote a lot of Bash, but now as I also looked through the Google Shell Style Guide, I thought it is time also to write my thoughts on that. I agree with that guide in most, but not in all points. </summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Personal Bash coding style guide</h1>
-<p class="quote"><i>Published at 2021-05-16T14:51:57+01:00</i></p>
+ <h1 style='display: inline'>Personal Bash coding style guide</h1><br />
+<br />
+<span class='quote'>Published at 2021-05-16T14:51:57+01:00</span><br />
+<br />
<pre>
.---------------------------.
/,--..---..---..---..---..--. `.
@@ -4115,26 +4669,43 @@ assert::equals "$(generate::make_link md "$gemtext")" \
// \\ // \\ |===|| hjw
"\__/"---------------"\__/"-+---+'
</pre>
-<p>Lately, I have been polishing and writing a lot of Bash code. Not that I never wrote a lot of Bash, but now as I also looked through the Google Shell Style Guide, I thought it is time also to write my thoughts on that. I agree with that guide in most, but not in all points. </p>
-<a class="textlink" href="https://google.github.io/styleguide/shellguide.html">Google Shell Style Guide</a><br />
-<h2>My modifications</h2>
-<p>These are my modifications to the Google Guide.</p>
-<h3>Shebang</h3>
-<p>Google recommends using always...</p>
+<br />
+<span>Lately, I have been polishing and writing a lot of Bash code. Not that I never wrote a lot of Bash, but now as I also looked through the Google Shell Style Guide, I thought it is time also to write my thoughts on that. I agree with that guide in most, but not in all points. </span><br />
+<br />
+<a class='textlink' href='https://google.github.io/styleguide/shellguide.html'>Google Shell Style Guide</a><br />
+<br />
+<h2 style='display: inline'>My modifications</h2><br />
+<br />
+<span>These are my modifications to the Google Guide.</span><br />
+<br />
+<h3 style='display: inline'>Shebang</h3><br />
+<br />
+<span>Google recommends using always...</span><br />
+<br />
<pre>
#!/bin/bash
</pre>
-<p>... as the shebang line, but that does not work on all Unix and Unix-like operating systems (e.g., the *BSDs don't have Bash installed to /bin/bash). Better is:</p>
+<br />
+<span>... as the shebang line, but that does not work on all Unix and Unix-like operating systems (e.g., the *BSDs don't have Bash installed to /bin/bash). Better is:</span><br />
+<br />
<pre>
#!/usr/bin/env bash
</pre>
-<h3>Two space soft-tabs indentation</h3>
-<p>I know there have been many tab- and soft-tab wars on this planet. Google recommends using two space soft-tabs for Bash scripts. </p>
-<p>I don't care if I use two or four space indentations. I agree, however, that we should not use tabs. I tend to use four-space soft-tabs as that's how I currently configured Vim for any programming language. What matters most, though, is consistency within the same script/project.</p>
-<p>Google also recommends limiting the line length to 80 characters. For some people, that seems to be an old habit from the '80s, where all computer terminals couldn't display longer lines. But I think that the 80 character mark is still a good practice, at least for shell scripts. For example, I am often writing code on a Microsoft Go Tablet PC (running Linux, of course), and it comes in convenient if the lines are not too long due to the relatively small display on the device.</p>
-<p>I hit the 80 character line length quicker with the four spaces than with two spaces, but that makes me refactor the Bash code more aggressively, which is a good thing. </p>
-<h3>Breaking long pipes</h3>
-<p>Google recommends breaking up long pipes like this:</p>
+<br />
+<h3 style='display: inline'>Two space soft-tabs indentation</h3><br />
+<br />
+<span>I know there have been many tab- and soft-tab wars on this planet. Google recommends using two space soft-tabs for Bash scripts. </span><br />
+<br />
+<span>I don't care if I use two or four space indentations. I agree, however, that we should not use tabs. I tend to use four-space soft-tabs as that's how I currently configured Vim for any programming language. What matters most, though, is consistency within the same script/project.</span><br />
+<br />
+<span>Google also recommends limiting the line length to 80 characters. For some people, that seems to be an old habit from the '80s, where all computer terminals couldn't display longer lines. But I think that the 80 character mark is still a good practice, at least for shell scripts. For example, I am often writing code on a Microsoft Go Tablet PC (running Linux, of course), and it comes in convenient if the lines are not too long due to the relatively small display on the device.</span><br />
+<br />
+<span>I hit the 80 character line length quicker with the four spaces than with two spaces, but that makes me refactor the Bash code more aggressively, which is a good thing. </span><br />
+<br />
+<h3 style='display: inline'>Breaking long pipes</h3><br />
+<br />
+<span>Google recommends breaking up long pipes like this:</span><br />
+<br />
<pre>
# All fits on one line
command1 | command2
@@ -4145,7 +4716,9 @@ command1 \
| command3 \
| command4
</pre>
-<p>I think there is a better way like the following, which is less noisy. The pipe | already indicates the Bash that another command is expected, thus making the explicit line breaks with \ obsolete:</p>
+<br />
+<span>I think there is a better way like the following, which is less noisy. The pipe | already indicates the Bash that another command is expected, thus making the explicit line breaks with \ obsolete:</span><br />
+<br />
<pre>
# Long commands
command1 |
@@ -4153,8 +4726,11 @@ command1 |
command3 |
command4
</pre>
-<h3>Quoting your variables</h3>
-<p>Google recommends always quote your variables. Generally, it would be best if you did that only for variables where you are unsure about the content/values of the variables (e.g., content is from an external input source and may contain whitespace or other special characters). In my opinion, the code will become quite noisy when you always quote your variables like this:</p>
+<br />
+<h3 style='display: inline'>Quoting your variables</h3><br />
+<br />
+<span>Google recommends always quote your variables. Generally, it would be best if you did that only for variables where you are unsure about the content/values of the variables (e.g., content is from an external input source and may contain whitespace or other special characters). In my opinion, the code will become quite noisy when you always quote your variables like this:</span><br />
+<br />
<pre>
greet () {
local -r greeting="${1}"
@@ -4162,7 +4738,9 @@ greet () {
echo "${greeting} ${name}!"
}
</pre>
-<p>In this particular example, I agree that you should quote them as you don't know the input (are there, for example, whitespace characters?). But if you are sure that you are only using simple bare words, then I think that the code looks much cleaner when you do this instead:</p>
+<br />
+<span>In this particular example, I agree that you should quote them as you don't know the input (are there, for example, whitespace characters?). But if you are sure that you are only using simple bare words, then I think that the code looks much cleaner when you do this instead:</span><br />
+<br />
<pre>
say_hello_to_paul () {
local -r greeting=Hello
@@ -4170,15 +4748,21 @@ say_hello_to_paul () {
echo "$greeting $name!"
}
</pre>
-<p>You see, I also omitted the curly braces { } around the variables. I only use the curly braces around variables when it makes the code either easier/clearer to read or if it is necessary to use them:</p>
+<br />
+<span>You see, I also omitted the curly braces { } around the variables. I only use the curly braces around variables when it makes the code either easier/clearer to read or if it is necessary to use them:</span><br />
+<br />
<pre>
declare FOO=bar
# Curly braces around FOO are necessary
echo "foo${FOO}baz"
</pre>
-<p>A few more words on always quoting the variables: For the sake of consistency (and for making ShellCheck happy), I am not against quoting everything I encounter. I also think that the larger the Bash script becomes, the more critical it becomes always to quote variables. That's because it will be more likely that you might not remember that some of the functions don't work on values with spaces in them, for example. It's just that I won't quote everything in every small script I write. </p>
-<h3>Prefer built-in commands over external commands</h3>
-<p>Google recommends using the built-in commands over available external commands where possible:</p>
+<br />
+<span>A few more words on always quoting the variables: For the sake of consistency (and for making ShellCheck happy), I am not against quoting everything I encounter. I also think that the larger the Bash script becomes, the more critical it becomes always to quote variables. That's because it will be more likely that you might not remember that some of the functions don't work on values with spaces in them, for example. It's just that I won't quote everything in every small script I write. </span><br />
+<br />
+<h3 style='display: inline'>Prefer built-in commands over external commands</h3><br />
+<br />
+<span>Google recommends using the built-in commands over available external commands where possible:</span><br />
+<br />
<pre>
# Prefer this:
addition=$(( X + Y ))
@@ -4188,13 +4772,21 @@ substitution="${string/#foo/bar}"
addition="$(expr "${X}" + "${Y}")"
substitution="$(echo "${string}" | sed -e 's/^foo/bar/')"
</pre>
-<p>I can't entirely agree here. The external commands (especially sed) are much more sophisticated and powerful than the built-in Bash versions. Sed can do much more than the Bash can ever do by itself when it comes to text manipulation (the name "sed" stands for streaming editor, after all).</p>
-<p>I prefer to do light text processing with the Bash built-ins and more complicated text processing with external programs such as sed, grep, awk, cut, and tr. However, there is also medium-light text processing where I would want to use external programs. That is so because I remember using them better than the Bash built-ins. The Bash can get relatively obscure here (even Perl will be more readable then - Side note: I love Perl).</p>
-<p>Also, you would like to use an external command for floating-point calculation (e.g., bc) instead of using the Bash built-ins (worth noticing that ZSH supports built-in floating-points).</p>
-<p>I even didn't get started with what you can do with awk (especially GNU Awk), a fully-fledged programming language. Tiny Awk snippets tend to be used quite often in Shell scripts without honouring the real power of Awk. But if you did everything in Perl or Awk or another scripting language, then it wouldn't be a Bash script anymore, wouldn't it? ;-)</p>
-<h2>My additions</h2>
-<h3>Use of 'yes' and 'no'</h3>
-<p>Bash does not support a boolean type. I tend just to use the strings 'yes' and 'no' here. I used 0 for false and 1 for true for some time, but I think that the yes/no strings are easier to read. Yes, the Bash script would need to perform string comparisons on every check, but if performance is crucial to you, you wouldn't want to use a Bash script anyway, correct?</p>
+<br />
+<span>I can't entirely agree here. The external commands (especially sed) are much more sophisticated and powerful than the built-in Bash versions. Sed can do much more than the Bash can ever do by itself when it comes to text manipulation (the name "sed" stands for streaming editor, after all).</span><br />
+<br />
+<span>I prefer to do light text processing with the Bash built-ins and more complicated text processing with external programs such as sed, grep, awk, cut, and tr. However, there is also medium-light text processing where I would want to use external programs. That is so because I remember using them better than the Bash built-ins. The Bash can get relatively obscure here (even Perl will be more readable then - Side note: I love Perl).</span><br />
+<br />
+<span>Also, you would like to use an external command for floating-point calculation (e.g., bc) instead of using the Bash built-ins (worth noticing that ZSH supports built-in floating-points).</span><br />
+<br />
+<span>I even didn't get started with what you can do with awk (especially GNU Awk), a fully-fledged programming language. Tiny Awk snippets tend to be used quite often in Shell scripts without honouring the real power of Awk. But if you did everything in Perl or Awk or another scripting language, then it wouldn't be a Bash script anymore, wouldn't it? ;-)</span><br />
+<br />
+<h2 style='display: inline'>My additions</h2><br />
+<br />
+<h3 style='display: inline'>Use of 'yes' and 'no'</h3><br />
+<br />
+<span>Bash does not support a boolean type. I tend just to use the strings 'yes' and 'no' here. I used 0 for false and 1 for true for some time, but I think that the yes/no strings are easier to read. Yes, the Bash script would need to perform string comparisons on every check, but if performance is crucial to you, you wouldn't want to use a Bash script anyway, correct?</span><br />
+<br />
<pre>
declare -r SUGAR_FREE=yes
declare -r I_NEED_THE_BUZZ=no
@@ -4211,8 +4803,11 @@ buy_soda () {
buy_soda $I_NEED_THE_BUZZ
</pre>
-<h3>Non-evil alternative to variable assignments via eval</h3>
-<p>Google is in the opinion that eval should be avoided. I think so too. They list these examples in their guide:</p>
+<br />
+<h3 style='display: inline'>Non-evil alternative to variable assignments via eval</h3><br />
+<br />
+<span>Google is in the opinion that eval should be avoided. I think so too. They list these examples in their guide:</span><br />
+<br />
<pre>
# What does this set?
# Did it succeed? In part or whole?
@@ -4222,7 +4817,9 @@ eval $(set_my_variables)
variable="$(eval some_function)"
</pre>
-<p>However, if I want to read variables from another file, I don't have to use eval here. I only have to source the file:</p>
+<br />
+<span>However, if I want to read variables from another file, I don't have to use eval here. I only have to source the file:</span><br />
+<br />
<pre>
% cat vars.source.sh
declare foo=bar
@@ -4232,7 +4829,9 @@ declare bay=foo
% bash -c 'source vars.source.sh; echo $foo $bar $baz'
bar baz foo
</pre>
-<p>And suppose I want to assign variables dynamically. In that case, I could just run an external script and source its output (This is how you could do metaprogramming in Bash without the use of eval - write code which produces code for immediate execution):</p>
+<br />
+<span>And suppose I want to assign variables dynamically. In that case, I could just run an external script and source its output (This is how you could do metaprogramming in Bash without the use of eval - write code which produces code for immediate execution):</span><br />
+<br />
<pre>
% cat vars.sh
#!/usr/bin/env bash
@@ -4244,9 +4843,13 @@ END
% bash -c 'source &lt;(./vars.sh); echo "Hello $user, it is $date"'
Hello paul, it is Sat 15 May 19:21:12 BST 2021
</pre>
-<p>The downside is that ShellCheck won't be able to follow the dynamic sourcing anymore.</p>
-<h3>Prefer pipes over arrays for list processing</h3>
-<p>When I do list processing in Bash, I prefer to use pipes. You can chain them through Bash functions as well, which is pretty neat. Usually, my list processing scripts are of a structure like this:</p>
+<br />
+<span>The downside is that ShellCheck won't be able to follow the dynamic sourcing anymore.</span><br />
+<br />
+<h3 style='display: inline'>Prefer pipes over arrays for list processing</h3><br />
+<br />
+<span>When I do list processing in Bash, I prefer to use pipes. You can chain them through Bash functions as well, which is pretty neat. Usually, my list processing scripts are of a structure like this:</span><br />
+<br />
<pre>
filter_lines () {
echo 'Start filtering lines in a fancy way!' &gt;&amp;2
@@ -4282,10 +4885,15 @@ main () {
main
</pre>
-<p>The stdout is always passed as a pipe to the next following stage. The stderr is used for info logging.</p>
-<h3>Assign-then-shift</h3>
-<p>I often refactor existing Bash code. That leads me to add and removing function arguments quite often. It's pretty repetitive work changing the $1, $2.... function argument numbers every time you change the order or add/remove possible arguments.</p>
-<p>The solution is to use of the "assign-then-shift"-method, which goes like this: "local -r var1=$1; shift; local -r var2=$1; shift". The idea is that you only use "$1" to assign function arguments to named (better readable) local function variables. You will never have to bother about "$2" or above. That is very useful when you constantly refactor your code and remove or add function arguments. It's something that I picked up from a colleague (a pure Bash wizard) some time ago:</p>
+<br />
+<span>The stdout is always passed as a pipe to the next following stage. The stderr is used for info logging.</span><br />
+<br />
+<h3 style='display: inline'>Assign-then-shift</h3><br />
+<br />
+<span>I often refactor existing Bash code. That leads me to add and removing function arguments quite often. It's pretty repetitive work changing the $1, $2.... function argument numbers every time you change the order or add/remove possible arguments.</span><br />
+<br />
+<span>The solution is to use of the "assign-then-shift"-method, which goes like this: "local -r var1=$1; shift; local -r var2=$1; shift". The idea is that you only use "$1" to assign function arguments to named (better readable) local function variables. You will never have to bother about "$2" or above. That is very useful when you constantly refactor your code and remove or add function arguments. It's something that I picked up from a colleague (a pure Bash wizard) some time ago:</span><br />
+<br />
<pre>
some_function () {
local -r param_foo="$1"; shift
@@ -4294,7 +4902,9 @@ some_function () {
...
}
</pre>
-<p>Want to add a param_baz? Just do this:</p>
+<br />
+<span>Want to add a param_baz? Just do this:</span><br />
+<br />
<pre>
some_function () {
local -r param_foo="$1"; shift
@@ -4304,7 +4914,9 @@ some_function () {
...
}
</pre>
-<p>Want to remove param_foo? Nothing easier than that:</p>
+<br />
+<span>Want to remove param_foo? Nothing easier than that:</span><br />
+<br />
<pre>
some_function () {
local -r param_bar="$1"; shift
@@ -4313,15 +4925,21 @@ some_function () {
...
}
</pre>
-<p>As you can see, I didn't need to change any other assignments within the function. Of course, you would also need to change the function argument lists at every occasion where the function is invoked - you would do that within the same refactoring session.</p>
-<h3>Paranoid mode</h3>
-<p>I call this the paranoid mode. The Bash will stop executing when a command exits with a status not equal to 0:</p>
+<br />
+<span>As you can see, I didn't need to change any other assignments within the function. Of course, you would also need to change the function argument lists at every occasion where the function is invoked - you would do that within the same refactoring session.</span><br />
+<br />
+<h3 style='display: inline'>Paranoid mode</h3><br />
+<br />
+<span>I call this the paranoid mode. The Bash will stop executing when a command exits with a status not equal to 0:</span><br />
+<br />
<pre>
set -e
grep -q foo &lt;&lt;&lt; bar
echo Jo
</pre>
-<p>Here 'Jo' will never be printed out as the grep didn't find any match. It's unrealistic for most scripts to run in paranoid mode purely, so there must be a way to add exceptions. Critical Bash scripts of mine tend to look like this:</p>
+<br />
+<span>Here 'Jo' will never be printed out as the grep didn't find any match. It's unrealistic for most scripts to run in paranoid mode purely, so there must be a way to add exceptions. Critical Bash scripts of mine tend to look like this:</span><br />
+<br />
<pre>
#!/usr/bin/env bash
@@ -4344,38 +4962,53 @@ some_function () {
...
}
</pre>
-<h2>Learned</h2>
-<p>There are also a couple of things I've learned from Google's guide.</p>
-<h3>Unintended lexicographical comparison.</h3>
-<p>The following looks like a valid Bash code:</p>
+<br />
+<h2 style='display: inline'>Learned</h2><br />
+<br />
+<span>There are also a couple of things I've learned from Google's guide.</span><br />
+<br />
+<h3 style='display: inline'>Unintended lexicographical comparison.</h3><br />
+<br />
+<span>The following looks like a valid Bash code:</span><br />
+<br />
<pre>
if [[ "${my_var}" &gt; 3 ]]; then
# True for 4, false for 22.
do_something
fi
</pre>
-<p>... but it is probably an unintended lexicographical comparison. A correct way would be:</p>
+<br />
+<span>... but it is probably an unintended lexicographical comparison. A correct way would be:</span><br />
+<br />
<pre>
if (( my_var &gt; 3 )); then
do_something
fi
</pre>
-<p>or</p>
+<br />
+<span>or</span><br />
+<br />
<pre>
if [[ "${my_var}" -gt 3 ]]; then
do_something
fi
</pre>
-<h3>PIPESTATUS</h3>
-<p>I have never used the PIPESTATUS variable before. I knew that it's there, but I never bothered to understand how it works until now thoroughly.</p>
-<p>The PIPESTATUS variable in Bash allows checking of the return code from all parts of a pipe. If it's only necessary to check the success or failure of the whole pipe, then the following is acceptable:</p>
+<br />
+<h3 style='display: inline'>PIPESTATUS</h3><br />
+<br />
+<span>I have never used the PIPESTATUS variable before. I knew that it's there, but I never bothered to understand how it works until now thoroughly.</span><br />
+<br />
+<span>The PIPESTATUS variable in Bash allows checking of the return code from all parts of a pipe. If it's only necessary to check the success or failure of the whole pipe, then the following is acceptable:</span><br />
+<br />
<pre>
tar -cf - ./* | ( cd "${dir}" &amp;&amp; tar -xf - )
if (( PIPESTATUS[0] != 0 || PIPESTATUS[1] != 0 )); then
echo "Unable to tar files to ${dir}" &gt;&amp;2
fi
</pre>
-<p>However, as PIPESTATUS will be overwritten as soon as you do any other command, if you need to act differently on errors based on where it happened in the pipe, you'll need to assign PIPESTATUS to another variable immediately after running the command (don't forget that [ is a command and will wipe out PIPESTATUS).</p>
+<br />
+<span>However, as PIPESTATUS will be overwritten as soon as you do any other command, if you need to act differently on errors based on where it happened in the pipe, you'll need to assign PIPESTATUS to another variable immediately after running the command (don't forget that [ is a command and will wipe out PIPESTATUS).</span><br />
+<br />
<pre>
tar -cf - ./* | ( cd "${DIR}" &amp;&amp; tar -xf - )
return_codes=( "${PIPESTATUS[@]}" )
@@ -4386,20 +5019,32 @@ if (( return_codes[1] != 0 )); then
do_something_else
fi
</pre>
-<h2>Use common sense and BE CONSISTENT.</h2>
-<p>The following two paragraphs are thoroughly quoted from the Google guidelines. But they hit the hammer on the head:</p>
-<p class="quote"><i>If you are editing code, take a few minutes to look at the code around you and determine its style. If they use spaces around their if clauses, you should, too. If their comments have little boxes of stars around them, make your comments have little boxes of stars around them too.</i></p>
-<p class="quote"><i>The point of having style guidelines is to have a common vocabulary of coding so people can concentrate on what you are saying rather than on how you are saying it. We present global style rules here, so people know the vocabulary. But local style is also important. If the code you add to a file looks drastically different from the existing code around it, the discontinuity throws readers out of their rhythm when they go to read it. Try to avoid this.</i></p>
-<h2>Advanced Bash learning pro tip</h2>
-<p>I also highly recommend having a read through the "Advanced Bash-Scripting Guide" (not from Google). I use it as the universal Bash reference and learn something new every time I look at it.</p>
-<a class="textlink" href="https://tldp.org/LDP/abs/html/">Advanced Bash-Scripting Guide</a><br />
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-01-01-bash-golf-part-2.html">2022-01-01 Bash Golf Part 2</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-11-29-bash-golf-part-1.html">2021-11-29 Bash Golf Part 1</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html">2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-05-16-personal-bash-coding-style-guide.html">2021-05-16 Personal Bash coding style guide (You are currently reading this)</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+<br />
+<h2 style='display: inline'>Use common sense and BE CONSISTENT.</h2><br />
+<br />
+<span>The following two paragraphs are thoroughly quoted from the Google guidelines. But they hit the hammer on the head:</span><br />
+<br />
+<span class='quote'>If you are editing code, take a few minutes to look at the code around you and determine its style. If they use spaces around their if clauses, you should, too. If their comments have little boxes of stars around them, make your comments have little boxes of stars around them too.</span><br />
+<br />
+<span class='quote'>The point of having style guidelines is to have a common vocabulary of coding so people can concentrate on what you are saying rather than on how you are saying it. We present global style rules here, so people know the vocabulary. But local style is also important. If the code you add to a file looks drastically different from the existing code around it, the discontinuity throws readers out of their rhythm when they go to read it. Try to avoid this.</span><br />
+<br />
+<br />
+<h2 style='display: inline'>Advanced Bash learning pro tip</h2><br />
+<br />
+<span>I also highly recommend having a read through the "Advanced Bash-Scripting Guide" (not from Google). I use it as the universal Bash reference and learn something new every time I look at it.</span><br />
+<br />
+<a class='textlink' href='https://tldp.org/LDP/abs/html/'>Advanced Bash-Scripting Guide</a><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2022-01-01-bash-golf-part-2.html'>2022-01-01 Bash Golf Part 2</a><br />
+<a class='textlink' href='./2021-11-29-bash-golf-part-1.html'>2021-11-29 Bash Golf Part 1</a><br />
+<a class='textlink' href='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html'>2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
+<a class='textlink' href='./2021-05-16-personal-bash-coding-style-guide.html'>2021-05-16 Personal Bash coding style guide (You are currently reading this)</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -4415,12 +5060,18 @@ fi
<summary>ASCII Art by Andy Hood!</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Welcome to the Geminispace</h1>
-<p class="quote"><i>Published at 2021-04-24T19:28:41+01:00; Updated at 2021-06-18</i></p>
-<p>ASCII Art by Andy Hood!</p>
-<p>Have you reached this article already via Gemini? It requires a Gemini client; web browsers such as Firefox, Chrome, Safari, etc., don't support the Gemini protocol. The Gemini address of this site (or the address of this capsule as people say in Geminispace) is:</p>
-<a class="textlink" href="https://foo.zone">https://foo.zone</a><br />
-<p>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 :-).</p>
+ <h1 style='display: inline'>Welcome to the Geminispace</h1><br />
+<br />
+<span class='quote'>Published at 2021-04-24T19:28:41+01:00; Updated at 2021-06-18</span><br />
+<br />
+<span>ASCII Art by Andy Hood!</span><br />
+<br />
+<span>Have you reached this article already via Gemini? It requires a Gemini client; web browsers such as Firefox, Chrome, Safari, etc., don't support the Gemini protocol. The Gemini address of this site (or the address of this capsule as people say in Geminispace) is:</span><br />
+<br />
+<a class='textlink' href='https://foo.zone'>https://foo.zone</a><br />
+<br />
+<span>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 :-).</span><br />
+<br />
<pre>
/\
@@ -4440,23 +5091,40 @@ fi
'.;.;' ;'.;' ..;;' AsH
</pre>
-<h2>Motivation</h2>
-<h3>My urge to revamp my personal website</h3>
-<p>For some time, I had to urge to revamp my personal website. Not to update the technology and its design but to update all the content (+ keep it current) and start a small tech blog again. So unconsciously, I began to search for an excellent platform to do all of that in a KISS (keep it simple &amp; stupid) way.</p>
-<h3>My still great Laptop running hot</h3>
-<p>Earlier this year (2021), I noticed that my almost seven-year-old but still great Laptop started to become hot and slowed down while surfing the web. Also, the Laptop's fan became quite noisy. This was all due to the additional bloat such as JavaScript, excessive use of CSS, tracking cookies+pixels, ads, and so on there was on the website. </p>
-<p>All I wanted was to read an interesting article, but after a big advertising pop-up banner appeared and made everything worse, I gave up and closed the browser tab.</p>
-<h2>Discovering the Gemini internet protocol</h2>
-<p>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.</p>
-<p>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.</p>
-<a href="https://foo.zone/gemfeed/2021-04-24-welcome-to-the-geminispace/amfora-screenshot.png"><img alt="Screenshot Amfora Gemini terminal client surfing this site" title="Screenshot Amfora Gemini terminal client surfing this site" src="https://foo.zone/gemfeed/2021-04-24-welcome-to-the-geminispace/amfora-screenshot.png" /></a><br />
-<a href="https://foo.zone/gemfeed/2021-04-24-welcome-to-the-geminispace/lagrange-screenshot.png"><img alt="Screenshot graphical Lagrange Gemini client surfing this site" title="Screenshot graphical Lagrange Gemini client surfing this site" src="https://foo.zone/gemfeed/2021-04-24-welcome-to-the-geminispace/lagrange-screenshot.png" /></a><br />
-<p>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.</p>
-<h2>My own Gemini capsule</h2>
-<p>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. </p>
-<p>This site was generated with Gemtexter. You can read more about it here:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html">Gemtexter - One Bash script to rule it all</a><br />
-<h2>Gemini advantages summarised</h2>
+<br />
+<h2 style='display: inline'>Motivation</h2><br />
+<br />
+<h3 style='display: inline'>My urge to revamp my personal website</h3><br />
+<br />
+<span>For some time, I had to urge to revamp my personal website. Not to update the technology and its design but to update all the content (+ keep it current) and start a small tech blog again. So unconsciously, I began to search for an excellent platform to do all of that in a KISS (keep it simple &amp; stupid) way.</span><br />
+<br />
+<h3 style='display: inline'>My still great Laptop running hot</h3><br />
+<br />
+<span>Earlier this year (2021), I noticed that my almost seven-year-old but still great Laptop started to become hot and slowed down while surfing the web. Also, the Laptop's fan became quite noisy. This was all due to the additional bloat such as JavaScript, excessive use of CSS, tracking cookies+pixels, ads, and so on there was on the website. </span><br />
+<br />
+<span>All I wanted was to read an interesting article, but after a big advertising pop-up banner appeared and made everything worse, I gave up and closed the browser tab.</span><br />
+<br />
+<h2 style='display: inline'>Discovering the Gemini internet protocol</h2><br />
+<br />
+<span>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.</span><br />
+<br />
+<span>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.</span><br />
+<br />
+<a href='./2021-04-24-welcome-to-the-geminispace/amfora-screenshot.png'><img alt='Screenshot Amfora Gemini terminal client surfing this site' title='Screenshot Amfora Gemini terminal client surfing this site' src='./2021-04-24-welcome-to-the-geminispace/amfora-screenshot.png' /></a><br />
+<a href='./2021-04-24-welcome-to-the-geminispace/lagrange-screenshot.png'><img alt='Screenshot graphical Lagrange Gemini client surfing this site' title='Screenshot graphical Lagrange Gemini client surfing this site' src='./2021-04-24-welcome-to-the-geminispace/lagrange-screenshot.png' /></a><br />
+<br />
+<span>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.</span><br />
+<br />
+<h2 style='display: inline'>My own Gemini capsule</h2><br />
+<br />
+<span>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. </span><br />
+<br />
+<span>This site was generated with Gemtexter. You can read more about it here:</span><br />
+<br />
+<a class='textlink' href='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html'>Gemtexter - One Bash script to rule it all</a><br />
+<br />
+<h2 style='display: inline'>Gemini advantages summarised</h2><br />
+<br />
<ul>
<li>Supports an alternative to the modern bloated web</li>
<li>Easy to operate and easy to write content</li>
@@ -4465,18 +5133,24 @@ fi
<li>Lightweight (although not as lightweight as the Gopher protocol)</li>
<li>Supports privacy (no cookies, no request header fingerprinting, TLS encryption)</li>
<li>Fun to play with (it's a bit geeky, yes, but a lot of fun!)</li>
-</ul>
-<h2>Dive into deep Gemini space</h2>
-<p>Check out one of the following links for more information about Gemini. For example, you will find a FAQ that explains why the protocol is named Gemini. Many Gemini capsules are dual-hosted via Gemini and HTTP(S) so that people new to Gemini can sneak peek at the content with a regular web browser. Some people go as far as tri-hosting all their content via HTTP(S), Gemini and Gopher.</p>
-<a class="textlink" href="https://gemini.circumlunar.space">https://gemini.circumlunar.space</a><br />
-<a class="textlink" href="https://gemini.circumlunar.space">https://gemini.circumlunar.space</a><br />
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html">2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again^2</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html">2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html">2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-04-24-welcome-to-the-geminispace.html">2021-04-24 Welcome to the Geminispace (You are currently reading this)</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+</ul><br />
+<h2 style='display: inline'>Dive into deep Gemini space</h2><br />
+<br />
+<span>Check out one of the following links for more information about Gemini. For example, you will find a FAQ that explains why the protocol is named Gemini. Many Gemini capsules are dual-hosted via Gemini and HTTP(S) so that people new to Gemini can sneak peek at the content with a regular web browser. Some people go as far as tri-hosting all their content via HTTP(S), Gemini and Gopher.</span><br />
+<br />
+<a class='textlink' href='https://gemini.circumlunar.space'>https://gemini.circumlunar.space</a><br />
+<a class='textlink' href='https://gemini.circumlunar.space'>https://gemini.circumlunar.space</a><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2023-03-25-gemtexter-2.0.0-lets-gemtext-again-2.html'>2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again^2</a><br />
+<a class='textlink' href='./2022-08-27-gemtexter-1.1.0-lets-gemtext-again.html'>2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again</a><br />
+<a class='textlink' href='./2021-06-05-gemtexter-one-bash-script-to-rule-it-all.html'>2021-06-05 Gemtexter - One Bash script to rule it all</a><br />
+<a class='textlink' href='./2021-04-24-welcome-to-the-geminispace.html'>2021-04-24 Welcome to the Geminispace (You are currently reading this)</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -4492,77 +5166,123 @@ fi
<summary>This article first appeared at the Mimecast Engineering Blog but I made it available here in my personal internet site too.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>DTail - The distributed log tail program</h1>
-<p class="quote"><i>Published at 2021-04-22T19:28:41+01:00; Updated at 2021-04-26</i></p>
-<a href="https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/title.png"><img alt="DTail logo image" title="DTail logo image" src="https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/title.png" /></a><br />
-<p>This article first appeared at the Mimecast Engineering Blog but I made it available here in my personal internet site too.</p>
-<a class="textlink" href="https://medium.com/mimecast-engineering/dtail-the-distributed-log-tail-program-79b8087904bb">Original Mimecast Engineering Blog post at Medium</a><br />
-<p>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.</p>
-<p>At Mimecast, we run over 10 thousand server boxes. Most of them host multiple microservices and each of them produces log files. Even with the use of time series databases and monitoring systems, raw application logs are still an important source of information when it comes to analysing, debugging, and troubleshooting services.</p>
-<p>Every engineer familiar with UNIX or a UNIX-like platform (e.g., Linux) is well aware of tail, a command-line program for displaying a text file content on the terminal which is also especially useful for following application or system log files with tail -f logfile.</p>
-<p>Think of DTail as a distributed version of the tail program which is very useful when you have a distributed application running on many servers. DTail is an Open-Source, cross-platform, fairly easy to use, support and maintain log file analysis &amp; statistics gathering tool designed for Engineers and Systems Administrators. It is programmed in Google Go.</p>
-<h2>A Mimecast Pet Project</h2>
-<p>DTail got its inspiration from public domain tools available already in this area but it is a blue sky from-scratch development which was first presented at Mimecast’s annual internal Pet Project competition (awarded with a Bronze prize). It has gained popularity since and is one of the most widely deployed DevOps tools at Mimecast (reaching nearly 10k server installations) and many engineers use it on a regular basis. The Open-Source version of DTail is available at:</p>
-<a class="textlink" href="https://dtail.dev">https://dtail.dev</a><br />
-<p>Try it out — We would love any feedback. But first, read on…</p>
-<h2>Differentiating from log management systems</h2>
-<p>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.</p>
-<p>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.</p>
-<a href="https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dtail.gif"><img alt="DTail sample session animated gif" title="DTail sample session animated gif" src="https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dtail.gif" /></a><br />
-<p>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.</p>
-<h2>Combining simplicity, security and efficiency</h2>
-<p>DTail also has a client component that connects to multiple servers concurrently for log files (or any other text files).</p>
-<p>The DTail client interacts with a DTail server on port TCP/2222 via SSH protocol and does not interact in any way with the system’s SSH server (e.g., OpenSSH Server) which might be running at port TCP/22 already. As a matter of fact, you don’t need a regular SSH server running for DTail at all. There is no support for interactive login shells at TCP/2222 either, as by design that port can only be used for text data streaming. The SSH protocol is used for the public/private key infrastructure and transport encryption only and DTail implements its own protocol on top of SSH for the features provided. There is no need to set up or buy any additional TLS certificates. The port 2222 can be easily reconfigured if you preferred to use a different one.</p>
-<p>The DTail server, which is a single static binary, will not fork an external process. This means that all features are implemented in native Go code (exception: Linux ACL support is implemented in C, but it must be enabled explicitly on compile time) and therefore helping to make it robust, secure, efficient, and easy to deploy. A single client, running on a standard Laptop, can connect to thousands of servers concurrently while still maintaining a small resource footprint.</p>
-<p>Recent log files are very likely still in the file system caches on the servers. Therefore, there tends to be a minimal I/O overhead involved.</p>
-<h2>The DTail family of commands</h2>
-<p>Following the UNIX philosophy, DTail includes multiple command-line commands each of them for a different purpose:</p>
+ <h1 style='display: inline'>DTail - The distributed log tail program</h1><br />
+<br />
+<span class='quote'>Published at 2021-04-22T19:28:41+01:00; Updated at 2021-04-26</span><br />
+<br />
+<a href='./2021-04-22-dtail-the-distributed-log-tail-program/title.png'><img alt='DTail logo image' title='DTail logo image' src='./2021-04-22-dtail-the-distributed-log-tail-program/title.png' /></a><br />
+<br />
+<span>This article first appeared at the Mimecast Engineering Blog but I made it available here in my personal internet site too.</span><br />
+<br />
+<a class='textlink' href='https://medium.com/mimecast-engineering/dtail-the-distributed-log-tail-program-79b8087904bb'>Original Mimecast Engineering Blog post at Medium</a><br />
+<br />
+<span>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.</span><br />
+<br />
+<span>At Mimecast, we run over 10 thousand server boxes. Most of them host multiple microservices and each of them produces log files. Even with the use of time series databases and monitoring systems, raw application logs are still an important source of information when it comes to analysing, debugging, and troubleshooting services.</span><br />
+<br />
+<span>Every engineer familiar with UNIX or a UNIX-like platform (e.g., Linux) is well aware of tail, a command-line program for displaying a text file content on the terminal which is also especially useful for following application or system log files with tail -f logfile.</span><br />
+<br />
+<span>Think of DTail as a distributed version of the tail program which is very useful when you have a distributed application running on many servers. DTail is an Open-Source, cross-platform, fairly easy to use, support and maintain log file analysis &amp; statistics gathering tool designed for Engineers and Systems Administrators. It is programmed in Google Go.</span><br />
+<br />
+<h2 style='display: inline'>A Mimecast Pet Project</h2><br />
+<br />
+<span>DTail got its inspiration from public domain tools available already in this area but it is a blue sky from-scratch development which was first presented at Mimecast’s annual internal Pet Project competition (awarded with a Bronze prize). It has gained popularity since and is one of the most widely deployed DevOps tools at Mimecast (reaching nearly 10k server installations) and many engineers use it on a regular basis. The Open-Source version of DTail is available at:</span><br />
+<br />
+<a class='textlink' href='https://dtail.dev'>https://dtail.dev</a><br />
+<br />
+<span>Try it out — We would love any feedback. But first, read on…</span><br />
+<br />
+<h2 style='display: inline'>Differentiating from log management systems</h2><br />
+<br />
+<span>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.</span><br />
+<br />
+<span>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.</span><br />
+<br />
+<a href='./2021-04-22-dtail-the-distributed-log-tail-program/dtail.gif'><img alt='DTail sample session animated gif' title='DTail sample session animated gif' src='./2021-04-22-dtail-the-distributed-log-tail-program/dtail.gif' /></a><br />
+<br />
+<span>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.</span><br />
+<br />
+<h2 style='display: inline'>Combining simplicity, security and efficiency</h2><br />
+<br />
+<span>DTail also has a client component that connects to multiple servers concurrently for log files (or any other text files).</span><br />
+<br />
+<span>The DTail client interacts with a DTail server on port TCP/2222 via SSH protocol and does not interact in any way with the system’s SSH server (e.g., OpenSSH Server) which might be running at port TCP/22 already. As a matter of fact, you don’t need a regular SSH server running for DTail at all. There is no support for interactive login shells at TCP/2222 either, as by design that port can only be used for text data streaming. The SSH protocol is used for the public/private key infrastructure and transport encryption only and DTail implements its own protocol on top of SSH for the features provided. There is no need to set up or buy any additional TLS certificates. The port 2222 can be easily reconfigured if you preferred to use a different one.</span><br />
+<br />
+<span>The DTail server, which is a single static binary, will not fork an external process. This means that all features are implemented in native Go code (exception: Linux ACL support is implemented in C, but it must be enabled explicitly on compile time) and therefore helping to make it robust, secure, efficient, and easy to deploy. A single client, running on a standard Laptop, can connect to thousands of servers concurrently while still maintaining a small resource footprint.</span><br />
+<br />
+<span>Recent log files are very likely still in the file system caches on the servers. Therefore, there tends to be a minimal I/O overhead involved.</span><br />
+<br />
+<h2 style='display: inline'>The DTail family of commands</h2><br />
+<br />
+<span>Following the UNIX philosophy, DTail includes multiple command-line commands each of them for a different purpose:</span><br />
+<br />
<ul>
<li>dserver: The DTail server, the only binary required to be installed on the servers involved.</li>
<li>dtail: The distributed log tail client for following log files.</li>
<li>dcat: The distributed cat client for concatenating and displaying text files.</li>
<li>dgrep: The distributed grep client for searching text files for a regular expression pattern.</li>
<li>dmap: The distributed map-reduce client for aggregating stats from log files.</li>
-</ul>
-<a href="https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dgrep.gif"><img alt="DGrep sample session animated gif" title="DGrep sample session animated gif" src="https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program/dgrep.gif" /></a><br />
-<h2>Usage example</h2>
-<p>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.</p>
-<p>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).</p>
-<p>The following example would connect to all DTail servers listed in the serverlist.txt, follow all files with the ending .log and filter for lines containing the string error. You can specify any Go compatible regular expression. In this example we add the case-insensitive flag to the regex:</p>
+</ul><br />
+<a href='./2021-04-22-dtail-the-distributed-log-tail-program/dgrep.gif'><img alt='DGrep sample session animated gif' title='DGrep sample session animated gif' src='./2021-04-22-dtail-the-distributed-log-tail-program/dgrep.gif' /></a><br />
+<br />
+<h2 style='display: inline'>Usage example</h2><br />
+<br />
+<span>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.</span><br />
+<br />
+<span>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).</span><br />
+<br />
+<span>The following example would connect to all DTail servers listed in the serverlist.txt, follow all files with the ending .log and filter for lines containing the string error. You can specify any Go compatible regular expression. In this example we add the case-insensitive flag to the regex:</span><br />
+<br />
<pre>
dtail –servers serverlist.txt –files ‘/var/log/*.log’ –regex ‘(?i:error)’
</pre>
-<p>You usually want to specify a regular expression as a client argument. This will mean that responses are pre-filtered for all matching lines on the server-side and thus sending back only the relevant lines to the client. If your logs are growing very rapidly and the regex is not specific enough there might be the chance that your client is not fast enough to keep up processing all of the responses. This could be due to a network bottleneck or just as simple as a slow terminal emulator displaying the log lines on the client-side.</p>
-<p>A green 100 in the client output before each log line received from the server always indicates that there were no such problems and 100% of all log lines could be displayed on your terminal (have a look at the animated Gifs in this post). If the percentage falls below 100 it means that some of the channels used by the servers to send data to the client are congested and lines were dropped. In this case, the color will change from green to red. The user then could decide to run the same query but with a more specific regex.</p>
-<p>You could also provide a comma-separated list of servers as opposed to a text file. There are many more options you could use. The ones listed here are just the very basic ones. There are more instructions and usage examples on the GitHub page. Also, you can study even more of the available options via the –help switch (some real treasures might be hidden there).</p>
-<h2>Fitting it in</h2>
-<p>DTail integrates nicely into the user management of existing infrastructure. It follows normal system permissions and does not open new “holes” on the server which helps to keep security departments happy. The user would not have more or less file read permissions than he would have via a regular SSH login shell. There is a full SSH key, traditional UNIX permissions, and Linux ACL support. There is also a very low resource footprint involved. On average for tailing and searching log files less than 100MB RAM and less than a quarter of a CPU core per participating server are required. Complex map-reduce queries on big data sets will require more resources accordingly.</p>
-<h2>Advanced features</h2>
-<p>The features listed here are out of the scope of this blog post but are worthwhile to mention:</p>
+<br />
+<span>You usually want to specify a regular expression as a client argument. This will mean that responses are pre-filtered for all matching lines on the server-side and thus sending back only the relevant lines to the client. If your logs are growing very rapidly and the regex is not specific enough there might be the chance that your client is not fast enough to keep up processing all of the responses. This could be due to a network bottleneck or just as simple as a slow terminal emulator displaying the log lines on the client-side.</span><br />
+<br />
+<span>A green 100 in the client output before each log line received from the server always indicates that there were no such problems and 100% of all log lines could be displayed on your terminal (have a look at the animated Gifs in this post). If the percentage falls below 100 it means that some of the channels used by the servers to send data to the client are congested and lines were dropped. In this case, the color will change from green to red. The user then could decide to run the same query but with a more specific regex.</span><br />
+<br />
+<span>You could also provide a comma-separated list of servers as opposed to a text file. There are many more options you could use. The ones listed here are just the very basic ones. There are more instructions and usage examples on the GitHub page. Also, you can study even more of the available options via the –help switch (some real treasures might be hidden there).</span><br />
+<br />
+<h2 style='display: inline'>Fitting it in</h2><br />
+<br />
+<span>DTail integrates nicely into the user management of existing infrastructure. It follows normal system permissions and does not open new “holes” on the server which helps to keep security departments happy. The user would not have more or less file read permissions than he would have via a regular SSH login shell. There is a full SSH key, traditional UNIX permissions, and Linux ACL support. There is also a very low resource footprint involved. On average for tailing and searching log files less than 100MB RAM and less than a quarter of a CPU core per participating server are required. Complex map-reduce queries on big data sets will require more resources accordingly.</span><br />
+<br />
+<h2 style='display: inline'>Advanced features</h2><br />
+<br />
+<span>The features listed here are out of the scope of this blog post but are worthwhile to mention:</span><br />
+<br />
<ul>
<li>Distributed map-reduce queries on stats provided in log files with dmap. dmap comes with its own SQL-like aggregation query language.</li>
<li>Stats streaming with continuous map-reduce queries. The difference to normal queries is that the stats are aggregated over a specified interval only on the newly written log lines. Thus, giving a de-facto live stat view for each interval.</li>
<li>Server-side scheduled queries on log files. The queries are configured in the DTail server configuration file and scheduled at certain time intervals. Results are written to CSV files. This is useful for generating daily stats from the log files without the need for an interactive client.</li>
<li>Server-side stats streaming with continuous map-reduce queries. This for example can be used to periodically generate stats from the logs at a configured interval, e.g., log error counts by the minute. These then can be sent to a time-series database (e.g., Graphite) and then plotted in a Grafana dashboard.</li>
<li>Support for custom extensions. E.g., for different server discovery methods (so you don’t have to rely on plain server lists) and log file formats (so that map-reduce queries can parse more stats from the logs).</li>
-</ul>
-<h2>For the future</h2>
-<p>There are various features we want to see in the future.</p>
+</ul><br />
+<h2 style='display: inline'>For the future</h2><br />
+<br />
+<span>There are various features we want to see in the future.</span><br />
+<br />
<ul>
<li>A spartan mode, not printing out any extra information but the raw remote log files would be a nice feature to have. This will make it easier to post-process the data produced by the DTail client with common UNIX tools. (To some degree this is possible already, just disable the ANSI terminal color output of the client with -noColors and pipe the output to another program).</li>
<li>Tempting would be implementing the dgoawk command, a distributed version of the AWK programming language purely implemented in Go, for advanced text data stream processing capabilities. There are 3rd party libraries available implementing AWK in pure Go which could be used.</li>
<li>A more complex change would be the support of federated queries. You can connect to thousands of servers from a single client running on a laptop. But does it scale to 100k of servers? Some of the servers could be used as middleware for connecting to even more servers.</li>
<li>Another aspect is to extend the documentation. Especially the advanced features such as map-reduce query language and how to configure the server-side queries currently do require more documentation. For now, you can read the code, sample config files or just ask the author for that! But this will be certainly addressed in the future.</li>
-</ul>
-<h2>Open Source</h2>
-<p>Mimecast highly encourages you to have a look at DTail and submit an issue for any features you would like to see. Have you found a bug? Maybe you just have a question or comment? If you want to go a step further: We would also love to see pull requests for any features or improvements. Either way, if in doubt just contact us via the DTail GitHub page.</p>
-<a class="textlink" href="https://dtail.dev">https://dtail.dev</a><br />
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-10-30-installing-dtail-on-openbsd.html">2022-10-30 Installing DTail on OpenBSD</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2022-03-06-the-release-of-dtail-4.0.0.html">2022-03-06 The release of DTail 4.0.0</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2021-04-22-dtail-the-distributed-log-tail-program.html">2021-04-22 DTail - The distributed log tail program (You are currently reading this)</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+</ul><br />
+<h2 style='display: inline'>Open Source</h2><br />
+<br />
+<span>Mimecast highly encourages you to have a look at DTail and submit an issue for any features you would like to see. Have you found a bug? Maybe you just have a question or comment? If you want to go a step further: We would also love to see pull requests for any features or improvements. Either way, if in doubt just contact us via the DTail GitHub page.</span><br />
+<br />
+<a class='textlink' href='https://dtail.dev'>https://dtail.dev</a><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2022-10-30-installing-dtail-on-openbsd.html'>2022-10-30 Installing DTail on OpenBSD</a><br />
+<a class='textlink' href='./2022-03-06-the-release-of-dtail-4.0.0.html'>2022-03-06 The release of DTail 4.0.0</a><br />
+<a class='textlink' href='./2021-04-22-dtail-the-distributed-log-tail-program.html'>2021-04-22 DTail - The distributed log tail program (You are currently reading this)</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -5807,17 +6527,23 @@ fib(10) = 55
<summary>PerlDaemon is a minimal daemon for Linux and other Unix like operating systems programmed in Perl. It is a minimal but pretty functional and fairly generic service framework. This means that it does not do anything useful other than providing a framework for starting, stopping, configuring and logging. To do something useful, a module (written in Perl) must be provided.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Perl Daemon (Service Framework)</h1>
-<p class="quote"><i>Published at 2011-05-07T22:26:02+01:00; Updated at 2021-05-07</i></p>
+ <h1 style='display: inline'>Perl Daemon (Service Framework)</h1><br />
+<br />
+<span class='quote'>Published at 2011-05-07T22:26:02+01:00; Updated at 2021-05-07</span><br />
+<br />
<pre>
a'! _,,_ a'! _,,_ a'! _,,_
\\_/ \ \\_/ \ \\_/ \.-,
\, /-( /'-,\, /-( /'-, \, /-( /
//\ //\\ //\ //\\ //\ //\\jrei
</pre>
-<p>PerlDaemon is a minimal daemon for Linux and other Unix like operating systems programmed in Perl. It is a minimal but pretty functional and fairly generic service framework. This means that it does not do anything useful other than providing a framework for starting, stopping, configuring and logging. To do something useful, a module (written in Perl) must be provided.</p>
-<h2>Features</h2>
-<p>PerlDaemon supports:</p>
+<br />
+<span>PerlDaemon is a minimal daemon for Linux and other Unix like operating systems programmed in Perl. It is a minimal but pretty functional and fairly generic service framework. This means that it does not do anything useful other than providing a framework for starting, stopping, configuring and logging. To do something useful, a module (written in Perl) must be provided.</span><br />
+<br />
+<h2 style='display: inline'>Features</h2><br />
+<br />
+<span>PerlDaemon supports:</span><br />
+<br />
<ul>
<li>Automatic daemonizing</li>
<li>Logging</li>
@@ -5827,8 +6553,9 @@ fib(10) = 55
<li>Easy to configure</li>
<li>Easy to extend</li>
<li>Multi-instance support (just use a different directory for each instance).</li>
-</ul>
-<h2>Quick Guide</h2>
+</ul><br />
+<h2 style='display: inline'>Quick Guide</h2><br />
+<br />
<pre>
# Starting
./bin/perldaemon start (or shortcut ./control start)
@@ -5839,9 +6566,13 @@ fib(10) = 55
# Alternatively: Starting in foreground
./bin/perldaemon start daemon.daemonize=no (or shortcut ./control foreground)
</pre>
-<p>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.</p>
-<h2>How to configure</h2>
-<p>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":</p>
+<br />
+<span>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.</span><br />
+<br />
+<h2 style='display: inline'>How to configure</h2><br />
+<br />
+<span>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":</span><br />
+<br />
<pre>
pb@titania:~/svn/utils/perldaemon/trunk$ ./control keys
# Path to the logfile
@@ -5868,8 +6599,11 @@ daemon.alivefile=./run/perldaemon.alive
# Specifies the working directory
daemon.wd=./
</pre>
-<h2>Example </h2>
-<p>So let's start the daemon with a loop interval of 10 seconds:</p>
+<br />
+<h2 style='display: inline'>Example </h2><br />
+<br />
+<span>So let's start the daemon with a loop interval of 10 seconds:</span><br />
+<br />
<pre>
$ ./control keys | grep daemon.loopinterval
daemon.loopinterval=1
@@ -5883,15 +6617,23 @@ Mon Jun 13 11:29:27 2011 (PID 2838): ExampleModule Test 2
$ ./control stop
Stopping daemon now...
</pre>
-<p>If you want to change that property forever, either edit perldaemon.conf or do this:</p>
+<br />
+<span>If you want to change that property forever, either edit perldaemon.conf or do this:</span><br />
+<br />
<pre>
$ ./control keys daemon.loopinterval=10 &gt; new.conf; mv new.conf conf/perldaemon.conf
</pre>
-<h2>HiRes event loop</h2>
-<p>PerlDaemon uses <span class="inlinecode">Time::HiRes</span> to make sure that all the events run incorrect intervals. For each loop run, a time carry value is recorded and added to the next loop run to catch up on lost time.</p>
-<h2>Writing your own modules</h2>
-<h3>Example module</h3>
-<p>This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-).</p>
+<br />
+<h2 style='display: inline'>HiRes event loop</h2><br />
+<br />
+<span>PerlDaemon uses <span class='inlinecode'>Time::HiRes</span> to make sure that all the events run incorrect intervals. For each loop run, a time carry value is recorded and added to the next loop run to catch up on lost time.</span><br />
+<br />
+<h2 style='display: inline'>Writing your own modules</h2><br />
+<br />
+<h3 style='display: inline'>Example module</h3><br />
+<br />
+<span>This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-).</span><br />
+<br />
<pre>
package PerlDaemonModules::ExampleModule;
@@ -5923,8 +6665,11 @@ sub do ($) {
1;
</pre>
-<h3>Your own module</h3>
-<p>Want to give it some better use? It's just as easy as:</p>
+<br />
+<h3 style='display: inline'>Your own module</h3><br />
+<br />
+<span>Want to give it some better use? It's just as easy as:</span><br />
+<br />
<pre>
cd ./lib/PerlDaemonModules/
cp ExampleModule.pm YourModule.pm
@@ -5932,17 +6677,26 @@ sub do ($) {
cd -
./bin/perldaemon restart (or shortcurt ./control restart)
</pre>
-<p>Now watch <span class="inlinecode">./log/perldaemon.log</span> closely. It is a good practice to test your modules in 'foreground mode' (see above how to do that).</p>
-<p>BTW: You can install as many modules within the same instance as desired. But they are run in sequential order (in future, they can also run in parallel using several threads or processes).</p>
-<h2>May the source be with you</h2>
-<p>You can find PerlDaemon (including the examples) at:</p>
-<a class="textlink" href="https://codeberg.org/snonux/perldaemon">https://codeberg.org/snonux/perldaemon</a><br />
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-05-27-perl-is-still-a-great-choice.html">2022-05-27 Perl is still a great choice</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2011-05-07-perl-daemon-service-framework.html">2011-05-07 Perl Daemon (Service Framework) (You are currently reading this)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2008-06-26-perl-poetry.html">2008-06-26 Perl Poetry</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+<br />
+<span>Now watch <span class='inlinecode'>./log/perldaemon.log</span> closely. It is a good practice to test your modules in 'foreground mode' (see above how to do that).</span><br />
+<br />
+<span>BTW: You can install as many modules within the same instance as desired. But they are run in sequential order (in future, they can also run in parallel using several threads or processes).</span><br />
+<br />
+<h2 style='display: inline'>May the source be with you</h2><br />
+<br />
+<span>You can find PerlDaemon (including the examples) at:</span><br />
+<br />
+<a class='textlink' href='https://codeberg.org/snonux/perldaemon'>https://codeberg.org/snonux/perldaemon</a><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2022-05-27-perl-is-still-a-great-choice.html'>2022-05-27 Perl is still a great choice</a><br />
+<a class='textlink' href='./2011-05-07-perl-daemon-service-framework.html'>2011-05-07 Perl Daemon (Service Framework) (You are currently reading this)</a><br />
+<a class='textlink' href='./2008-06-26-perl-poetry.html'>2008-06-26 Perl Poetry</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>
@@ -6677,8 +7431,10 @@ _jgs_\|//_\\|///_\V/_\|//__
<summary>Here are some Perl Poems I wrote. They don't do anything useful when you run them, but they don't produce a compiler error either. They only exist for fun and demonstrate what you can do with Perl syntax.</summary>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
- <h1>Perl Poetry</h1>
-<p class="quote"><i>Published at 2008-06-26T21:43:51+01:00; Updated at 2021-05-04</i></p>
+ <h1 style='display: inline'>Perl Poetry</h1><br />
+<br />
+<span class='quote'>Published at 2008-06-26T21:43:51+01:00; Updated at 2021-05-04</span><br />
+<br />
<pre>
'\|/' *
-- * -----
@@ -6701,10 +7457,15 @@ _~~|~/_|_|__/|~~~~~~~ | / ~~~~~ | | ~~~~~~~~
~ ~ ~~~ _|| (_/ (___)_| |Nov291999
(__) (____)
</pre>
-<p>Here are some Perl Poems I wrote. They don't do anything useful when you run them, but they don't produce a compiler error either. They only exist for fun and demonstrate what you can do with Perl syntax.</p>
-<p>Wikipedia: "Perl poetry is the practice of writing poems that can be compiled as legal Perl code, for example the piece known as Black Perl. Perl poetry is made possible by the large number of English words that are used in the Perl language. New poems are regularly submitted to the community at PerlMonks."</p>
-<a class="textlink" href="https://en.wikipedia.org/wiki/Perl">https://en.wikipedia.org/wiki/Perl</a><br />
-<h2>math.pl</h2>
+<br />
+<span>Here are some Perl Poems I wrote. They don't do anything useful when you run them, but they don't produce a compiler error either. They only exist for fun and demonstrate what you can do with Perl syntax.</span><br />
+<br />
+<span>Wikipedia: "Perl poetry is the practice of writing poems that can be compiled as legal Perl code, for example the piece known as Black Perl. Perl poetry is made possible by the large number of English words that are used in the Perl language. New poems are regularly submitted to the community at PerlMonks."</span><br />
+<br />
+<a class='textlink' href='https://en.wikipedia.org/wiki/Perl'>https://en.wikipedia.org/wiki/Perl</a><br />
+<br />
+<h2 style='display: inline'>math.pl</h2><br />
+<br />
<pre>
#!/usr/bin/perl
@@ -6746,7 +7507,9 @@ home: //ig,'nore', time and sleep $very =~ s/tr/on/g;
__END__
</pre>
-<h2>christmas.pl</h2>
+<br />
+<h2 style='display: inline'>christmas.pl</h2><br />
+<br />
<pre>
#!/usr/bin/perl
@@ -6790,7 +7553,9 @@ __END__
This is perl, v5.8.8 built for i386-freebsd-64int
</pre>
-<h2>shopping.pl</h2>
+<br />
+<h2 style='display: inline'>shopping.pl</h2><br />
+<br />
<pre>
#!/usr/bin/perl
@@ -6822,15 +7587,22 @@ and sleep until unpack$ing, cool products();
__END__
This is perl, v5.8.8 built for i386-freebsd-64int
</pre>
-<h2>More...</h2>
-<p>Did you like what you saw? Have a look at Codeberg to see my other poems too:</p>
-<a class="textlink" href="https://codeberg.org/snonux/perl-poetry">https://codeberg.org/snonux/perl-poetry</a><br />
-<p>Other related posts are:</p>
-<a class="textlink" href="https://foo.zone/gemfeed/2022-05-27-perl-is-still-a-great-choice.html">2022-05-27 Perl is still a great choice</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2011-05-07-perl-daemon-service-framework.html">2011-05-07 Perl Daemon (Service Framework)</a><br />
-<a class="textlink" href="https://foo.zone/gemfeed/2008-06-26-perl-poetry.html">2008-06-26 Perl Poetry (You are currently reading this)</a><br />
-<p>E-Mail your comments to hi@paul.cyou :-)</p>
-<a class="textlink" href="../">Back to the main site</a><br />
+<br />
+<h2 style='display: inline'>More...</h2><br />
+<br />
+<span>Did you like what you saw? Have a look at Codeberg to see my other poems too:</span><br />
+<br />
+<a class='textlink' href='https://codeberg.org/snonux/perl-poetry'>https://codeberg.org/snonux/perl-poetry</a><br />
+<br />
+<span>Other related posts are:</span><br />
+<br />
+<a class='textlink' href='./2022-05-27-perl-is-still-a-great-choice.html'>2022-05-27 Perl is still a great choice</a><br />
+<a class='textlink' href='./2011-05-07-perl-daemon-service-framework.html'>2011-05-07 Perl Daemon (Service Framework)</a><br />
+<a class='textlink' href='./2008-06-26-perl-poetry.html'>2008-06-26 Perl Poetry (You are currently reading this)</a><br />
+<br />
+<span>E-Mail your comments to hi@paul.cyou :-)</span><br />
+<br />
+<a class='textlink' href='../'>Back to the main site</a><br />
</div>
</content>
</entry>