Compare commits

...

66 Commits

Author SHA1 Message Date
7e75763cee
expand on readme style 2025-03-22 23:45:43 +01:00
2d3961e0f5
update readme 2025-03-22 23:41:04 +01:00
72ad0786c8
allow joins on related articles 2025-03-22 23:26:20 +01:00
b64d9de0c4
bad.horse bad.horse 2025-03-20 13:10:43 +01:00
fa9c8edb1d
edit Makefile intro 2025-03-18 18:54:17 +01:00
741e988536
base 16 notes 2025-03-18 18:11:57 +01:00
a72e2b117d
syntax fix 2025-03-13 14:06:45 +01:00
cc574d5358
backup syntax 2025-03-07 12:12:17 +01:00
0d76eb0531
edit virtualbox 2025-03-05 16:46:46 +01:00
3bfeacd2d7
write managing groups 2025-03-05 16:46:36 +01:00
ed4b54cf7e
tag 2025-03-03 19:44:41 +01:00
4e89c5ab9b
more grammarlier 2025-03-02 22:04:04 +01:00
1732c62734
add soft serve maintenance 2025-03-02 18:15:59 +01:00
fb157895fb
add requirements 2025-03-02 18:11:52 +01:00
b3258d9f5f
refactor db creation 2025-03-02 10:14:20 +01:00
d793bca3ea
search video audio 2025-02-28 17:10:25 +01:00
14470b6f92
typo 2025-02-27 16:59:11 +01:00
59fb0ada24
lowercase tags 2025-02-24 09:19:15 +01:00
b68fa25cea
syntax and colouration 2025-02-19 15:11:37 +01:00
5bd45973b4
clean makefile help syntax 2025-02-17 19:04:09 +01:00
66cdca5c85
give articles lowercase tags 2025-02-17 00:27:30 +01:00
aa32bfc249
bibliographies with recfiles 2025-02-14 13:05:28 +01:00
fc88ab6200
recfile example 2025-02-13 17:39:55 +01:00
eaec01076b
ip addresses with recfiles 2025-02-13 17:39:38 +01:00
0abc2818e8
use title as db key 2025-02-13 03:52:15 +01:00
4250f619c3
unify kernel notes 2025-02-13 01:42:50 +01:00
4d53f7c7d6
rebuild on $dir/$file.md changes
Still not rebuilding on changes to $dir/$dir/$file.md.
2025-02-13 01:34:33 +01:00
38feabb79f
name fix 2025-02-13 01:16:24 +01:00
b4683a8681
add contents to databases 2025-02-13 00:08:34 +01:00
d2934bf8a3
recfile fixes 2025-02-12 23:01:50 +01:00
5afc414a52
small edits 2025-02-12 23:01:40 +01:00
d8b4a9d00b
stop duplicate db entries 2025-02-12 22:51:27 +01:00
a15b565e09
metadata fixes 2025-02-12 22:50:27 +01:00
6ccba626c8
edit git lfs 2025-02-12 17:46:59 +01:00
415985d08c
make silently be default 2025-02-12 17:00:34 +01:00
d6c3cd6387
set default editor 2025-02-12 16:51:02 +01:00
4c3d51ff83
use parallel execution by default 2025-02-12 16:49:10 +01:00
8f3da4558f
split database into parts
Each category - sound/, networking/, et c. - now has its own little
database in .dbs/.  So the database only recompiles based on categories,
rather than a complete recompile every time a single file changes.
2025-02-12 16:47:47 +01:00
137466a423
edit article categories in makefile 2025-02-12 15:46:02 +01:00
37df47cf3b
fix mark article target 2025-02-12 15:37:05 +01:00
b6280a8581
separate system search 2025-02-12 15:36:40 +01:00
1ce84ebc53
edit metadata 2025-02-12 15:01:15 +01:00
341b6ed46f
remove old otr notes 2025-02-12 14:38:02 +01:00
63ce7e8bbb
expand readme usage example 2025-02-11 21:26:55 +01:00
2184e9d663
tidy tags 2025-02-11 21:26:39 +01:00
02381c71f2
add collatz conjecture 2025-02-11 21:16:49 +01:00
ef7b424586
remove redundant Documentation tag 2025-02-11 20:47:50 +01:00
9621cfc26a
rewrite introduction 2025-02-11 20:39:24 +01:00
d92631c795
add wordcount to database 2025-02-11 20:38:45 +01:00
b81fd55a87
sort database by title 2025-02-11 19:41:02 +01:00
e4be8a8523
allow any fuzzy finder 2025-02-11 19:09:37 +01:00
eeade3cdfb
automatically show dependencies 2025-02-11 18:04:03 +01:00
481b34a472
label make clean 2025-02-11 15:37:55 +01:00
fd850761f3
add tags 2025-02-11 13:21:05 +01:00
b7729e5712
generate articles with makefile 2025-02-11 13:06:37 +01:00
bbd34e24ec
generate db with makefile 2025-02-11 12:55:07 +01:00
808ef3bb71
shorten recfiles intro 2025-02-10 20:32:04 +01:00
53e86fb86e
board games with recfiles 2025-02-10 01:02:12 +01:00
6b4a846284
note makefile help 2025-02-09 22:20:16 +01:00
2250275be5
outline makefiles 2025-02-07 23:40:13 +01:00
7427b05b0b
recfiles typo 2025-02-07 20:26:17 +01:00
5e703a65c0
tidy up keyboard key swap 2025-02-07 17:42:10 +01:00
8b7912a68f
extend recfiles example 2025-02-07 17:07:38 +01:00
5460f23f12
add recfiles 2025-02-07 13:35:57 +01:00
7afe6e33cd
basic column command 2025-02-04 19:33:13 +01:00
1d8ccbc5e8
arch maintenance 2025-01-22 18:36:50 +01:00
142 changed files with 1748 additions and 774 deletions

81
Makefile Normal file
View File

