Compare commits

..

48 Commits

Author SHA1 Message Date
30bc3b7055 Merge branch 'dev' into vhs 2025-02-14 13:06:12 +01:00
c95ad1076e Merge branch 'dev' into vhs 2025-02-12 17:06:33 +01:00
8f5298bc2f Merge branch 'dev' into vhs 2025-02-11 20:51:23 +01:00
dcfe955cfe Merge branch 'dev' into vhs 2025-02-10 20:32:15 +01:00
1dc717bdc1 Merge branch 'dev' into vhs 2025-02-10 01:02:29 +01:00
fe5f856590 place tape in recfiles.md 2025-02-07 20:30:35 +01:00
987208d232 Merge branch 'dev' into vhs 2025-02-07 20:26:22 +01:00
d0d0ddf079 make recfiles tape 2025-02-07 20:24:45 +01:00
a26b9a8287 remove recfiles tape 2025-02-07 19:20:06 +01:00
6e9d2bd0c0 Merge branch 'dev' into vhs 2025-02-07 19:15:07 +01:00
5460e90137 Merge branch 'dev' into vhs 2025-01-17 19:23:42 +01:00
4cc4603b2e Merge branch 'dev' into vhs 2025-01-14 05:05:49 +01:00
a8617fb5b1 Merge branch 'dev' into vhs 2024-12-16 00:44:45 +01:00
04814ff498 Merge branch 'dev' into vhs 2024-12-07 14:06:39 +01:00
7eea76f2be Merge branch 'dev' into vhs 2024-12-05 16:28:34 +01:00
f3143876db Merge branch 'master' into vhs 2024-11-28 17:08:54 +01:00
3457ed4c61 Merge branch 'dev' into vhs 2024-11-28 02:50:59 +01:00
786178195b Merge branch 'master' into vhs 2024-08-13 19:05:17 +02:00
29bff234fd place requirements for at tape 2024-08-07 18:01:34 +02:00
3e3e072623 Merge branch 'master' into vhs 2024-08-06 20:47:23 +01:00
a6907d7a91 Merge branch 'master' into vhs 2024-06-02 05:27:58 +02:00
3f98db3d3a Merge branch 'dev' into vhs 2023-12-02 03:10:14 +01:00
17b90a54cb Merge branch 'dev' into vhs 2023-09-23 09:29:51 +02:00
0587e9914a place requirements for tapes 2023-09-14 19:06:16 +02:00
257ece871c provide yes.tape 2023-09-14 19:05:47 +02:00
89ec9614e5 Merge branch 'dev' into vhs 2023-09-14 19:00:06 +02:00
6f8902ff8f add lf tape 2023-09-04 21:06:03 +02:00
1eab64e1bc Merge branch 'dev' into vhs 2023-09-04 20:29:11 +02:00
92f90b51f7 Merge branch 'dev' into vhs 2023-09-04 19:24:52 +02:00
b44d6b88ed Merge branch 'dev' into vhs 2023-08-23 22:10:21 +02:00
23160b22ad Merge branch 'dev' into vhs 2023-07-19 15:16:42 +02:00
fd2c44f49b Merge branch 'dev' into vhs 2023-07-12 03:23:28 +02:00
8b599e2c77 Merge branch 'master' into vhs 2023-07-02 12:39:49 +02:00
4a9d2d61d2 Merge branch 'dev' into vhs 2023-06-20 15:08:40 +02:00
fda9fcdec4 unify sc-im formatting 2023-06-08 17:45:22 +02:00
395cb363db place w3m gif in file 2023-06-08 16:34:33 +02:00
abc2add177 add w3m tape 2023-06-08 16:30:59 +02:00
2dbc7965da Merge branch 'master' into vhs 2023-06-08 13:37:46 +02:00
4dd6c979b6 Merge branch 'dev' into vhs 2023-04-20 21:02:21 +02:00
8672905dc4 fix at.gif syntax 2023-04-13 22:23:05 +02:00
6a3703a2d0 add at tape 2023-04-13 06:18:57 +02:00
8bb0c57ddb Merge branch 'master' into vhs 2023-04-13 06:17:15 +02:00
8994bbe0e2 include tapes in xbps 2023-04-11 14:02:51 +02:00
ea5ecad274 Merge branch 'master' into vhs 2023-04-11 14:02:28 +02:00
c6f2891003 add xbps tapes 2023-04-11 14:01:43 +02:00
46f538bbe8 Merge branch 'master' into vhs 2023-04-11 12:37:51 +02:00
f80bc47a24 fix path 2023-04-10 17:15:31 +02:00
6162bb1502 add which.tape 2023-04-10 17:09:30 +02:00
125 changed files with 726 additions and 1092 deletions

View File

