<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Colas.Nahaboo.net - Code</title>
    <subtitle>Colas Nahaboo personal site, with discussions about programming code, web and computing topics, surfing and SUPing, and various musings.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://colas.nahaboo.net/code/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-04-13T00:00:00+00:00</updated>
    <id>https://colas.nahaboo.net/code/atom.xml</id>
    <entry xml:lang="en">
        <title>Save these Firefox tabs for later</title>
        <published>2026-04-13T00:00:00+00:00</published>
        <updated>2026-04-13T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/save-these-firefox-tabs-for-later/"/>
        <id>https://colas.nahaboo.net/code/save-these-firefox-tabs-for-later/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/save-these-firefox-tabs-for-later/">&lt;p&gt;I often look for some concept out of curiority, and end up with tens of browser tabs opened on the subject, and realize that I have no time now to pursue this rabbit into his hole, end up with tons of Firefox windows with tens of tabs gathering dust (and eating RAM) on my desktop. Up to now I just created Foswiki pages or Trello tasks as reminders to tackle these projects later on, but it required enough manual work to often postpone doing it and either losing the info or be swamped in thousands of tabs. And saving them as Firefox bookmarks was cumbersome and required lots of manual management.&lt;&#x2F;p&gt;
&lt;p&gt;What I decided to do is a simple way to save all these tabs offline, and be able to re-open the window simply. I bundle them into what I call &lt;strong&gt;.ffst files&lt;&#x2F;strong&gt; (for FireFox Saved Tabs), simple text files of one url per line, into a &lt;code&gt;~&#x2F;firefox-savedtabs&#x2F;&lt;&#x2F;code&gt; directory.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Saving a set of tabs&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Select the tabs (click on the first one, shift-click on the last one)&lt;&#x2F;li&gt;
&lt;li&gt;Open the right-mouse-button menu on a tab, and select &lt;code&gt;Copy URLs&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Create a new file (e.g: &lt;code&gt;some-name.ffst&lt;&#x2F;code&gt;) in the &lt;code&gt;~&#x2F;firefox-savedtabs&#x2F;&lt;&#x2F;code&gt; directory with your favorite editor,&lt;&#x2F;li&gt;
&lt;li&gt;Paste the tabs into it,&lt;&#x2F;li&gt;
&lt;li&gt;Save.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Restoring the tabs into a new window:&lt;&#x2F;strong&gt; either by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;running the script below &lt;code&gt;firefox-savedtabs-restore&lt;&#x2F;code&gt; without arguments, and choosing which file to restore.&lt;&#x2F;li&gt;
&lt;li&gt;running the script with the ffst file as argument:&lt;br &#x2F;&gt;
&lt;code&gt;firefox-savedtabs-restore some-name.ffst&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Browsing the directory  &lt;code&gt;~&#x2F;firefox-savedtabs&#x2F;&lt;&#x2F;code&gt; in a file explorer window, and choosing to open the .ffst file with &lt;code&gt;Firefox SavedTabs restore&lt;&#x2F;code&gt; once you have created the &lt;code&gt;~&#x2F;.local&#x2F;share&#x2F;applications&#x2F;firefox-savedtabs.desktop&lt;&#x2F;code&gt; file below&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I can thus just mention the .ffstr file in my various &quot;todo&quot; places (TODO lists, TODO files, pinboard, wikis, trello, ...)&lt;&#x2F;p&gt;
&lt;p&gt;Note that you can adapt this to any browser, and choose whatever directory name and file extension you want.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Updating&lt;&#x2F;strong&gt; the tabs is just re-copying the urls and re-pasting in the file.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-two-scripts-are&quot;&gt;The two scripts are:&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-two-scripts-are&quot; aria-label=&quot;Anchor link for: the-two-scripts-are&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;usr-local-bin-firefox-savedtabs-restore&quot;&gt;&#x2F;usr&#x2F;local&#x2F;bin&#x2F;firefox-savedtabs-restore&lt;a class=&quot;zola-anchor&quot; href=&quot;#usr-local-bin-firefox-savedtabs-restore&quot; aria-label=&quot;Anchor link for: usr-local-bin-firefox-savedtabs-restore&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Note that you can modify in it the &lt;code&gt;restore&lt;&#x2F;code&gt; function to use with another browser.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #EA76CB;font-style: italic;&quot;&gt;#!&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;font-style: italic;&quot;&gt;# shellcheck disable=SC1090,SC2155,SC2046 # source files, declare&amp;amp;assign&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;font-style: italic;&quot;&gt;# restore saved tabs bundles (text files of urls, one per line)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;$HOME&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&#x2F;firefox-savedtabs&#x2F;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt;restore&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;(){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt;    mapfile&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; -t urls&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E64553;font-style: italic;&quot;&gt;$1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt;    firefox&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; --new-window &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;${urls&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;@&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #D20F39;font-style: italic;&quot;&gt;    exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FE640B;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt; [[&lt;&#x2F;span&gt;&lt;span&gt; $#&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FE640B;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt; ]];&lt;&#x2F;span&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;font-style: italic;&quot;&gt;    # Without args, list the saves, most recent first, and prompt to restore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #D20F39;font-style: italic;&quot;&gt;    echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;In ~&#x2F;.firefox-savedtabs&#x2F;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #D20F39;font-style: italic;&quot;&gt;    cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;$dir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D20F39;font-style: italic;&quot;&gt; exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FE640B;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt;    select&lt;&#x2F;span&gt;&lt;span&gt; i in &lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;$(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt;find&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; . -type f -name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #EA76CB;&quot;&gt; \*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;.ffst&lt;&#x2F;span&gt;&lt;span style=&quot;color: #EA76CB;&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;                    -printf &amp;#39;%TY-%Tm-%Td.%THh%TM:%TS %h&#x2F;%f\n&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: #EA76CB;&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt;                   sed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; -e &amp;#39;s| [.]&#x2F;|_|&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt; sort&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; -r&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: #EA76CB;&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt;                   sed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; -re &amp;#39;s&#x2F;:[0-9]{2}[.][0-9]*&#x2F;&#x2F;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;);&lt;&#x2F;span&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt; do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt;        restore&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;${i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;#*&lt;&#x2F;span&gt;&lt;span&gt;_}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt;    done&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt;else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;font-style: italic;&quot;&gt;    # with a file name or path, restore the window&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    file&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E64553;font-style: italic;&quot;&gt;$1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt; [[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; -e&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;$file&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt; ]];&lt;&#x2F;span&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt;        restore&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;$file&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt; [[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; -e&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;$file&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt; ]] &amp;amp;&amp;amp; [[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; -e&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;$dir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;$file&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt; ]];&lt;&#x2F;span&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        file&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;$dir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;$file&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;font-style: italic;&quot;&gt;        restore&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;$file&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt;    else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #D20F39;font-style: italic;&quot;&gt;        echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;***Error: file not found: &lt;&#x2F;span&gt;&lt;span style=&quot;color: #EA76CB;&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;$file&lt;&#x2F;span&gt;&lt;span style=&quot;color: #EA76CB;&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; in &lt;&#x2F;span&gt;&lt;span&gt;$dir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #D20F39;font-style: italic;&quot;&gt;        exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FE640B;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt;    fi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8839EF;&quot;&gt;fi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;local-share-applications-firefox-savedtabs-desktop&quot;&gt;~&#x2F;.local&#x2F;share&#x2F;applications&#x2F;firefox-savedtabs.desktop&lt;a class=&quot;zola-anchor&quot; href=&quot;#local-share-applications-firefox-savedtabs-desktop&quot; aria-label=&quot;Anchor link for: local-share-applications-firefox-savedtabs-desktop&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #DF8E1D;&quot;&gt;Desktop Entry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;Name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Firefox SavedTabs restore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;font-style: italic;&quot;&gt;# update-desktop-database ~&#x2F;.local&#x2F;share&#x2F;applications&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;Exec&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;usr&#x2F;local&#x2F;bin&#x2F;firefox-savedtabs-restore %u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;Type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Application&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;Terminal&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;MimeType&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;x-scheme-handler&#x2F;x-firefox-savedtabs&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;font-style: italic;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Converting Zola pages from TOML to YAML</title>
        <published>2026-04-07T00:00:00+00:00</published>
        <updated>2026-04-07T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/converting-zola-pages-from-toml-to-yaml/"/>
        <id>https://colas.nahaboo.net/code/converting-zola-pages-from-toml-to-yaml/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/converting-zola-pages-from-toml-to-yaml/">&lt;p&gt;Since &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.getzola.org&#x2F;&quot;&gt;Zola&lt;&#x2F;a&gt; now supports frontmatter in its markdown pages in the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;yaml.org&#x2F;&quot;&gt;YAML&lt;&#x2F;a&gt; format in addition to the original &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;toml.io&#x2F;&quot;&gt;TOML&lt;&#x2F;a&gt;, I decided to migrate all my pages to YAML, as it is both easier to read and write for humans, and natively understood by a majority of tools (Emacs, marktext, obsidian, vs-code, typos, zettlt...)&lt;&#x2F;p&gt;
&lt;p&gt;So I wrote a small bash script for the conversion, &lt;code&gt;site-toml2yaml&lt;&#x2F;code&gt; (all my personal site management tools start with the prefix &lt;code&gt;site-&lt;&#x2F;code&gt; for taking advantage of the tab-completion).
It should run on any Linux or Unix system, and it requires &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;TomWright&#x2F;dasel&quot;&gt;dasel&lt;&#x2F;a&gt; and the usual gang: grep, sed, head...&lt;&#x2F;p&gt;
&lt;p&gt;Note that you could also use &lt;strong&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gohugo.io&#x2F;commands&#x2F;hugo_convert&#x2F;&quot;&gt;hugo convert&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;, but I haven&#x27;t tested it.&lt;&#x2F;p&gt;
&lt;p&gt;You can grab it at my &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;colas-zola-tools&quot;&gt;zola-tools repository&lt;&#x2F;a&gt;. This repository is quite empty for now, but I will use it to publish the various small tools I use to maintain this public site.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;a class=&quot;zola-anchor&quot; href=&quot;#usage&quot; aria-label=&quot;Anchor link for: usage&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;site-toml2yaml&lt;&#x2F;strong&gt; &lt;em&gt;md-files or directories...&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Converts in place the frontmatter of Markdown files from TOML to YAML.&lt;br &#x2F;&gt;
It recurses in directories, but looking only for &lt;code&gt;*.md&lt;&#x2F;code&gt; files and sub-dirs.&lt;br &#x2F;&gt;
Without argument, run on &lt;code&gt;${ZOLA_ROOT}&#x2F;content&#x2F;&lt;&#x2F;code&gt; &lt;br &#x2F;&gt;
Should work on any Markdown files with TOML frontmatter.&lt;&#x2F;p&gt;
&lt;p&gt;You should only run it on your content&#x2F; dir normally. For instance running it
on your themes&#x2F; dir will risk messing your imported themes&lt;&#x2F;p&gt;
&lt;p&gt;WARNING: it modifies the files in place, so MAKE A BACKUP before running it!&lt;&#x2F;p&gt;
&lt;h2 id=&quot;why-converting-to-yaml&quot;&gt;Why converting to YAML?&lt;a class=&quot;zola-anchor&quot; href=&quot;#why-converting-to-yaml&quot; aria-label=&quot;Anchor link for: why-converting-to-yaml&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;TOML is arguably a &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;npf.io&#x2F;2014&#x2F;08&#x2F;intro-to-toml&#x2F;&quot;&gt;better configuration file format&lt;&#x2F;a&gt; than YAML, but only if you want to use it as a simpler JSON, i.e. a well-specified, unambiguous way to represent any data.&lt;&#x2F;p&gt;
&lt;p&gt;However, I feel that for the simple and limited use case of Zola pages frontmatter, it is overkill and thus a real pain to read and edit by hand. Let&#x27;s take an example:&lt;&#x2F;p&gt;
&lt;div class=&#x27;tables-horiz meta&#x27;&gt;
&lt;div&gt;
&lt;h3&gt;TOML&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;table1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    foo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;bar&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;    [&lt;&#x2F;span&gt;&lt;span&gt;table1.nested_table&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        baz&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;bat&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;[[&lt;&#x2F;span&gt;&lt;span&gt;comments&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;author&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;Nate&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;Great Article!&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;[[&lt;&#x2F;span&gt;&lt;span&gt;comments&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;author&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;Anonymous&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; &amp;quot;Love it!&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;div&gt;
&lt;div&gt;
&lt;h3&gt;YAML&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;comments&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;  -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt; author&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; Nate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;    text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; Great Article!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7C7F93;&quot;&gt;  -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt; author&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; Anonymous&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;    text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; Love it!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;table1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;  foo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; bar&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;  nested_table&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #1E66F5;&quot;&gt;    baz&lt;&#x2F;span&gt;&lt;span style=&quot;color: #179299;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #40A02B;&quot;&gt; bat&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;
&lt;p&gt;See? Especially for people like me with a Unix culture, the YAML format seems both more natural (resembling the format of email or HTTP headers, the use of indentation à la Python), and TOML has a repulsive Windows flavor. Add to this that most of the tools I use understand natively YAML frontmatter but not TOML, and the decision is easy.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Explicit Action Pattern keeps you in the flow</title>
        <published>2026-04-05T00:00:00+00:00</published>
        <updated>2026-04-05T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/explicit-action-pattern-keeps-you-in-the-flow/"/>
        <id>https://colas.nahaboo.net/code/explicit-action-pattern-keeps-you-in-the-flow/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/explicit-action-pattern-keeps-you-in-the-flow/">&lt;p&gt;When designing interfaces for tools for my personal use, I have been using what I call an &lt;strong&gt;Explicit Action Pattern&lt;&#x2F;strong&gt;, the opposite of modal design. Due to the general trend towards minimalism of modern UI practice, it is not used a lot, but I think it should, and here is why.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;examples&quot;&gt;Examples&lt;a class=&quot;zola-anchor&quot; href=&quot;#examples&quot; aria-label=&quot;Anchor link for: examples&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;

&lt;table style=&#x27;background-color: #f0f7ff;&#x27;&gt;
  &lt;tr&gt;
    &lt;th&gt;Explicit Action Pattern&lt;&#x2F;th&gt;&lt;th&gt;Modal Design&lt;&#x2F;th&gt;
  &lt;&#x2F;tr&gt;
  &lt;tr&gt;
    &lt;td style=&#x27;padding-right:2em;&#x27;&gt;
      &lt;div&gt;&lt;b&gt;Initial Search&lt;&#x2F;b&gt;&lt;&#x2F;div&gt;
      &lt;form style=&#x27;display:inline&#x27;&gt;
        &lt;input name=search value=&quot;&quot; size=24&gt;
          &lt;input type=submit value=&#x27;SEARCH ALL&#x27; style=&#x27;font-weight:bold&#x27;&gt;
      &lt;&#x2F;form&gt;
      &lt;br&gt;
      &lt;form style=&#x27;display:inline&#x27;&gt;
        &lt;input name=search value=&quot;&quot; size=24&gt;
        &lt;input type=submit value=&#x27;Search Movie&#x27;&gt;
      &lt;&#x2F;form&gt;
      &lt;br&gt;
      &lt;form style=&#x27;display:inline&#x27;&gt;
        &lt;input name=search value=&quot;&quot; size=24&gt;
        &lt;input type=submit value=&#x27;Search Music&#x27;&gt;
      &lt;&#x2F;form&gt;
      &lt;br&gt;
      &lt;form style=&#x27;display:inline&#x27;&gt;
        &lt;input name=search value=&quot;Alan Cooper&quot; size=24&gt;
        &lt;input type=submit value=&#x27;Search EBook&#x27;&gt;
      &lt;&#x2F;form&gt;
    &lt;&#x2F;td&gt;
    &lt;td&gt;
      &lt;form style=&#x27;display:inline&#x27;&gt;
        &lt;input name=search value=&quot;Alan Cooper&quot; size=24&gt;
        &lt;input type=submit value=&#x27;Search&#x27;&gt;
        &lt;br&gt;
        &lt;input type=&quot;radio&quot; id=&quot;0&quot; name=&quot;movie&quot; value=&quot;all&quot; &#x2F;&gt;
        &lt;label for=&quot;0&quot;&gt;&lt;b&gt;All&lt;&#x2F;b&gt;&lt;&#x2F;label&gt;
        &lt;input type=&quot;radio&quot; id=&quot;1&quot; name=&quot;movie&quot; value=&quot;movie&quot; &#x2F;&gt;
        &lt;label for=&quot;1&quot;&gt;movie&lt;&#x2F;label&gt;
        &lt;input type=&quot;radio&quot; id=&quot;2&quot; name=&quot;movie&quot; value=&quot;music&quot; &#x2F;&gt;
        &lt;label for=&quot;2&quot;&gt;music&lt;&#x2F;label&gt;
        &lt;input type=&quot;radio&quot; id=&quot;3&quot; name=&quot;movie&quot; value=&quot;ebook&quot; checked &#x2F;&gt;
        &lt;label for=&quot;3&quot;&gt;ebook&lt;&#x2F;label&gt;
      &lt;&#x2F;form&gt;
    &lt;&#x2F;td&gt;
  &lt;&#x2F;tr&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;div&gt;&lt;b&gt;Search results...&lt;&#x2F;b&gt;&lt;&#x2F;div&gt;
      &lt;form style=&#x27;display:inline&#x27;&gt;
        &lt;input name=search size=24 value=&quot;&quot;&gt;
        &lt;input type=submit value=Search&gt;
      &lt;&#x2F;form&gt;
      &lt;br&gt;
      &lt;form style=&#x27;display:inline&#x27;&gt;
        &lt;input name=search value=&quot;Alan Cooper&quot; size=24&gt;
        &lt;input type=submit value=&quot;Re Search&quot;&gt;
      &lt;&#x2F;form&gt;
    &lt;&#x2F;td&gt;
    &lt;td&gt;
      &lt;form style=&#x27;display:inline&#x27;&gt;
        &lt;input name=search value=&quot;Alan Cooper&quot; size=24&gt;
        &lt;input type=submit value=&#x27;Search&#x27;&gt;
        &lt;input type=submit value=&#x27;Clear&#x27;&gt;
        &lt;br&gt;
        &lt;input type=&quot;radio&quot; id=&quot;0&quot; name=&quot;movie&quot; value=&quot;all&quot; &#x2F;&gt;
        &lt;label for=&quot;0&quot;&gt;&lt;b&gt;All&lt;&#x2F;b&gt;&lt;&#x2F;label&gt;
        &lt;input type=&quot;radio&quot; id=&quot;1&quot; name=&quot;movie&quot; value=&quot;movie&quot; &#x2F;&gt;
        &lt;label for=&quot;1&quot;&gt;movie&lt;&#x2F;label&gt;
        &lt;input type=&quot;radio&quot; id=&quot;2&quot; name=&quot;movie&quot; value=&quot;music&quot; &#x2F;&gt;
        &lt;label for=&quot;2&quot;&gt;music&lt;&#x2F;label&gt;
        &lt;input type=&quot;radio&quot; id=&quot;3&quot; name=&quot;movie&quot; value=&quot;ebook&quot; checked &#x2F;&gt;
        &lt;label for=&quot;3&quot;&gt;ebook&lt;&#x2F;label&gt;
      &lt;&#x2F;form&gt;
    &lt;&#x2F;td&gt;
  &lt;&#x2F;tr&gt;
&lt;&#x2F;table&gt;

&lt;p&gt;As you can see in the top row, for searching an ebook, I will &quot;flow&quot; through the form from left to right, filling the relevant field and hitting the return key, or pressing the &quot;Search EBook&quot; button. But with the traditional modal design, choosing the radio button &quot;ebook&quot; breaks my flow of entry.&lt;&#x2F;p&gt;
&lt;p&gt;On the second row, you can see how I use this design for providing a &quot;search again&quot; form, where I can choose to enter a new search, or edit the previous one by selecting the relevant search box. It treats the search interface like a REPL (Read-Eval-Print Loop) rather than a static webpage. Whereas in the traditional way, I would have to break my flow to go hit the &quot;Clear&quot; button to empty the field.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;interaction-flow&quot;&gt;Interaction flow&lt;a class=&quot;zola-anchor&quot; href=&quot;#interaction-flow&quot; aria-label=&quot;Anchor link for: interaction-flow&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;So, rather than breaking the flow of the interactions to set modes, you just flow seamlessly into branches of the decision tree. If we take a car driving analogy, you just choose a direction when encountering a fork in the road, rather than having to get out of the car to move a barrier before resuming your ride.&lt;&#x2F;p&gt;
&lt;script src=https:&#x2F;&#x2F;colas.nahaboo.net&#x2F;js&#x2F;mermaid.js&gt;&lt;&#x2F;script&gt;

&lt;pre class=&quot;mermaid&quot;&gt;
  

graph TD;
    User((User Interaction));

    %% LEFT SIDE: Explicit Pattern (Parallel)
    subgraph Explicit [&quot;Explicit Action Pattern (Parallel)&quot;];
        FormB[Dedicated Form: Search Books];
        InputB[&#x2F;Input Field: Books&#x2F;];
        FormM[Dedicated Form: Search Movies];
        InputM[&#x2F;Input Field: Movies&#x2F;];
    end;

    %% RIGHT SIDE: Modal Pattern (Sequential)
    subgraph Modal [&quot;Modal     Design (Sequential)&quot;];
        FormS[Single Search Form];
        %% The Vertical Spine (invisible link to keep things straight)
        FormS ~~~ InputS[&#x2F;Generic Input Field&#x2F;];
        %% The &quot;Hook&quot; - Positioned to the side
        Mode{{Mode Selection: Books vs Movies}};
    end;

    %% Explicit Connections (Direct Flow)
    User --&gt; FormB;
    User --&gt; FormM;
    FormB --&gt; InputB;
    FormM --&gt; InputM;
    InputB --&gt; Submit((Submit));
    InputM --&gt; Submit;

    %% Modal Connections (The Hook Flow)
    User --&gt; FormS;
    FormS --&gt; Mode;
    Mode --&gt; InputS;
    InputS --&gt; Submit;

    %% Styling from original source
    style FormB fill:#f9f,stroke:#333;
    style FormM fill:#f9f,stroke:#333;
    style InputB fill:#ccf,stroke:#333;
    style InputM fill:#ccf,stroke:#333;
    style Modal fill:#f5f5f5,stroke:#999,stroke-dasharray: 5 5;
    style FormS fill:#eee,stroke:#999;
    style Mode fill:#fff,stroke:#333,stroke-width:2px;
&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;benefits&quot;&gt;Benefits&lt;a class=&quot;zola-anchor&quot; href=&quot;#benefits&quot; aria-label=&quot;Anchor link for: benefits&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;This Explicit Action Pattern has many benefits for power users:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Distributed Entry:&lt;&#x2F;strong&gt; Breaking one complex task into multiple simple, dedicated entry points.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Parallel UI:&lt;&#x2F;strong&gt; Presenting all options simultaneously rather than hiding them behind a selection step.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Non-Modal Interaction:&lt;&#x2F;strong&gt; Avoiding the &quot;mode&quot; where you have to set a state (e.g., clicking a radio button) before you can perform the actual action.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For the examples above:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Feature&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Separate Dedicated Fields&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Single Field + mode switches&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Cognitive Load&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Higher initial load&lt;&#x2F;strong&gt; (more to look at), unless you are already used to this UI.&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Lower initial load&lt;&#x2F;strong&gt; (cleaner look), especially for novices.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Physical Effort&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Lower&lt;&#x2F;strong&gt; (Click bar → Type → Enter).&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Higher&lt;&#x2F;strong&gt; (Click radio → Click bar → Type → Enter).&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Intent Clarity&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Absolute from the moment you click.&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Ambiguous until the modifier is set.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Screen Space&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&quot;Expensive&quot;; requires more vertical&#x2F;grid space.&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Efficient; fits in a header.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This is essentially applying &lt;strong&gt;Functional Programming&lt;&#x2F;strong&gt; and &lt;strong&gt;CLI philosophy&lt;&#x2F;strong&gt; to a GUI.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Immutability:&lt;&#x2F;strong&gt; The pre-filled field is the &quot;original state.&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Pure Functions:&lt;&#x2F;strong&gt; Each input field has a single, predictable output.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;No Side Effects:&lt;&#x2F;strong&gt; Clearing one field doesn&#x27;t break your ability to see the other.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In a nutshell, &lt;strong&gt;Directness over Modality&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;for-power-users&quot;&gt;For power users&lt;a class=&quot;zola-anchor&quot; href=&quot;#for-power-users&quot; aria-label=&quot;Anchor link for: for-power-users&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;If you are used to CLI environments, or using mostly keyboards shortcuts in interfaces, or editors like Emacs or vi, your brain likely functions on &quot;Command-Action&quot; pairs. And Explicit Action Patterns offers you:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Muscle Memory:&lt;&#x2F;strong&gt; You can bind a specific field to a specific mental &quot;slot.&quot; You don&#x27;t have to check the state of a radio button before hitting enter; you &lt;em&gt;know&lt;&#x2F;em&gt; which field you are in. It transforms a two-click &quot;hunt and peck&quot; task into a single-click muscle memory task. You don&#x27;t have to wait for an animation or look for a label; you just hit the coordinate on the screen you already know.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;No &quot;Context Switch&quot; Tax:&lt;&#x2F;strong&gt; Selecting a radio button is a &quot;mode switch.&quot; It requires you to stop thinking about your search query for a second to handle the UI mechanics. Separate fields eliminate that tax.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Visual Affordance:&lt;&#x2F;strong&gt; The label &quot;Search Movies&quot; is context-free, an immediate call to action. A generic &quot;Search&quot; box is a mystery until you look at the surrounding buttons.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;in-the-real-world&quot;&gt;In the real world&lt;a class=&quot;zola-anchor&quot; href=&quot;#in-the-real-world&quot; aria-label=&quot;Anchor link for: in-the-real-world&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;While interfaces have moved toward the &quot;Google-style&quot; of Modal Design to flatten the learning curve for the general public, many expert-level interfaces still rely on the Explicit Action Pattern. You can find it in library catalogs, Bloomberg or Reuters terminals, and high-end enterprise software.&lt;&#x2F;p&gt;
&lt;p&gt;You can also see this approach in media editing software. Instead of a single &quot;Save...&quot; dialog that asks for a format later, you often have explicit menu entries: &quot;Save,&quot; &quot;Export as PNG,&quot; &quot;Export as JPG,&quot; or &quot;Export as MP3.&quot;&lt;&#x2F;p&gt;
&lt;p&gt;And one can consider that the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Unix_philosophy&quot;&gt;Unix philosophy&lt;&#x2F;a&gt; of having one tool per function, instead of mega-commands with tons of options is also an embodiment of the  Explicit Action Pattern.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;dive-deeper&quot;&gt;Dive deeper&lt;a class=&quot;zola-anchor&quot; href=&quot;#dive-deeper&quot; aria-label=&quot;Anchor link for: dive-deeper&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;This approach is highly &quot;discoverable.&quot; You don&#x27;t need to learn &quot;how the search bar works&quot;; the interface tells you exactly what it can do by simply existing. This is what ihas been advocated by many Usability experts, that I consider mandatory reads:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The boss: Alan Cooper books, especially &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;thedesignbooks.com&#x2F;books&#x2F;about-face-the-essentials-of-interaction-design&quot;&gt;About Face: The Essentials of Interaction Design&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The enjoyable &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;sensible.com&#x2F;dont-make-me-think&#x2F;&quot;&gt;Don&#x27;t make me think&lt;&#x2F;a&gt; by Steve Krug.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.cs.umd.edu&#x2F;users&#x2F;ben&#x2F;papers&#x2F;Shneiderman1983Direct.pdf&quot;&gt;Direct Manipulation&lt;&#x2F;a&gt; by Ben Shneiderman&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.edwardtufte.com&#x2F;notes-sketches&#x2F;?msg_id=0000Jr&quot;&gt;Data Density&lt;&#x2F;a&gt; the examples above being described by him as &quot;Parallel Input&quot;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;The_Humane_Interface&quot;&gt;The human Interface&lt;&#x2F;a&gt; by Jef Raskin, especially his &quot;Monotonicity&quot;: the idea that a specific goal should always be achieved by a specific, unchanging set of actions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Foswiki update script</title>
        <published>2026-03-26T00:00:00+00:00</published>
        <updated>2026-03-26T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/foswiki-update-script/"/>
        <id>https://colas.nahaboo.net/code/foswiki-update-script/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/foswiki-update-script/">&lt;p&gt;Although I have &lt;a href=&quot;&#x2F;blog&#x2F;a-new-version-of-the-site-for-2026-in-zola&quot;&gt;migrated my public site to zola&lt;&#x2F;a&gt; which was on &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;foswiki.org&quot;&gt;Foswiki&lt;&#x2F;a&gt;, I have decided for now to keep my private family wiki on Foswiki for now.&lt;&#x2F;p&gt;
&lt;p&gt;So I needed to upgrade it to 2.1.11, it was still in 2.1.6, and since the upgrade is not exactly intuitive, I made a bash script to automatise the upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;You can find it &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;foswiki-upgrade&quot;&gt;on GitHub&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;See also its publication on the Foswiki site, with a &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;foswiki.org&#x2F;Support&#x2F;BestPracticeTip35#comment1.1774606339&quot;&gt;reminder of the standard upgrade method&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;how-the-script-works&quot;&gt;How the Script Works&lt;a class=&quot;zola-anchor&quot; href=&quot;#how-the-script-works&quot; aria-label=&quot;Anchor link for: how-the-script-works&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;This script supposes a modern version of Foswiki (v2+): it blindly overwrites the files that should not have been modified, so when customizing your wiki be sure to never directly modify distributed files.&lt;&#x2F;p&gt;
&lt;p&gt;The script however will not overwrite blindly any topic file that has been edited via Foswiki itself, by checking the author metadata. It will perform a 3-way merge, as automated as possible.&lt;&#x2F;p&gt;
&lt;p&gt;It also works only on a local copy of the site. You will have to download yourself a copy of your site, upgrade, and then re-upload it in place. This keeps the script simpler and safer.&lt;&#x2F;p&gt;
&lt;p&gt;It works on linux, but should work in linux-like layers on top of other OSes, such as cygwin, WSL, Homebrew, ...&lt;&#x2F;p&gt;
&lt;h2 id=&quot;why-staying-on-foswiki&quot;&gt;Why staying on Foswiki?&lt;a class=&quot;zola-anchor&quot; href=&quot;#why-staying-on-foswiki&quot; aria-label=&quot;Anchor link for: why-staying-on-foswiki&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;My private wiki is used by me, but also my wife, who is not really fluent in wiki or markdown  editing, so an excellent WYSIWYG is a must. And personnaly, I hate databases and strive for stability and simple architecture. Foswiki has all these qualities... and I would have a lot of content to convert.&lt;&#x2F;p&gt;
&lt;p&gt;But I will probably switch to an open source markdown-based wiki with a very good WYSIWYG editor and flat file storage, and easy to maintain. For now I see 3 potential candidates:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;silverbullet.md&#x2F;&quot;&gt;SilverBullet&lt;&#x2F;a&gt;, still evolving but very promising&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;otterwiki.com&#x2F;&quot;&gt;OtterWiki&lt;&#x2F;a&gt;, minimal but seems powerful enough&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;js.wiki&#x2F;&quot;&gt;Wiki.js&lt;&#x2F;a&gt; the current leader, but I will wait for the v3 as the v2 to v3 migration do not seem automatic, and the development &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;selfhosted&#x2F;comments&#x2F;1mebp67&#x2F;is_wikijs_3_dead&#x2F;&quot;&gt;seems to have slowed greatly&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Rsync-Incr</title>
        <published>2025-02-11T00:00:00+00:00</published>
        <updated>2025-02-11T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/rsync-incr/"/>
        <id>https://colas.nahaboo.net/code/rsync-incr/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/rsync-incr/">&lt;h2 id=&quot;what-is-rsync-incr&quot;&gt;What is rsync-incr&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-is-rsync-incr&quot; aria-label=&quot;Anchor link for: what-is-rsync-incr&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;rsync-incr&lt;&#x2F;strong&gt; is a linux wrapper shell (bash) script around
&lt;a href=&#x27;https:&#x2F;&#x2F;github.com&#x2F;RsyncProject&#x2F;rsync&#x27; title=&#x27;rsync website&#x27;&gt;rsync&lt;&#x2F;a&gt; to perform automated, unattended, incremental, disk
to disk backups, automatically removing old backups to make room for new
ones. It produces standard mirror copies browsable and restorable
without specific tools.I have been using it in production daily at work
and at home since 2004.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;goals&quot;&gt;Goals&lt;a class=&quot;zola-anchor&quot; href=&quot;#goals&quot; aria-label=&quot;Anchor link for: goals&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;I wanted to have a backup system with the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;standard&lt;&#x2F;strong&gt; based on standard tools (rsync), and restorable with only
standard tools.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;simple&lt;&#x2F;strong&gt; as possible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;automatable&lt;&#x2F;strong&gt; to be run daily (or more) by crontab, managing error
conditions reliably so we can mail on errors, and making automatically
room for new backups.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;user-manual&quot;&gt;User Manual&lt;a class=&quot;zola-anchor&quot; href=&quot;#user-manual&quot; aria-label=&quot;Anchor link for: user-manual&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;rsync-incr [options] N sourcedir destdir&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;rsync-incr will create &lt;code&gt;destdir&lt;&#x2F;code&gt; as a perfect mirror, and save in
&lt;code&gt;destdir.past&lt;&#x2F;code&gt; a directory per run with copies of changed files old
versions. These &lt;code&gt;N&lt;&#x2F;code&gt; (at most) directories of old versions of changed
files are named by their dates in the form
&lt;code&gt;destdir.past&#x2F;YYYY-MM-DD.HHhMN-SIZEm&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;e.g: &lt;code&gt;for rsync-incr 10 &#x2F;home &#x2F;backups&#x2F;home&lt;&#x2F;code&gt; &lt;br&gt;
&lt;code&gt;&#x2F;backups&#x2F;home.past&#x2F;2005-01-24.04h23-122m&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Date of last backup is in the contents of file &lt;code&gt;destdir.past&#x2F;LAST_DATE&lt;&#x2F;code&gt;.
No need to append a trailing &#x2F; to source and destination. &lt;br&gt;
&lt;code&gt;Dest&lt;&#x2F;code&gt; must be on the local machine (maybe NFS-mounted), &lt;code&gt;sourcedir&lt;&#x2F;code&gt; can
be on a remote machine via the ssh syntax &lt;code&gt;host:dir&lt;&#x2F;code&gt;.&lt;br&gt; &lt;code&gt;SIZE&lt;&#x2F;code&gt; in
name is the disk space taken that this backup, in megabytes, before an
optional compression via &lt;code&gt;--cbf&lt;&#x2F;code&gt;, to help you find the good value of &lt;code&gt;N&lt;&#x2F;code&gt;
m (e.g: the max of past SIZEs), as this size is hard to find in &lt;code&gt;--snap&lt;&#x2F;code&gt;
mode SIZE is rounded to upper bound: 0m means 0 bytes, 2m less than 2m&lt;&#x2F;p&gt;
&lt;p&gt;This a simple script, making backups usables by standard rsync (no need
for a dedicated restore script). It has 2 basic modes of operation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;default&lt;&#x2F;strong&gt;: make a perfect copy, of all hard links, devices, sparse
files, and just stores in dirs the previous versions of only the
changed files. This makes it easy to find the different states a files
went through, but make it harder to get a perfect snapshot of what was
the full state N days before. E.g, if a directory contains files A and
B, and B is modified today, yesterday backup will contain only
yesterday version of B, and today will contain current versions of A
and B.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;--snap&lt;&#x2F;strong&gt;: makes full snapshots of what the source was like at backup
times as described in &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;http:&#x2F;&#x2F;www.mikerubel.org&#x2F;computers&#x2F;rsync_snapshots&quot;&gt;Mike Rubel&#x27;s article&lt;&#x2F;a&gt; It is
easier to get to full snapshots of previous states, and should run
faster than the default. E.g, if a directory contains files A and B,
and B is modified today, both yesterday and today backups will contain
A and B, but A will be the same file (hard links to the same inode),
and the Bs will be two different fles.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If N has &quot;m&quot; appended (2m, 34m, ..) old versions are removed before
backup until we have at least N megabytes free on dest, and the max of
space taken by previous backups (+ 10%, see &lt;code&gt;--pbsm&lt;&#x2F;code&gt;). Otherwise, just
keep the last N backups.&lt;&#x2F;p&gt;
&lt;p&gt;Options are passed to rsync, but must be a single word parts (e.g: use
&lt;code&gt;--rsh=ssh&lt;&#x2F;code&gt;, not &lt;code&gt;-e ssh&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;e.g:
&lt;code&gt;rsync-incr -z --bwlimit=12 --rsh=ssh server:&#x2F;home&#x2F;me &#x2F;backups&#x2F;me&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;(this will create an perfect backup in &lt;code&gt;&#x2F;backups&#x2F;me&lt;&#x2F;code&gt; and a series of
previous versions as dirs like
&lt;code&gt;&#x2F;backups&#x2F;me.past&#x2F;2004-10-26.04:40:20-234&lt;&#x2F;code&gt; ...) rsync-incr uses &lt;code&gt;rsync&lt;&#x2F;code&gt;
with options: &lt;code&gt;-HSax --delete --force&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Special non-rsync options:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;--nohl&lt;&#x2F;strong&gt; do not use the -H &#x2F; --hard-links option (do not preserve
hard links), faster if you do not need to preserve hard links.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;--cbf&lt;&#x2F;strong&gt; compresses (gzip -r) all backuped files (will not compress
files with hard links)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;--snap&lt;&#x2F;strong&gt; old backups are full snapshots of previous stats, as in
&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;http:&#x2F;&#x2F;www.mikerubel.org&#x2F;computers&#x2F;rsync_snapshots&#x2F;#Incremental&quot;&gt;Mike Rubel&#x27;s article&lt;&#x2F;a&gt;
but this do not preserve hard links&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;--grem&lt;&#x2F;strong&gt; global remove: will remove oldest backups globally on the
filesystem (otherwise space-making on a small backup could wipe out
all backups in order to desperately make room, not noticing that
removing a single old backup of a bigger backup could do the job).
&lt;br&gt; You should place a list (one per line) of all the absolute
paths of &lt;code&gt;LAST_DATE&lt;&#x2F;code&gt; files on the system in the env variable
&lt;code&gt;RSYNCINCR_LASTDATES&lt;&#x2F;code&gt;, for instance by a statement:
&lt;ul&gt;
&lt;li&gt;export RSYNCINCR_LASTDATES&lt;code&gt;`locate =LAST_DATE`&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;otherwise a global find will be used, which can be very &lt;strong&gt;slow&lt;&#x2F;strong&gt;. It
will only remove backups on same filesystem as destdir, so you can list
all LAST_DATE paths on all disks. For instance if all the backups are
organized as &lt;code&gt;&#x2F;backups&#x2F;host&#x2F;partition&lt;&#x2F;code&gt;, the following should be included
at the start of backup scripts to decrease startup time: &lt;br&gt;
&lt;code&gt;RSYNCINCR_LASTDATES=`ls -1 &#x2F;backups&#x2F;*&#x2F;*.past&#x2F;LAST_DATE`&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;--pbsm=P&lt;&#x2F;strong&gt; Previous Backups Space Margin: reserve space before
backup for at least the max size of previous backups + P% (P default
to 10). If P ends with &quot;m&quot; (like 7m) it is taken as P megabytes to add
rather as a percentage.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;--inodes=N&lt;&#x2F;strong&gt; ensures we have at least N percent of inodes free, and
make room if not. Useful for backuping directories with huge number of
small files.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;--clean&lt;&#x2F;strong&gt; Just make enough room for the backups, but do not actually
perform the backups&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;--cross-devs&lt;&#x2F;strong&gt; allows to backup directories spanning multiples
volumes, mounted on subdirectories. Otherwise rsync-incr uses the -x
option of rsync.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To restore a backup, use standard rsync (trailing slashes are
IMPORTANT):&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;rsync -HSax --delete --force *backup* &#x2F; *original* &#x2F;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Rsync errors are propagated (the script exits with rsync exit status),
except for the error #24 which is trapped, as this error can happen on
backups of live systems (being modified while backuped)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;download&quot;&gt;Download&lt;a class=&quot;zola-anchor&quot; href=&quot;#download&quot; aria-label=&quot;Anchor link for: download&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;From github: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;rsync-incr&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;rsync-incr&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;a class=&quot;zola-anchor&quot; href=&quot;#installation&quot; aria-label=&quot;Anchor link for: installation&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;Just copy the &lt;code&gt;rsync-incr&lt;&#x2F;code&gt; shell script anywherein your PATH, e.g:
&lt;code&gt;&#x2F;usr&#x2F;local&#x2F;bin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;a class=&quot;zola-anchor&quot; href=&quot;#implementation&quot; aria-label=&quot;Anchor link for: implementation&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A 120 lines of shell script (excluding the embedded doc)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;license&quot;&gt;License&lt;a class=&quot;zola-anchor&quot; href=&quot;#license&quot; aria-label=&quot;Anchor link for: license&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Pure Open source: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;copyleft&#x2F;gpl.html&quot;&gt;GPL&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;more-details&quot;&gt;More details&lt;a class=&quot;zola-anchor&quot; href=&quot;#more-details&quot; aria-label=&quot;Anchor link for: more-details&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;See also what inspired me:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;RsyncProject&#x2F;rsync&quot;&gt;Rsync&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;http:&#x2F;&#x2F;www.mikerubel.org&#x2F;computers&#x2F;rsync_snapshots&quot;&gt;Mike rubel seminal article&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20170208161849&#x2F;https:&#x2F;&#x2F;www.perusion.com&#x2F;misc&#x2F;Snapback2&#x2F;snapback2.html&quot;&gt;snapback&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;hacks.oreilly.com&#x2F;pub&#x2F;h&#x2F;42&quot;&gt;O&#x27;Reilly hacks&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;new-versions-announcements&quot;&gt;New versions announcements&lt;a class=&quot;zola-anchor&quot; href=&quot;#new-versions-announcements&quot; aria-label=&quot;Anchor link for: new-versions-announcements&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Since 2025, releases are annonced on the Github site, at:
&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;rsync-incr&#x2F;releases&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;rsync-incr&#x2F;releases&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This documentation pages are going to migrate to Github too.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;examples-of-use&quot;&gt;Examples of use&lt;a class=&quot;zola-anchor&quot; href=&quot;#examples-of-use&quot; aria-label=&quot;Anchor link for: examples-of-use&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;See a &lt;a href=&quot;&#x2F;code&#x2F;detailed-example-of-rsync-incr-operation&quot;&gt;detailed example of what rsync-incr does&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Also, here are (modified for privacy) real scripts I use daily:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;rsync-incr&#x2F;blob&#x2F;main&#x2F;backup-script1.txt&quot;&gt;Example1&lt;&#x2F;a&gt; a script run
daily on the host backserv to archive incrementally various machine
partitions and mailing in case of errors at $email&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;rsync-incr&#x2F;blob&#x2F;main&#x2F;backup-script2.txt&quot;&gt;Example2&lt;&#x2F;a&gt; this script is
auto-run on start of the backup server: it connects to the main server
(named &quot;m&quot;), backups, and halts the backup server It does it in 2
paralled processes impacting disks on different controllers for added
speed. Only m root partition is done incrementally&lt;&#x2F;li&gt;
&lt;li&gt;To connect to sites that use a non-standard port for ssh, let&#x27;s say
&lt;code&gt;26&lt;&#x2F;code&gt; the trick is to create a shell script, for instance named
&lt;code&gt;ssh-p26&lt;&#x2F;code&gt;, containing the line: &lt;code&gt;exec ssh -p 26 &quot;$@&quot;&lt;&#x2F;code&gt; and call
rsync-incr with the option &lt;code&gt;--rsh=ssh-p26&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;other-backup-systems&quot;&gt;Other backup systems&lt;a class=&quot;zola-anchor&quot; href=&quot;#other-backup-systems&quot; aria-label=&quot;Anchor link for: other-backup-systems&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;Rsync-incr is not the only open source smart and simple backup system.
It is I think unique in its automated claculation of free space and
smart removal of old backups to make room for new ones. But other ones,
can be more relevant to your needs, for instance:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;rdiff-backup.nongnu.org&#x2F;features.html&quot;&gt;rdiff-backup&lt;&#x2F;a&gt; that only
stores differences in files. For instance for big log files,
rsync-incr will archive a full copy of the log (although it would have
transferred on the network only the changed lines), whereas
rdiff-backup will only store the actual added lines and is much more
space-efficient backup-side. However, you do not get the easy
browsing, access and comparison on backups that rsync-incr offers&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.dirvish.org&#x2F;&quot;&gt;dirvish&lt;&#x2F;a&gt; nice fast backup, but do not
automate expiration of backups&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;rsnapshot.org&#x2F;&quot;&gt;rsnapshot&lt;&#x2F;a&gt;
is more powerful and integrated, in perl having features that
rsync-incr leave to a wrapper script&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;history&quot;&gt;History&lt;a class=&quot;zola-anchor&quot; href=&quot;#history&quot; aria-label=&quot;Anchor link for: history&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;v1.9&lt;&#x2F;strong&gt; 2017-06-13 faster method to remove directories with huge
number of files. new option --inodes=N&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v1.8&lt;&#x2F;strong&gt; 2011-07-11 fix for working across mounted partitions with new
option --cross-devs, rsh support dropped, only use ssh now&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v1.7&lt;&#x2F;strong&gt; 2009-01-01, bug fix: could fail if was restarted on the same
dirs in the same minute &lt;br&gt; 2009-01-05 this documentation
updated: the &lt;code&gt;--no&lt;&#x2F;code&gt; option is in fact &lt;code&gt;--clean&lt;&#x2F;code&gt;. Code is inchanged, no
need to re-download. &lt;br&gt; new &lt;a href=&quot;&#x2F;code&#x2F;detailed-example-of-rsync-incr-operation&quot;&gt;subpage&lt;&#x2F;a&gt;
to give a detailed example&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v1.6&lt;&#x2F;strong&gt; 2008-12-19, works with destdir on NFS now (before was not
removing old backups due to free space calculations not working on
NFS), &lt;br&gt; new &lt;code&gt;--no&lt;&#x2F;code&gt; option.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v1.5&lt;&#x2F;strong&gt; 2008-10-12, nothing changed, only packaging doc, and web page
moved here. No need to upgrade&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v1.4&lt;&#x2F;strong&gt; 2007-02-26, bug fix by Jeremy Lingmann: on system with long
device names wrapping enabled, rsync-incr was unable to compute free
space. We now use df -P to fix this. This is the only change, upgrade
recommended.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v1.3&lt;&#x2F;strong&gt; 2006-08-08, bug fix: rsync options with metacharacters were
not working (e.g the * in: --exclude=&#x27;&#x2F;tmp&#x2F;*&#x27;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v1.2&lt;&#x2F;strong&gt; 2006-06-21, bug fix by Jiri Voves: --pbsm option worked only
for sizes given in megabytes (with appended &quot;m&quot;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v1.1&lt;&#x2F;strong&gt; 2005-03-25, bug fix: in some cases some old backups were not
deleted. if day of month started with 0.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v1.0&lt;&#x2F;strong&gt; 2005-02-19, first public release&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;v0.9&lt;&#x2F;strong&gt; 2004-12-15, internal beta test&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;comments&quot;&gt;Comments&lt;a class=&quot;zola-anchor&quot; href=&quot;#comments&quot; aria-label=&quot;Anchor link for: comments&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Suntimes, a small shell utility</title>
        <published>2022-03-03T00:00:00+00:00</published>
        <updated>2022-03-03T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/suntimes-a-small-shell-utility/"/>
        <id>https://colas.nahaboo.net/code/suntimes-a-small-shell-utility/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/suntimes-a-small-shell-utility/">&lt;p&gt;I just made a small command-line utility to display the sunrise and sunset times at a location. It can be quite useful in shell scripts.&lt;&#x2F;p&gt;
&lt;p&gt;It is a minimal Go wrapper around the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;nathan-osman&#x2F;go-sunrise&quot;&gt;nathan-osman&#x2F;go-sunrise library&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;You can find it at my repository: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;suntimes&quot;&gt;GitHub - ColasNahaboo&#x2F;suntimes&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Completed the 2015 Advent of Code challenge in GO</title>
        <published>2022-02-24T00:00:00+00:00</published>
        <updated>2022-02-24T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/completed-the-2015-advent-of-code-challenge-in-go/"/>
        <id>https://colas.nahaboo.net/code/completed-the-2015-advent-of-code-challenge-in-go/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/completed-the-2015-advent-of-code-challenge-in-go/">&lt;p&gt;And I completed the 2015 challenge! (see my &lt;a href=&quot;&#x2F;code&#x2F;starting-the-2015-advent-of-code-challenge-in-go&quot;&gt;previous post&lt;&#x2F;a&gt;). You can read my notes on it on my  &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;advent-of-code-my-solutions&#x2F;tree&#x2F;main&#x2F;go&#x2F;2015&quot;&gt;GitHub&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This was quite interesting, and I thing a great way to learn a language just after completing its tutorial, as this challenge as a feel of &quot;real life&quot; situations, and allow for a variety of solutions, so that you can put different approaches to the test.&lt;&#x2F;p&gt;
&lt;p&gt;I forced myself to not look at the solutions available on the net, except for two cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using working code to generate more data to test against (random inputs + expected result number). I just ran the code of other solutions, without reading their source. I often used  solutions by &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;devjobe&#x2F;advent-of-code-2015-golang&quot;&gt;devjobe&lt;&#x2F;a&gt; and &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;schwern&#x2F;adventofcode.go&quot;&gt;schwern&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Once I had a working solution, browsing the source code of other solutions to compare with mine and see where I could improve, and discover cool tricks. I mostly used the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;adventofcode&#x2F;wiki&#x2F;solution_megathreads&#x2F;#wiki_december_2015&quot;&gt;reddit megathread&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I also tried to use only the standard Go packages, and not the ones available on the web. I am sure I will end up using 3rd party packages to replace the standard ones (the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;pkg.go.dev&#x2F;flag&quot;&gt;flag package &lt;&#x2F;a&gt;  to parse options for instance is really too primitive). And I also didn&#x27;t create a separate module or package for my library of common useful functions. I will surely do it in the future, but I feel I should have more experience first.&lt;&#x2F;p&gt;
&lt;p&gt;Anyways, it has confirmed that Go was the language I have been waiting for all these years. On the one hand, I have a bit of regret not having jumped on it sooner, but on the other hand it was easier to just wait for my retirement (one year ago) to free myself from any work politics and constraints to be able to fully explore the programming language landscape with no strings attached.&lt;&#x2F;p&gt;
&lt;p&gt;I can see myself using 4 languages in the future:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;bash&lt;&#x2F;strong&gt; for any &quot;glue&quot; tooling and scripts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;go&lt;&#x2F;strong&gt; for my main do-it-all language, and web backend.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;javascript&lt;&#x2F;strong&gt; (and&#x2F;or WebAssembly) for my web frontend, with pure modern HTML and CSS, but no framework, à la  &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;http:&#x2F;&#x2F;vanilla-js.com&#x2F;&quot;&gt;Vanilla JS&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;and maybe a higher performance, specialized language, if I encounter such needs: E.g: &lt;strong&gt;zig&lt;&#x2F;strong&gt; as a replacement of C for tasks where Go could be unsuited (if I encounter any), or &lt;strong&gt;julia&lt;&#x2F;strong&gt; for math-specific things, etc...&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Edit: I see that Neil Henning also enjoyed discovering a new language via AoC: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.duskborn.com&#x2F;posts&#x2F;2021-aoc-zig&#x2F;&quot;&gt;A Review of the Zig Programming Language (using Advent of Code 2021)&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Starting the 2015 Advent of Code challenge in GO</title>
        <published>2022-02-09T00:00:00+00:00</published>
        <updated>2022-02-09T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/starting-the-2015-advent-of-code-challenge-in-go/"/>
        <id>https://colas.nahaboo.net/code/starting-the-2015-advent-of-code-challenge-in-go/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/starting-the-2015-advent-of-code-challenge-in-go/">&lt;p&gt;I discovered the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;&quot;&gt;advent of code&lt;&#x2F;a&gt; in 2021, and did it in &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;advent-of-code-my-solutions&#x2F;tree&#x2F;main&#x2F;bash&quot;&gt;bash&lt;&#x2F;a&gt; for the challenge. But since I started learning GO, I decided to code the previous AoC years in GO as a mean to practice it. So, although my bash code can be useful to see some tricks of a seasoned bash programmer, these GO solutions must be considered as &quot;student code&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;So I started coding the 2015 year of AoC in GO, available on my GitHub: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;advent-of-code-my-solutions&#x2F;blob&#x2F;main&#x2F;go&#x2F;2015&quot;&gt;advent-of-code-my-solutions&#x2F;go&#x2F;2015&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The code is in GO, with some housekeeping scripts in bash.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>My bash library on Github</title>
        <published>2022-02-05T00:00:00+00:00</published>
        <updated>2022-02-05T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/my-bash-library-on-github/"/>
        <id>https://colas.nahaboo.net/code/my-bash-library-on-github/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/my-bash-library-on-github/">&lt;p&gt;I have started to publish on Github, at &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;colas-bash-lib&quot;&gt;colas-bash-lib&lt;&#x2F;a&gt;, my collection of various &lt;strong&gt;bash functions&lt;&#x2F;strong&gt; I reuse often in my bash scripts.&lt;&#x2F;p&gt;
&lt;p&gt;Fell free to copy and use in any of your projects or compilation of bash tools.&lt;&#x2F;p&gt;
&lt;p&gt;I have tried to make them the &lt;strong&gt;fastest&lt;&#x2F;strong&gt; possible, by avoiding forking sub-shells or external commands, and
benchmarking extensively to compare the possible way of coding them. Of course, I will gladly accept suggestions or code to make them faster.
But it means that error checking is often terse and minimal, and readability of the code was not a priority.&lt;&#x2F;p&gt;
&lt;p&gt;I have a kind of «anti-npm» approach, in that I &lt;strong&gt;copy&lt;&#x2F;strong&gt; these functions into my scripts rather that using hem as a true external library that I would load at runtime. It thus avoid installation issues, and the ependency problems that may arise from automated upgrades.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Bash lessons learned with AoC 2021</title>
        <published>2022-01-11T00:00:00+00:00</published>
        <updated>2022-01-11T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/bash-lessons-learned-with-aoc-2021/"/>
        <id>https://colas.nahaboo.net/code/bash-lessons-learned-with-aoc-2021/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/bash-lessons-learned-with-aoc-2021/">&lt;p&gt;I completed all the exercises of the Advent of Code 2021 in bash! (see &lt;a href=&quot;&#x2F;code&#x2F;advent-of-code-2021&quot;&gt;my previous post&lt;&#x2F;a&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;You can find my solutions with comments in my GitHub repository at https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;advent-of-code-my-solutions&#x2F;tree&#x2F;main&#x2F;bash&#x2F;2021&lt;&#x2F;p&gt;
&lt;p&gt;I must say I &quot;cheated&quot; a bit. My  solution for the Day 24 was too slow in bash, and as I was a bit out of  steam, I did not try to find a smart algorithm. I just noticed that I  solved it by building a bash arithmetic expression (of 1 million  characters...) that I then evaluated in bash, and since its syntax was  exactly the one for C... I just made the bash script compile the bash  expression in C and execute it, using the C compiler as a bash  arithmetic just-in-time compiler :-)&lt;&#x2F;p&gt;
&lt;p&gt;I just discovered AoC this year, and I am impressed. Challenging, fun,  and a great way to progress. I am going to do the previous years, too,  but in &quot;real&quot; languages this time. At least ones with data structures... I will start with Go.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;what-i-learned&quot;&gt;What I learned:&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-i-learned&quot; aria-label=&quot;Anchor link for: what-i-learned&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Coding in bash is not so bad, even if it can border on insanity at times :-).&lt;&#x2F;li&gt;
&lt;li&gt;Modern bash features are often overlooked but very useful.&lt;&#x2F;li&gt;
&lt;li&gt;Passing shellcheck should be a mandatory goal for each bash programmer. I resented it at first since I thought it was adding unecessary syntaxic sugar to my code until I realized that it was a symptom that my coding style was the problem.&lt;&#x2F;li&gt;
&lt;li&gt;Use &lt;code&gt;[[...]]&lt;&#x2F;code&gt; for strings and &lt;code&gt;((...))&lt;&#x2F;code&gt; for integers other any of the legacy constructs like &lt;code&gt;[...]&lt;&#x2F;code&gt;, &lt;code&gt;test&lt;&#x2F;code&gt;, etc... The code is then much cleaner and safer (and a tad faster), as you do not have to quote as much. E.g: &lt;code&gt;[[ -z foo ]]&lt;&#x2F;code&gt; instead of &lt;code&gt;[ -z &quot;$foo&quot; ]&lt;&#x2F;code&gt;, or even &lt;code&gt;((i=j))&lt;&#x2F;code&gt; instead of &lt;code&gt;i=&quot;$j&quot;&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;but&lt;&#x2F;strong&gt;, this makes traditional debugging with &lt;code&gt;set -x&lt;&#x2F;code&gt; less useful as the values of variables are not displayed anymore. E.g if j is 2, the tracing of &lt;code&gt;i=&quot;$j&quot;&lt;&#x2F;code&gt; shows &lt;code&gt;i=2&lt;&#x2F;code&gt; whereas the tracing of &lt;code&gt;((i=j))&lt;&#x2F;code&gt; only shows &lt;code&gt;((i=j))&lt;&#x2F;code&gt;. This could be where a bash debugger would be useful, but I know only one, &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;bashdb.sourceforge.net&#x2F;bashdb.html&quot;&gt;bashdb&lt;&#x2F;a&gt;, and it does not seem updated anymore, and I could not find a version working with bash 5.1. The &lt;code&gt;trap DEBUG&lt;&#x2F;code&gt; trick can be useful, though.&lt;&#x2F;li&gt;
&lt;li&gt;So, I tend to write now &lt;code&gt;i=$((j+k))&lt;&#x2F;code&gt; while developing code, and maybe later for production switch to the a bit more efficient &lt;code&gt;((i = j+k))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;I avoided arrays in bash because I found out they were abysmally slow when first introduced, to the point that managing data in files with grep, sed, ... was actually faster than using arrays. But not anymore! Bash arrays should now be used as much as possible.&lt;&#x2F;li&gt;
&lt;li&gt;A lot of bash functions can &quot;map&quot; on arrays. For instance &lt;code&gt;${tab[@]&#x2F;&#x2F;x&#x2F;y}&lt;&#x2F;code&gt; will string-replace x by y in all the elements of the array tab, and is super fast.&lt;&#x2F;li&gt;
&lt;li&gt;Use arrays rather than the classic way to represent lists in bash by space-separated (or tab-separated) substrings in a  string.&lt;&#x2F;li&gt;
&lt;li&gt;Bash can have typed variables: integer ones via &lt;code&gt;declare -i&lt;&#x2F;code&gt; or &lt;code&gt;local -i&lt;&#x2F;code&gt;, and using them makes your code safer.&lt;&#x2F;li&gt;
&lt;li&gt;Bash functions can be passed variables by name, useful for efficiency to avoid copying big arrays or strings, and to provide multiple return values by modifying passed variables. But it cannot recurse as it is not a passing by reference, but by name.&lt;&#x2F;li&gt;
&lt;li&gt;Working with arrays makes using &lt;code&gt;$(...)&lt;&#x2F;code&gt; impractical, as commands are executed in a subshell and cannot access arrays anymore to update them in the parent shell. So I tend to pass the return value(s) into global variables of the same name of a function. E.g. instead of &lt;code&gt;x=$(foo)&lt;&#x2F;code&gt;, I write &lt;code&gt;foo; x=&quot;$foo&quot;&lt;&#x2F;code&gt;. Or pass variables by name to set them if I want to return multiple results.&lt;&#x2F;li&gt;
&lt;li&gt;To parse a space-separated string, the fastest is using &lt;code&gt;set&lt;&#x2F;code&gt; to map the elements in the positional parameters &lt;code&gt;$1&lt;&#x2F;code&gt;, &lt;code&gt;$2&lt;&#x2F;code&gt;, ... then the &lt;code&gt;${string#* }&lt;&#x2F;code&gt; and &lt;code&gt;${string% *}&lt;&#x2F;code&gt; operators are the fastest, closely followed by a read, the full &lt;code&gt;[[ $string =~ ([-[:digit:]]+)[[:space:]]... ]]&lt;&#x2F;code&gt; being 3 times slower. And if possible, using indexes is even faster: &lt;code&gt;${string:i:j}&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Use the faster &lt;code&gt;$(&amp;lt; filename)&lt;&#x2F;code&gt; instead of &lt;code&gt;$(cat filename)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;To copy an associative array A1 to A2 in bash 4.4+, do:
&lt;code&gt;A1_def=$(declare -p A1) &amp;amp;&amp;amp; declare -A A2=&quot;${A1_def#*=}&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;To access more than 9 parameters in a function: use braces: &lt;code&gt;$10&lt;&#x2F;code&gt; wont work, but &lt;code&gt;${10}&lt;&#x2F;code&gt; does.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Moving to Github</title>
        <published>2021-12-10T00:00:00+00:00</published>
        <updated>2021-12-10T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/moving-to-github/"/>
        <id>https://colas.nahaboo.net/code/moving-to-github/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/moving-to-github/">&lt;p&gt;&lt;strong&gt;Warning:&lt;&#x2F;strong&gt; I will move all the sources I maintained on my own &lt;strong&gt;mercurial&lt;&#x2F;strong&gt; web instance in &lt;code&gt;hg.colas.nahaboo.net&lt;&#x2F;code&gt;  to my GitHub repositories: https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;&lt;&#x2F;p&gt;
&lt;p&gt;I have thus redirected the non-functional &lt;code&gt;hg.colas.nahaboo.net&lt;&#x2F;code&gt; to this page.&lt;&#x2F;p&gt;
&lt;p&gt;The move will be gradual, I started with &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;rsync-incr&quot;&gt;rsync-incr&lt;&#x2F;a&gt;, and I hope to have finished before the end of 2021. Please ask me is you do not see yet your favorite source there.&lt;&#x2F;p&gt;
&lt;p&gt;The reason is that Debian has phased out most of what the web tools for mercurial rely on (python2, wsgi, ...), and thus my web hg repository was broken. And since I wanted anyways to move it to GitHub, it is not worth repairing it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;how-to-move-mercurial-hg-directories-to-github&quot;&gt;How to move mercurial (hg) directories to GitHub&lt;a class=&quot;zola-anchor&quot; href=&quot;#how-to-move-mercurial-hg-directories-to-github&quot; aria-label=&quot;Anchor link for: how-to-move-mercurial-hg-directories-to-github&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;As my hg repositories were very simple (no branches, I tend to use cloned repos than branches), what I do to migrate a repository &lt;code&gt;foo&lt;&#x2F;code&gt; to github:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;I used &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;repo.or.cz&#x2F;fast-export.git&quot;&gt;hg-fast-export&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;I converted the hg repo of &lt;code&gt;foo&lt;&#x2F;code&gt; to a local git repository of the same name, with the main hg branch mapped to github default &lt;code&gt;main&lt;&#x2F;code&gt; instead of the script default of &lt;code&gt;master&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;I created an &lt;strong&gt;empty&lt;&#x2F;strong&gt; repository &lt;code&gt;foo&lt;&#x2F;code&gt; on github (no files such as README.md, LICENSE, ...)&lt;&#x2F;li&gt;
&lt;li&gt;I added it as origin to my local git repo&lt;&#x2F;li&gt;
&lt;li&gt;I deleted my hg repo, and git-pushed my local git repo (which became my working repo) to github. Plus I redirected the old hgweb repo urls to the new github repo adress.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I.e. as actual bash commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;repo=foo                        # the name of the repo to convert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hg=~&#x2F;hg                         # where are my local hg repos&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git=~&#x2F;git                       # where are my local git repos&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hfe=&#x2F;opt&#x2F;fast-export            # where is my copy of hg-fast-export.sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ghn=ColasNahaboo                # my name on github&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir $git&#x2F;$repo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd $git&#x2F;$repo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git init&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$hfe&#x2F;hg-fast-export.sh -r &amp;quot;$hg&#x2F;$repo&amp;quot; -M main -n &amp;quot;$git&#x2F;$repo&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git branch -M main&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git checkout main&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git remote add origin git@github.com:$ghn&#x2F;$repo.git&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Warning: for this last step, the github repo must exist and be empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git push -u origin main&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Advent of Code 2021</title>
        <published>2021-12-07T00:00:00+00:00</published>
        <updated>2021-12-07T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/advent-of-code-2021/"/>
        <id>https://colas.nahaboo.net/code/advent-of-code-2021/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/advent-of-code-2021/">&lt;p&gt;I just discovered the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;&quot;&gt;Advent of code&lt;&#x2F;a&gt; coding challenge. It exists since 2015, and seems really interesting in that it is language-agnostic.&lt;&#x2F;p&gt;
&lt;p&gt;Each day a problem is described, with input files consisting of numeric values for the problem. You must submit the answer which is a number by whatever means you want.&lt;&#x2F;p&gt;
&lt;p&gt;I started to do the current 2021 challenge, in &lt;strong&gt;bash&lt;&#x2F;strong&gt; to force myself to code in a more modern style that pass &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.shellcheck.net&#x2F;&quot;&gt;shellcheck&lt;&#x2F;a&gt;. And later, i will probably do the other years in &lt;strong&gt;Go&lt;&#x2F;strong&gt; to learn it.&lt;&#x2F;p&gt;
&lt;p&gt;I publish my solutions as I code them on &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;advent-of-code-my-solutions&#x2F;tree&#x2F;main&#x2F;bash&#x2F;2021&quot;&gt;my github&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;More info:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;&quot;&gt;advent of code&lt;&#x2F;a&gt; (aka AOC) site&lt;&#x2F;li&gt;
&lt;li&gt;The sub-reddit  &lt;a href=&quot;&#x2F;r&#x2F;adventofcode&quot;&gt;&#x2F;r&#x2F;adventofcode&lt;&#x2F;a&gt; to discuss AOC&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Detailed example of rsync-incr operation</title>
        <published>2009-01-11T00:00:00+00:00</published>
        <updated>2009-01-11T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/detailed-example-of-rsync-incr-operation/"/>
        <id>https://colas.nahaboo.net/code/detailed-example-of-rsync-incr-operation/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/detailed-example-of-rsync-incr-operation/">&lt;p&gt;Let&#x27;s say we have a source directory, &lt;code&gt;dir&lt;&#x2F;code&gt; that we are going to backup
into &lt;code&gt;backup&lt;&#x2F;code&gt; with default options and &lt;code&gt;backup--snap&lt;&#x2F;code&gt; with &lt;code&gt;--snap&lt;&#x2F;code&gt;. We
will have in it the files:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- On Day 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- On Day 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - A is Added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - B stay the same in Both days&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - C is Changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - D is Deleted and not there anymore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;so-on-day-1&quot;&gt;So, on Day 1:&lt;a class=&quot;zola-anchor&quot; href=&quot;#so-on-day-1&quot; aria-label=&quot;Anchor link for: so-on-day-1&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;We set up the source&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# mkdir dir; echo bbb &amp;gt;dir&#x2F;B;echo ccc &amp;gt;dir&#x2F;C;echo ddd &amp;gt;dir&#x2F;D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ls -l dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We backup normally&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# rsync-incr 5 dir backups&#x2F;dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ls -lR backups&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 2 colas local 4096 Jan 10 23:40 dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 2 colas local 4096 Jan 10 23:42 dir.past&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups&#x2F;dir:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups&#x2F;dir.past:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 17 Jan 10 23:42 LAST_DATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We backup with --snap&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# rsync-incr --snap 5 dir backups--snap&#x2F;dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ls -lR backups--snap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups--snap:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 2 colas local 4096 Jan 10 23:40 dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 3 colas local 4096 Jan 10 23:44 dir.past&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups--snap&#x2F;dir:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups--snap&#x2F;dir.past:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 2 colas local 4096 Jan 10 23:44 2009-01-10.23h44-0m&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 17 Jan 10 23:44 LAST_DATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups--snap&#x2F;dir.past&#x2F;2009-01-10.23h44-0m:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;on-day-2&quot;&gt;On day 2&lt;a class=&quot;zola-anchor&quot; href=&quot;#on-day-2&quot; aria-label=&quot;Anchor link for: on-day-2&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;We set up the source&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# rm dir&#x2F;D; echo aaa&amp;gt;dir&#x2F;A; echo CCC&amp;gt;dir&#x2F;C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ls -l dir&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:48 A&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:48 C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We backup normally&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# rsync-incr 5 dir backups&#x2F;dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ls -lR backups&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 2 colas local 4096 Jan 10 23:48 dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 3 colas local 4096 Jan 10 23:50 dir.past&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; backups&#x2F;dir:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:48 A&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:48 C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; backups&#x2F;dir.past:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 2 colas local 4096 Jan 10 23:50 2009-01-10.23h42-1m&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 17 Jan 10 23:50 LAST_DATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; backups&#x2F;dir.past&#x2F;2009-01-10.23h42-1m:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:40 D &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;There, you can see that the &quot;past&quot; backup dir contains an image of the
whole of dir the &quot;day&quot; before. But you see that B has a link count of 2
so is shared between the 2 backup dirs, whereas C is not, the 2 C files
have different contents&lt;&#x2F;p&gt;
&lt;p&gt;We backup with --snap&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# rsync-incr --snap 5 dir backups&#x2F;dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ls -lR backups--snap&#x2F;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 2 colas local 4096 Jan 10 23:30 dir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 4 colas local 4096 Jan 10 23:30 dir.past&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups--snap&#x2F;dir:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:30 A&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 2 colas local 4 Jan 10 23:27 B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:30 C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups--snap&#x2F;dir.past:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 2 colas local 4096 Jan 10 23:30 2009-01-10.23h30-0m&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;drwxrwxr-x 2 colas local 4096 Jan 10 23:27 2009-01-10.23h30-1m&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 17 Jan 10 23:30 LAST_DATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups--snap&#x2F;dir.past&#x2F;2009-01-10.23h30-0m:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backups--snap&#x2F;dir.past&#x2F;2009-01-10.23h30-1m:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 2 colas local 4 Jan 10 23:27 B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:27 C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-rw-r-- 1 colas local 4 Jan 10 23:27 D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;There, you can see that the &quot;past&quot; backup dir contains an image of the whole of dir the &quot;day&quot; before. But you see that B has a link count of 2 so is shared between the 2 backup dirs, whereas C is not, the 2 C files have different contents&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>My work on TWiki</title>
        <published>2008-12-20T00:00:00+00:00</published>
        <updated>2008-12-20T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/my-work-on-twiki/"/>
        <id>https://colas.nahaboo.net/code/my-work-on-twiki/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/my-work-on-twiki/">&lt;p&gt;I discovered the wiki concept in 2000, and quickly decided that this was
the future of the web site building tools, after many attempts at trying
various methods of Web development. Doing some research made me choose
the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;twiki.org&quot;&gt;TWiki engine&lt;&#x2F;a&gt;, and since then I have been part of
the TWiki community, providing some work and enhancements on it. For
more detailed info, the best place is to go look at &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;twiki.org&#x2F;cgi-bin&#x2F;view&#x2F;Main&#x2F;ColasNahaboo&quot;&gt;my page on the
TWiki site&lt;&#x2F;a&gt;, and my
&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;twiki.org&#x2F;cgi-bin&#x2F;view&#x2F;Codev&#x2F;PersonalRoadmapForColasNahaboo&quot;&gt;personal goals&lt;&#x2F;a&gt;
for it.&lt;&#x2F;p&gt;
&lt;p&gt;Of course, since the brutal TWiki fork, I have
folowed the whole TWiki community into the new great
&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;foswiki.org&quot;&gt;Foswiki&lt;&#x2F;a&gt; wiki project.&lt;&#x2F;p&gt;
&lt;p&gt;I was working on: (latest first)&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;TWiki &quot;koala&quot; pattern skin A system to
properly customize the pattern skin. This is the one I use on this
site&lt;&#x2F;li&gt;
&lt;li&gt;Enhancements to the Vote Plugin&lt;&#x2F;li&gt;
&lt;li&gt;TWiki misc enhancements for freetown&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Hgweb Mercurial template customization</title>
        <published>2008-04-06T00:00:00+00:00</published>
        <updated>2008-04-06T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/hgweb-mercurial-template-customization/"/>
        <id>https://colas.nahaboo.net/code/hgweb-mercurial-template-customization/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/hgweb-mercurial-template-customization/">&lt;p&gt;If you use the &lt;code&gt;hgwebdir.cgi&lt;&#x2F;code&gt; system to provide a web view of your mercurial repository, to customize the style like I did for (&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20101113204327&#x2F;https:&#x2F;&#x2F;hg.colas.nahaboo.net&#x2F;&quot;&gt;archived view&lt;&#x2F;a&gt;), a way to do it is (in debian, paths to adapt to your linux distribution):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;copy &lt;code&gt;&#x2F;usr&#x2F;share&#x2F;mercurial&#x2F;templates&#x2F;gitweb&lt;&#x2F;code&gt; somewhere among your hg repositories. make a hg repository out of it&lt;&#x2F;li&gt;
&lt;li&gt;clone it to another one, e.g. &lt;code&gt;myhg&lt;&#x2F;code&gt;. This way, when upgrades will change the distributed templates, you will just have to copy the new ones in your &lt;code&gt;gitweb&lt;&#x2F;code&gt; repo, commit, and pull+merge the changes into your &lt;code&gt;myhg&lt;&#x2F;code&gt; repo.&lt;&#x2F;li&gt;
&lt;li&gt;edit the files in it: header.tmpl to add css code, etc. Adding links in the page headers will make you edit most of the files&lt;&#x2F;li&gt;
&lt;li&gt;install by copying it to &lt;code&gt;&#x2F;usr&#x2F;share&#x2F;mercurial&#x2F;templates&#x2F;myhg&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;edit your &#x2F;etc&#x2F;mercurial&#x2F;hgrc to tell hgwebdir.cgi to use your new templates by a line &lt;code&gt;style=myhg&lt;&#x2F;code&gt; . in your &lt;code&gt;[web]&lt;&#x2F;code&gt; section. Here is my file as an exemple:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #4C4F69; background-color: #EFF1F5;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# system-wide mercurial configuration file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# See hgrc(5) for more information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[trusted]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;users=colas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[web]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;baseurl=https&amp;amp;#58;&#x2F;&#x2F;hg.colas.nahaboo.net&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contact=colas@nahaboo.net&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;description=Open source software made by Colas Nahaboo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;maxchanges=16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;staticurl=https&amp;amp;#58;&#x2F;&#x2F;hg.colas.nahaboo.net&#x2F;static&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;style=colas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The above will make these settings global to the site. but you can still override them on a per-repository basis by adding these lines into the &lt;code&gt;hgweb.config&lt;&#x2F;code&gt; of the repositories.&lt;&#x2F;li&gt;
&lt;li&gt;Note that you can use HTML code in the description field&lt;&#x2F;li&gt;
&lt;li&gt;This &lt;code&gt;hgrc&lt;&#x2F;code&gt; is not cloned by &lt;code&gt;hg&lt;&#x2F;code&gt;. So you must add&#x2F;edit it directly on the web repository, you cannot prepare it in advance in your work dir and expect it to be pushed on the web site on first creation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>LDAP TWiki authentication</title>
        <published>2007-05-24T00:00:00+00:00</published>
        <updated>2007-05-24T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/ldap-twiki-authentication/"/>
        <id>https://colas.nahaboo.net/code/ldap-twiki-authentication/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/ldap-twiki-authentication/">&lt;h2 id=&quot;principles&quot;&gt;Principles&lt;a class=&quot;zola-anchor&quot; href=&quot;#principles&quot; aria-label=&quot;Anchor link for: principles&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;This is how we use LDAP auth with TWiki (Cairo) with Microsoft Active
Directory&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We make TWiki use standard apache basic authentication (The
non-cookie, standard method). In this mode TWiki expects Apache to do
all the auth work, and then execute TWiki perl scripts with the user
login set into the environment variable &lt;code&gt;REMOTE_USER&lt;&#x2F;code&gt; by apache. Our
trick is to use a modified mod_ladp apache module that wil get the AD
login of the user, auth with AD&#x2F;LDAP with it, and then &lt;strong&gt;change&lt;&#x2F;strong&gt; the
&lt;code&gt;REMOTE_USER&lt;&#x2F;code&gt; variable from windows login to the wiki name that is
dynamically computed by fetching First Name and Last Name in LDAP, and
concatenating them after some cleaning (capitalization, removing on
non-letter chars)&lt;&#x2F;li&gt;
&lt;li&gt;every N hours (for us, 4) a shell script dumps all
the LDAP accounts, checks the one not yet declared as TWiki accounts,
and for them create them via a modified (to be used non-interactively,
and without declaring a password) version of the &lt;code&gt;register&lt;&#x2F;code&gt; TWiki perl
CGI script&lt;&#x2F;li&gt;
&lt;li&gt;This shell script keeps the list of all LDAP accounts as a
wiki page for reference, and mails the changes to an admin mailing list&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;a class=&quot;zola-anchor&quot; href=&quot;#implementation&quot; aria-label=&quot;Anchor link for: implementation&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;apache-module&quot;&gt;Apache module&lt;a class=&quot;zola-anchor&quot; href=&quot;#apache-module&quot; aria-label=&quot;Anchor link for: apache-module&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We are based on the v2.4.2 of
&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.muquit.com&#x2F;muquit&#x2F;software&#x2F;mod_auth_ldap&#x2F;mod_auth_ldap.html&quot;&gt;https:&#x2F;&#x2F;www.muquit.com&#x2F;muquit&#x2F;software&#x2F;mod_auth_ldap&#x2F;mod_auth_ldap.html&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;


&lt;a href=&quot;&#x2F;code&#x2F;ldap-twiki-authentication&#x2F;mod_auth_ldap.colas.tgz&quot;&gt;mod_auth_ldap.colas.tgz&lt;&#x2F;a&gt;

: The
whole module, modified&lt;&#x2F;li&gt;
&lt;li&gt;


&lt;a href=&quot;&#x2F;code&#x2F;ldap-twiki-authentication&#x2F;README.colas&quot;&gt;README.colas&lt;&#x2F;a&gt;

: The readme&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-modified-register-twiki-file&quot;&gt;The modified register TWiki file&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-modified-register-twiki-file&quot; aria-label=&quot;Anchor link for: the-modified-register-twiki-file&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;to be placed in the TWiki &lt;code&gt;bin&#x2F;&lt;&#x2F;code&gt; dir *



&lt;a href=&quot;&#x2F;code&#x2F;ldap-twiki-authentication&#x2F;register-ldap&quot;&gt;register-ldap&lt;&#x2F;a&gt;

: modified version of the
Cairo TWiki bin&#x2F;register script&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-offline-account-generation-scripts&quot;&gt;The offline account-generation scripts&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-offline-account-generation-scripts&quot; aria-label=&quot;Anchor link for: the-offline-account-generation-scripts&quot;&gt;🔗&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;


&lt;a href=&quot;&#x2F;code&#x2F;ldap-twiki-authentication&#x2F;README_scripts.txt&quot;&gt;README_scripts.txt&lt;&#x2F;a&gt;

: The README of scripts&lt;&#x2F;li&gt;
&lt;li&gt;


&lt;a href=&quot;&#x2F;code&#x2F;ldap-twiki-authentication&#x2F;ldap-ilog-update-wikinames&quot;&gt;ldap-ilog-update-wikinames&lt;&#x2F;a&gt;

: main script&lt;&#x2F;li&gt;
&lt;li&gt;


&lt;a href=&quot;&#x2F;code&#x2F;ldap-twiki-authentication&#x2F;ldap-ilog-dump-wikiname&quot;&gt;ldap-ilog-dump-wikiname&lt;&#x2F;a&gt;

: dump info for one account&lt;&#x2F;li&gt;
&lt;li&gt;


&lt;a href=&quot;&#x2F;code&#x2F;ldap-twiki-authentication&#x2F;wiki-register&quot;&gt;wiki-register&lt;&#x2F;a&gt;

: shell script calling the CGI register-ldap via wget&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;debug &#x2F; dev ones:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;


&lt;a href=&quot;&#x2F;code&#x2F;ldap-twiki-authentication&#x2F;wiki-register-all&quot;&gt;wiki-register-all&lt;&#x2F;a&gt;

: batch account creation&lt;&#x2F;li&gt;
&lt;li&gt;


&lt;a href=&quot;&#x2F;code&#x2F;ldap-twiki-authentication&#x2F;wiki-ldap-check-accounts&quot;&gt;wiki-ldap-check-accounts&lt;&#x2F;a&gt;

: one shot: clean all wiki pages accounts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
</feed>
