manbytesgnu_site

Source files for manbytesgnu.org
git clone git://holbrook.no/manbytesgnu_site.git
Log | Files | Refs

commit 1124bd9c8cf6cc23d95968963b98718eb4f187df
parent 8fb70355ecb6bd60d875c2c19502b9756aa82282
Author: lash <dev@holbrook.no>
Date:   Tue, 18 Jun 2024 17:55:12 +0100

Update missing posts, add atom

Diffstat:
Dcontent.proposed/20221015_fresh_git.rst | 153-------------------------------------------------------------------------------
Mcontent/20221015_fresh_git.rst | 12++++++------
Acontent/20240609_timezones.rst | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mlash/templates/base.html | 2+-
Mpelicanconf.py | 2+-
5 files changed, 97 insertions(+), 161 deletions(-)

diff --git a/content.proposed/20221015_fresh_git.rst b/content.proposed/20221015_fresh_git.rst @@ -1,153 +0,0 @@ -Keeping your gits in a row -########################## - -:date: 2022-10-15 14:49 -:modified: 2022-10-15 14:49 -:category: Archiving -:author: Louis Holbrook -:tags: git,bash -:slug: git-fresh -:summary: Scripts to keep your local git clone fresh, and help you move them around. -:lang: en -:status: draft - - -I believe that if you use a piece of code, you are also responsible for making sure that that code is available in the future. - -In this spirit, I decided a couple of years ago that I would keep a full clone of all VCS repositories that I use. - - -Dude, I can't be bothered -========================= - -Yeah, yeah, I hear ya. - -But imagine that one day you cannot reach the code repository anymore. - -It could be because you are working where internet is scarce or impossible to rely on. - -It could be that you have to cope with what was in your faraday cage when a giant solar flare happened. - -It could be that you, or the author of the code, have been cut off by the accelerating `weaponization of everything <https://torrentfreak.com/the-eu-wants-its-own-dns-resolver-that-can-block-unlawful-traffic-220119/>`_. - -Or maybe none of the above happened. But you still understand and appreciate what it means to build a truly decentralized society, where we all participate and contribute, not only consume. - - -Git organized -============= - -For every `git` repository that I use, I actually keep a *local copy* on my daily device. - -I also keep a copy on a device at home, *and* on a remote device. - -My thinking is: - -1. If I lose my laptop, I have two copies -2. If my house burns down, I have two copies -3. If my house burns down *with* my laptop inside, I have *at least one more copy*. - -... and so on. - - -I hate to move it, move it -========================== - -Sometimes we have to, though,. - -And what can be a real pain is to move heaps of code repositories around. For example if you are moving to a new machine, or want to bootstrap a new copy without having to source the data yourself. - -To make this easier, I wrote the `gitrefresh bash tool <https://git.defalsify.org/gitrefresh>`_ to copy only the minimum of information required to source the data from a remote. [1]_ - - - - -Freshening up -============= - -To make sense of what is what in the repository store, I use a simple folder structure. - -Obviously, when I create copies of the repository store, I would like to keep the same folder structure. So the tool needed to make that possible. - -Additionally, what's needed are tools to bootstrap a repository group from a list, and a tool to refresh those repositories periodically once they've been bootstrapped. - -To achieve this, I actually wrote `three tools <https://git.defalsify.org/gitrefresh>`_, as follows: - - -`gitlist.sh` ------------- - -create a list of `git` repositories under a filesystem path, with the option of preserving the directory structure. - - -`gitstart.sh` -------------- - -clone `git` repositories from a list generated from :code:`gitlist.sh`, with or without direcory structure. - - -`gitrefresh.sh` ---------------- - -fetch and merge updates from remotes of each repository under a directory. - - -Behavior -======== - -The :code:`gitlist.sh` and :code:`gitrefresh.sh` tools work more or less the same way. - -They traverse a directory structure recursively. - -Every time a valid git repository is found, that repository is processed. Afterwards, the tool will exit to the parent folder. [2]_ - - -Example -------- - -Let's say we have three repositories that we are mirroring locally: - -* :code:`https://github.com/bitcoin/bips` under :code:`btc/bips` -* :code:`https://aur.archlinux.org/libkeccak.git` under :code:`os/archlinux/aur/libkeccak` -* :code:`git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git` under :code:`linux/linux` - -First we use :code:`gitlist.sh` to generate the list of repos to bootstrap [3]_: - -.. code:: console - - $ gitlist.sh -p | tee gitlist.txt - https://github.com/bitcoin/bips btc/bips - https://aur.archlinux.org/libkeccak.git os/archlinux/aur/libkeccak` - git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux/linux` - - -Using :code:`gitstart.sh` with this list, we can restore this bunch of repositories *with* the same directory structure anywhere else: - -.. code:: console - - $ cd /path/to/new/repos/location - $ gitstart.sh < gitlist.txt - -Now, the idea is that from time to time you should get the latest changes from the upstream source. - -I simply combine :code:`gitrefresh.sh` with :code:`cron` to do this on the remote, while manually doing the refresh locally once in awhile. - -Using the tool, all it takes is: - -.. code:: console - - $ cd /path/to/new/repos/location - $ gitrefresh.sh pull - - -.. - - .. [1] Yes. I didn't get beyond `git` yet. But at least it's a start. - -.. - - .. [2] This, of course, means that the tool will not automatically archive code from *submodules*. The submodule construct is a target of both a lot of love and a lot of hate. Personally, I like it. But at the same time it is my opinion that it does not absolve us from *knowing* and being *mindful* which submodules a repository is using, and thus making sure that we have an independent clone of that repository. - -.. - - .. [3] We add the :code:`-p` flag to preserve the directory structure on disk. - diff --git a/content/20221015_fresh_git.rst b/content/20221015_fresh_git.rst @@ -1,15 +1,15 @@ Keeping your gits in a row ########################## -:date: 2022-10-15 14:49 -:modified: 2022-10-15 14:49 +:date: 2024-06-18 16:28 +:modified: 2024-06-18 16:33 :category: Archiving :author: Louis Holbrook :tags: git,bash :slug: git-fresh :summary: Scripts to keep your local git clone fresh, and help you move them around. :lang: en -:status: draft +:status: published I believe that if you use a piece of code, you are also responsible for making sure that that code is available in the future. @@ -17,7 +17,7 @@ I believe that if you use a piece of code, you are also responsible for making s In this spirit, I decided a couple of years ago that I would keep a full clone of all VCS repositories that I use. -Dude, I can't be bothered +Can't someone else do it? ========================= Yeah, yeah, I hear ya. @@ -56,7 +56,7 @@ Sometimes we have to, though,. And what can be a real pain is to move heaps of code repositories around. For example if you are moving to a new machine, or want to bootstrap a new copy without having to source the data yourself. -To make this easier, I wrote the `gitrefresh bash tool <https://git.defalsify.org/gitrefresh>`_ to copy only the minimum of information required to source the data from a remote. [1]_ +To make this easier, I wrote the `gitrefresh bash tool <https://holbrook.no/src/gitrefresh/log.html>`_ to copy only the minimum of information required to source the data from a remote. [1]_ @@ -70,7 +70,7 @@ Obviously, when I create copies of the repository store, I would like to keep th Additionally, what's needed are tools to bootstrap a repository group from a list, and a tool to refresh those repositories periodically once they've been bootstrapped. -To achieve this, I actually wrote `three tools <https://git.defalsify.org/gitrefresh>`_, as follows: +To achieve this, I actually wrote `three tools <https://holbrook.no/src/gitrefresh/log.html>`_, as follows: `gitlist.sh` diff --git a/content/20240609_timezones.rst b/content/20240609_timezones.rst @@ -0,0 +1,89 @@ +A world clock in your terminal +############################## + +:date: 2024-06-09 23:22:35 +:category: Offlining +:author: Louis Holbrook +:tags: bash,linux +:slug: world-clock-terminal +:summary: A single character command to display the current time of your favorite places in the world +:lang: en +:status: published + + +Zoning in +========= + +Timezones in Linux isn't a particularly intuitive issue. + +On my distro, archlinux, time-zone files are located in ``/usr/share/zoneinfo``, and there are several different categories of them. + +I've given up referencing time in the usual three- and four-letter acronyms like ``CEST`` and ``EST`` long ago. Not only are they ambiguous in themselves, but not all of them even have records in the zoneinfo tree. + +The best approach I have found so far is to look at the world continent directories, and look for nearby cities. Your OS alone may not be enough in all cases to figure out the zone for obscure locations, but at least it gets you half the way there. + +... as in, you ask your friend or associate to name some big cities close to them, and hope you find a match in your filesystem. + + +Environmental zones +=================== + +Turns out that the ``date`` command of GNU/Linux uses the environment variable ``TZ``, which lets you define the time-zone you want the output to be translated to. + +In my case at time of writing: + +.. code-block:: bash + + $ TZ=America/El_Salvador date + Sun Jun 9 05:00:16 PM CST 2024 + + # sigh, see what I mean? + $ TZ=CST date + Sun Jun 9 11:04:12 PM CST 2024 + + +Ugly, yes. Luckily ``date`` also lets you format the output. + + +Times, tabled +============= + +Now, let's bring those two together. + +.. code-block:: bash + + z=("US/Hawaii" "America/El_Salvador" "US/Eastern" "Europe/Lisbon" "Europe/Berlin" "Africa/Nairobi" "Asia/Taipei") + for z in ${z[@]}; do + d=$(TZ=$z date +'%H:%M:%S (%z)') + s=$(printf %-16s $z) + echo -e "$s\t$d" + done + +This script iterates a list of valid time-zone strings from ``/usr/share/zoneinfo``, outputting the zone along with the time and offet in a readable, tabulated format. + +This results in: + +.. code-block:: bash + + $ z + US/Hawaii 13:02:12 (-1000) + America/El_Salvador 17:02:12 (-0600) + US/Eastern 19:02:12 (-0400) + Europe/Lisbon 00:02:12 (+0100) + Europe/Berlin 01:02:12 (+0200) + Africa/Nairobi 02:02:12 (+0300) + Asia/Taipei 07:02:12 (+0800) + +The ``z`` here is merely an alias mapping added to ``.bashrc`` [1]_: + +.. code-block:: bash + + alias z=`bash $HOME/scripts/timezones.sh` + +Voila, now you have a world clock in your terminal at any time. + +And all it takes is two mere keystrokes. + +.. + + .. [1] Of course, be a bit careful with those aliases. There are even commands in GNU/Linux with only one character, like ``w``. If you override them in aliases, your override takes precedence. diff --git a/lash/templates/base.html b/lash/templates/base.html @@ -35,7 +35,7 @@ <footer id="contentinfo" class="body"> <hr/> <address id="about" class="vcard body"> - Powered by <a title="Pelican is a static site generator" href="https://getpelican.com/">Pelican</a> | <a title="manbytesgnu.com is licensed under Creative Commons Attribution-ShareAlike 4.0 International" href="https://holbrook.no/share/licenses/cc/cc-by-sa-4.0.txt">CC-BY-SA 4.0</a> | <a title="GIT site history since jan 15th 2022" href="https://holbrook.no/src/manbytesgnu_site/log.html">Site history</a> | ETH <a href="./images/donate_eth_qr.png" title="Ethereum address for tipping">0x98d0D0a1992d9A0c3C84ccb92182A05c852972d1</a> | BTC <a href="./images/donate_btc_qr.png" title="Bitcoin address for tipping">12DnRH9HpJ6cfET2LKHrURn2yZBDfDEwHv</a> + Powered by <a title="Pelican is a static site generator" href="https://getpelican.com/">Pelican</a> | <a title="manbytesgnu.com is licensed under Creative Commons Attribution-ShareAlike 4.0 International" href="https://holbrook.no/share/licenses/cc/cc-by-sa-4.0.txt">CC-BY-SA 4.0</a> | <a title="GIT site history since jan 15th 2022" href="https://holbrook.no/src/manbytesgnu_site/log.html">Site history</a> | <a href="./feeds/all.atom.xml" title="Atom feed of all posts">Atom feed</a> | ETH <a href="./images/donate_eth_qr.png" title="Ethereum address for tipping">0x98d0D0a1992d9A0c3C84ccb92182A05c852972d1</a> | BTC <a href="./images/donate_btc_qr.png" title="Bitcoin address for tipping">12DnRH9HpJ6cfET2LKHrURn2yZBDfDEwHv</a> </address><!-- /#about --> </footer><!-- /#contentinfo --> </body> diff --git a/pelicanconf.py b/pelicanconf.py @@ -12,7 +12,7 @@ TIMEZONE = 'Europe/Berlin' DEFAULT_LANG = 'en' # Feed generation is usually not desired when developing -FEED_ALL_ATOM = None +FEED_ALL_ATOM = "feeds/all.atom.xml" CATEGORY_FEED_ATOM = None TRANSLATION_FEED_ATOM = None AUTHOR_FEED_ATOM = None