diff options
author | EuAndreh <eu@euandre.org> | 2025-04-16 11:20:43 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-04-16 11:20:43 -0300 |
commit | d36c2e459a74ec67e523539eb98b78b95b01432a (patch) | |
tree | a7099fbfbdab6a21f59b6efe095bffb40ceae646 /src/content/tils/2020/08 | |
parent | src/content/style.css: Show header on hover only (diff) | |
download | euandre.org-d36c2e459a74ec67e523539eb98b78b95b01432a.tar.gz euandre.org-d36c2e459a74ec67e523539eb98b78b95b01432a.tar.xz |
src/content/: Normalize [source,$lang] code blocks
Diffstat (limited to 'src/content/tils/2020/08')
-rw-r--r-- | src/content/tils/2020/08/12/filename-timestamp.adoc | 4 | ||||
-rw-r--r-- | src/content/tils/2020/08/14/browse-git.adoc | 12 | ||||
-rw-r--r-- | src/content/tils/2020/08/16/git-search.adoc | 6 | ||||
-rw-r--r-- | src/content/tils/2020/08/28/grep-online.adoc | 6 |
4 files changed, 14 insertions, 14 deletions
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. |