@@ -24,37 +24,35 @@ $(foreach dir, $(categories), \
$(eval .dbs/$(dir).rec: $(wildcard $(dir)/*)) \
)
.dbs/:
mkdir $@
$(databases): .dbs/%.rec: %/ | .dbs/
$(databases): .dbs/%.rec: %/
$(info making $(@F))
@mkdir -p $(@D)
for entry in $(shell find $< -type f -name "*.md") ; do \
printf "file: %s\n" "$$entry" ;\
sed -n '2,/^---$$/ {/^---$$/d; p}' "$$entry" |\
tr -d '[]' | tr -s ' ' |\
sed '/tags: /s/, /\ntag: /g ; s/tags:/tag:/ ; /requires/s/, /\nrequires: /g' ;\
printf "wordcount: %s\n\n" "$$(wc -w < $$entry)" ;\
sed -e 's/\[ //' -e 's/ \]//' |\
tr -d '"' ;\
printf "wordcount: %s\n" "$$(wc -w < $$entry)" ;\
printf "file: %s\n\n" "$$entry" ;\
done > $@
for entry in $(shell find $< -type f -name "*.md"); do \
recset $@ -e "file = '$${entry}'" -f wordcount --set-add="$$(wc -w < $${entry})" ;\
recset $@ -e "file = '$${entry}'" -f content --set-add="$$($(spill_contents) $${entry})" ;\
done
# This two-variable read can only happen because of the quotes in the titles.
db.rec: $(databases)
$(warning rebuilding from $? )
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 $^ >> $@
printf '%s\n\n' '%sort: title' >> $@
recsel $^ >> $@
recsel $@ -e "requires != ''" -CR title,requires |\
while read title requires; do \
for provider in "$$requires" ; do \
IFS=', ' && for provider in $$requires; do \
recset $@ -e "title = '$${provider}'" -f provides -a "$${title}" ;\
done ;\
done
sed -i 's/"//g' $@
recfix --sort $@
$(info Created main database: $@)
recfix --sort $@
default += db.rec
@@ -73,7 +71,7 @@ article: ## Write an article
filename="$$(echo "$$title" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')" ;\
printf '%s\n' '---' >> $$path/$$filename.md ;\
printf 'title: "%s"\n' "$$title" >> $$path/$$filename.md ;\
printf 'tags: [ "%s" ]\n' "$$path" | tr '[:upper:]' '[:lower:]' | sed 's#\/#", "#g' >> $$path/$$filename.md ;\
printf 'tags: [ "%s" ]\n' "$$path" | sed 's#\/#", "#g' >> $$path/$$filename.md ;\
printf '%s\n\n' '---' >> $$path/$$filename.md ;\
$(EDITOR) +5 "$$path/$$filename.md"

View File

@@ -4,29 +4,23 @@ 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 -t guide -j provides -G title \
-e "title = 'ssh'" \
-p 'sum(provides_wordcount)'
recsel db.rec -m 1 -P content | less -R
```
# Style
@@ -36,16 +30,6 @@ 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.
[Do not Jaquays documentation](https://splint.rs/posts/no_links)
## Be Opinionated
- Guides should not ask the reader to select options half-way through.
@@ -90,11 +74,6 @@ 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

View File

@@ -1,6 +1,6 @@
---
title: "at"
tags: [ "basics", "time" ]
tags: [ "Basics", "time" ]
---
Install with:
@@ -64,6 +64,8 @@ atrm 2
Check `/var/spool/atd/` to see the jobs.
![At it again](/tapes/at.gif)
## Automation
Automatically add a job for later, by setting the date, then using echo for the command.

42
basics/at.tape Normal file
View File

@@ -0,0 +1,42 @@
Require at
Require atd
Sleep 500ms
Type "at teatime"
Enter
Sleep 1.5s
Type "./"
Sleep 500ms
Type "baskup.sh"
Sleep 1.5s
Enter
Sleep 1.5s
Ctrl+D
Sleep 3.5s
Type "atq"
Enter
Sleep 1.5s
Type "atq 1"
Sleep 500ms
Type "4"
Enter
Sleep 500ms
Type "at"
Sleep 1s
Type " -c 15"
Enter
Sleep 1.5s
Type "at"
Sleep 500ms
Type " "
Sleep 500ms
Type "-"
Sleep 500ms
Type "c 15 | grep PWD"
Enter
Sleep 5.5s
Type "atrm 15"
Sleep 2s
Enter
Sleep 3s
Ctrl+D

View File

@@ -1,6 +1,6 @@
---
title: "Basics"
tags: [ "basics" ]
tags: [ "Basics" ]
---
You need about a dozen commands to move around Linux.

View File

@@ -1,6 +1,6 @@
---
title: "clock"
tags: [ "basics", "time" ]
tags: [ "Basics", "time" ]
---
Show system time:

View File

@@ -1,6 +1,6 @@
---
title: "conditionals"
tags: [ "basics" ]
tags: [ "Basics" ]
---
# If statements

View File

@@ -1,6 +1,6 @@
---
title: "cron"
tags: [ "basics", "time" ]
tags: [ "Basics", "time" ]
---
# Cronie

View File

@@ -1,6 +1,6 @@
---
title: "bash games"
tags: [ "games" ]
tags: [ "Games" ]
---
Games are a great way to learn bash.

View File

@@ -1,6 +1,6 @@
---
title: "kill"
tags: [ "basics" ]
tags: [ "Basics" ]
---
If you want to kill a program in a graphical environment, open a terminal and type:

View File

@@ -1,6 +1,6 @@
---
title: "locale"
tags: [ "basics", "time" ]
tags: [ "Basics", "time" ]
---
Your locale tells the computer your location, preferred time-and-date format, standard language, papersize, et c.

View File

@@ -1,6 +1,6 @@
---
title: "locating"
tags: [ "basics" ]
tags: [ "Basics" ]
---
# Type
@@ -13,6 +13,8 @@ type -P ls
type -a cat
```
![where is cmus?](/tapes/which.gif)
# Whereis the Program
Where is `grep` and all its configuration files?

View File

@@ -1,6 +1,6 @@
---
title: "processes"
tags: [ "basics" ]
tags: [ "Basics" ]
---
# Proccesses

View File

@@ -1,6 +1,6 @@
---
title: "time"
tags: [ "basics", "time" ]
tags: [ "Basics", "time" ]
---
# systemd
@@ -56,7 +56,7 @@ Then set that language, with:
LANG=pl_PL.UTF-8
```
...then reboot.
... then reboot.
# Network Time Protocol

View File

@@ -1,6 +1,6 @@
---
title: "users"
tags: [ "basics" ]
tags: [ "Basics" ]
---
# Basic Information

33
basics/which.tape Normal file
View File

@@ -0,0 +1,33 @@
Require cmus
Type "whereis cmus"
Enter
Sleep 1s
Type "which cmus"
Enter
Sleep 500ms
Type "type /bin/cmus"
Enter
Sleep 5s
Type "man cmus"
Enter
Sleep 1s
Type " "
Sleep 1s
Type " "
Sleep 1s
Type " "
Sleep 500ms
Type " "
Sleep 1.5s
Type " "
Sleep 500ms
Type " "
Sleep 1.5s
Type " "
Sleep 500ms
Type " q"
Sleep 500ms
Type "cmus"
Sleep 3s
Ctrl+D

View File

@@ -1,6 +1,6 @@
---
title: "profanity"
tags: [ "chat", "omemo" ]
tags: [ "Chat", "omemo" ]
---
# Setup (Commands)
@@ -142,3 +142,4 @@ You can ensure omemo automatcally turns on:
```
---
'OTR' encryption is mostly dead, but you can find the old instructions [here](profanity-otr).

View File

@@ -1,6 +1,6 @@
---
title: "wgetpaste"
tags: [ "chat" ]
tags: [ "Chat" ]
---
See available pastebins:

View File

@@ -8,21 +8,22 @@ tags: [ "tar", "backups", ".tgz", "tar.gz" ]
Combine many files and directories into a single t-archive file.
```sh
```bash
tar cf "$ARCHIVE".tar $DIR
```
You can remember this with the mnemonic '*C*reate *F*ile'.
Unfortunately, this stores the full file path, so making a tar archive of `/etc/nginx/` will store `etc/nginx` (without the leading `/`).
Unfortunately, this stores the full file path, so making a tar archive of `/etc/nginx/` will store `etc/nginx` (without the leading `/`.
It's often better to tell tar which path to start from using the `-C` flag.
```sh
```bash
tar cf "$ARCHIVE".tar -C /etc/ nginx
```
Check the contents of your archive with:
```sh
```bash
tar tf "$ARCHIVE".tar
```
@@ -30,7 +31,7 @@ If you want to store 'everything in a directory', then using `*` will not work,
Instead, you can store the target in a variable:
```sh
```bash
files=$(ls /etc/nginx)
tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
```
@@ -39,9 +40,7 @@ tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
Extract the tar archive with
```sh
tar xf "$ARCHIVE".tar
```
> tar xf "$ARCHIVE".tar
You can remember this with the mnemonic 'e*X*tract *F*ile'.
@@ -49,7 +48,7 @@ You can remember this with the mnemonic 'e*X*tract *F*ile'.
Create a zip-compressed archive with the `z` flag.
```sh
```bash
tar czf "$ARCHIVE".tgz -C /etc/nginx/ $file
```
@@ -61,16 +60,18 @@ You can use any file ending you want, but sane people like to use '.tgz' or '.ta
Make archive:
```sh
7za a -tzip -p "$PASSWORD" -mem=AES256 $ARCHIVE.zip $FILE_1 $FILE_2
```bash
PASSWORD=my_password
```
```bash
7za a -tzip -p$PASSWORD -mem=AES256 $ARCHIVE.zip $FILE_1 $FILE_2
```
Note that people can still see every filename in your archive, and can change those files.
They just can't read the contents.
Unzip:
```sh
```bash
7za x archive.zip
```

View File

@@ -1,11 +1,11 @@
---
title: "unison"
tags: [ "backups", "synch" ]
tags: [ "Backups", "synch" ]
---
Install unison on both machines, and make sure both have the same version of unison, with the same version of the ocaml compiler (the smallest difference will cause problems).
```sh
```bash
unison -version
```
@@ -13,14 +13,14 @@ Create the `~/.unison` directory on both machines.
Make a job called `backup`:
```sh
```bash
JOB=backup
```
Here is an example job, which synchronizes the `~/music` directory with a remote machine which has the same username.
```sh
```bash
echo "
auto = true
root=$HOME
@@ -42,7 +42,7 @@ The last command means it will ignore any file with a name ending in `.flac`.
The first command means this will run but also confirm which files will be deleted, and which will be transferred, us `batch = true` instead.
Or you can deleted that line in the `.prf` file and run it with a flag:
```sh
```bash
unison -batch *backup*.prf
```

View File

@@ -3,24 +3,6 @@ title: "Base 16"
tags: [ "data" ]
---
Base 16 numbers often use `0x` at the start, so '10' just means '10', but `0x10` means '10 in base 16' which means '16'.
For small numbers, use `printf`.
```sh
```bash
printf "%x" $NUMBER
```
For any number, use `bc`.
```sh
fortune | md5sum | cut -d' ' -f1 | tr [:lower:] [:upper:] | bc
```
- Inputting base 16 uses `ibase=16`.
- Outputting base 10 uses `ibase=10`
```sh
echo 'ibase=16;' $(echo cbb478ac825f0dce7671254be035d0bc | tr [:lower:] [:upper:]) | bc
```

View File

@@ -6,40 +6,41 @@ tags: [ "data" ]
## New Machines
```sh
```bash
git config --global user.email "$YOUR_EMAIL"
```
```sh
```bash
git config --global user.name "$YOUR_NAME"
```
# New Git
Decide on algorithm:
Start a git in directory `$DIR`:
- If you're scared of insecure hash-sums, go with `hash=sha256`.
- If you don't know what a hash sum is, go with `hash=sha1`.
## Init the Git
Start a git in directory `${DIR}`:
```sh
git init --object-format=${hash} ${DIR}
cd ${DIR}
```bash
mkdir $DIR && cd $DIR
```
Make a file explaining what the project does, and tell `git` to track it:
```bash
git init
```
```sh
echo "I hereby solemnly swear never to commit a binary file." > README.md
Make a file explaining what the project does:
```bash
vim README.md
```
Add this to the git:
```bash
git add README.md
```
Then make the initial commit, explaining the change you just made:
```sh
```bash
git commit
```
@@ -47,17 +48,17 @@ git commit
Once you make a change to some file, add it and make a commit explaining it.
```sh
```bash
git add $FILE
```
```sh
```bash
git commit -m"change $FILE"
```
Check your history:
```sh
```bash
git log
```
@@ -68,20 +69,20 @@ Give it the same name as the `$DIR` directory, above.
Add this as a remote:
```sh
```bash
REMOTE=gitlab
git remote add $REMOTE https://gitlab.com/$USERNAME/$DIR
```
Tell git you're pushing the branch "master" to the remote repo "origin":
```sh
```bash
git push -u master origin
```
If someone makes a change on the remote, pull it down with:
```sh
```bash
git pull
```
@@ -90,31 +91,31 @@ git pull
A branch is a full copy of the project to test additional ideas.
You can make a new branch called 'featurez' like this:
```sh
```bash
git branch $FEATURE_BRANCH
```
Have a look at all your branches:
```sh
```bash
git branch
```
Switch to your new branch:
```sh
```bash
git checkout $FEATURE_BRANCH
```
And if your changes are rubbish, checkout the "master" branch again, then delete "featurez":
```sh
```bash
git branch -D $FEATURE_BRANCH
```
Or if it's a good branch, push it to the remote:
```sh
```bash
remote=origin
git push $remote $FEATURE_BRANCH
```
@@ -123,13 +124,13 @@ git push $remote $FEATURE_BRANCH
Once you like the feature, merge it into the main branch. Switch to master then merge it:
```sh
```bash
git merge $FEATURE_BRANCH
```
And delete the branch, as you've already merged it:
```sh
```bash
git branch -d $FEATURE_BRANCH
```
@@ -137,7 +138,7 @@ git branch -d $FEATURE_BRANCH
## Pulling another git repo into a subtree
```sh
```bash
git subtree add -P config git@gitlab.com:bindrpg/config.git master
```
@@ -145,27 +146,27 @@ git subtree add -P config git@gitlab.com:bindrpg/config.git master
## Delete All History
```sh
```bash
git checkout --orphan temp
```
```sh
```bash
git add -A
```
```sh
```bash
git commit -am "release the commits!"
```
```sh
```bash
git branch -D master
```
```sh
```bash
git branch -m master
```
```sh
```bash
git push -f origin master
```
@@ -173,21 +174,21 @@ Gitlab requires more changes, such as going to `settings > repository` and switc
## Clean up Bloated Repo
```sh
```bash
git fsck --full
```
```sh
```bash
git gc --prune=now --aggressive
```
```sh
```bash
git repack
```
## Find Binary Blobs
```sh
```bash
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \

View File

@@ -1,22 +0,0 @@
---
title: "Commit for Another"
tags: [ "data", "git" ]
---
You can make Alice the author, while you are still the commiter:
```sh
name="Alice Bobinson"
email="alice@email.com"
git add ${file}
git commit --author="${name} <${email}>"
```
Or, make Alice both the committer and the author:
```sh
git -c user.name="${name}" -c user.email="${email}" commit -m "${message}"
```

View File

@@ -1,7 +1,6 @@
---
title: "git-lfs"
tags: [ "data", "git" ]
requires: [ "git" ]
---
Git Large File Storage ('LFS') needs to change your `~/.gitconfig` to check out those binary files:

View File

@@ -1,69 +0,0 @@
---
title: "git stash"
tags: [ "data", "git" ]
requires: [ "git" ]
---
Save file-changes without committing anything.
Change a file:
```sh
file=README.md
fortune >> ${file}
git diff
git stash save
```
List which stashes you have:
```sh
git stash list
stash@{1}: WIP on master: c21f102 init git
```
Make a new file, then stash it:
```sh
otherfile=file.log
fortune > ${otherfile}
git add ${otherfile}
stashname=logfile
git stash save ${stashname}
```
Now you can see two stashed changes, and the most recent has a name:
```sh
git stash list
stash@{0}: On master: logfile
stash@{1}: WIP on master: c21f102 init git
```
You can delete a stash by referring to its index number, or name (if it has one).
```sh
choice=1
git stash drop ${choice}
choice=${stashname}
git stash drop ${choice}
```
Or just run `git stash drop` to remove the most recent (labelled `{0}`).
Return stashed changes with an index number (or the most recent).
```sh
git stash pop ${choice}
```
Delete all stashes:
```sh
git stash clear
```

View File

@@ -1,19 +0,0 @@
---
title: "Interactive String Substitution"
tags: [ "data", "vim", "substitution" ]
---
Want to find and replace, but also confirm each instance?
```sh
vim -c "%s/${pattern}/${replacement}/gc" -c 'wq' ${file}
```
Notice that double-quotes (`"`) in the first command (`-c`).
Alternatively, check with an example string:
```sh
sed "s/${pattern}/ARGLEBARGLE/g" ${file} | grep 'ARGLEBARGLE'
```

View File

@@ -1,13 +0,0 @@
---
title: "ijq"
tags: [ "data", "json", "TUI" ]
---
Analyse `json` easier with `ijq`.
```sh
column -J -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd > host.json
ijq !$
```
If you get stuck, try adding `.[]`.

View File

@@ -1,6 +1,6 @@
---
title: "khard"
tags: [ "data" ]
tags: [ "Data" ]
---
Get the basic config:

View File

@@ -1,6 +1,6 @@
---
title: "PDF Metadata Erasure"
tags: [ "metadata", "ghost script", "gs", ".pdf" ]
tags: [ "Metadata", "Ghost Script", "gs", ".pdf" ]
---
You cannot erase pdf metadata with `exiftool` (it only *appends* your changes).

View File

@@ -1,7 +1,6 @@
---
title: "radicale and nginx"
tags: [ "data", "calendar" ]
requires: [ "nginx", "certbot" ]
---
Check before you start:

View File

@@ -52,3 +52,5 @@ recset -f "$new_field" --delete $database
- [Recfiles for gemini capsules](gemini://tilde.town/~dozens/gemlog/21.gmi)
![Recfiles](/tapes/recfiles.gif)

View File

@@ -0,0 +1,68 @@
Require recins
Set Shell "bash"
Set TypingSpeed 0.1
Set FontSize 25
Set Width 900
Set Height 700
Enter
Type "touch games.rec"
Enter
Sleep 2s
Type 'recins --record "Name: Vojvodina" games.rec'
Enter
Sleep 2s
Type 'recsel games.rec'
Enter
Sleep 2s
Type 'for g in Saboter Carcassonne Chess; do recins -r "Name: $g" games.rec; done'
Enter
Type 'recsel games.rec'
Enter
Sleep 2s
Type 'cat games.rec'
Enter
Sleep 1s
Type 'recsel --quick=Carc games.rec'
Enter
Type 'recsel -q Carc games.rec'
Enter
Sleep 2s
Type 'recsel -q "sabot" --print=Name games.rec'
Enter
Sleep 1s
Type 'recsel --case-insensitive -q "sabot" --print=Name games.rec'
Enter
Sleep 2s
Type 'recsel -i -q "chess" -p Name games.rec'
Enter
Sleep 1s
Type 'recset -f "Played" --set-add="no" games.rec'
Enter
Type 'recsel games.rec'
Enter
Sleep 1s
Type 'recset -iq chess -f "Played" --set=yes games.rec'
Enter
Type 'recsel games.rec'
Enter
Sleep 1s
Type 'recset -f "Played" --delete games.rec'
Enter
Type 'recsel games.rec'
Enter
Hide
Type 'rm games.rec'
Enter
Sleep 3s

View File

@@ -1,7 +1,6 @@
---
title: "sc-im"
tags: [ "TUI", "data", "spreadsheet", ".csv" ]
requires: [ "vim basics" ]
---
- [Sample file](sc-im/sample.sc)
@@ -48,6 +47,7 @@ echo 'set autowrap' >> .config/sc-im/scimrc
|:----------------------|:---:|
| text (left align) | < |
| text (right align) | > |
| text (right align) | `|` |
| Edit existing text | E |
### Meta Actions
@@ -62,6 +62,26 @@ echo 'set autowrap' >> .config/sc-im/scimrc
| paste with format | Pc |
| delete a cell | x |
# Movement
| Action | Key |
|:-------------------------------:|:---:|
| highest part | H |
| lowest part | L |
| top | gg |
| move right | g$ |
| move left | g0 |
| insert middle | \ |
| insert left | \> |
| insert right | < |
| to to cell b4 | b4 |
| see all text in cells | aa |
| format cells so you can see it. | f |
| format wider right | fl |
| format smaller left | fh |
| format wider down | fj |
| format smaller down | fk |
### Functions

View File

@@ -1,13 +0,0 @@
---
title: "Convert Spreadsheets"
tags: [ "data", "sc-im" ]
---
Convert between spreadsheet formats with `sc-im`.
```sh
sc-im --quiet --quit_afterload --nocurses --export_csv ${file}.xlsx
sc-im --quiet --quit_afterload --nocurses --export_tab ${file}.sc
sc-im --quiet --quit_afterload --nocurses --export_mkd ${file}.csv
sc-im --quiet --quit_afterload --nocurses --export_txt ${file}.tsv
```

View File

@@ -1,33 +0,0 @@
---
title: "Search Video Audio"
tags: [ "data", "video" ]
---
Check subtitles available:
```sh
url='https://videos.domainepublic.net/videos/watch/d9567d5b-1add-477c-bce3-a58cef84c28c'
yt-dlp --list-subs "$url" | grep --max-count=1 '^en'
```
The original language often displays with `-orig`, e.g. `en-orig (Original)`.
```
Language Formats
ar vtt
az vtt
bg vtt
ca vtt
cs vtt
da vtt
de vtt
el vtt
en vtt
```
Search youtube.com for videos on a topic, and download subtitles:
```sh
url="$(ytfzf -I l "$search" )" && \
yt-dlp --write-subs --sub-format 'ass/srt/best/vtt' --sub-langs "en.*" --skip-download "$url"
```

View File

@@ -1,24 +0,0 @@
---
title: "Soft Serve Maintenance"
tags: [ "data", "git server", "maintenance" ]
requires: [ "git", "nginx" ]
---
Over time git repositories become bloated with old data, but never get cleaned.
I can't find an official way to clean up the crud, so I did this:
```sh
usermod -aG soft-serve $USER
# Log out and back in for this to take effect.
cd /var/lib/soft-serve/data/repos
sudo chmod -R g+w *
git config --global --add safe.directory '*'
du -sh *.git
for repo in *.git; do
git -C "$repo" gc
done
du -sh *.git
$EDITOR ~/.gitconfig
# You should remove having everything marked 'safe'.
```

View File

@@ -1,8 +0,0 @@
---
title: "Soft-Serve"
tags: [ "data", "git server", "lfs", "TUI" ]
requires: [ "git", "nginx" ]
---
- [Soft-Serve with https](soft-serve/soft_https.md)
- [Maintenance](soft-serve/maintenance.md)

View File

@@ -1,7 +1,6 @@
---
title: "Soft Serve through https"
tags: [ "data", "git server", "lfs" ]
requires: [ "git", "nginx" ]
---
## `http` Setup
@@ -34,7 +33,7 @@ Restart the `soft-serve` service, then check it's working by cloning from localh
git clone http://localhost:23232/${some_repo}.git
```
### `https` Setup
## `https` Setup
Put this file at `/etc/nginx/sites-enabled/$DOMAIN.tld`, then set up standard certificates with [nginx](../networking/website/nginx.md).
@@ -68,4 +67,3 @@ Put this file at `/etc/nginx/sites-enabled/$DOMAIN.tld`, then set up standard ce
}
```

View File

@@ -1,34 +0,0 @@
---
title: "Taskwarrior Contexts"
tags: [ "data", "task" ]
requires: [ "Taskwarrior" ]
---
# Contexts
Set three contexts by their tags:
```sh
task context define work +sa or +hr
```
```sh
task context define study +ed or +void or +rat
```
```sh
task context define home -sa -hr -ed -void -rat
```
Change to the first context.
```sh
task context work
```
Then stop.
```sh
task context none
```

View File

@@ -1,20 +0,0 @@
---
title: "Taskwarrior Configuration"
tags: [ "data", "task" ]
requires: [ "Taskwarrior" ]
---
Show your current config:
```sh
task show
```
Use machine-readable output to make a config file with all configuration keys shown, then make it your configuration file.
```sh
task _show > ${file}
mv ${file} ~/.config/task/taskrc
```

View File

@@ -1,35 +1,23 @@
---
title: "Taskwarrior"
tags: [ "data", "organization" ]
title: "task"
tags: [ "Organization" ]
---
Set up the configuration file:
```sh
```bash
task
```
Taskwarrior published a new feature to synchronize tasks others, but the feature was not ready.
The server's default installation instructions assume that users pay for hosting services.
All listed providers run proprietary software and actively support genocide.
To ignore the synchronization, tell the configuration file to use a local synchronization file.
```
task config sync.local.server_dir
task config data.location ~/.local/state/
```
Add a task:
```sh
```bash
task add update linux
```
See which task is next:
```sh
```bash
task next
```
@@ -37,13 +25,13 @@ Note the id number.
Mark a task as started:
```sh
```bash
task start 1
```
Once finished:
```sh
```bash
task 1 done
```
@@ -51,21 +39,23 @@ task 1 done
Add a project:
```sh
```bash
task add project:house buy potted plant
task add proj:house.repair buy screwdriver
task add proj:house.repair buy shelf brackets
task add pro:house.paint buy white paint
for t in "buy red paint" "buy black paint" "buy brushes" ; do
task add pro:house.paint $t
done
task add pro:house.paint buy red paint
task add pro:house.paint buy black paint
task add pro:house.paint buy brushes
```
## Summary
```sh
```bash
task pro:house sum
```
```bash
task burndown.daily pro:house
```
@@ -73,33 +63,69 @@ The summaries will show how fast a project is being completed, and when you can
# Tags
```sh
```bash
task add +buy toothbrush
```
You can then see only tasks which involve buying something with:
```bash
task +buy
```
# Contexts
Set three contexts by their tags:
```bash
task context define work +sa or +hr
```
```bash
task context define study +ed or +void or +rat
```
```bash
task context define home -sa -hr -ed -void -rat
```
Change to the first context.
```bash
task context work
```
Then stop.
```bash
task context none
```
# Review
View list of tasks completed in the last week:
```sh
```bash
task end.after:today-1wk completed
```
# User Defined Attributes
Define a new attribute for tasks called 'size'.
The 'user defined attribute' (UDA) needs a `type` and `label`.
Make a UDA 'size'.
```sh
```bash
task config uda.size.type string
```
```bash
task config uda.size.label Size
```
You can also ensure task tasks can only be `large`, `medium`, or `small`, then set a default.
```sh
```bash
task config uda.size.values large,medium,small
```
```bash
uda.size.default=medium
```
@@ -107,7 +133,7 @@ uda.size.default=medium
This command shows tasks I'm most interested in:
```sh
```bash
task next +ACTIVE or +OVERDUE or due:today or scheduled:today or pri:H
```

View File

@@ -1,18 +1,18 @@
---
title: "timewarrior"
tags: [ "data", "tracking", "time", "timew" ]
tags: [ "Data", "tracking", "time", "timew" ]
---
# Summaries
Try:
```sh
```bash
timew summary :yesterday
```
You can also use :week, :lastweek, :month, :quarter, :year, or a range such as:
```sh
```bash
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
```sh
```bash
timew start
timew stop
timew continue
@@ -32,7 +32,7 @@ timew tags
And add ids with:
```sh
```bash
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.
```sh
```bash
timew summary :ids
```
Then if we're looking at task @2:
```sh
```bash
timew move @2 12:00
timew lengthen @2 3mins
```
```sh
```bash
time shorten @2 40mins
```
# Forgetting
```sh
```bash
timew start 1h ago @4
```
Or if your action actually had a break:
```sh
```bash
timew split @8
```
Or maybe not?
```sh
```bash
timew join @4 @8
timew @8 delete
```
Start at previous time
```sh
```bash
timew start 3pm 'Read chapter 12'
timew start 90mins ago 'Read chapter 12'
```
Cancel currently tracked time.
```sh
```bash
timew cancel
```
@@ -157,11 +157,11 @@ with:
# Fixing Errors
```sh
```bash
curl -O https://taskwarrior.org/download/timew-dbcorrection.py
```
```sh
```bash
python timew-dbcorrections.py
```

View File

@@ -1,11 +0,0 @@
---
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.

View File

@@ -19,3 +19,4 @@ w3m ddg.gg
| T | new tab |
| { / } | switch tabs |
![w3m browser](/tapes/w3m.gif)

43
data/w3m.tape Normal file
View File

@@ -0,0 +1,43 @@
Require w3m
Sleep 1s
Type "w3m ddg.gg"
Sleep 500ms
Enter
Sleep 1.5s
Tab
Enter
Type "cats"
Enter
Sleep 2s
Tab
Enter
Sleep 2s
Type "jjjjjjjjjjjj"
Tab
Enter
Sleep 2s
Type "U"
Sleep 500ms
Ctrl+U
Sleep 500ms
Type "dmz.rs"
Sleep 500ms
Enter
Sleep 4.5s
Type "jjjjjjjj"
Tab
Type "j"
Sleep 500ms
Enter
Sleep 1s
Type " "
Sleep 2s
Backspace
Sleep 500ms
Type " "
Sleep 1.5s
Type " "
Sleep 2s
Type "qy"
Sleep 500ms

View File

@@ -1,6 +1,6 @@
---
title: "autologin"
tags: [ "distros", "arch" ]
tags: [ "Distros", "Arch" ]
---
# Automatic Login

View File

@@ -1,6 +1,6 @@
---
title: "Aeroplane Mode in Void"
tags: [ "void" ]
tags: [ "Void" ]
---
Put your device in 'aeroplane' mode (e.g. where no trace of signal leaves it) by turning off Wi-Fi and blue-tooth.
@@ -9,7 +9,7 @@ su root
sv stop wpa_supplicant bluetoothd
```
Find your device's name with `ip -color addr`.
Find your device's name with `ip a`.
If unsure, try this:
```sh

View File

@@ -1,6 +1,6 @@
---
title: "Void Autologin"
tags: [ "void" ]
tags: [ "Void" ]
---
Make the autologin service:

View File

@@ -1,6 +1,6 @@
---
title: "extrace"
tags: [ "void" ]
tags: [ "Void" ]
---
Monitor all processes:

View File

@@ -1,6 +1,6 @@
---
title: "sv"
tags: [ "void" ]
tags: [ "Void" ]
---
# List Services

View File

@@ -1,6 +1,6 @@
---
title: "Void Linux Basics"
tags: [ "void" ]
tags: [ "Void" ]
---
# Updates
@@ -57,5 +57,5 @@ brightnessctl s 10%+
- [autologin](autologin.md)
- [services](sv.md)
- [wifi](../../networking/wpa_supplicant.md)
- [wifi](wpa_cli.md)

View File

@@ -0,0 +1,28 @@
Require xbps-query
Require xbps-install
Set Shell "bash"
Set FontSize 20
Set Width 1400
Set Height 900
Type "sudo xbps-install --sync" Enter Sleep 700ms Enter
Type "sudo xbps-install --update --yes" Sleep 700ms
Backspace 33
Type "echo same but faster!" Sleep 200ms Enter
Type "sudo xbps-install -uy" Enter Sleep 700ms
Type "echo now we just download" Sleep 2s Enter
Type "sudo xbps-install -SD --yes" Sleep 700ms Enter
Type "echo and install from the downloaded updates..." Sleep 2s Enter
Type "sudo xbps-install -Du" Sleep 700ms Enter
Sleep 4s

View File

@@ -0,0 +1,64 @@
Require xbps-query
Require xbps-install
Set Shell "bash"
#Set FontSize 20
#Set Width 1400
#Set Height 900
#Hide
#
#Type "sudo xbps-remove -y cowsay xcowsay aerc"
Show
Type "xbps-query cows" Enter Sleep 1s
Type "nothing..."
Backspace 11
Type "xbps-query --search cows" Sleep 500ms Enter
Type "xbps-query --repository --search cows" Sleep 500ms Enter
Type "echo same but faster!" Sleep 200ms Enter
Type "xbps-query -Rs cows" Sleep 500ms Enter
Sleep 3s
Type "sudo xbps-install -y xcowsay" Enter Sleep 700ms Enter
Sleep 5
Type "xbps-query --repository --search 'email'" Sleep 300ms Enter
Type "too much...." Sleep 1s
Backspace 13
Sleep 1s
Type "xbps-query -R --search '^email'" Sleep 300ms Enter
Sleep 2s
Type "xbps-query -Rs --regex '^email terminal'" Sleep 300ms Enter
Type "???" Sleep 2s
Backspace 3
Sleep 3s
Type "regex first!" Sleep 2s
Backspace 12
Type "xbps-query --regex -Rs '^email.*terminal'" Sleep 300ms Enter Sleep 900ms
Type "xbps-query --regex -Rs '^terminal.*email'" Sleep 300ms Enter Sleep 900ms
Type "sudo xbps-install aerc" Enter Sleep 300ms Enter Sleep 2s

View File

@@ -0,0 +1,28 @@
Require xbps-query
Require xbps-install
Set Shell "bash"
#Set FontSize 20
#Set Width 1400
#Set Height 900
Type "sudo xbps-remove --yes thunderbird" Enter Sleep 2s
Type "time to kill orphans" Sleep 600ms
Backspace 21
Enter
Type "xbps-remove --remove-orphans --dry-run" Sleep 700ms
Backspace 38
Enter
Type "xbps-remove -on | cowsay" Sleep 300ms Enter Sleep 1.5s
Type "sudo xbps-remove --yes -o" Sleep 700ms Enter
Sleep 2s

View File

@@ -1,6 +1,6 @@
---
title: "xbps"
tags: [ "void" ]
tags: [ "Void" ]
---
## Search
@@ -22,6 +22,8 @@ Search with regex:
xbps-query --regex -Rs 'cow(s)?\w'
```
![xbps searches](/tapes/xbps-query.gif)
List what's required for cowsay
```bash
@@ -68,6 +70,8 @@ Upgrade current packages.
xbps-install -Suv
```
![xbps searches](/tapes/xbps-install.gif)
## Remove/ Uninstall
Remove cowsay
@@ -90,6 +94,8 @@ xbps-remove -o
Show information about cowsay
![xbps searches](/tapes/xbps-remove.gif)
## Fixes
Reinstall cowsay

View File

@@ -11,7 +11,6 @@ Select a keymap, and create a new custom map.
```sh
su root
ls /usr/share/kbd/keymaps/i386/qwerty/
basemap=/usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz
newmap=/usr/share/kbd/keymaps/custom.map.gz

View File

@@ -1,20 +0,0 @@
---
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
```

View File

@@ -1,6 +1,6 @@
---
title: "fail2ban"
tags: [ "networking" ]
tags: [ "Networking" ]
requires: [ "ssh" ]
---
# SSH Daemon Jail

View File

@@ -1,6 +1,6 @@
---
title: "Easy Network Graph"
tags: [ "networking" ]
tags: [ "Networking" ]
---
Set up a file like this, called `troubleshooting.txt`.

View File

@@ -1,6 +1,6 @@
---
title: "iptables"
tags: [ "networking" ]
tags: [ "Networking" ]
---
# Intro

View File

@@ -1,6 +1,6 @@
---
title: "nmap"
tags: [ "networking" ]
tags: [ "Networking" ]
---
Example:

View File

@@ -1,6 +1,6 @@
---
title: "pi-hole-server"
tags: [ "distros" ]
tags: [ "Distros" ]
---
# Installation

View File

@@ -1,25 +0,0 @@
---
title: "Port Scan"
tags: [ "networking" ]
repo: 'https://github.com/mrjackwills/havn/'
---
`havn` scans ports.
It's not in many repos, but if you can `cargo install havn`.
```sh
havn -h
havn -a
domain=splint.rs
havn -p 19-90 ${domain}
```
That last command doesn't work reliably, so increase the number of retries (`-r`), or decrease concurrent requests (`-c`).
```sh
havn -p 19-443 -r 6 ${domain}
havn -p 1-1000 -c 500 -r 5 ${domain}
```

View File

@@ -1,6 +1,6 @@
---
title: "rclone"
tags: [ "networking", "synch" ]
tags: [ "Networking" ]
---
The manpage's 'Synopsis' provides a fast reference.
```

View File

@@ -1,6 +1,6 @@
---
title: "Download videos"
tags: [ "scraping" ]
tags: [ "Scraping" ]
---
Install `yt-dlp`.

View File

@@ -1,6 +1,6 @@
---
title: "Agate on Arch Linux"
tags: [ "networking", "arch", "gemini" ]
tags: [ "Networking", "Arch", "Gemini" ]
---
Docs are [here](https://github.com/mbrubeck/agate).

View File

@@ -7,7 +7,7 @@ tags: [ "networking" ]
Try out basic ssh by accessing `git.charm.sh`, without needing authentication:
```sh
```bash
ssh git.charm.sh
```
@@ -16,32 +16,32 @@ The ssh server is sometimes in a package called `openssh`, and sometimes only in
Once it's installed, check it's working:
```sh
```bash
sudo systemctl status ssh
```
If that doesn't work, the service may be called `sshd`.
```sh
```bash
sudo systemctl status sshd
```
Then start that service:
```sh
```bash
sudo systemctl start sshd
```
Test it works by using ssh into your own system, from inside:
```sh
```bash
ssh $USER@localhost
```
Access the computer from another computer on the same local network by finding your computer's IP address.
```sh
```bash
ip address | grep inet
```
@@ -56,24 +56,24 @@ Here is mine:
The first one starts `127`, which means it returns back to that computer (like `localhost`).
The second is an ipv6 address, which is too angelic for this world, and has yet to descend.
The second is an ipv6 address, which is too angelic for this world, and has yet to ascend.
The third will work from a remote computer.
```sh
```bash
ssh $USERNAME@IP_ADDRESS
```
Once you have that, generate some ssh keys:
```sh
```bash
ssh-keygen
```
Look at your keys:
```sh
```bash
ls ~/.ssh
```
@@ -82,7 +82,7 @@ The other is secret.
Now send those keys to a remote computer:
```sh
```bash
ssh-copy-id $USERNAME@IP_ADDRESS
```

View File

@@ -1,6 +1,6 @@
---
title: "sshfs"
tags: [ "networking" ]
tags: [ "Networking" ]
requires: [ "ssh" ]
---
# Mount

View File

@@ -1,6 +1,6 @@
---
title: "ssh-tricks"
tags: [ "networking", "ssh", "tricks" ]
tags: [ "Networking", "ssh", "tricks" ]
requires: [ "ssh" ]
---

View File

@@ -1,9 +1,9 @@
---
title: "tor"
tags: [ "networking" ]
tags: [ "Networking" ]
---
# Get a Hostname
# Get a hostname
```bash
sudo vim /etc/tor/torrc

View File

@@ -1,6 +1,6 @@
---
title: "transmission"
tags: [ "networking", "torrenting" ]
tags: [ "Networking", "Torrenting" ]
---
# Torrench

View File

@@ -1,11 +1,11 @@
---
title: "troubleshooting"
tags: [ "networking" ]
tags: [ "Networking" ]
---
# Do you have an IP?
If not, try checking out what your local networking interfaces are, then check if they have been picked up:
If not, try checking out what your local Networking interfaces are, then check if they have been picked up:
```bash
dmesg | grep eth0

View File

@@ -1,6 +1,6 @@
---
title: "nginx"
tags: [ "networking", "web" ]
tags: [ "Networking" ]
---
Install nginx:

View File

@@ -1,6 +1,6 @@
---
title: "network"
tags: [ "networking" ]
tags: [ "Networking" ]
---
# Netstat Stuff

View File

@@ -1,6 +1,6 @@
---
title: "wpa_supplicant"
tags: [ "networking" ]
tags: [ "Networking" ]
---
`wpa_supplicant` configurations are stored in `/etc/wpa_supplicant/wpa_supplicant-wlan0` (or equivalent).

View File

@@ -1,6 +1,6 @@
---
title: "Basic Sound"
tags: [ "sound" ]
tags: [ "Sound" ]
---
# Pulse

View File

@@ -1,6 +1,6 @@
---
title: "festival"
tags: [ "sound" ]
tags: [ "Sound" ]
---
# Basics

View File

@@ -1,6 +1,6 @@
---
title: "mpd"
tags: [ "sound" ]
tags: [ "Sound" ]
---
# Setup

View File

@@ -1,6 +1,6 @@
---
title: "ncmpcpp"
tags: [ "sound" ]
tags: [ "Sound" ]
---
# Music Player Daemon

View File

@@ -23,8 +23,7 @@ Using four spaces will not work!
## Dependency Files
Now we've made a `README.md` file, we can show how a makefile looks in the README file.
Add these lines to the `Makefile`:
Now we've made a `README.md` file, we can show how a makefile looks in the README:
```make
README.md: Makefile
@@ -45,7 +44,7 @@ Note the order:
Notice that the file above can print into the README by using `echo "" >> $@`.
The `$@` stands for 'the file which we want', and `$<` stands for 'the first dependency file'.
The `make` program starts by replacing those variables, so when you run `make`, the program looks like this:
The `make` program starts by replacing those variables, and the result it:
```make
README.md: Makefile
@@ -55,6 +54,7 @@ README.md: Makefile
cat Makefile >> README.md
echo '```' >> README.md
```
| Sigil | Meaning |
@@ -71,6 +71,7 @@ README.md: Makefile
You can assign a variable normally, but must refer to it in brackets.
```make
storage_directory = backups
@@ -181,3 +182,4 @@ In this case, the makefile can see that `backup` depends on the current backup f
- [File patterns](Makefiles/patterns.md)
- [Makefile graphs](Makefiles/graph-easy.md)
- [In-build help](Makefiles/help.md)
- [Makefile graphs](Makefiles/graph-easy.md)

View File

@@ -7,14 +7,12 @@ Make your first target 'help' to give an overview of the main targets.
Running `make help` will search for text which starts with `## ` and show what that target does.
```make
.PHONY: help
help: ## Print the help message.
help: ## Print the help message
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
sort | \
column -s ':' -t
.PHONY: clean
clean: ## Remove generated files.
clean: ## Remove generated files
$(RM) $(defaults)
```

View File

@@ -1,3 +1,4 @@
---
title: "Makefile Patterns"
tags: [ "system", "make" ]

View File

@@ -1,6 +1,6 @@
---
title: "android"
tags: [ "system", "phone" ]
tags: [ "System", "phone" ]
---
# mtpfs

View File

@@ -1,114 +0,0 @@
---
title: "Ansible with Docker"
tags: [ "system", "ansible", "docker" ]
requires: [ "Docker" ]
---
Set up two containers: `deb` and `arch`, add them to an `ansible` hosts file, then do a 'ping' to see if they respond.
## Required Packages
- `ansible`
- `jq`
- `docker`
## Debian Container
```sh
docker run -di --rm --name deb --hostname deb debian
docker exec -it deb sh -c 'apt update && apt -y install openssh-server python3 sudo'
```
Generate the host's ssh keys, then start the ssh daemon:
```sh
docker exec -it deb sh -c 'ssh-keygen -A'
docker exec -d deb /usr/sbin/sshd -D
```
## Arch Linux Container
```sh
docker run -di --rm --name arch --hostname arch archlinux
docker exec -it arch sh -c 'pacman -Syu --noconfirm python sudo openssh'
docker exec -it arch sh -c 'ssh-keygen -A'
docker exec -d arch /usr/sbin/sshd -D
```
## `ssh` Keys
Copy across your public ssh key to the container's `authorized_keys` file:
```sh
pubkey=~/.ssh/id_rsa.pub
for hostname in arch deb; do
docker cp $pubkey $hostname:/root/.ssh/authorized_keys
docker exec -it $hostname sh -c "chown -R root:root /root/.ssh/"
docker exec -it $hostname sh -c "chmod -R 700 /root/.ssh/"
done
```
## Hosts File
Find name of containers' IPv4 addresses.
```sh
docker network inspect bridge
```
The output is awful.
Use `jq` to parse the `json`:
```sh
docker network inspect bridge | jq -r '.[].Containers | .[].IPv4Address'
```
Now put those into a host file:
```sh
docker_hosts=hosts.txt
echo '[containers]' > $docker_hosts
docker network inspect bridge | \
jq -r '.[].Containers | .[] | "root@" + .IPv4Address' | \
cut -d/ -f1 >> $docker_hosts
```
You may need to add those host keys to your known hosts file.
Either connect interactively, or (for scripts):
```sh
hosts="$(docker network inspect bridge | jq -r '.[].Containers | .[] | .Name + " " + .IPv4Address' | \
cut -d/ -f1)"
echo "$hosts"
echo "$hosts" | while read hostname ip; do
printf "%s" "$ip"
key="$(docker exec $hostname cat /etc/ssh/ssh_host_ed25519_key.pub)"
echo "$ip $key" >> ~/.ssh/known_hosts
done
```
Check if they ping:
```sh
ansible -i $docker_hosts all -m ping
```
This command produces an irritating warning about the python interpreter (i.e., `python3`).
Make the warning shut-up:
```sh
echo '
[containers:vars]
ansible_python_interpreter=/usr/bin/python3.13' >> $docker_hosts
```
Now the ping is cleaner:
```sh
ansible -i $docker_hosts all -m ping
```

View File

@@ -1,6 +1,6 @@
---
title: "awk"
tags: [ "system", ".csv" ]
tags: [ "System", ".csv" ]
---
# Basics

View File

@@ -1,6 +1,6 @@
---
title: "bash tips"
tags: [ "shell", "POSIX" ]
tags: [ "Shell", "POSIX" ]
---
## Track Live Changes

View File

@@ -1,6 +1,6 @@
---
title: "character-encoding"
tags: [ "system", "encoding" ]
tags: [ "System", "encoding" ]
---
Convert a text file from one encoding type to another with:

View File

@@ -1,6 +1,6 @@
---
title: "Default Programs"
tags: [ "defaults", "mime type" ]
tags: [ "Defaults", "Mime Type" ]
---
Install the package `xdg-utils`, then make very liberal use of the tab button.

View File

@@ -1,8 +1,10 @@
---
title: "lf - The Light File Manager"
tags: [ "file browser", "TUI" ]
tags: [ "File Browser", "TUI" ]
---
![lf](/tapes/lf.gif)
## Config File
If you don't have a `~/.config/lf/lfrc` file, you can probably find an example in `/usr/share/examples/lf`.

24
system/lf.tape Normal file
View File

@@ -0,0 +1,24 @@
Require lf
Set Shell "bash"
Set FontSize 12
Set Width 800
Set Height 600
Type "lf"
Sleep 1.5s
Enter
Sleep 1.5s
Type "jjj"
Sleep 1s
Enter
Sleep 2s
Type "fortune > file"
Enter
Sleep 2s
Enter
Type "/file"
Enter
Sleep 3s
Type "q"

View File

@@ -1,6 +1,6 @@
---
title: "logs"
tags: [ "system" ]
tags: [ "System" ]
---
# Basic

View File

@@ -1,98 +0,0 @@
---
title: "Python Projects with Makefiles"
tags: [ "tutorial", "system", "makefiles", "graphviz", "python" ]
requires: [ "Makefiles" ]
---
If you have a python script which requires a packages - e.g. `graphviz` - you can automate the setup with a `Makefile`.
The `Makefile` will:
1. Make three copies of an 8-line installer script.
2. Use one of the installer script to install local packages.
3. Install a symbolic link to python.
3. Make a script called `activate`, which tells python to use
# Context
Python coders don't like updating their projects, they just expect everyone to install the same version of everything that they have.
Historically, people dealt with this by installing only half a dozen copies of `graphviz`; but now each python project uses a local environment, with a local copy of `graphviz`, which means everyone gets to install a new copy of `graphviz` every time they try out a project.
Downloading 40MB of software for each 40-line script you write is called 'virtual environments' because it sounds cool.
We can make it even cooler with `make`, but not yet, because python - like the fae of old - will not fetch anything until you know its true name.
# Setup
```sh
command -v python
realpath `!!`
```
You must reveal that true path, because `python` is always a relative symbolic link, to an absolute symbolic link, which leads to a shortcut.
We can finally let `make` know how to invoke python, and where it will install `graphviz`.
If your python's version is '3.14', then python needs its packages placed in `${somewhere}/lib/python3.14/site-packages/`.
You must create a new, local, name for these packages, because - like the fey of old - python demands a private name in return for revealing its true name.
I'll call mine `camelot`, because the path is long and arduous.
Set up the Makefiles like this:
```make
py_link != command -v python
py != realpath $(py_link)
version != basename $(py)
virtenv = camelot
```
Now you can ask for a local `pip` script, which can install the python packages:
```make
[...]
$(virtenv)/bin/pip:
$(py) -m venv $(virtenv)
```
Finally, list the packages you want in `requirements.txt`, and make `pip` install from it.
```sh
ppkg=graphviz
echo ${ppkg} > requirements.txt
```
```make
[...]
pkgs = $(virtenv)/lib/$(version)/site-packages/
$(pkgs): $(virtenv)/bin/pip
$(pkgs): requirements.txt
$(virtenv)/bin/pip install -r $<
```
The complete Makefile looks like this:
```make
all: .default
py_link != command -v python
py != realpath $(py_link)
version != basename $(py)
virtenv = camelot
$(virtenv)/bin/pip:
$(py) -m venv $(virtenv)
pkgs = $(virtenv)/lib/$(version)/site-packages/
$(pkgs): $(virtenv)/bin/pip
$(pkgs): requirements.txt
$(virtenv)/bin/pip install -r $<
.PHONY: .default
.default: $(pkgs)
```

Some files were not shown because too many files have changed in this diff Show More