From b64d9de0c4723e4a8248d5d0721c68a3c613d0ac Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Thu, 20 Mar 2025 13:10:43 +0100 Subject: [PATCH 1/7] bad.horse bad.horse --- networking/bad_horse.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 networking/bad_horse.md diff --git a/networking/bad_horse.md b/networking/bad_horse.md new file mode 100644 index 0000000..5d2f9ca --- /dev/null +++ b/networking/bad_horse.md @@ -0,0 +1,20 @@ +--- +title: "Mapping the Net" +tags: [ "networking", "graph", "fun" ] +--- + +Find the path to a domain: + +```sh +domain=bad.horse +max_hops=50 + +tracepath -m $maximum_hops $domain +``` + +If you're on Debian, you can use `graph-easy` and `dothost` to make an instant diagram: + +```sh +domain=dice.camp +dothost $domain | graph-easy --boxart +``` From 72ad0786c8a3b3f2d5940ee5f64666f39be59931 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Sat, 22 Mar 2025 23:26:20 +0100 Subject: [PATCH 2/7] allow joins on related articles --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 5443326..e013a9b 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,8 @@ $(databases): .dbs/%.rec: %/ | .dbs/ db.rec: $(databases) printf '%s\n' '%rec: guide' > $@ printf '%s\n' '%key: title' >> $@ + printf '%s\n' '%type: requires rec guide' >> $@ + printf '%s\n' '%type: provides rec guide' >> $@ printf '%s\n' '%type: wordcount int' >> $@ printf '%s\n\n' '%sort: wordcount' >> $@ cat $^ >> $@ From 2d3961e0f553ade1eb06972a0090b9cc6b332721 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Sat, 22 Mar 2025 23:41:04 +0100 Subject: [PATCH 3/7] update readme --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 69c814d..d5e3175 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,29 @@ title: "Linux Knowledge Base" The Linux Knowledge-Base provides quick-start guides for working with terminal programs. +If you like this style of short articles with a miniature database, then join me in my quest to remove the nausea of poorly-written documentation. + # Setup Install `make`, `recutils`, and any fuzzy-finder (i.e. `sk`, `fzy`, or `fzf`). ## Usage +Set up the database and try a few queries: ```sh make make database +recsel db.rec -m 3 recsel db.rec -q database -recsel db.rec -q gpg recsel db.rec -e "title = 'ssh'" recsel db.rec -e "title ~ 'ssh'" recsel db.rec -e "title ~ 'bash'" -R title,wordcount -recsel db.rec -m 1 -P content | less -R + +recsel db.rec -t guide -j provides -G title \ + -e "title = 'ssh'" \ + -p 'sum(provides_wordcount)' ``` # Style From 7e75763cee41dccefc5aed01435b201495da2764 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Sat, 22 Mar 2025 23:45:43 +0100 Subject: [PATCH 4/7] expand on readme style --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index d5e3175..1b269cc 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,14 @@ recsel db.rec -t guide -j provides -G title \ - Nobody cares about how the project started. - Nobody wants to read what `ffmpeg` is, because anyone who wants to use it already knows what it is. +## State Knowledge Dependencies + +Articles should state what you need to understand in order to read them *at the start*. +They should not assume the reader knows much beyond common terminal commands, and should not provide a link to some other resource half-way through an article. + +People should be able to read an article from the beginning, then keep going until the end, and then stop. +Articles should not take a detour through a chain of other articles of unknown size. + ## Be Opinionated - Guides should not ask the reader to select options half-way through. @@ -80,6 +88,11 @@ grep ls --color=always $HISTFILE | $PAGER Now we can see what can be changed. +## Assume People Follow the Instructions + +Articles should say what to type, not the output. +If the command is `ls`, users will see files once they try the command, but the article does not need to provide an example list of files unless an important point has to be made about output. + # What's Wrong with Everything Else? ## Man pages From 68d3a850c06cdfe8ebb817740f701b3b4870c92a Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 26 Mar 2025 13:46:04 +0100 Subject: [PATCH 5/7] how to show torrents --- data/view_torrents.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 data/view_torrents.md diff --git a/data/view_torrents.md b/data/view_torrents.md new file mode 100644 index 0000000..9218034 --- /dev/null +++ b/data/view_torrents.md @@ -0,0 +1,11 @@ +--- +title: "View Torrents" +tags: [ "data", "transmission", "torrenting" ] +--- + + +```sh +transmission-show $file.torrent | less +``` + +`TRACKERS` shows where transmission will ask who has the torrent, but will probably be out of date. From a6b8420c2656aede5732c8b21e9f1219937b2e05 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 26 Mar 2025 13:51:17 +0100 Subject: [PATCH 6/7] update warrior syntax --- data/taskwarrior/task.md | 42 +++++++++++++++++++-------------------- data/taskwarrior/timew.md | 28 +++++++++++++------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/data/taskwarrior/task.md b/data/taskwarrior/task.md index b1ee2c1..dc3019f 100644 --- a/data/taskwarrior/task.md +++ b/data/taskwarrior/task.md @@ -5,19 +5,19 @@ tags: [ "organization" ] Set up the configuration file: -```bash +```sh task ``` Add a task: -```bash +```sh task add update linux ``` See which task is next: -```bash +```sh task next ``` @@ -25,13 +25,13 @@ Note the id number. Mark a task as started: -```bash +```sh task start 1 ``` Once finished: -```bash +```sh task 1 done ``` @@ -39,7 +39,7 @@ task 1 done Add a project: -```bash +```sh task add project:house buy potted plant task add proj:house.repair buy screwdriver task add proj:house.repair buy shelf brackets @@ -51,11 +51,11 @@ task add pro:house.paint buy brushes ## Summary -```bash +```sh task pro:house sum ``` -```bash +```sh task burndown.daily pro:house ``` @@ -63,13 +63,13 @@ The summaries will show how fast a project is being completed, and when you can # Tags -```bash +```sh task add +buy toothbrush ``` You can then see only tasks which involve buying something with: -```bash +```sh task +buy ``` @@ -77,27 +77,27 @@ task +buy Set three contexts by their tags: -```bash +```sh task context define work +sa or +hr ``` -```bash +```sh task context define study +ed or +void or +rat ``` -```bash +```sh task context define home -sa -hr -ed -void -rat ``` Change to the first context. -```bash +```sh task context work ``` Then stop. -```bash +```sh task context none ``` @@ -105,7 +105,7 @@ task context none View list of tasks completed in the last week: -```bash +```sh task end.after:today-1wk completed ``` @@ -113,19 +113,19 @@ task end.after:today-1wk completed Make a UDA 'size'. -```bash +```sh task config uda.size.type string ``` -```bash +```sh task config uda.size.label Size ``` -```bash +```sh task config uda.size.values large,medium,small ``` -```bash +```sh uda.size.default=medium ``` @@ -133,7 +133,7 @@ uda.size.default=medium This command shows tasks I'm most interested in: -```bash +```sh task next +ACTIVE or +OVERDUE or due:today or scheduled:today or pri:H ``` diff --git a/data/taskwarrior/timew.md b/data/taskwarrior/timew.md index 0ac1081..d1e7b1e 100644 --- a/data/taskwarrior/timew.md +++ b/data/taskwarrior/timew.md @@ -6,13 +6,13 @@ tags: [ "data", "tracking", "time", "timew" ] Try: -```bash +```sh timew summary :yesterday ``` You can also use :week, :lastweek, :month, :quarter, :year, or a range such as: -```bash +```sh timew summary today to tomorrow timew today - tomorrow 2018-10-15T06:00 - 2018-10-17T06:00 @@ -22,7 +22,7 @@ Each of these can gain with the :ids tag. # Basics -```bash +```sh timew start timew stop timew continue @@ -32,7 +32,7 @@ timew tags And add ids with: -```bash +```sh timew summary :ids timew track 10am - 1pm timewarrior timew track 1pm for 2h walk @@ -42,50 +42,50 @@ timew track 1pm for 2h walk First get ids. -```bash +```sh timew summary :ids ``` Then if we're looking at task @2: -```bash +```sh timew move @2 12:00 timew lengthen @2 3mins ``` -```bash +```sh time shorten @2 40mins ``` # Forgetting -```bash +```sh timew start 1h ago @4 ``` Or if your action actually had a break: -```bash +```sh timew split @8 ``` Or maybe not? -```bash +```sh timew join @4 @8 timew @8 delete ``` Start at previous time -```bash +```sh timew start 3pm 'Read chapter 12' timew start 90mins ago 'Read chapter 12' ``` Cancel currently tracked time. -```bash +```sh timew cancel ``` @@ -157,11 +157,11 @@ with: # Fixing Errors -```bash +```sh curl -O https://taskwarrior.org/download/timew-dbcorrection.py ``` -```bash +```sh python timew-dbcorrections.py ``` From 641b8fb825dfe713a2e4dda2b64b4b775c10b28d Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 26 Mar 2025 14:07:27 +0100 Subject: [PATCH 7/7] update vim syntax --- vim/navigate.md | 47 ++++++++++++++++--------------------------- vim/vim-completion.md | 8 ++++---- vim/vim-search.md | 10 ++++----- vim/vim-windows.md | 16 +++++++-------- vim/vim_in_bash.md | 2 +- vim/vim_tricks.md | 3 ++- 6 files changed, 37 insertions(+), 49 deletions(-) diff --git a/vim/navigate.md b/vim/navigate.md index c40054e..4b8de50 100644 --- a/vim/navigate.md +++ b/vim/navigate.md @@ -1,34 +1,21 @@ --- title: "vim navigation" -tags: [ "vim" ] +tags: [ "vim", "navigation" ] --- -| Move | Command | -|:-----|:-------------| -|Down page | C-f | -| Down half page | C-d | -| Up page | C-b | -| Up half page | C-u | - -## Scroll - -> C-e - -> C-y - -## Jumps - -Go through your last jumps: - -> C-I - -> C-O - -Go to the last and previous places you've changed: - -> g; - -> g, +| Move | Command | +|:------------------------|:-------------| +| Down page | Ctl-f | +| Down half page | Ctl-d | +| Up page | Ctl-b | +| Up half page | Ctl-u | +| Scroll down | Ctl-e | +| Scroll up | Ctl-y | +| Jump to previous place | Ctl-i | +| Jump to back | Ctl-o | +| Jump to last change | g; | +| Jump to next change | g, | +| Go to current filename | gf | Go to a filename, and type `gf` (Go-to-File). For example, if you put your cursor over the `~/.vimrc` in this line, you can edit your vim configuration file. @@ -39,10 +26,10 @@ For example, if you put your cursor over the `~/.vimrc` in this line, you can ed Make a 20 character 'visual split' in the current working directory ('`.`'). -> :20vs . +`:20vs .` -Change the view for this: +Swap buffer positions: -> C-w x +`C-w x` diff --git a/vim/vim-completion.md b/vim/vim-completion.md index 1714288..524b8c7 100644 --- a/vim/vim-completion.md +++ b/vim/vim-completion.md @@ -1,16 +1,16 @@ --- title: "vim completion" -tags: [ "vim" ] +tags: [ "vim", "completion" ] --- Complete the word by searching for the *n*ext similar word: -> C-n +`C-n` Complete the word by searching for a *p*revious similar word: -> C-p +`C-p` Complete the full line: -> C-x C-l +`C-x C-l` diff --git a/vim/vim-search.md b/vim/vim-search.md index 7e952d4..3963639 100644 --- a/vim/vim-search.md +++ b/vim/vim-search.md @@ -1,22 +1,22 @@ --- title: "vim search" -tags: [ "vim" ] +tags: [ "vim", "search" ] --- Search for the next and or previous occurrence of the word under your cursor with `*` and `#`. Search and replace the first 'one' found with 'two': -> :%s/one/two/ +`:%s/one/two/` Same, but replace 'one' globally: -> :%s/one/two/g +`:%s/one/two/g` Put quotes around every occurrence of `$HOME`: -> :%s/$HOME/"&" +`:%s/$HOME/"&"` Same, but add curly brackets around `$HOSTNAME`: -> :%s/$HOSTNAME/{&} +`:%s/$HOSTNAME/{&}` diff --git a/vim/vim-windows.md b/vim/vim-windows.md index 987ac39..fdd8c97 100644 --- a/vim/vim-windows.md +++ b/vim/vim-windows.md @@ -3,12 +3,12 @@ title: "vim windows" tags: [ "vim" ] --- -| Command | Keys | -|:-----|:----:| -| split window | C-w s | -| split window vertically | C-w v | -| close window | C-q | -| change window | C-w w | -| rotate windows | C-w r | -| split open new file | :sf path/file | +| Command | Keys | +|:--------------------------|:-------------------:| +| split window | `C-w s` | +| split window vertically | `C-w v` | +| close window | `C-q` | +| change window | `C-w w` | +| rotate windows | `C-w r` | +| split open new file | `:sf $filepath` | diff --git a/vim/vim_in_bash.md b/vim/vim_in_bash.md index e045510..b0d28fe 100644 --- a/vim/vim_in_bash.md +++ b/vim/vim_in_bash.md @@ -7,7 +7,7 @@ Put bash in vim mode! Place the following in your `~/.inputrc`: -```bash +``` set editing-mode vi set show-mode-in-prompt on set vi-ins-mode-string \1\e[33;32m\2[>]=\1\e[0m\2 diff --git a/vim/vim_tricks.md b/vim/vim_tricks.md index e30b171..e873e11 100644 --- a/vim/vim_tricks.md +++ b/vim/vim_tricks.md @@ -1,9 +1,10 @@ --- title: "Vim Tricks" tags: [ "vim" ] +requiered: [ "ssh" ] --- ## Remote Editing -> vim scp://*user*@*myserver*[:*port*]//*path/to/file.txt* +`vim scp://*user*@*myserver*[:*port*]//*path/to/file.txt*`