summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-04-16 11:20:43 -0300
committerEuAndreh <eu@euandre.org>2025-04-16 11:20:43 -0300
commitd36c2e459a74ec67e523539eb98b78b95b01432a (patch)
treea7099fbfbdab6a21f59b6efe095bffb40ceae646
parentsrc/content/style.css: Show header on hover only (diff)
downloadeuandre.org-d36c2e459a74ec67e523539eb98b78b95b01432a.tar.gz
euandre.org-d36c2e459a74ec67e523539eb98b78b95b01432a.tar.xz
src/content/: Normalize [source,$lang] code blocks
-rw-r--r--src/content/blog/2018/07/17/guix-nixos.adoc6
-rw-r--r--src/content/blog/2018/12/21/ytdl-subs.adoc10
-rw-r--r--src/content/blog/2019/06/02/nixos-stateless-workstation.adoc2
-rw-r--r--src/content/blog/2020/08/10/guix-srht.adoc4
-rw-r--r--src/content/blog/2020/10/05/cargo2nix.adoc2
-rw-r--r--src/content/blog/2020/10/05/swift2nix.adoc5
-rw-r--r--src/content/blog/2020/11/14/local-first-review.adoc6
-rw-r--r--src/content/blog/2021/01/26/remembering-ann.adoc18
-rw-r--r--src/content/blog/2021/02/17/fallible.adoc2
-rw-r--r--src/content/blog/2021/04/29/relational-review.adoc6
-rw-r--r--src/content/pastebins/2018/07/13/guixbuilder.adoc2
-rw-r--r--src/content/pastebins/2019/06/08/inconsistent-hash.adoc4
-rw-r--r--src/content/pastebins/2019/12/29/raku-tuple-type.adoc4
-rw-r--r--src/content/pastebins/2020/01/04/guix-import-failure.adoc2
-rw-r--r--src/content/pastebins/2020/02/14/guix-shebang.adoc2
-rw-r--r--src/content/pastebins/2020/11/27/guix-build-local.adoc4
-rw-r--r--src/content/pastebins/2020/12/15/guix-pack-fail.adoc4
-rw-r--r--src/content/pastebins/2021/06/22/curl-wget.adoc4
-rw-r--r--src/content/podcasts/2020/12/19/test-entry.adoc2
-rw-r--r--src/content/screencasts/2021/02/07/autoqemu.adoc2
-rw-r--r--src/content/tils/2020/08/12/filename-timestamp.adoc4
-rw-r--r--src/content/tils/2020/08/14/browse-git.adoc12
-rw-r--r--src/content/tils/2020/08/16/git-search.adoc6
-rw-r--r--src/content/tils/2020/08/28/grep-online.adoc6
-rw-r--r--src/content/tils/2020/09/04/cli-email-fun-profit.adoc11
-rw-r--r--src/content/tils/2020/09/05/oldschool-pr.adoc6
-rw-r--r--src/content/tils/2020/10/11/search-git-history.adoc4
-rw-r--r--src/content/tils/2020/11/08/find-broken-symlink.adoc4
-rw-r--r--src/content/tils/2020/11/12/diy-nix-bash-ci.adoc2
-rw-r--r--src/content/tils/2020/11/12/git-bisect-automation.adoc5
-rw-r--r--src/content/tils/2020/11/12/useful-bashvars.adoc6
-rw-r--r--src/content/tils/2020/11/30/git-notes-ci.adoc4
-rw-r--r--src/content/tils/2020/12/15/shellcheck-repo.adoc17
-rw-r--r--src/content/tils/2021/01/12/curl-awk-emails.adoc8
-rw-r--r--src/content/tils/2021/01/17/posix-shebang.adoc6
-rw-r--r--src/content/tils/2021/07/23/git-tls-gpg.adoc2
-rw-r--r--src/content/tils/2021/08/11/js-bigint-reviver.adoc5
37 files changed, 103 insertions, 96 deletions
diff --git a/src/content/blog/2018/07/17/guix-nixos.adoc b/src/content/blog/2018/07/17/guix-nixos.adoc
index b9cd89b..42290f6 100644
--- a/src/content/blog/2018/07/17/guix-nixos.adoc
+++ b/src/content/blog/2018/07/17/guix-nixos.adoc
@@ -19,7 +19,7 @@ builds in the isolated environments.
The {manual}[manual] already provides you with a ready to run (as root) command
for creating the build users:
-[source,bash]
+[source,sh]
----
groupadd --system guixbuild
for i in `seq -w 1 10`;
@@ -37,7 +37,7 @@ However, In my personal NixOS I have disabled
{mutable-users}[`users.mutableUsers`], which means that even if I run the above
command it means that they'll be removed once I rebuild my OS:
-[source,shell]
+[source,sh]
----
$ sudo nixos-rebuild switch
(...)
@@ -165,7 +165,7 @@ guix-daemon = {
There you go! After running `sudo nixos-rebuild switch` I could get Guix up and
running:
-[source,bash]
+[source,sh]
----
$ guix package -i hello
The following package will be installed:
diff --git a/src/content/blog/2018/12/21/ytdl-subs.adoc b/src/content/blog/2018/12/21/ytdl-subs.adoc
index b6540b7..5c4575f 100644
--- a/src/content/blog/2018/12/21/ytdl-subs.adoc
+++ b/src/content/blog/2018/12/21/ytdl-subs.adoc
@@ -46,7 +46,7 @@ less control on what you share with YouTube and Google.
youtube-dl is a command-line tool for downloading videos, from YouTube and
{other-sites}[many other sites]:
-[source,shell]
+[source,sh]
----
$ youtube-dl https://www.youtube.com/watch?v=rnMYZnY3uLA
[youtube] rnMYZnY3uLA: Downloading webpage
@@ -70,7 +70,7 @@ some interesting flags that we can use:
Putting it all together:
-[source,shell]
+[source,sh]
----
$ youtube-dl "https://www.youtube.com/channel/UClu474HMt895mVxZdlIHXEA" \
--download-archive ~/Nextcloud/cache/youtube-dl-seen.conf \
@@ -90,7 +90,7 @@ download only the last video, since the other 19 were already downloaded.
With this basic setup you have a minimal subscription system at work, and you
can create some functions to help you manage that:
-[source,shell]
+[source,sh]
----
#!/bin/sh
@@ -128,7 +128,7 @@ export -f download_playlist
With these functions, you now can have a subscription fetching script to
download the latest videos from your favorite channels:
-[source,shell]
+[source,sh]
----
#!/bin/sh
@@ -180,7 +180,7 @@ You could try putting it in a dedicated git repository, and wrap the script with
an autocommit after every run. If you ever had a merge conflict, you'd simply
accept all changes and then run the following to tidy up the file:
+
-[source,shell]
+[source,sh]
----
$ uniq youtube-dl-seen.conf > youtube-dl-seen.conf
----
diff --git a/src/content/blog/2019/06/02/nixos-stateless-workstation.adoc b/src/content/blog/2019/06/02/nixos-stateless-workstation.adoc
index 541440b..f89a106 100644
--- a/src/content/blog/2019/06/02/nixos-stateless-workstation.adoc
+++ b/src/content/blog/2019/06/02/nixos-stateless-workstation.adoc
@@ -106,7 +106,7 @@ I'm using {myrepos}[myrepos] to manage all my git repositories, and the general
rule I apply is to add any repository specific configuration in myrepos'
`checkout` phase:
-[source,shell]
+[source,sh]
----
# sample ~/.mrconfig file snippet
[dev/guix/guix]
diff --git a/src/content/blog/2020/08/10/guix-srht.adoc b/src/content/blog/2020/08/10/guix-srht.adoc
index 6411259..a89e86e 100644
--- a/src/content/blog/2020/08/10/guix-srht.adoc
+++ b/src/content/blog/2020/08/10/guix-srht.adoc
@@ -18,7 +18,7 @@ heavily on interactive input.
I developed the following set of scripts that I have been using for some time to
run Guix tasks inside builds.sr.ht jobs. First, `install-guix.sh`:
-[source,shell]
+[source,sh]
----
#!/usr/bin/env bash
set -x
@@ -67,7 +67,7 @@ guixbuild users and authorize the `ci.guix.gnu.org.pub` signing key.
After installing Guix, we perform a `guix pull` to update Guix inside
`start-guix.sh`:
-[source,shell]
+[source,sh]
----
#!/usr/bin/env bash
set -x
diff --git a/src/content/blog/2020/10/05/cargo2nix.adoc b/src/content/blog/2020/10/05/cargo2nix.adoc
index 38f3bfa..a2d478e 100644
--- a/src/content/blog/2020/10/05/cargo2nix.adoc
+++ b/src/content/blog/2020/10/05/cargo2nix.adoc
@@ -60,7 +60,7 @@ internal to Cargo.
Try out the demo (also taken from the repo's README):
-[source,shell]
+[source,sh]
----
pushd "$(mktemp -d)"
wget -O- https://euandre.org/static/attachments/cargo2nix-demo.tar.gz |
diff --git a/src/content/blog/2020/10/05/swift2nix.adoc b/src/content/blog/2020/10/05/swift2nix.adoc
index 4e0ae36..ba0125f 100644
--- a/src/content/blog/2020/10/05/swift2nix.adoc
+++ b/src/content/blog/2020/10/05/swift2nix.adoc
@@ -15,6 +15,7 @@ I wrote a simple little tool called {swift2nix}[swift2nix] that allows you trick
Swift's package manager into assuming everything is set up. Here's the example
from swift2nix's README file:
+[source,nix]
----
let
niv-sources = import ./nix/sources.nix;
@@ -143,7 +144,7 @@ This is something that {node2nix}[node2nix] does right. It allows you to build
the Node.js environment to satisfy NPM, and you can keep using NPM for
everything else:
-[source,shell]
+[source,sh]
----
ln -s ${node2nix-package.shell.nodeDependencies}/lib/node_modules ./node_modules
npm test
@@ -165,7 +166,7 @@ nice-to-have.
swift2nix itself could provide an "easy" interface, something that allows you to
write:
-[source,shell]
+[source,sh]
----
nix-build -A swift2nix.release
nix-build -A swift2nix.test
diff --git a/src/content/blog/2020/11/14/local-first-review.adoc b/src/content/blog/2020/11/14/local-first-review.adoc
index 2a57664..f9dd4b0 100644
--- a/src/content/blog/2020/11/14/local-first-review.adoc
+++ b/src/content/blog/2020/11/14/local-first-review.adoc
@@ -46,7 +46,7 @@ ____
They give examples of artificial restrictions, like this artificial restriction
I've come up with:
-[source,bash]
+[source,sh]
----
#!/bin/sh
@@ -63,7 +63,7 @@ echo $((2 + 2))
Now when using this very useful program:
-[source,bash]
+[source,sh]
----
# today
$ ./useful-adder.sh
@@ -84,7 +84,7 @@ or similar restriction, and stopped working after days pass? Or what if the
programmer added a constant to make the development simpler, and this led to
unintentionally restricting the user?
-[source,bash]
+[source,sh]
----
# today
$ useful-program
diff --git a/src/content/blog/2021/01/26/remembering-ann.adoc b/src/content/blog/2021/01/26/remembering-ann.adoc
index 889683d..6786b3c 100644
--- a/src/content/blog/2021/01/26/remembering-ann.adoc
+++ b/src/content/blog/2021/01/26/remembering-ann.adoc
@@ -54,7 +54,7 @@ previous choices appear at the beginning.
Where you would do:
-[source,shell]
+[source,sh]
----
$ seq 5 | fzf
@@ -69,7 +69,7 @@ $ seq 5 | fzf
And every time get the same order of numbers, now you can write:
-[source,shell]
+[source,sh]
----
$ seq 5 | remembering -p seq-fzf -c fzf
@@ -85,7 +85,7 @@ $ seq 5 | remembering -p seq-fzf -c fzf
On the first run, everything is the same. If you picked 4 on the previous
example, the following run would be different:
-[source,shell]
+[source,sh]
----
$ seq 5 | remembering -p seq-fzf -c fzf
@@ -124,7 +124,7 @@ Here are some functions I wrote myself that you may find useful:
=== Run a command with fzf on `$PWD`
-[source,shellcheck]
+[source,sh]
----
f() {
profile="$f-shell-function(pwd | sed -e 's_/_-_g')"
@@ -148,7 +148,7 @@ profile allows it to not mix data for different repositories.
:pass: https://www.passwordstore.org/
-[source,shell]
+[source,sh]
----
choice="$(find "$HOME/.password-store" -type f | \
grep -Ev '(.git|.gpg-id)' | \
@@ -169,14 +169,14 @@ the contents of my {pass}[password store], with the entries ordered by usage.
Where I previously had:
-[source,shell]
+[source,sh]
----
exe=$(yeganesh -x) && exec $exe
----
Now I have:
-[source,shell]
+[source,sh]
----
exe=$(dmenu_path | remembering -p dmenu-exec -c dmenu) && exec $exe
----
@@ -187,7 +187,7 @@ If you don't have `dmenu_path`, you can get just the underlying `stest` tool
that looks at the executables available in your `$PATH`. Here's a juicy
one-liner to do it:
-[source,shell]
+[source,sh]
----
$ wget -O- https://dl.suckless.org/tools/dmenu-5.0.tar.gz | \
tar Ozxf - dmenu-5.0/arg.h dmenu-5.0/stest.c | \
@@ -198,7 +198,7 @@ $ wget -O- https://dl.suckless.org/tools/dmenu-5.0.tar.gz | \
With the `stest` utility you'll be able to list executables in your `$PATH` and
pipe them to dmenu or something else yourself:
-[source,shell]
+[source,sh]
----
$ (IFS=:; ./stest -flx $PATH;) | sort -u | remembering -p another-dmenu-exec -c dmenu | sh
----
diff --git a/src/content/blog/2021/02/17/fallible.adoc b/src/content/blog/2021/02/17/fallible.adoc
index f2aa333..1f2f641 100644
--- a/src/content/blog/2021/02/17/fallible.adoc
+++ b/src/content/blog/2021/02/17/fallible.adoc
@@ -265,7 +265,7 @@ int main() {
Compile with `-DFALLIBLE` and run {fallible-check}[`fallible-check.1`]:
-[source,shell]
+[source,sh]
----
$ c99 -DFALLIBLE -o leaky leaky.c -lfallible
$ fallible-check ./leaky
diff --git a/src/content/blog/2021/04/29/relational-review.adoc b/src/content/blog/2021/04/29/relational-review.adoc
index cb552c3..4b53737 100644
--- a/src/content/blog/2021/04/29/relational-review.adoc
+++ b/src/content/blog/2021/04/29/relational-review.adoc
@@ -89,6 +89,7 @@ FROM people employees
INNER JOIN people managers ON employees.manager_id = managers.id;
----
+[source,clojure]
----
;; create schema
#{{:db/ident :person/id
@@ -126,11 +127,12 @@ Both "Foo" and "Bar" are employees, and the data is normalized. SQL represents
data as tables, and Datomic as datoms, but relations could be derived from both,
which we could view as:
-....
+[source,sql]
+----
employee_name | manager_name
----------------------------
"Foo" | "Bar"
-....
+----
== Conclusion
diff --git a/src/content/pastebins/2018/07/13/guixbuilder.adoc b/src/content/pastebins/2018/07/13/guixbuilder.adoc
index e8a8dd5..35057f9 100644
--- a/src/content/pastebins/2018/07/13/guixbuilder.adoc
+++ b/src/content/pastebins/2018/07/13/guixbuilder.adoc
@@ -1,7 +1,7 @@
= Guix builder user creation commands
:categories: guix
-[source,shell]
+[source,sh]
----
groupadd --system guixbuild
for i in `seq -w 1 10`;
diff --git a/src/content/pastebins/2019/06/08/inconsistent-hash.adoc b/src/content/pastebins/2019/06/08/inconsistent-hash.adoc
index 32ebaec..8dc5794 100644
--- a/src/content/pastebins/2019/06/08/inconsistent-hash.adoc
+++ b/src/content/pastebins/2019/06/08/inconsistent-hash.adoc
@@ -37,7 +37,7 @@ terraform-godaddy = pkgs.buildGoModule rec {
== Local build:
-[source,shell]
+[source,sh]
----
$ nix-build -A terraform-godaddy
these derivations will be built:
@@ -191,7 +191,7 @@ error: build of '/nix/store/y5961vv6y9c0ps2sbd8xfnpqvk0q7qhq-terraform-godaddy-1
The `setup.sh` script contains a call to `nix-shell` which in turns build the
same `terraform-godaddy` derivation:
-[source,shell]
+[source,sh]
----
$ cd vps/
$ ./scripts/ci/setup.sh
diff --git a/src/content/pastebins/2019/12/29/raku-tuple-type.adoc b/src/content/pastebins/2019/12/29/raku-tuple-type.adoc
index 0337ad8..50dd841 100644
--- a/src/content/pastebins/2019/12/29/raku-tuple-type.adoc
+++ b/src/content/pastebins/2019/12/29/raku-tuple-type.adoc
@@ -1,7 +1,7 @@
= Raku tuple type annotation
:categories: raku programming-languages
-[source,perl]
+[source,raku]
----
# Single Str return value: this works
sub f1(Str $in --> Str) {
@@ -21,7 +21,7 @@ sub f2(Str $in --> (Str, Str)) {
Error log is:
-[source,perl]
+[source,raku]
----
===SORRY!=== Error while compiling /path/to/my/file
Malformed return value
diff --git a/src/content/pastebins/2020/01/04/guix-import-failure.adoc b/src/content/pastebins/2020/01/04/guix-import-failure.adoc
index 08c6ea1..5896645 100644
--- a/src/content/pastebins/2020/01/04/guix-import-failure.adoc
+++ b/src/content/pastebins/2020/01/04/guix-import-failure.adoc
@@ -1,7 +1,7 @@
= Failure on Guix TeX Live importer
:categories: guix
-[source,shell]
+[source,sh]
----
$ guix import texlive fontspec
redirection vers « https://ctan.org/xml/1.2/pkg/fontspec »...
diff --git a/src/content/pastebins/2020/02/14/guix-shebang.adoc b/src/content/pastebins/2020/02/14/guix-shebang.adoc
index 0dcbe54..d415d36 100644
--- a/src/content/pastebins/2020/02/14/guix-shebang.adoc
+++ b/src/content/pastebins/2020/02/14/guix-shebang.adoc
@@ -1,7 +1,7 @@
= Guix shebang
:categories: guix
-[source,shell]
+[source,sh]
----
#!/usr/bin/env -S guix environment --ad-hoc bash -- bash
set -Eeuo pipefail
diff --git a/src/content/pastebins/2020/11/27/guix-build-local.adoc b/src/content/pastebins/2020/11/27/guix-build-local.adoc
index 6fe5089..1a18d4b 100644
--- a/src/content/pastebins/2020/11/27/guix-build-local.adoc
+++ b/src/content/pastebins/2020/11/27/guix-build-local.adoc
@@ -36,7 +36,7 @@ Inside a file named `build.scm`:
A plain build command didn't work:
-[source,shell]
+[source,sh]
----
$ guix build -L. my-hello
guix build: error: my-hello : paquet inconnu
@@ -44,7 +44,7 @@ guix build: error: my-hello : paquet inconnu
But with an eval expression it did:
-[source,shell]
+[source,sh]
----
$ guix build -L. -e '(@ (build) my-hello)'
# works
diff --git a/src/content/pastebins/2020/12/15/guix-pack-fail.adoc b/src/content/pastebins/2020/12/15/guix-pack-fail.adoc
index 369cae4..3631fbc 100644
--- a/src/content/pastebins/2020/12/15/guix-pack-fail.adoc
+++ b/src/content/pastebins/2020/12/15/guix-pack-fail.adoc
@@ -9,7 +9,7 @@ FIXED: Use `GUIX_PROFILE= source etc/profile`
The example from the {post}[blog post] fails.
-[source,shell]
+[source,sh]
----
$ tar xf `guix pack --relocatable -S /bin=bin -S /etc=etc guile gnutls guile-json`
$ source etc/profile
@@ -75,7 +75,7 @@ no code for module (gnutls)
My Guix version if fairly recent:
-[source,shell]
+[source,sh]
----
$ guix describe
Génération 83 14 déc. 2020 00:28:16 (actuelle)
diff --git a/src/content/pastebins/2021/06/22/curl-wget.adoc b/src/content/pastebins/2021/06/22/curl-wget.adoc
index 08caf12..97f55c7 100644
--- a/src/content/pastebins/2021/06/22/curl-wget.adoc
+++ b/src/content/pastebins/2021/06/22/curl-wget.adoc
@@ -2,7 +2,7 @@
`curl`:
-[source,shell]
+[source,sh]
----
$ pushd `mktemp -d`
/tmp/tmp.AZkwvk7azD ~/
@@ -55,7 +55,7 @@ SUM: 1309 39501 56083 25
`wget`:
-[source,shell]
+[source,sh]
----
$ pushd `mktemp -d`
/tmp/tmp.NX0udlJMiz ~/
diff --git a/src/content/podcasts/2020/12/19/test-entry.adoc b/src/content/podcasts/2020/12/19/test-entry.adoc
index c641449..9e7eb00 100644
--- a/src/content/podcasts/2020/12/19/test-entry.adoc
+++ b/src/content/podcasts/2020/12/19/test-entry.adoc
@@ -11,7 +11,7 @@ Another link to home: https://euandre.org
A code block:
-[source,shell]
+[source,sh]
----
$ l
total 372K
diff --git a/src/content/screencasts/2021/02/07/autoqemu.adoc b/src/content/screencasts/2021/02/07/autoqemu.adoc
index 440ede9..b20b092 100644
--- a/src/content/screencasts/2021/02/07/autoqemu.adoc
+++ b/src/content/screencasts/2021/02/07/autoqemu.adoc
@@ -41,7 +41,7 @@ were{empty}footnote:script-command[
{klaatu}[klaatu] for the tip!).
]:
-[source,shell]
+[source,sh]
----
pushd `mktemp -d`
git clone https://euandre.org/git/autoqemu .
diff --git a/src/content/tils/2020/08/12/filename-timestamp.adoc b/src/content/tils/2020/08/12/filename-timestamp.adoc
index 1cbe404..aa8d63b 100644
--- a/src/content/tils/2020/08/12/filename-timestamp.adoc
+++ b/src/content/tils/2020/08/12/filename-timestamp.adoc
@@ -5,7 +5,7 @@ When writing Jekyll posts or creating log files with dates on them, I usually
struggle with finding a direct way of accomplishing that. There's a simple
solution: `date -I`.
-[source,shell]
+[source,sh]
----
./my-program.sh > my-program.$(date -I).log
cp post-template.md _posts/$(date -I)-post-slug.md
@@ -18,7 +18,7 @@ I always had to read `man date` or search the web over and over, and after doing
this repeatedly it became clear that both `date -I` and `date -Is` (`s` here
stands for seconds) are the thing that I'm looking for 95% of the time:
-[source,shell]
+[source,sh]
----
# inside my-program.sh
echo "Program started at $(date -Is)"
diff --git a/src/content/tils/2020/08/14/browse-git.adoc b/src/content/tils/2020/08/14/browse-git.adoc
index 3d7660e..6b3ff6d 100644
--- a/src/content/tils/2020/08/14/browse-git.adoc
+++ b/src/content/tils/2020/08/14/browse-git.adoc
@@ -4,7 +4,7 @@
I commonly use tools like `git log` together with `git show` when inspecting
past changes in a repository:
-[source,shell]
+[source,sh]
----
git log
# search for a the commit I'm looking for
@@ -18,7 +18,7 @@ but to browse the whole repository at that specific commit.
I used to accomplish it the "brute force" way: clone the whole repository in
another folder and checkout the commit there:
-[source,shell]
+[source,sh]
----
git clone <original-repo> /tmp/tmp-repo-clone
cd /tmp-repo-clone
@@ -28,7 +28,7 @@ git checkout <my-commit>
But git itself allows we to specific the directory of the checkout by using the
`--work-tree` global git flag. This is what `man git` says about it:
-[source,txt]
+[source,text]
----
--work-tree=<path>
Set the path to the working tree. It can be an absolute path or a path relative to the current working
@@ -40,7 +40,7 @@ But git itself allows we to specific the directory of the checkout by using the
So it allows us to set the desired path of the working tree. So if we want to
copy the contents of the current working tree into `copy/`:
-[source,shell]
+[source,sh]
----
mkdir copy
git --work-tree=copy/ checkout .
@@ -49,7 +49,7 @@ git --work-tree=copy/ checkout .
After that `copy/` will contain a replica of the code in HEAD. But to checkout
a specific, we need some extra parameters:
-[source,shell]
+[source,sh]
----
git --work-tree=<dir> checkout <my-commit> -- .
----
@@ -59,7 +59,7 @@ Morse signals to git, but we're actually saying to `git-checkout` which sub
directory of `<my-commit>` we want to look at. Which means we can do something
like:
-[source,shell]
+[source,sh]
----
git --work-tree=<dir> checkout <my-commit> -- src/
----
diff --git a/src/content/tils/2020/08/16/git-search.adoc b/src/content/tils/2020/08/16/git-search.adoc
index 26e617d..4113f3f 100644
--- a/src/content/tils/2020/08/16/git-search.adoc
+++ b/src/content/tils/2020/08/16/git-search.adoc
@@ -11,7 +11,7 @@ Here's a useful trio to know about to help you search things in git:
Show a specific commit and it's diff:
-[source,shell]
+[source,sh]
----
git show
# shows the latest commit
@@ -25,7 +25,7 @@ git show v1.2
Search through the commit messages:
-[source,shell]
+[source,sh]
----
git log --grep='refactor'
----
@@ -36,7 +36,7 @@ git log --grep='refactor'
Search content in git history:
-[source,shell]
+[source,sh]
----
git grep 'TODO'
# search the repository for the "TODO" string
diff --git a/src/content/tils/2020/08/28/grep-online.adoc b/src/content/tils/2020/08/28/grep-online.adoc
index 7d22cf8..77363ab 100644
--- a/src/content/tils/2020/08/28/grep-online.adoc
+++ b/src/content/tils/2020/08/28/grep-online.adoc
@@ -13,7 +13,7 @@ some pattern but I can't, because either:
Here's a simple script that allows you to overcome that problem easily:
-[source,shell]
+[source,sh]
----
#!/usr/bin/env bash
set -eu
@@ -90,7 +90,7 @@ Perform `git grep`, forwarding the remaining arguments from `$@`.
Example output:
-[source,shell]
+[source,sh]
----
$ git search 'make get-git' https://git.zx2c4.com/cgit/
Clonage dans '/tmp/git-search/cgit'...
@@ -114,7 +114,7 @@ needed.
When no argument is provided, it prints the usage text:
-[source,shell]
+[source,sh]
----
$ git search
Missing argument REGEX_PATTERN.
diff --git a/src/content/tils/2020/09/04/cli-email-fun-profit.adoc b/src/content/tils/2020/09/04/cli-email-fun-profit.adoc
index 5476fac..1da1154 100644
--- a/src/content/tils/2020/09/04/cli-email-fun-profit.adoc
+++ b/src/content/tils/2020/09/04/cli-email-fun-profit.adoc
@@ -15,7 +15,7 @@ Reason 3 is the fun part, reasons 1 and 2 are the profit part.
First {ssmpt}[install and configure SSMTP] for using, say, Gmail as the email
server:
-[source,shell]
+[source,sh]
----
# file /etc/ssmtp/ssmtp.conf
FromLineOverride=YES
@@ -31,7 +31,7 @@ AuthPass=password
Now install {mailutils}[GNU Mailutils] (`sudo apt-get install mailutils` or the
equivalent on your OS), and send yourself your first email:
-[source,shell]
+[source,sh]
----
echo body | mail -aFrom:email@example.com email@example.com -s subject
----
@@ -39,7 +39,7 @@ echo body | mail -aFrom:email@example.com email@example.com -s subject
And that's about it, you've got mail. Here are some more places where it might
be applicable:
-[source,shell]
+[source,sh]
----
# report a backup cronjob, attaching logs
set -e
@@ -62,10 +62,11 @@ trap finish EXIT
do-long-backup-cmd-here
----
-....
+[source,sh]
+----
# share the output of a cmd with someone
some-program | mail someone@example.com -s "The weird logs that I was talking about"
-....
+----
...and so on.
diff --git a/src/content/tils/2020/09/05/oldschool-pr.adoc b/src/content/tils/2020/09/05/oldschool-pr.adoc
index a2c758c..392ec67 100644
--- a/src/content/tils/2020/09/05/oldschool-pr.adoc
+++ b/src/content/tils/2020/09/05/oldschool-pr.adoc
@@ -26,7 +26,7 @@ to be locked in by any of them, putting the "D" back in "DVCS": it’s a
Here’s the raw output of a `git request-pull`:
-[source,shell]
+[source,sh]
----
$ git request-pull HEAD public-origin
The following changes since commit 302c9f2f035c0360acd4e13142428c100a10d43f:
@@ -62,7 +62,7 @@ address ready for public consumption.
A simple solution for that is for you to add the `public-origin` alias as the
HTTPS alternative to the SSH version:
-[source,shell]
+[source,sh]
----
$ git remote add public-origin https://example.com/user/repo
----
@@ -78,7 +78,7 @@ Experiment it yourself, and get acquainted with the CLI.
Now that you can create the content of a pull request, you can just
{cli-email}[deliver it] to the interested parties email:
-[source,shell]
+[source,sh]
----
# send a PR with your last commit to the author's email
git request-pull HEAD public-origin | mail author@example.com -s "PR: Add thing to repo"
diff --git a/src/content/tils/2020/10/11/search-git-history.adoc b/src/content/tils/2020/10/11/search-git-history.adoc
index 06df9dc..696368c 100644
--- a/src/content/tils/2020/10/11/search-git-history.adoc
+++ b/src/content/tils/2020/10/11/search-git-history.adoc
@@ -15,7 +15,7 @@ name, only bits of it.
I immediately went to the list of TILs I had written on searching in Git, but it
wasn't readily obvious how to do it, so here it goes:
-[source,shell]
+[source,sh]
----
git log -- *pattern*
----
@@ -23,7 +23,7 @@ git log -- *pattern*
You could add globs before the pattern to match things on any directory, and add
our `-p` friend to promptly see the diffs:
-[source,shell]
+[source,sh]
----
git log -p -- **/*pattern*
----
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 9b44036..624d24a 100644
--- a/src/content/tils/2020/11/08/find-broken-symlink.adoc
+++ b/src/content/tils/2020/11/08/find-broken-symlink.adoc
@@ -6,7 +6,7 @@
The `find` command knows how to show broken symlinks:
-[source,shell]
+[source,sh]
----
find . -xtype l
----
@@ -15,7 +15,7 @@ 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:
-[source,shell]
+[source,sh]
----
git annex wanted . 'exclude=Music/* and exclude=Videos/*'
----
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 219b694..97ace30 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
@@ -12,7 +12,7 @@ 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:
-[source,shell]
+[source,sh]
----
#!/usr/bin/env bash
set -Eeuo pipefail
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 d7ea2ca..dff8737 100644
--- a/src/content/tils/2020/11/12/git-bisect-automation.adoc
+++ b/src/content/tils/2020/11/12/git-bisect-automation.adoc
@@ -10,11 +10,12 @@ 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:
-....
+[source,sh]
+----
$ 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.
diff --git a/src/content/tils/2020/11/12/useful-bashvars.adoc b/src/content/tils/2020/11/12/useful-bashvars.adoc
index 84b93c3..fb148fb 100644
--- a/src/content/tils/2020/11/12/useful-bashvars.adoc
+++ b/src/content/tils/2020/11/12/useful-bashvars.adoc
@@ -13,7 +13,7 @@ on the terminal.
The {bash-bang-bang}[`!!` variable] refers to the previous command, and I find
useful when following chains for symlinks:
-[source,shell]
+[source,sh]
----
$ which git
/run/current-system/sw/bin/git
@@ -25,7 +25,7 @@ readlink $(which git)
It is also useful when you forget to prefix `sudo` to a command that requires
it:
-[source,shell]
+[source,sh]
----
$ requires-sudo.sh
requires-sudo.sh: Permission denied
@@ -43,7 +43,7 @@ The {bash-dollar-underscore}[`$_` variable] will give you the most recent
parameter you provided to a previous argument, which can save you typing
sometimes:
-[source,shell]
+[source,sh]
----
# instead of...
$ mkdir -p a/b/c/d/
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 602e11d..48a996b 100644
--- a/src/content/tils/2020/11/30/git-notes-ci.adoc
+++ b/src/content/tils/2020/11/30/git-notes-ci.adoc
@@ -13,7 +13,7 @@ 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:
-[source,shell]
+[source,sh]
----
#!/usr/bin/env bash
set -Eeuo pipefail
@@ -101,7 +101,7 @@ https://euandre.org/git/servers/commit?id=87c57133abd8be5d7cc46afbf107f59b260665
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:
-[source,shell]
+[source,sh]
----
$ SHA="$(git notes --ref=refs/notes/ci-logs list 87c57133abd8be5d7cc46afbf107f59b26066575)"
$ echo "https://euandre.org/git/servers/blob?id=$SHA"
diff --git a/src/content/tils/2020/12/15/shellcheck-repo.adoc b/src/content/tils/2020/12/15/shellcheck-repo.adoc
index db280db..387e793 100644
--- a/src/content/tils/2020/12/15/shellcheck-repo.adoc
+++ b/src/content/tils/2020/12/15/shellcheck-repo.adoc
@@ -12,7 +12,7 @@ In my repositories I usually have Bash and POSIX scripts, which I want to keep
tidy with {shellcheck}[ShellCheck]. Here's the first version of
`assert-shellcheck.sh`:
-[source,shell]
+[source,sh]
----
#!/bin/sh -eux
@@ -28,7 +28,7 @@ recently added some scripts without any extension, so `assert-shellcheck.sh`
called for a second version. The first attempt was to try grepping the shebang
line:
-[source,shell]
+[source,sh]
----
$ grep '^#!/' assert-shellcheck.sh
#!/usr/sh
@@ -37,7 +37,7 @@ $ grep '^#!/' assert-shellcheck.sh
Good, we have a grep pattern on the first try. Let's try to find all the
matching files:
-[source,shell]
+[source,sh]
----
$ find . -type f | xargs grep -l '^#!/'
./TODOs.org
@@ -76,7 +76,7 @@ sample hooks in `.git/hooks/*`.
To list the files that Git is tracking we'll try `git ls-files`:
-[source,shell]
+[source,sh]
----
$ git ls-files | xargs grep -l '^#!/'
TODOs.org
@@ -109,7 +109,7 @@ and to stop processing the file if the pattern matches. A quick search points
me to using `FNR` for the former, and `{ nextline }` for the latter. Let's try
it:
-[source,shell]
+[source,sh]
----
$ git ls-files | xargs awk 'FNR>1 { nextfile } /^#!\// { print FILENAME; nextfile }'
bootstrap
@@ -131,13 +131,14 @@ matching against any part of the file that may have a shebang-like line, we only
look for the first. Let's put it back into the `assert-shellcheck.sh` file and
use `NULL` for separators to accommodate files with spaces in the name:
-....
+[source,sh]
+----
#!/usr/sh -eux
git ls-files -z | \
xargs -0 awk 'FNR>1 { nextfile } /^#!\// { print FILENAME; nextfile }' | \
xargs shellcheck
-....
+----
This is where I've stopped, but I imagine a likely improvement: match against
only +#!/bin/sh+ and +#!/usr/bin/env bash+ shebangs (the ones I use most), to
@@ -152,7 +153,7 @@ on the POSIX subset of Awk for working correctly.
After publishing, I could remove `{ nextfile }` and even make the script
simpler:
-[source,shell]
+[source,sh]
----
#!/usr/sh -eux
diff --git a/src/content/tils/2021/01/12/curl-awk-emails.adoc b/src/content/tils/2021/01/12/curl-awk-emails.adoc
index 875c655..d432da2 100644
--- a/src/content/tils/2021/01/12/curl-awk-emails.adoc
+++ b/src/content/tils/2021/01/12/curl-awk-emails.adoc
@@ -18,7 +18,7 @@ write a solution.
The first part was the easiest: store the email in a file:
-[source,shell]
+[source,sh]
----
# ~/.config/mutt/muttrc:
set sendmail=~/bin/enqueue-email.sh
@@ -32,7 +32,7 @@ cat - > "$HOME/mbsync/my-queued-emails/$(date -Is)"
Now that I had the email file store locally, I needed a program to send the
email from the file, so that I could create a cronjob like:
-[source,shell]
+[source,sh]
----
for f in ~/mbsync/my-queued-emails/*; do
~/bin/dispatch-email.sh "$f" && rm "$f"
@@ -43,7 +43,7 @@ The `dispatch-email.sh` would have to look at the `From:` header and decide
which SMTP server to use. As I {found-out-article}[found out] that {curl}[curl]
supports SMTP and is able to send emails, this is what I ended up with:
-[source,shell]
+[source,sh]
----
#!/bin/sh -eu
@@ -102,7 +102,7 @@ array.
I even did it incrementally:
-[source,shell]
+[source,sh]
----
$ H='To: to@example.com, to2@example.com\nCc: cc@example.com, cc2@example.com\nBcc: bcc@example.com,bcc2@example.com\n'
$ printf "$H" | awk '/^To: .*$/ { print $0 }'
diff --git a/src/content/tils/2021/01/17/posix-shebang.adoc b/src/content/tils/2021/01/17/posix-shebang.adoc
index 4e2fbe8..5cf0695 100644
--- a/src/content/tils/2021/01/17/posix-shebang.adoc
+++ b/src/content/tils/2021/01/17/posix-shebang.adoc
@@ -14,7 +14,7 @@ I didn't know what to do with that first line.
What I had previously was:
-[source,shell]
+[source,sh]
----
#!/usr/bin/env bash
set -Eeuo pipefail
@@ -27,7 +27,7 @@ options were also gone, and would be replaced by nothing.
I converted all of them to:
-[source,shell]
+[source,sh]
----
#!/bin/sh -eu
----
@@ -45,7 +45,7 @@ options is ignored, as it is a comment!
Which means that the shebang most friendly with POSIX is:
-[source,shell]
+[source,sh]
----
#!/bin/sh
set -eu
diff --git a/src/content/tils/2021/07/23/git-tls-gpg.adoc b/src/content/tils/2021/07/23/git-tls-gpg.adoc
index 8fe86c6..f198c2b 100644
--- a/src/content/tils/2021/07/23/git-tls-gpg.adoc
+++ b/src/content/tils/2021/07/23/git-tls-gpg.adoc
@@ -14,7 +14,7 @@ Here's how I'd verify that I've cloned an authentic version of
HTTPS.
]:
-[source,shell]
+[source,sh]
----
$ wget -qO- https://euandre.org/public.asc | gpg --import -
gpg: clef 81F90EC3CD356060 : « EuAndreh <eu@euandre.org> » n'est pas modifiée
diff --git a/src/content/tils/2021/08/11/js-bigint-reviver.adoc b/src/content/tils/2021/08/11/js-bigint-reviver.adoc
index f7dd3de..98ee79b 100644
--- a/src/content/tils/2021/08/11/js-bigint-reviver.adoc
+++ b/src/content/tils/2021/08/11/js-bigint-reviver.adoc
@@ -65,7 +65,8 @@ console.log(typeof parsed[7]["a-bigint"])
The output of the above is:
-....
+[source,javascript]
+----
[
null,
true,
@@ -79,7 +80,7 @@ The output of the above is:
[null,true,false,-1,3.14,"a string",{"a-number":"-123"},{"a-bigint":"-123n"}]
string
bigint
-....
+----
If you're on a web browser, you can probably try copying and pasting the above
code on the console right now, as is.