@ -0,0 +1,81 @@
MAKEFLAGS += -j
MAKEFLAGS += -s
EDITOR ?= vi
FZF != command -v sk || command -v fzy || command -v fzf || \
{ echo install a fuzzy finder && exit 1 ;}
spill_contents = sed -e '1,/---/d'
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
articles != find * -type f -name "*.md"
dirs != ls -d */
categories = $(patsubst %/, %, $(dirs))
databases = $(patsubst %, .dbs/%.rec, $(categories))
default += $(databases)
$(foreach dir, $(categories), \
$(eval .dbs/$(dir).rec: $(wildcard $(dir)/*)) \
)
.dbs/:
mkdir $@
$(databases): .dbs/%.rec: %/ | .dbs/
$(info making $(@F))
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)" ;\
done > $@
# This two-variable read can only happen because of the quotes in the titles.
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 $^ >> $@
recsel $@ -e "requires != ''" -CR title,requires |\
while read title requires; do \
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: $@)
default += db.rec
.git/info/exclude: $(default)
echo $^ | tr ' ' '\n' > $@
default += .git/info/exclude
.PHONY: database
database: $(default) ## Make a recfiles database
.PHONY: article
article: ## Write an article
@path=$$(find $(categories) -type d | sort | uniq | $(FZF)) ;\
read -p "Title: " title ;\
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 '%s\n\n' '---' >> $$path/$$filename.md ;\
$(EDITOR) +5 "$$path/$$filename.md"
.PHONY: clean
clean: ## Remove all generated files
$(RM) $(default)

120
README.md
View File

@ -1,77 +1,99 @@
---
title: "Knowledge Base"
title: "Linux Knowledge Base"
---
# Linux Knowledgebase
The Linux Knowledge-Base provides quick-start guides for working with terminal programs.
This is a list of quickstart guides for Linux programs, designed to get the user up and running as fast as possible.
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 -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)'
```
# Style
## Praxis Only
## No History, No Context
We leave theory alone as much as possible.
The documentation should be of the form 'if you want *X*, type *Y*'.
- 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.
We don't need to explain what a program does - anyone looking up 'how to X', already knows what they want to do.
We don't even need to explain which program to use - if someone wants to combine an mp4 and webm video into a single video file, they only care about that result, not about learning `ffmpeg`.
## State Knowledge Dependencies
Any interest in these tools only comes after we can use them.
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.
## Chronological
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.
Entries should read like scripts - everything in the right order, with small notes on what this does.
## Be Opinionated
The chronology should never branch.
If `gitea` can use three different types of database, the documentation should simply pick one and continue instructions from there.
Repetition works better than a reference - if a database requires three commands to set up, it's better to repeat those three commands for every program that requires a database than to just link to another file which discusses databases.
- Guides should not ask the reader to select options half-way through.
- Options for different filesystems, databases, et c., should be written as separate guides.
---
## Repetition Beats Reference
### Closing
If a database requires three commands to set up, it's better to repeat those three commands for every program that requires a database than to just link to another file which discusses databases.
Introductory documents should show anything required to cleanly uninstall a program, without leaving bulky configuration files behind.
## Show Arguments as Variables
## Three Input Types
Look at this line:
There are three types of examples:
Fixed input:
```bash
ls
```sh
grep ls --color=always $HISTFILE | less -R
```
Anything with arbitrary input should be shown as a variable.
What else can go in place of `always`?
Can you say `--color=red`?
Can you put anything?
The answer is not obvious.
```bash
ls $FILE
What about this line:
```sh
git branch new
git checkout new
```
Non-commands (e.g. output) should be shown as quoted text:
Do you always use `new`?
Can you use another word here?
The answer is not obvious.
> LK img
> Mail kn
> Projects music
---
# Example
```
How to see which websites you're actively accessing:
` ` `bash
ss -tr dst :$PORT
` ` `
> State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
> ESTAB 0 0 192.168.0.14:42476 149.154.167.91:https
> ESTAB 0 0 192.168.0.14:43644 104.17.90.199:https
It's better to make all arbitrary values variables.
```sh
git branch $branch_name
git checkout $branch_name
PAGER='less -R'
grep ls --color=always $HISTFILE | $PAGER
```
# What's wrong with everything else?
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
@ -79,12 +101,14 @@ ss -tr dst :$PORT
- Often presumes you know everything except that one program.
- Often written in the 80's, and it shows.
- Zero respect for your time.
- Often references `info` pages (yuck).
## curl cheat.sh/
## `curl cheat.sh`
- Doesn't have the programs I like.
- Too short to get you started on many programs.
- Poor understanding of priority (`git stash` is covered before `git commit`).
- Repetitive
# Current State

View File

@ -6,7 +6,20 @@ tags: [ "fun" ]
- `asciiquarium`
- `cbonsai -lim "$(fortune)"`
```bash
```sh
cow=$(cowsay -l | sort -R | head -1)
fortune -s | figlet | cowsay -nf $cow | lolcat
```
Watch the [Collatz Conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture) collapse:
```sh
x="$(du -sc ~/.cache | tr -d '[:alpha:]' | tail -1)"
until [ "$x" -eq "1" ]; do
test "$(( x % 2 ))" -eq 0 && x=$(( x / 2 )) || \
x=$(( x * 3 + 1 ))
clear -x
figlet "$x" | lolcat
sleep 1
done
```

View File

@ -1,6 +1,6 @@
---
title: "at"
tags: [ "Documentation", "Basics" ]
tags: [ "basics", "time" ]
---
Install with:

View File

@ -1,6 +1,6 @@
---
title: "Basics"
tags: [ "Documentation", "Basics" ]
tags: [ "basics" ]
---
You need about a dozen commands to move around Linux.
@ -342,11 +342,12 @@ apt install $PROGRAM
Remove `lolcat`, because it's useless:
```bash
```sh
sudo apt remove lolcat
```
... and that's pretty much it. You can move, create, destroy, install things, and look things up.
...and that's pretty much it.
You can move, create, destroy, install things, and look things up.
# Review

View File

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

36
basics/column.md Normal file
View File

@ -0,0 +1,36 @@
---
title: "column"
tags: [ "basics", "format", "json" ]
---
Put output into column.
```bash
du -h /etc/* | column
```
Reformat file with an explicit separator (`-s`):
```bash
column -ts: /etc/passwd
```
Give columns names (`-N`), so you can hide some (`-H`):
```bash
column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID /etc/passwd
```
Reorder with `-O` (unspecified items remain):
```bash
column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID -O User,Description,shell /etc/passwd
```
Output to json format with `-J`:
```bash
column -J -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd
```

View File

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

View File

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

View File

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

View File

@ -1,34 +0,0 @@
---
title: "kernel"
tags: [ "Documentation", "Basics" ]
---
## Living Space
Kernel modules live in lib/modules/$(uname -r)
## Change
Load them with
```bash
sudo modprobe ath9k
```
Or remove one with
```bash
sudo modprove uvcvideo
```
The PC's irritating speaker beep can be really annoying. Disable it with:
```bash
sudo modprobe -r pcspeaker
```
Permanently disable a module by blacklisting it in `/etc/modprobe.d`:
```bash
echo 'blacklist pcspkr' > /etc/modprobe.d/*nobeep*.conf
```

View File

@ -1,6 +1,6 @@
---
title: "kill"
tags: [ "Documentation", "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: [ "Documentation", "Basics" ]
tags: [ "basics", "time" ]
---
Your locale tells the computer your location, preferred time-and-date format, standard language, papersize, et c.

View File

@ -1,62 +1,33 @@
---
title: "locating"
tags: [ "Documentation", "Basics" ]
tags: [ "basics" ]
---
# Type
`type` shows what kind of thing you're running, be it an alias, function, or binary program.
```bash
type cmus
```sh
type cd
type ls
type -P ls
type -a cat
```
# Whereis the Program
Ask where the `angband` program is, along with all its configuration files:
Where is `grep` and all its configuration files?
`whereis angband`
Also `which` shows where a binary file (the program) is,
```bash
which cmus
```sh
whereis grep
```
# Search Instantly with `plocate`
Which one of these is the binary file which you actually use?
You can search every file on the computer instantly by installing `plocate`.
Once installed, run `sudo updatedb` to create the database of (nearly) every file on the computer.
Check how big the database is:
```bash
du -h /var/lib/plocate/plocate.db
```sh
which grep
```
Once you have the database, you can find nearly any file instantly.
# More
- Search for gifs: `locate .gif`
- Search for gifs in the `/usr/` directory: `locate /usr/ .gif`
- Search for jpg images with 'dog' or 'Dog' in the name: `locate -i dog jpg`
- Search for videos: `plocate --regex '.mp4$|.mkv$|.wmv$|.webm$|.mov$|.avi$'`
For best results, run `updatedb` regularly, perhaps in [crontab](../system/cron.md).
## Search More Places
`plocate` will not search `/tmp/`, because nobody cares about those files, and won't search inside `/mnt/`, because that's where USB sticks get mounted, so the files keep changing as USB sticks come and go.
Change where `plocate` searches by editing the configuration file at `/etc/updatedb.conf`.
By default, the `/mnt` directory is 'pruned' from the database.
So if you want to search `/mnt` for videos, remove the word `/mnt` from the configuration file.
```bash
cat /etc/updatedb.conf
sudo sed 's#/mnt/##' /etc/updatedb.conf
sudo updatedb
plocate --regex '.mp4$|.mkv$|.wmv$|.webm$|.mov$|.avi$'
```
- [Search instantly with `plocate`](data/search_system.md)

View File

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

View File

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

View File

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

View File

@ -1,57 +0,0 @@
---
title: "profanity"
tags: [ "Documentation", "Chat", "OTR" ]
---
# otr
'Off The Record' encryption seems mostly dead to me.
But this is what I did, back in the day...
Install libotr-dev or libotr5-dev or whatever..
```
sudo apt -y install lib5otr-dev
```
Make your otr keys.
```
/otr gen
```
Then you can start an otr converstation.
```
/otr start bob@jobbies.org
```
Or if you already have a conversation windows open, switch to our using:
```
/otr
```
Finally, verify!
```
/otr question "Who are you?" bob
```
Bob is verified upon the answer, 'bob'.
### OTR Finger Prints
Get yours with
```
/otr myfp
```
```
/otr theirfp
```
```
/otr myfp
```

View File

@ -1,6 +1,6 @@
---
title: "profanity"
tags: [ "Documentation", "Chat", "omemo" ]
tags: [ "chat", "omemo" ]
---
# Setup (Commands)

View File

@ -1,29 +1,29 @@
---
title: "wgetpaste"
tags: [ "Documentation", "Chat" ]
tags: [ "chat" ]
---
See available pastebins:
```bash
```sh
wgetpaste -S
```
Upload script.sh to bpaste:
```bash
```sh
wgetpaste -s bpaste script.sh
```
Input clipboard to dpaste with the heading "Title"
```bash
```sh
wgetpaste -s dpaste -d Title -x
```
Paste in the file then load the result to the right-hand clipboard:
```bash
```sh
wgetpaste -s dpaste -X
```

View File

@ -1,6 +1,6 @@
---
title: "Archives"
tags: [ "Documentation", "tar", "backups" ]
tags: [ "tar", "backups", ".tgz", "tar.gz" ]
---
# `tar`
@ -8,22 +8,21 @@ tags: [ "Documentation", "tar", "backups" ]
Combine many files and directories into a single t-archive file.
```bash
```sh
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.
```bash
```sh
tar cf "$ARCHIVE".tar -C /etc/ nginx
```
Check the contents of your archive with:
```bash
```sh
tar tf "$ARCHIVE".tar
```
@ -31,7 +30,7 @@ If you want to store 'everything in a directory', then using `*` will not work,
Instead, you can store the target in a variable:
```bash
```sh
files=$(ls /etc/nginx)
tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
```
@ -40,7 +39,9 @@ tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
Extract the tar archive with
> tar xf "$ARCHIVE".tar
```sh
tar xf "$ARCHIVE".tar
```
You can remember this with the mnemonic 'e*X*tract *F*ile'.
@ -48,7 +49,7 @@ You can remember this with the mnemonic 'e*X*tract *F*ile'.
Create a zip-compressed archive with the `z` flag.
```bash
```sh
tar czf "$ARCHIVE".tgz -C /etc/nginx/ $file
```
@ -60,18 +61,16 @@ You can use any file ending you want, but sane people like to use '.tgz' or '.ta
Make archive:
```bash
PASSWORD=my_password
```
```bash
7za a -tzip -p$PASSWORD -mem=AES256 $ARCHIVE.zip $FILE_1 $FILE_2
```sh
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:
```bash
```sh
7za x archive.zip
```

View File

@ -1,11 +1,11 @@
---
title: "unison"
tags: [ "Documentation", "Backups" ]
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).
```bash
```sh
unison -version
```
@ -13,14 +13,14 @@ Create the `~/.unison` directory on both machines.
Make a job called `backup`:
```bash
```sh
JOB=backup
```
Here is an example job, which synchronizes the `~/music` directory with a remote machine which has the same username.
```bash
```sh
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:
```bash
```sh
unison -batch *backup*.prf
```

View File

@ -1,8 +1,26 @@
---
title: "Base 16"
tags: [ "Documentation", "Data" ]
tags: [ "data" ]
---
```bash
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
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

@ -5,5 +5,10 @@ tags: [ "data", "calendar", "daylight savings" ]
## Setup
The UK government keeps an ics file with clock, [here](https://www.gov.uk/when-do-the-clocks-change/united-kingdom.ics).
The UK government keeps an `ics` file with clock.
```sh
wget https://www.gov.uk/when-do-the-clocks-change/united-kingdom.ics
calcurse -i united-kingdom.ics
```

View File

@ -9,10 +9,10 @@ Install `opensmtpd` (or similar), then `ncat` or `nc` or `netcat` (this mysterio
Start the `opensmtpd` service, then use netcat to speak with the mail-daemon:
```
```sh
nc localhost 25
```
The computer should respond with code `220`, which means 'I am listening'.
> 220 hex ESMTP OpenSMTPD
@ -40,7 +40,7 @@ Tell the mail daemon who you are in this format.
Then tell it who you're sending to.
```
```sh
RCPT TO: <www@dmz.rs>
```
@ -67,7 +67,7 @@ You will find the email under `/var/spool` or `/var/mail` or similar.
If unsure, just take a part of your email, like `FRAGMENT="turn off server please"`, then `grep` for it:
```bash
```sh
sudo grep -r $FRAGMENT /var/spool/*
```

View File

@ -1,17 +1,17 @@
---
title: "exiftool"
tags: [ "Documentation", "Metadata" ]
tags: [ "metadata", "exifdata" ]
---
Find metadata.
Find metadata:
```bash
exiftool image.jpg
```sh
exiftool "$file".jpg
```
Find info on all images in current directory.
Find info on all `.png` images in current directory.
```bash
```sh
exiftool -ext .png .
```
@ -19,22 +19,14 @@ You can make this recurring with the -r switch.
And overwrite all metadata:
```bash
```sh
exiftool -all= -overwrite_original -ext jpg .
```
(NB: This does not work on pdf data. See [here](pdf_erasure.md) for erasing all pdf data)
Or just GPS data:
```bash
```sh
exiftool -gps:all= *.jpg
```
You can also use the imagemagick tool:
```bash
identify -verbose
```

View File

@ -1,6 +1,6 @@
---
title: "git"
tags: [ "Documentation", "data" ]
tags: [ "data" ]
---
# Starting

View File

@ -1,24 +1,72 @@
---
title: "git-lfs"
tags: [ "Documentation", "data" ]
tags: [ "data", "git" ]
---
Install, and add with
Git Large File Storage ('LFS') needs to change your `~/.gitconfig` to check out those binary files:
```bash
```sh
cat ~/.gitconfig
git lfs install
cat ~/.gitconfig
```
Then track some filetype with:
Then track some filetypes with:
```bash
git lfs track "\*.ttf"
```sh
cd $git_repository
ext=ttf
git lfs track "*.$ext"
```
Or a directory with:
```bash
```sh
git lfs track "images/"
```
All changes require adding `.gitattributes`.
Track the changes to `.gitattributes`:
```sh
git status
git add .gitattributes
git commit -m "add $ext to lfs"
```
## Bash Completion
If bash completion does not work, you'll have to add it:
```sh
git lfs completion bash | sudo tee /usr/share/bash-completion/completions/git-lfs
```
## Trouble Shooting
You have some file "$FILE".png, which has some problem.
Check the filetype:
```sh
file "$FILE".png
```
This should say the type is 'image'.
If it says the type is 'text', then this file is really just a reminder to `git-lfs` to check out that file.
Check `git-lfs` is expecting that file:
```sh
git lfs status
git lfs ls-files
```
...then try these commands, and check the filetype again:
```sh
git lfs fetch --all
git lfs fsck
git lfs checkout
git lfs status
```

View File

@ -1,6 +1,6 @@
---
title: "git hooks"
tags: [ "Documentation", "data", "git" ]
tags: [ "data", "git" ]
---
Check out the sample hooks:

View File

@ -1,6 +1,6 @@
---
title: "git"
tags: [ "Documentation", "data", "git", "subtree" ]
title: "git subtree"
tags: [ "data", "git", "subtree" ]
---
## Pulling a Subtree from an existing git

View File

@ -1,6 +1,6 @@
---
title: "gpg"
tags: [ "Documentation", "data", "GPG" ]
tags: [ "data", "gpg" ]
---
- [Setup](gpg/basics.md)

View File

@ -1,6 +1,6 @@
---
title: "GPG Basics"
tags: [ "Documentation", "data", "GPG" ]
tags: [ "data", "GPG" ]
---
# Making keys

View File

@ -1,6 +1,7 @@
---
title: "gpg"
tags: [ "Documentation", "vim", "data", "GPG" ]
title: "gpg with vim"
tags: [ "vim", "data", "GPG" ]
requires: [ "GPG Basics", "vim basics" ]
---
The `vim-gnupg` plugin lets vim edit gpg-encrypted files as if they were unencrypted.

View File

@ -1,6 +1,6 @@
---
title: "groff"
tags: [ "Documentation", "Data" ]
tags: [ "data", "logic" ]
---
# Basic Documents

View File

@ -1,60 +1,52 @@
---
title: "khard"
tags: [ "Documentation", "Data" ]
tags: [ "data" ]
---
Get the basic config:
```bash
```sh
mkdir ~/.config/khard
```
```bash
```sh
cp /usr/share/doc/khard/examples/khard/khard.conf.example ~/.config/khard.conf
```
Short list
```bash
```sh
khard list
```
Longer list
```bash
```sh
khard show
```
Show from addressbook 'work'
```bash
```sh
khard list -a work
```
Make a new contact in address book 'family'
```bash
```sh
khard new -a family
```
```bash
```sh
khard edit grampa
```
```bash
```sh
khard remove bob
```
Move contact 'nina' from 'work' to 'home' address book.
```bash
```sh
khard move -a home nina -A work
```
## Advanced
Merge:
```bash
khard merge [-a source_abook] [-u uid|search terms [search terms ...]] [-A target_abook] [-U target_uid|-t target_search_terms]
```

View File

@ -1,6 +1,6 @@
---
title: "newsboat"
tags: [ "Documentation", "RSS" ]
tags: [ "RSS" ]
---
Create the configuration directory before you start, and add at least 1 URL.

View File

@ -1,42 +1,42 @@
---
title: "pass"
tags: [ "Documentation", "data" ]
tags: [ "data" ]
requires: "GPG Basics"
---
[Video instructions](https://www.hooktube.com/watch?v=hlRQTj1D9LA)
Setup [gpg](./gpg.md) keys.
Show your gpg secret it:
```bash
```sh
gpg --list-secret-keys
```
Then use the id number under `sec` to make a pass repo:
```bash
```sh
KEY="$(gpg --list-secret-keys | grep -m 1 -A1 '^sec' | tail -n 1)"
```
```bash
```sh
pass init $KEY
```
To add a basic password, e.g. for `$WEBSITE`:
```bash
```sh
pass $WEBSITE
```
To insert a multiline password, e.g. with a login name:
```bash
```sh
pass add -m $WEBSITE
```
Remove a password:
```bash
```sh
pass rm $WEBSITE
```

View File

@ -1,8 +1,9 @@
---
title: "pdf to txt"
tags: [ "Documentation", "data", "pdf", "ocr" ]
tags: [ "data", "pdf", "ocr" ]
---
How to translate pdf book images to text (results are very poor, and will need lots of corrections).
How to translate pdfs to text (results are very poor, and will need lots of corrections).
## Dependencies
@ -17,8 +18,8 @@ pdftoppm -png *file*.pdf test
```
```bash
for x in \*png; do
tesseract -l eng "$x" - >> *out*.txt
for x in *png; do
tesseract -l eng "$x" - >> out.txt
done
```

View File

@ -1,8 +1,11 @@
---
title: "PDF Metadata Erasure"
tags: [ "Documentation", "Metadata", "Ghost Script" ]
tags: [ "metadata", "ghost script", "gs", ".pdf" ]
---
You cannot erase pdf metadata with `exiftool` (it only *appends* your changes).
To delete pdf metadata, you'll need `gs`.
Make a text file called 'pdfmark.txt'.

View File

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

54
data/recfiles.md Normal file
View File

@ -0,0 +1,54 @@
---
title: "Recfiles"
tags: [ "data", "database" ]
---
Create:
```sh
database=games.rec
touch $database
for g in Vojvodina Saboter Carcassonne Chess; do
recins -r "Name: $g" -r "Played: yes" $database
done
```
Read:
```sh
recsel $database
query=Carc
recsel --quick=$query $database
game=Vojvodina
recsel --expression="Name = '${game}'" $database
```
Update:
```sh
recset --expression="Name = '${game}'" -f Played --set="no" $database
new_field=Played
value=no
recset -f "$new_field" --delete $database
recset -f "$new_field" --set-add="$value" $database
recsel $database
```
Delete:
```sh
recdel --expression="Name = '${game}'" $database
recset -f "$new_field" --delete $database
```
- [Extended example](recfiles/extended.md)
- [Playing with board games data](recfiles/Board_Games.md)
- [Playing with IP addresses](recfiles/IP_ASN.md)
- [Manage LaTeX Bibliographies](recfiles/bibliography.md)
- [Fixes](recfiles/recfixes.md)
# Resources
- [Recfiles for gemini capsules](gemini://tilde.town/~dozens/gemlog/21.gmi)

View File

@ -0,0 +1,62 @@
---
title: "Board Games with Recfiles"
tags: [ "data", "recfiles", "games" ]
requires: "Recfiles"
---
You can play with a board games database from boardgamegeek.com.
## Download the Database
```sh
mkdir board_games
cd board_games
curl -Lo bg.zip 'https://www.kaggle.com/api/v1/datasets/download/threnjen/board-games-database-from-boardgamegeek'
unzip bg.zip
```
The header line shows fields with a bunch of colons, which will confused `recutils`, so we'll have to get rid of them.
```sh
sed -i '1s/://g' *.csv
```
Convert the games to `.rec` format.
```sh
csv2rec games.csv > games.rec
```
## Queries
If you try to look at older games, you'll find lots of results.
```sh
recsel games.rec -e "YearPublished < 1800" -c
recsel games.rec -e "YearPublished < 1800" -Cp Name
```
But most are wrong.
The problem is games with a `YearPublished` date of `0`, probably because the year published is unknown.
```sh
recsel games.rec -e "Name = 'The Goblin King is Angry'" -p YearPublished
```
Fix the query by removing games published in '0 AD'.
```sh
recsel games.rec -e "YearPublished < 1800 && YearPublished != 0" -R YearPublished,Name
```
Or fix the database setting `YearPublished` to 'unknown':
```sh
recsel games.rec -e "YearPublished = 0" -Cp Name
recset games.rec -e "YearPublished = 0" -f "YearPublished" -S 'unknown'
```
Strategic games which work best with 3 players, sorted by Average Rating:
```sh
recsel games.rec -e "BestPlayers = 3 && CatStrategy = 1" -CR Name --sort=AvgRating
```

16
data/recfiles/IP_ASN.md Normal file
View File

@ -0,0 +1,16 @@
---
title: "IP Addresses with Recfiles"
tags: [ "data", "recfiles", "games" ]
requires: "Recfiles"
---
## Download the Database
Download the csv data, and separate the ipv4 data from the ipv6.
```sh
curl -Lo ips.zip 'https://www.kaggle.com/api/v1/datasets/download/ipinfo/ipinfo-country-asn'
unzip -p ips.zip country_asn.csv | csv2rec | recsel -e "start_ip ~ '\.'" > ipv4.rec
unzip -p ips.zip country_asn.csv | csv2rec | recsel -e "start_ip ~ '::'" > ipv6.rec
```

View File

@ -0,0 +1,121 @@
---
title: "Recfile Bibliography for TeX"
tags: [ "data", "database", "recfiles", "tex" ]
requires: [ "Recfiles", "TeX", "Makefile" ]
---
Store your bibliography in a `recfile` database, then extract any part with `make`.
For example, you could store books like this in `bibliography.rec`:
```recfile
%rec: book
%key: slug
slug: thinkingexperience
author: H. H. Price
title: Thinking and Experience
year: 1953
publisher: Harvard University Press, Cambridge
slug: inventingrightwrong
author: John Leslie Mackie
title: Inventing Right and Wrong
year: 1997
publisher: Penguin Books, England
```
Run `make book` to extract `book.bib`, ready for LaTeX to use:
```bib
@book{thinkingexperience,
author = {H. H. Price},
title = {Thinking and Experience},
year = {1953},
publisher = {Harvard University Press, Cambridge},
}
@book{inventingrightwrong,
author = {John Leslie Mackie},
title = {Inventing Right and Wrong},
year = {1997},
publisher = {Penguin Books, England},
}
```
The `makefile` syntax is just a few lines (though admittedly employs some garbled shell-crud):
```make
bibs != grep -Po '%rec: \K.*' bibliography.rec
bibfiles = $(patsubst %, %.bib, $(bibs))
$(bibfiles): %.bib: bibliography.rec
recsel $< -t $(basename $@) |\
sed 's/slug: \(.*\)/@$(basename $@){\1,/g' |\
sed 's/^\(\b.*\b\): \(.*\)/ \1 = {\2},/gI' |\
sed 's/^$$/}\n/g' > $@
echo '}' >> $@
```
Here's a longer `bibliography.rec` file, which can also produce `article.bib`:
```recfile
%rec: book
%key: slug
%type: year int
%constraint: year > -2000
%sort: year month
slug: thinkingexperience
author: H. H. Price
title: Thinking and Experience
year: 1953
publisher: Harvard University Press, Cambridge
slug: inventingrightwrong
author: John Leslie Mackie
title: Inventing Right and Wrong
year: 1997
publisher: Penguin Books, England
slug: metaphysicscontemporaryintro
author: Michael J. Loux
title: Metaphysics: A Contemporary Introduction
year: 1998
publisher: Routledge, London
slug: pluralityworlds
author: David Lewis
title: On the Plurality of Worlds
publisher: Blackwell Publishing, Oxford
year: 2001
%rec: article
%key: slug
%sort: year month
slug: genuinerealisttheory
author: John Divers
title: A Genuine Realist Theory of Advanced Modalizing
year: 1999
pages: 217240
month: april
journaltitle: Mind
uri: https://academic.oup.com/mind/article-abstract/108/430/217/975258?redirectedFrom=fulltext
volume: 108
publisher: Harvard University Press, Cambridge
slug: twokindsmentalrealism
author: Tam\'{a}s Demeter
title: Two Kinds of Mental Realism
year: 2009
pages: 40:59-71
uri: https://www.researchgate.net/profile/Tamas_Demeter2/publication/41554923_Two_Kinds_of_Mental_Realism/links/0deec53247f5a4ae21000000.pdf
month: august
journaltitle: Journal for General Philosophy of Science
volume: 30
publisher: Harvard University Press, Cambridge
```

118
data/recfiles/extended.md Normal file
View File

@ -0,0 +1,118 @@
---
title: "Recfiles Extended Example"
tags: [ "data", "database", "recfiles" ]
---
## Create
Make a database for your boardgames, specifying only one field and value:
```bash
database=games.rec
n=Name
g=Vojvodina
touch $database
recins -f $n --value $g $database
recsel $database
```
Insert a few more, with the estimated playtime:
```bash
recins -f Name -v Saboter -f Playtime -v 30 $database
recins -f Name -v Chess -f Playtime -v 30 $database
```
View all games, or select one by number:
```bash
recsel $database
recsel -n 0 $database
```
Each game should note whether or not you have played it yet, so you can add that field and set the default to `yes`.
```bash
f=played
v=yes
recset -f $f -a $v $database
```
...but the field is wrong, it should have a capital letter:
```bash
new_field=Played
recset -f $f --rename $new_field
```
## Read
Check how many records the database has:
```bash
recinf $database
```
Look at just the games you've never played:
```bash
recsel --expression="Played = 'no'" $database
```
Print how many, then just print the names:
```bash
recsel -e "Played = 'no'" --count $database
recsel -e "Played = 'no'" --print=Name $database
```
## Update
To change a game's `Played` field from `no` to `yes`, use `recset` to specify the number, and change that field.
```bash
num=0
f=Played
value=yes
recsel --number=$num $database
recset --number=$num -f $f --set=$value $database
```
Find all games with a playtime of `30`, and set the field `Max_Players` to `4`.
```bash
recset -e "Playtime = 40" -f Max_Players --set 50 games.rec
```
This doesn't work, because that field does not exist.
You can `--set-add` the field, to add it wherever it does not exist.
```bash
recset -e "Playtime = 40" -f Max_Players --set-add 50 games.rec
```
## Delete
Remove `Played` record from first game:
```bash
num=0
recset --number=$num -f Played --delete $database
```
You can comment the line instead of deleting it:
```bash
num=1
recset --number=$num -f Played --delete $database
recsel $database
cat $database
```
Delete an entire record:
```bash
num=2
recdel --number=$num $database
```

33
data/recfiles/recfixes.md Normal file
View File

@ -0,0 +1,33 @@
---
title: "Recfixes"
tags: [ "data", "recfiles" ]
requires: "Recfiles"
---
Sometimes `recsel` chokes on a large query, and you need to break the query into chunks with a pipe.
This Kickstarter file has 374,853 records.
Here's the chonky query:
```sh
recsel kick.rec -e "Category = 'Games'" -p "Subcategory,Avg(Goal)" -G Subcategory
```
It breaks down like this:
| Chunk | Meaning |
|:-----------------------------:|:---------------------------------------------:|
| `recsel kick.rec` | Select records from `kick.rec` |
| `-e "Category = 'Games'"` | Select only records where Category = 'Games' |
| `-p "Subcategory,Avg(Goal)"` | Print the Subcategory and average goal |
| `-G "Subcategory"` | Group by subcategory |
Two ways to break the query apart:
```sh
recsel kick.rec -e "Category = 'Games'" | recsel -p "Subcategory,Avg(Goal)" -G "Subcategory"
recsel kick.rec -e "Category = 'Games'" > games.rec
recsel games.rec -p "Subcategory" -G "Subcategory"
```

View File

@ -1,6 +1,7 @@
---
title: "sc-im"
tags: [ "Documentation", "TUI", "data" ]
tags: [ "TUI", "data", "spreadsheet", ".csv" ]
requires: [ "vim basics" ]
---
- [Sample file](sc-im/sample.sc)

49
data/search_system.md Normal file
View File

@ -0,0 +1,49 @@
---
title: "Search System"
tags: [ "data", "search", "locate", "plocate" ]
requires: "cron"
---
You can search every file on the computer instantly by installing `plocate`.
Once installed, run `sudo updatedb` to create the database of (nearly) every file on the computer.
Check how big the database is:
```sh
du -h /var/lib/plocate/plocate.db
```
Once you have the database, you can find nearly any file instantly.
- Search for gifs: `locate .gif`
- Search for gifs in the `/usr/` directory: `locate /usr/ .gif`
- Search for jpg images with 'dog' or 'Dog' in the name: `locate -i dog jpg`
- Search for videos: `plocate --regex '.mp4$|.mkv$|.wmv$|.webm$|.mov$|.avi$'`
For best results, run `updatedb` regularly, perhaps in [crontab](../system/cron.md).
## Search More Places
`plocate` will not search `/tmp/`, because nobody cares about those files, and won't search inside `/mnt/`, because that's where USB sticks get mounted, so the files keep changing as USB sticks come and go.
Change where `plocate` searches by editing the configuration file at `/etc/updatedb.conf`.
By default, the `/mnt` directory is 'pruned' from the database.
So if you want to search `/mnt` for videos, remove the word `/mnt` from the configuration file.
```bash
su root
cat /etc/updatedb.conf
sed -i 's#/mnt/##' /etc/updatedb.conf
updatedb
exit
```
Now you can search in `/mnt` for films:
```sh
plocate --regex '.mp4$|.mkv$|.wmv$|.webm$|.mov$|.avi$'
```

View File

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

@ -0,0 +1,24 @@
---
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,6 +1,7 @@
---
title: "Soft Serve through https"
tags: [ "data", "git" ]
tags: [ "data", "git server", "lfs" ]
requires: [ "git", "nginx" ]
---
## `http` Setup
@ -33,7 +34,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).
@ -67,3 +68,4 @@ Put this file at `/etc/nginx/sites-enabled/$DOMAIN.tld`, then set up standard ce
}
```

8
data/soft.md Normal file
View File

@ -0,0 +1,8 @@
---
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,6 +1,6 @@
---
title: "sqlite"
tags: [ "Documentation", "data" ]
tags: [ "data" ]
---
Work with a database:

View File

@ -1,6 +1,6 @@
---
title: "task"
tags: [ "Documentation", "Organization" ]
tags: [ "organization" ]
---
Set up the configuration file:

View File

@ -1,6 +1,6 @@
---
title: "timew"
tags: [ "Documentation", "Data" ]
title: "timewarrior"
tags: [ "data", "tracking", "time", "timew" ]
---
# Summaries

View File

@ -1,6 +1,6 @@
---
title: "w3m"
tags: [ "Documentation", "browsers" ]
tags: [ "browsers" ]
---
Open a search tab:

View File

@ -8,7 +8,7 @@ tags: [ "networking", "ssh", "android" ]
3. Open fdroid, and run:
```bash
```sh
pkg upgrade
pkg install busybox termux-services openssh openssh-sftp-server
source $PREFIX/etc/profile.d/start-services.sh

View File

@ -0,0 +1,53 @@
---
title: "Maintenance"
tags: [ "arch" ]
---
# Package Cache
Clean the cache of old packages in `/var/cachepacman/pkg/`:
```bash
ls /var/cache/pacman/pkg/ | wc -l
sudo pacman -Sc
ls /var/cache/pacman/pkg/ | wc -l
```
And the same for `yay` (with `-Yc` to remove old dependencies):
```bash
ls ~/.cache/yay/ | wc -l
yay -Sc
yay -Yc
ls ~/.cache/yay/ | wc -l
```
# New Configs
If you chance a configuration file, such as `/etc/environment`, and `pacman` wants to update the file, it will place `/etc/environment.pacnew`.
Check the new files, then look at the difference between the `pacman` version, and your version.
```bash
sudo find /etc/ /var/ /usr/ -name "*.pacnew"
diff /etc/pacman.d/mirrorlist*
```
Either,
- Update the files manually,
```bash
sudo -e /etc/pacman.d/mirrorlist
sudo rm /etc/pacman.d/mirrorlist.pacnew
```
Or,
- use a tool like `pacdiff` to view the changes next to each other, and select them with `vim`.
```bash
sudo pacman -S pacman-contrib
sudo pacdiff
```

View File

@ -1,6 +1,6 @@
---
title: "Arch on a Raspberry Pi 4"
tags: [ "Documentation", "distros", "raspberry pi", "rpi" ]
tags: [ "distros", "raspberry pi", "rpi" ]
---
The [Official Instructions](https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4) for a Raspberry pi 4 do not allow for working sound from the headphone jack, unless you use the aarch64 Installation.

View File

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

View File

@ -1,6 +1,7 @@
---
title: "basic-install"
tags: [ "Documentation", "arch" ]
tags: [ "arch" ]
requires: [ "partitions", "time" ]
---
Keyboard layout changed.

View File

@ -1,24 +1,25 @@
---
title: "fonts"
tags: [ "Documentation", "distros" ]
tags: [ "distros" ]
---
# Basics
Update font-cache:
```bash
```sh
su root
fc-cache
```
List fonts:
```bash
```sh
fc-list
```
Grab the part of the font name you need for Xresources:
```bash
```sh
fc-list | cut -d: -f2
```

View File

@ -1,6 +1,6 @@
---
title: "fonts"
tags: [ "Documentation", "distros" ]
title: "Ach Linux GPU Setup"
tags: [ "arch", "GPU" ]
---
# Step 1: Multilib
@ -60,4 +60,3 @@ You should see 'true' here.
```bash
sudo pacman -S --needed lib32-mesa vulkan-radeon lib32-vulkan-radeon vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-amdgpu
```

View File

@ -1,6 +1,6 @@
---
title: "pacman"
tags: [ "Documentation", "distros" ]
tags: [ "distros" ]
---
Packages are kept in /var/cache/pacman/pkg.

View File

@ -1,6 +1,6 @@
---
title: "apt"
tags: [ "Documentation", "distros" ]
tags: [ "distros" ]
---
## apt
@ -8,27 +8,27 @@ tags: [ "Documentation", "distros" ]
Messed up a package's configuration files?
```bash
```sh
sudo apt-get purge [thing]
```
```bash
```sh
sudo apt autoremove
```
Check if you still have related things:
```bash
```sh
apt search [thing]
```
```bash
```sh
sudo apt-get install [ thing ]
```
Still have problems?
```bash
```sh
sudo dpgk --force-confmiss -i /var/cache/apt/archives/[thing]
```

View File

@ -1,18 +1,24 @@
---
title: "Aeroplane Mode in Void"
tags: [ "Documentation", "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.
> sudo sv stop wpa_supplicant bluetoothd
```sh
su root
sv stop wpa_supplicant bluetoothd
```
Find your device's name with `ip a`.
Find your device's name with `ip -color addr`.
If unsure, try this:
> name=$(ip a | grep -Eo 'wlp\w{3}')
> echo $name
```sh
name=$(ip a | grep -Eo 'wlp\w{3}')
echo $name
```
Then set that device down:
> sudo ip link set $name down
```sh
ip link set $name down
```

View File

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

View File

@ -1,22 +1,22 @@
---
title: "extrace"
tags: [ "Documentation", "Void" ]
tags: [ "void" ]
---
Monitor all processes:
```bash
```sh
extrace
```
Monitor one process:
```bash
```sh
extrace ls
```
Monitor a script:
```bash
```sh
./script.sh | extrace
```

View File

@ -9,16 +9,17 @@ Jenkins is janky.
## Start
Start the service file.
```bash
sudo ln -s /etc/sv/jenkins /var/service
sudo sv start jenkins
```sh
su root
ln -s /etc/sv/jenkins /var/service
sv start jenkins
```
Then visit the web interface with `$BROWSER localhost:8080`.
If it's not working, try running the command from the run file the first time:
```bash
```sh
chpst -u jenkins java -jar /opt/jenkins/jenkins.war
```

View File

@ -6,13 +6,13 @@ tags: [ "void", "locale" ]
Check the current locales:
```bash
```sh
locale -a
```
Add the languages you want by editing `/etc/default/libc-locales`, and uncommenting your choice:
```bash
```sh
#en_DK.UTF-8 UTF-8
#en_DK ISO-8859-1
en_GB.UTF-8 UTF-8
@ -25,13 +25,14 @@ Now you can generate what you need for those languages.
However, instead of generating what you need, you're going to generate everything which needs updating:
```bash
sudo xbps-reconfigure glibc-locales
```sh
su root
xbps-reconfigure glibc-locales
```
Finally, select your chosen locale by placing it in `/etc/locale.conf`.
```bash
```sh
echo "LC_ALL=en_GB.UTF-8
LANG=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8" > /etc/locale.conf
@ -48,7 +49,7 @@ en_GB ISO-8859-1
Check your new locales are available:
```bash
```sh
locale -a
```

View File

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

View File

@ -1,6 +1,6 @@
---
title: "Void Linux Basics"
tags: [ "Documentation", "Void" ]
tags: [ "void" ]
---
# Updates

View File

@ -1,6 +1,6 @@
---
title: "xbps"
tags: [ "Documentation", "Void" ]
tags: [ "void" ]
---
## Search

View File

@ -1,6 +1,6 @@
---
title: "brightness"
tags: [ "Documentation", "hardware" ]
tags: [ "hardware", "laptop" ]
---
# Brightness

66
hardware/keyboard.md Normal file
View File

@ -0,0 +1,66 @@
---
title: "keyboard"
tags: [ "keyboard", "vim" ]
---
# System-Wide Capslock and Escape Swap
This works everywhere, including in a bare-ass tty.
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
gunzip -c $basemap | \
sed 's/Caps_Lock/\n/g;s/Escape/Caps_Lock/g;s/\n/Escape/g' | \
gzip > $newmap
```
Tell the system to use this keymap at startup by naming it in the `rc.conf` file:
```sh
echo "KEYMAP=$newmap" >> /etc/rc.conf
cat /etc/rc.conf
reboot
```
# Set Layout with X Display
Set layout to British English.
```sh
setxkbmap -layout gb
```
Or Polish with:
```sh
setxkbmap -layout pl
```
| Language | short |
|:---------|:------|
| Polish | `pl` |
| Serbian | `rs` |
Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout.
```sh
setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle
```
## Alt_GR
Remap, e.g., the right Windows key, to Alt_Gr.
```
key <RWIN> {[ ISO_Level3_Shift ]};
```

View File

@ -1,68 +0,0 @@
---
title: "keyboard"
tags: [ "Documentation", "keyboard" ]
---
# Set Layout with X Display
Set layout to British English.
```bash
setxkbmap -layout gb
```
Or Polish with:
```bash
setxkbmap -layout pl
```
| Language | short |
|:--------|:------|
| Polish | pl |
| Serbian | rs |
Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout.
```bash
setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle
```
## Alt_GR
Remap, e.g., the right Windows key, to Alt_Gr.
```
key <RWIN> {[ ISO_Level3_Shift ]};
```
# Set TTY Keymap
Copy your keymap, e.g. if it's polish-1, then:
```bash
cp /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz /usr/share/kbd/keymaps/*custom*.map.gz
```
Then change that map:
```bash
sudo vim /usr/share/kbd/keymaps/custom.map.gz
```
---
You can switch Escape and Caps Lock with a single line:
```bash
sudo sh -c "gunzip -c /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz | sed 's/ Escape/ PLACEHOLDER/ ; s/Caps_Lock/Escape/g ; s/PLACEHOLDER/Caps_Lock/' | gzip > /usr/share/kbd/keymaps/custom.map.gz"
```
---
Change the default keyboard mapping to the custom map:
```bash
echo 'KEYMAP="/usr/share/kbd/keymaps/*custom*.map.gz"' | sudo tee /etc/vconsole.conf
```
Reboot to have changes take effect.

View File

@ -1,37 +0,0 @@
☢ ☣ s ☠ ⚠
radioactive sign biohazard sign skull and crossbones warning sign
☤ ⚕ ⚚ †
caduceus staff of aesculapius staff of hermes dagger
☯ ⚖ ☮ ⚘
yin yang scales peace flower
⚔ ☭ ⚒ ⚓
crossed swords hammer and sickle hammer and pick anchor
⚛ ⚜ ⚡ ⚶
atom symbol fleur-de-lis lightning vesta
☥ ✠ ✙ ✞
ankh cross cross cross
✟ ✧ ⋆ ★
cross diamond star star
☆ ✪ ✫ ✬
star star star star
✭ ✮ ✯ ✰
star star star star
☸ ✵ ❂ ☘
wheel of dharma star sun shamrock
♡ ♥ ❤ ⚘
heart heart big heart flower
❀ ❃ ❁ ✼
flower flower flower flower
☀ ✌ ♫ ♪
sun V sign music note / melody music note / melody
☃ ❄ ❅ ❆
snowman snowflake snowflake snowflake
☕ ☂ ❦ ✈
cofee umbrella floral heart / leaf airplane
♕ ♛ ♖ ♜
white king / crown black king / crown white rook / tower black rook / tower
☁ ☾
cloud waning crescent moon

View File

@ -1,12 +1,16 @@
---
title: "monitor"
tags: [ "Documentation", "hardware" ]
tags: [ "hardware" ]
---
See screen size
> xrandr -q
```sh
xrandr -q
```
Automatically configure:
> xrandr --auto
```sh
xrandr --auto
```

View File

@ -1,6 +1,6 @@
---
title: "printers"
tags: [ "Documentation", "hardware" ]
tags: [ "hardware" ]
---
# Cups: The Common Unix Printing System

20
networking/bad_horse.md Normal file
View File

@ -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
```

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
---
title: "Agate on Arch Linux"
tags: [ "Documentation", "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:
```bash
```sh
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:
```bash
```sh
sudo systemctl status ssh
```
If that doesn't work, the service may be called `sshd`.
```bash
```sh
sudo systemctl status sshd
```
Then start that service:
```bash
```sh
sudo systemctl start sshd
```
Test it works by using ssh into your own system, from inside:
```bash
```sh
ssh $USER@localhost
```
Access the computer from another computer on the same local network by finding your computer's IP address.
```bash
```sh
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 ascend.
The second is an ipv6 address, which is too angelic for this world, and has yet to descend.
The third will work from a remote computer.
```bash
```sh
ssh $USERNAME@IP_ADDRESS
```
Once you have that, generate some ssh keys:
```bash
```sh
ssh-keygen
```
Look at your keys:
```bash
```sh
ls ~/.ssh
```
@ -82,7 +82,7 @@ The other is secret.
Now send those keys to a remote computer:
```bash
```sh
ssh-copy-id $USERNAME@IP_ADDRESS
```

View File

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

View File

@ -1,6 +1,7 @@
---
title: "ssh tricks"
tags: [ "Documentation", "Networking", "ssh", "tricks" ]
title: "ssh-tricks"
tags: [ "networking", "ssh", "tricks" ]
requires: [ "ssh" ]
---
Mount a remote filesystem locally with fuse-sshfs:

View File

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

View File

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

View File

@ -1,11 +1,11 @@
---
title: "troubleshooting"
tags: [ "Documentation", "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: [ "Documentation", "Networking" ]
tags: [ "networking", "web" ]
---
Install nginx:

View File

@ -1,7 +1,8 @@
---
title: "wifi"
tags: [ "Documentation", "Networking" ]
title: "network"
tags: [ "networking" ]
---
# Netstat Stuff
Stats on local net usage within domain.

View File

@ -1,6 +1,6 @@
---
title: "wireguard"
tags: [ "Documentation", "Networking", "VPN" ]
tags: [ "networking", "VPN" ]
---
<!--
from
@ -11,25 +11,22 @@ https://engineerworkshop.com/blog/how-to-set-up-wireguard-on-a-raspberry-pi/
Install `wireguard-tools` on the server.
```bash
sudo -i
```
```bash
```sh
su root
cd /etc/wireguard
```
umask 077
```bash
```sh
wg genkey | tee server_private_key | wg pubkey > server_public_key
```
```bash
```sh
wg genkey | tee client_private_key | wg pubkey > client_public_key
```
```bash
```sh
echo "
[Interface]
Address = 10.0.0.1/24
@ -46,20 +43,20 @@ wg genkey | tee client_private_key | wg pubkey > client_public_key
" > /etc/wireguard/wg0.conf
```
```bash
```sh
echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/wg.conf
```
```bash
```sh
systemctl enable --now wg-quiqck@wg0
```
```bash
```sh
chown -R root:root /etc/wireguard/
```
```bash
chmod -R og-rwx /etc/wireguard/\*
```sh
chmod -R og-rwx /etc/wireguard/*
```
Forward traffic from port 51900 to the server.
@ -72,21 +69,25 @@ Install `wireguard-tools` on the client.
Copy the client private key and server public key to the server (or just fill in the variables).
> server_ip=*your server's public ip*
echo "
[Interface]
Address = 10.0.0.2/32
PrivateKey = $(cat client_private_key)
DNS = 9.9.9.9
[Peer]
PublicKey = $(cat server_public_key)
Endpoint = $(echo $server_ip:51900)
AllowedIPs = 0.0.0.0/0, ::/0
" > /etc/wireguard/wg0-client.conf
```sh
server_ip=$PUBLIC_IP
> wg-quick up wg0-client
echo "
[Interface]
Address = 10.0.0.2/32
PrivateKey = $(cat client_private_key)
DNS = 9.9.9.9
[Peer]
PublicKey = $(cat server_public_key)
Endpoint = $(echo $server_ip:51900)
AllowedIPs = 0.0.0.0/0, ::/0
" > /etc/wireguard/wg0-client.conf
wg-quick up wg0-client
```
## Extras
@ -98,6 +99,6 @@ Add multiple peers by copying the `[peer]` section (they each get called `peer`)
Make a standard client configuration, then:
```bash
```sh
qrencode -t ansiutf8 < /etc/wireguard/mobile_user.conf
```

View File

@ -1,60 +1,63 @@
---
title: "wireless"
tags: [ "Documentation", "Networking" ]
tags: [ "networking" ]
---
# Check wifi's working
```bash
Check wifi's working
```sh
lspci -k
```
Or for usb wifi:
```bash
```sh
dmesg | grep usbcore
```
... and hopefully it'll say the new interface is registered.
...and hopefully it'll say the new interface is registered.
# Check if a wifi interface has been created
Check if a wifi interface has been created
```bash
```sh
ip link
```
or
...or
```bash
```sh
iw dev
```
Assuming it's wlan0, bring it up with
```bash
```sh
ip link set wlan0 up
```
Error messages probably means your wireless chipset requires a firmware to function. In this case, check the kernel messages for firmware being loaded
```bash
```sh
dmesg | grep firmware
```
# Utilities
iw doesn't do wpa/wpa2. wpa_supplicant does everything. iwd does everything except WEXT encryption.
- `iw` doesn't do wpa/wpa2.
- `iwd` does everything except WEXT encryption.
- `wpa_supplicant` does everything.
# Connecting
Get the link status:
```bash
```sh
iw dev wlan0 link
```
Scan for available points:
```bash
```sh
iw dev wlan0 scan
```

View File

@ -1,57 +1,57 @@
---
title: "wpa_supplicant"
tags: [ "Documentation", "Networking" ]
tags: [ "networking" ]
---
wpa_supplicant configurations are stored in /etc/wpa_supplicant/wpa_supplicant-wlan0 (or equivalent).
`wpa_supplicant` configurations are stored in `/etc/wpa_supplicant/wpa_supplicant-wlan0` (or equivalent).
## WiFi Connection
```bash
```sh
wpa_cli
```
Once in, scan the network, add an empty place to store credentials, then input them.
```bash
```sh
scan
```
```bash
```sh
scan_results
```
```bash
```sh
add_network
```
This outputs a network number, e.g. '3'. This is the new network you'll work with.
```bash
```sh
set_network *3* ssid *"Kosachok Cafe"*
```
```bash
```sh
set_network 3 psk *"Kosachok2019"*
```
OR (for no password)
```bash
```sh
set_network *3* key_mgmt NONE
```
```bash
```sh
enable_network 3
```
```bash
```sh
save_config
```
This takes a while to connect, so to speed things up, restart the service:
```bash
```sh
sudo sv restart wpa_supplicant
```
@ -59,13 +59,13 @@ sudo sv restart wpa_supplicant
You can script like this:
```bash
```sh
wpa_cli add_network
```
That returns an ID, so you can say:
```bash
```sh
newNetwork="$(wpa_cli add_network)"
```
@ -73,19 +73,19 @@ Then `$newNetwork` would equal that number, and you can add/ remove networks wit
But remember to escape the quotes, so adding a network would be:
```bash
```sh
wpa_cli set_network *3* psk *\""passphrase"\"*
```
## Generating Keys Manually
```bash
```sh
wpa_passphrase [ssid] [password]
```
For example:
```bash
```sh
wpa_passphrase 'Cafe Kosachok' 'Kosachok2019'
```
@ -95,8 +95,11 @@ If you encounter problems, you will probably need to delete the old device pid i
Next up, start wpa_supplicant:
```bash
```sh
wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0
```
The -B flag runs this as a background process. Remove this to see real-time output in order to solve problems. The -i flag denotes the physical device used for the wifi. The -c flag points to the configuration file for use.
The `-B` flag runs this as a background process.
Remove this to see real-time output in order to solve problems.
The `-i` flag denotes the physical device used for the wifi.
The `-c` flag points to the configuration file for use.

27
new.sh
View File

@ -1,27 +0,0 @@
#!/bin/sh
echo Select a category
category="$(find . -type d -printf '%P\n' | fzy)"
[ ! -d "$category" ] && mkdir "$category"
echo Select a name
read name
filePath="$category/$(echo $name | sed 's/ /_/g').md"
tagsList="$(echo \"$category | sed 's#\/#", "#g')\""
[ -e "$filePath" ] && $EDITOR "$filePath" && exit 0
echo "---
title: \"$name\"
tags: [ $tagsList ]
---
" > "$filePath"
$EDITOR "$filePath"

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