summaryrefslogtreecommitdiff
path: root/src/content/tils/2020/11
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-03-31 21:51:40 -0300
committerEuAndreh <eu@euandre.org>2025-03-31 21:51:40 -0300
commit570ec471d1605318aeefb030cd78682ae442235b (patch)
tree51e17eabe37c6689f8799b55e6875c3480329a2c /src/content/tils/2020/11
parentMakefile, mkdeps.sh: Derive index.html and feed.xml from more static "sortdat... (diff)
downloadeuandre.org-570ec471d1605318aeefb030cd78682ae442235b.tar.gz
euandre.org-570ec471d1605318aeefb030cd78682ae442235b.tar.xz
src/content/: Update all files left to asciidoc
Diffstat (limited to 'src/content/tils/2020/11')
-rw-r--r--src/content/tils/2020/11/08/find-broken-symlink.adoc36
-rw-r--r--src/content/tils/2020/11/12/diy-nix-bash-ci.adoc45
-rw-r--r--src/content/tils/2020/11/12/git-bisect-automation.adoc23
-rw-r--r--src/content/tils/2020/11/12/useful-bashvars.adoc56
-rw-r--r--src/content/tils/2020/11/14/gpodder-media.adoc30
-rw-r--r--src/content/tils/2020/11/30/git-notes-ci.adoc63
6 files changed, 90 insertions, 163 deletions
diff --git a/src/content/tils/2020/11/08/find-broken-symlink.adoc b/src/content/tils/2020/11/08/find-broken-symlink.adoc
index bc97fc6..d8f6b20 100644
--- a/src/content/tils/2020/11/08/find-broken-symlink.adoc
+++ b/src/content/tils/2020/11/08/find-broken-symlink.adoc
@@ -1,36 +1,24 @@
----
+= Find broken symlinks with "find"
-title: Find broken symlinks with "find"
-
-date: 2020-11-08
-
-layout: post
-
-lang: en
-
-ref: find-broken-symlinks-with-find
-
-eu_categories: shell
-
----
+:annex: https://git-annex.branchable.com/
+:annex-wanted: https://git-annex.branchable.com/git-annex-wanted/
The `find` command knows how to show broken symlinks:
-```shell
+[source,shell]
+----
find . -xtype l
-```
+----
-This was useful to me when combined with [Git Annex][git-annex]. Its
-[`wanted`][git-annex-wanted] option allows you to have a "sparse" checkout of
-the content, and save space by not having to copy every annexed file locally:
+This was useful to me when combined with {annex}[Git Annex]. Its
+{annex-wanted}[`wanted`] option allows you to have a "sparse" checkout of the
+content, and save space by not having to copy every annexed file locally:
-```shell
+[source,shell]
+----
git annex wanted . 'exclude=Music/* and exclude=Videos/*'
-```
+----
You can `find` any broken symlinks outside those directories by querying with
Git Annex itself, but `find . -xtype l` works on other places too, where broken
symlinks might be a problem.
-
-[git-annex]: https://git-annex.branchable.com/
-[git-annex-wanted]: https://git-annex.branchable.com/git-annex-wanted/
diff --git a/src/content/tils/2020/11/12/diy-nix-bash-ci.adoc b/src/content/tils/2020/11/12/diy-nix-bash-ci.adoc
index 3336482..73919d5 100644
--- a/src/content/tils/2020/11/12/diy-nix-bash-ci.adoc
+++ b/src/content/tils/2020/11/12/diy-nix-bash-ci.adoc
@@ -1,27 +1,17 @@
----
+= DIY bare bones CI server with Bash and Nix
-title: DIY bare bones CI server with Bash and Nix
-
-date: 2020-11-12 3
-
-layout: post
-
-lang: en
-
-ref: diy-bare-bones-ci-server-with-bash-and-nix
-
-eu_categories: ci
-
----
+:post-receive: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
+:example-project: https://euandreh.xyz/remembering/ci.html
With a server with Nix installed (no need for NixOS), you can leverage its build
-isolation for running CI jobs by adding a [post-receive][post-receive] Git hook
+isolation for running CI jobs by adding a {post-receive}[post-receive] Git hook
to the server.
In most of my project I like to keep a `test` attribute which runs the test with
-`nix-build -A test`. This way, a post-receive hook could look like:
+`nix-build -A test`. This way, a post-receive hook could look like:
-```shell
+[source,shell]
+----
#!/usr/bin/env bash
set -Eeuo pipefail
set -x
@@ -42,33 +32,30 @@ finish() {
trap finish EXIT
nix-build -A test
-```
+----
-We initially (lines #5 to #8) create a log file, named after *when* the run is
-running and for *which* commit it is running for. The `exec` and `tee` combo
-allows the output of the script to go both to `stdout` *and* the log file. This
+We initially (lines #5 to #8) create a log file, named after _when_ the run is
+running and for _which_ commit it is running for. The `exec` and `tee` combo
+allows the output of the script to go both to `stdout` _and_ the log file. This
makes the logs output show up when you do a `git push`.
Lines #10 to #13 create a fresh clone of the repository and line #20 runs the
test command.
After using a similar post-receive hook for a while, I now even generate a
-simple HTML file to make the logs available ([example project][ci-logs])
+simple HTML file to make the logs available ({example-project}[example project])
through the browser.
-[post-receive]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
-[ci-logs]: https://euandreh.xyz/remembering/ci.html
-
-## Upsides
+== Upsides
No vendor lock-in, as all you need is a server with Nix installed.
And if you pin the Nixpkgs version you're using, this very simple setup yields
extremely sandboxed runs on a very hermetic environment.
-## Downsides
+== Downsides
Besides the many missing shiny features of this very simplistic CI, `nix-build`
-can be very resource intensive. Specifically, it consumes too much memory. So if
-it has to download too many things, or the build closure gets too big, the
+can be very resource intensive. Specifically, it consumes too much memory. So
+if it has to download too many things, or the build closure gets too big, the
server might very well run out of memory.
diff --git a/src/content/tils/2020/11/12/git-bisect-automation.adoc b/src/content/tils/2020/11/12/git-bisect-automation.adoc
index 9c34b2a..c70bb2d 100644
--- a/src/content/tils/2020/11/12/git-bisect-automation.adoc
+++ b/src/content/tils/2020/11/12/git-bisect-automation.adoc
@@ -1,18 +1,4 @@
----
-
-title: Git bisect automation
-
-date: 2020-11-12 2
-
-layout: post
-
-lang: en
-
-ref: git-bisect-automation
-
-eu_categories: git
-
----
+= Git bisect automation
It is good to have an standardized way to run builds and tests on the repository
of a project, so that you can find when a bug was introduced by using
@@ -22,14 +8,15 @@ I've already been in the situation when a bug was introduced and I didn't know
how it even was occurring, and running Git bisect over hundreds of commits to
pinpoint the failing commit was very empowering:
-```
+....
$ GOOD_COMMIT_SHA=e1fd0a817d192c5a5df72dd7422e36558fa78e46
$ git bisect start HEAD $GOOD_COMMIT_SHA
$ git bisect run sn -c './build.sh && ./run-failing-case.sh'
-```
+....
Git will than do a binary search between the commits, and run the commands you
provide it with to find the failing commit.
Instead of being afraid of doing a bisect, you should instead leverage it, and
-make Git help you dig through the history of the repository to find the bad code.
+make Git help you dig through the history of the repository to find the bad
+code.
diff --git a/src/content/tils/2020/11/12/useful-bashvars.adoc b/src/content/tils/2020/11/12/useful-bashvars.adoc
index 33a072e..5061b64 100644
--- a/src/content/tils/2020/11/12/useful-bashvars.adoc
+++ b/src/content/tils/2020/11/12/useful-bashvars.adoc
@@ -1,59 +1,49 @@
----
+= Useful Bash variables
-title: Useful Bash variables
+:bash: https://www.gnu.org/software/bash/
+:bash-bang-bang: https://www.gnu.org/software/bash/manual/bash.html#Event-Designators
+:bash-dollar-underscore: https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters
-date: 2020-11-12 1
+{bash}[GNU Bash] has a few two letter variables that may be useful when typing
+on the terminal.
-layout: post
+== `!!`: the text of the last command
-lang: en
-
-ref: useful-bash-variables
-
-eu_categories: shell
-
----
-
-[GNU Bash][gnu-bash] has a few two letter variables that may be useful when
-typing on the terminal.
-
-[gnu-bash]: https://www.gnu.org/software/bash/
-
-## `!!`: the text of the last command
-
-The [`!!` variable][previous-command] refers to the previous command, and I find
+The {bash-bang-bang}[`!!` variable] refers to the previous command, and I find
useful when following chains for symlinks:
-[previous-command]: https://www.gnu.org/software/bash/manual/bash.html#Event-Designators
-
-```shell
+[source,shell]
+----
$ which git
/run/current-system/sw/bin/git
$ readlink $(!!)
readlink $(which git)
/nix/store/5bgr1xpm4m0r72h9049jbbhagxdyrnyb-git-2.28.0/bin/git
-```
+----
It is also useful when you forget to prefix `sudo` to a command that requires
it:
-```shell
+[source,shell]
+----
$ requires-sudo.sh
requires-sudo.sh: Permission denied
$ sudo !!
sudo ./requires-sudo.sh
# all good
-```
+----
Bash prints the command expansion before executing it, so it is better for you
to follow along what it is doing.
-## `$_`: most recent parameter
+== `$_`: most recent parameter
-The [`$_` variable][recent-parameter] will give you the most recent parameter
-you provided to a previous argument, which can save you typing sometimes:
+The {bash-dollar-underscore}[`$_` variable] will give you the most recent
+parameter you provided to a previous argument, which can save you typing
+sometimes:
-```shell
+[source,shell]
+----
# instead of...
$ mkdir -p a/b/c/d/
$ cd a/b/c/d/
@@ -61,11 +51,9 @@ $ cd a/b/c/d/
# ...you can:
$ mkdir -p a/b/c/d/
$ cd $_
-```
-
-[recent-parameter]: https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters
+----
-## Conclusion
+== Conclusion
I wouldn't use those in a script, as it would make the script terser to read, I
find those useful shortcut that are handy when writing at the interactive
diff --git a/src/content/tils/2020/11/14/gpodder-media.adoc b/src/content/tils/2020/11/14/gpodder-media.adoc
index a74b225..f722f35 100644
--- a/src/content/tils/2020/11/14/gpodder-media.adoc
+++ b/src/content/tils/2020/11/14/gpodder-media.adoc
@@ -1,24 +1,15 @@
----
+= gPodder as a media subscription manager
-title: gPodder as a media subscription manager
+:re-discover: https://www.charlieharrington.com/unexpected-useless-and-urgent
+:gpodder: https://gpodder.github.io/
-date: 2020-11-14
+As we {re-discover}[re-discover] the value of Atom/RSS feeds, most useful feed
+clients I know of don't support media, specifically audio and video.
-layout: post
+{gpodder}[gPodder] does.
-lang: en
-
-ref: gpodder-as-a-media-subscription-manager
-
----
-
-As we [re-discover][rss] the value of Atom/RSS feeds, most useful feed clients I
-know of don't support media, specifically audio and video.
-
-[gPodder][gpodder] does.
-
-It is mostly know as a desktop podcatcher. But the thing about podcasts is that
-the feed is provided through an RSS/Atom feed. So you can just use gPodder as
+It is mostly know as a desktop podcatcher. But the thing about podcasts is that
+the feed is provided through an RSS/Atom feed. So you can just use gPodder as
your media feed client, where you have control of what you look at.
I audio and video providers I know of offer an RSS/Atom view of their content,
@@ -26,8 +17,5 @@ so you can, say, treat any YouTube channel like a feed on its own.
gPodder will then managed your feeds, watched/unwatched, queue downloads, etc.
-Being obvious now, it was a big finding for me. If it got you interested, I
+Being obvious now, it was a big finding for me. If it got you interested, I
recommend you giving gPodder a try.
-
-[rss]: https://www.charlieharrington.com/unexpected-useless-and-urgent
-[gpodder]: https://gpodder.github.io/
diff --git a/src/content/tils/2020/11/30/git-notes-ci.adoc b/src/content/tils/2020/11/30/git-notes-ci.adoc
index f8dd063..bfce42a 100644
--- a/src/content/tils/2020/11/30/git-notes-ci.adoc
+++ b/src/content/tils/2020/11/30/git-notes-ci.adoc
@@ -1,28 +1,19 @@
----
+= Storing CI data on Git notes
-title: Storing CI data on Git notes
+:git-notes: https://git-scm.com/docs/git-notes
+:nix-bash-ci: link:../12/diy-nix-bash-ci.html
+:cgit: https://git.zx2c4.com/cgit/
-date: 2020-11-30
+Extending the bare bones CI server I've {nix-bash-ci}[talked about before],
+divoplade on Freenode suggested storing CI artifacts on {git-notes}[Git notes],
+such as tarballs, binaries, logs, _etc_.
-layout: post
+I've written a small script that will put log files and CI job data on Git
+notes, and make it visible on the porcelain log. It is a simple extension of
+the previous article:
-lang: en
-
-ref: storing-ci-data-on-git-notes
-
-eu_categories: git,ci
-
----
-
-Extending the bare bones CI server I've [talked about before][previous-article],
-divoplade on Freenode suggested storing CI artifacts on [Git notes][git-notes],
-such as tarballs, binaries, logs, *etc*.
-
-I've written a small script that will put log files and CI job data on Git notes,
-and make it visible on the porcelain log. It is a simple extension of the
-previous article:
-
-```shell
+[source,shell]
+----
#!/usr/bin/env bash
set -Eeuo pipefail
set -x
@@ -63,16 +54,17 @@ git config --global user.name 'EuAndreh CI'
./container make check site
./container make publish
-```
+----
-The important part is in the `finish()` function:
-- #25 stores the exit status and the generated filename separated by spaces;
-- #26 adds the log file in a note using the `refs/notes/ci-logs` ref;
-- #27 it adds a note to the commit saying how to see the logs.
+The important part is in the `finish()` function: - #25 stores the exit status
+and the generated filename separated by spaces; - #26 adds the log file in a
+note using the `refs/notes/ci-logs` ref; - #27 it adds a note to the commit
+saying how to see the logs.
A commit now has an attached note, and shows it whenever you look at it:
-```diff
+[source,diff]
+----
$ git show 87c57133abd8be5d7cc46afbf107f59b26066575
commit 87c57133abd8be5d7cc46afbf107f59b26066575
Author: EuAndreh <eu@euandre.org>
@@ -100,23 +92,20 @@ index d1830ca..a4ccde7 100644
(service dhcp-client-service-type)
#;
(service opensmtpd-service-type
-```
+----
-Other tools such as [cgit][cgit] will also show notes on the web interface:
-<https://euandre.org/git/servers/commit?id=87c57133abd8be5d7cc46afbf107f59b26066575>.
+Other tools such as {cgit}[cgit] will also show notes on the web interface:
+https://euandre.org/git/servers/commit?id=87c57133abd8be5d7cc46afbf107f59b26066575.
You can go even further: since cgit can serve raw blob directly, you can even
serve such artifacts (log files, release artifacts, binaries) from cgit itself:
-```shell
+[source,shell]
+----
$ SHA="$(git notes --ref=refs/notes/ci-logs list 87c57133abd8be5d7cc46afbf107f59b26066575)"
$ echo "https://euandre.org/git/servers/blob?id=$SHA"
https://euandre.org/git/servers/blob?id=1707a97bae24e3864fe7943f8dda6d01c294fb5c
-```
+----
And like that you'll have cgit serving the artifacts for you:
-<https://euandre.org/git/servers/blob?id=1707a97bae24e3864fe7943f8dda6d01c294fb5c>.
-
-[previous-article]: {% link _tils/2020-11-12-diy-bare-bones-ci-server-with-bash-and-nix.md %}
-[git-notes]: https://git-scm.com/docs/git-notes
-[cgit]: https://git.zx2c4.com/cgit/
+https://euandre.org/git/servers/blob?id=1707a97bae24e3864fe7943f8dda6d01c294fb5c.