Compare commits
	
		
			20 Commits
		
	
	
		
			e534d24e52
			...
			ef7b424586
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						ef7b424586
	
				 | 
					
					
						|||
| 
						
						
							
						
						9621cfc26a
	
				 | 
					
					
						|||
| 
						
						
							
						
						d92631c795
	
				 | 
					
					
						|||
| 
						
						
							
						
						b81fd55a87
	
				 | 
					
					
						|||
| 
						
						
							
						
						e4be8a8523
	
				 | 
					
					
						|||
| 
						
						
							
						
						eeade3cdfb
	
				 | 
					
					
						|||
| 
						
						
							
						
						481b34a472
	
				 | 
					
					
						|||
| 
						
						
							
						
						fd850761f3
	
				 | 
					
					
						|||
| 
						
						
							
						
						b7729e5712
	
				 | 
					
					
						|||
| 
						
						
							
						
						bbd34e24ec
	
				 | 
					
					
						|||
| 
						
						
							
						
						808ef3bb71
	
				 | 
					
					
						|||
| 
						
						
							
						
						53e86fb86e
	
				 | 
					
					
						|||
| 
						
						
							
						
						6b4a846284
	
				 | 
					
					
						|||
| 
						
						
							
						
						2250275be5
	
				 | 
					
					
						|||
| 
						
						
							
						
						7427b05b0b
	
				 | 
					
					
						|||
| 
						
						
							
						
						5e703a65c0
	
				 | 
					
					
						|||
| 
						
						
							
						
						8b7912a68f
	
				 | 
					
					
						|||
| 
						
						
							
						
						5460f23f12
	
				 | 
					
					
						|||
| 
						
						
							
						
						7afe6e33cd
	
				 | 
					
					
						|||
| 
						
						
							
						
						1d8ccbc5e8
	
				 | 
					
					
						
							
								
								
									
										54
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
FZF != command -v sk || command -v fzy || command -v fzf || \
 | 
			
		||||
	{ echo install a fuzzy finder && exit 1 ;}
 | 
			
		||||
 | 
			
		||||
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"
 | 
			
		||||
 | 
			
		||||
db.rec: $(articles)
 | 
			
		||||
	printf '%s\n' '%rec: guide' > $@
 | 
			
		||||
	printf '%s\n' '%type: wordcount int' >> $@
 | 
			
		||||
	printf '%s\n\n' '%sort: title' >> $@
 | 
			
		||||
	for x in $^ ; do \
 | 
			
		||||
		sed -n '2,/^---$$/ {/^---$$/d; p}' "$$x" |\
 | 
			
		||||
		sed -e 's/\[ //'  -e 's/ \]//' |\
 | 
			
		||||
		tr -d '"' ;\
 | 
			
		||||
		printf "file: %s\n\n" "$$x" ;\
 | 
			
		||||
	done >> $@
 | 
			
		||||
	for entry in $^; do \
 | 
			
		||||
		recset $@ -e "file = '$${entry}'" -f wordcount --set-add="$$(wc -w < $${entry})" ;\
 | 
			
		||||
	done
 | 
			
		||||
	recsel $@ -e "requires != ''" -CR title,requires |\
 | 
			
		||||
	while read title requires; do \
 | 
			
		||||
		IFS=', ' && for provider in $$requires; do \
 | 
			
		||||
			recset $@ -e "title = '$${provider}'" -f provides -a "$${title}" ;\
 | 
			
		||||
		done ;\
 | 
			
		||||
	done
 | 
			
		||||
	recfix --sort $@
 | 
			
		||||
 | 
			
		||||
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 . -type d -printf '%P\n' | $(FZF)); \
 | 
			
		||||
	read -p "Title: " title; \
 | 
			
		||||
	printf '%s\n' '---' >> $$path/$$title.md ; \
 | 
			
		||||
	printf 'title: "%s"\n' "$$title" >> $$path/$$title.md ; \
 | 
			
		||||
	printf 'tags: [ "%s" ]\n' "$$path" | sed 's#\/#", "#g' >> $$path/$$title.md ; \
 | 
			
		||||
	printf '%s\n\n' '---' >> $$path/$$title.md ;\
 | 
			
		||||
	$(EDITOR) +5 $$path/$$title.md
 | 
			
		||||
 | 
			
		||||
.PHONY: clean
 | 
			
		||||
clean: ## Remove all generated files
 | 
			
		||||
	$(RM) $(default)
 | 
			
		||||
							
								
								
									
										94
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										94
									
								
								README.md
									
									
									
									
									
								
							@@ -1,77 +1,67 @@
 | 
			
		||||
---
 | 
			
		||||
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.
 | 
			
		||||
# Setup
 | 
			
		||||
 | 
			
		||||
Install `make`, `recutils`, and any fuzzy-finder (i.e. `sk`, `fzy`, or `fzf`).
 | 
			
		||||
 | 
			
		||||
Usage: `make`
 | 
			
		||||
 | 
			
		||||
# 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`.
 | 
			
		||||
## Be Opinionated
 | 
			
		||||
 | 
			
		||||
Any interest in these tools only comes after we can use them.
 | 
			
		||||
- 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.
 | 
			
		||||
 | 
			
		||||
## Chronological
 | 
			
		||||
## Repetition Beats Reference
 | 
			
		||||
 | 
			
		||||
Entries should read like scripts - everything in the right order, with small notes on what this does.
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
## Show Arguments as Variables
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
Look at this line:
 | 
			
		||||
 | 
			
		||||
### Closing
 | 
			
		||||
 | 
			
		||||
Introductory documents should show anything required to cleanly uninstall a program, without leaving bulky configuration files behind.
 | 
			
		||||
 | 
			
		||||
## Three Input Types
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
# What's Wrong with Everything Else?
 | 
			
		||||
 | 
			
		||||
## Man pages
 | 
			
		||||
 | 
			
		||||
@@ -79,12 +69,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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "at"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
Install with:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Basics"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
You need about a dozen commands to move around Linux.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "clock"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Show system time:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								basics/column.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								basics/column.md
									
									
									
									
									
										Normal 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
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "conditionals"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
# If statements
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "cron"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
# Cronie
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "bash games"
 | 
			
		||||
tags: [ "Documentation", "Games" ]
 | 
			
		||||
tags: [ "Games" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Games are a great way to learn bash.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "kernel"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
## Living Space
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "locale"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Your locale tells the computer your location, preferred time-and-date format, standard language, papersize, et c.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "locating"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
# Type
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "processes"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
# Proccesses
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "time"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
# systemd
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "users"
 | 
			
		||||
tags: [ "Documentation", "Basics" ]
 | 
			
		||||
tags: [ "Basics" ]
 | 
			
		||||
---
 | 
			
		||||
# Basic Information
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "profanity"
 | 
			
		||||
tags: [ "Documentation", "Chat", "OTR" ]
 | 
			
		||||
tags: [ "Chat", "OTR" ]
 | 
			
		||||
---
 | 
			
		||||
# otr
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "profanity"
 | 
			
		||||
tags: [ "Documentation", "Chat", "omemo" ]
 | 
			
		||||
tags: [ "Chat", "omemo" ]
 | 
			
		||||
---
 | 
			
		||||
# Setup (Commands)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "wgetpaste"
 | 
			
		||||
tags: [ "Documentation", "Chat" ]
 | 
			
		||||
tags: [ "Chat" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
See available pastebins:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Archives"
 | 
			
		||||
tags: [ "Documentation", "tar", "backups" ]
 | 
			
		||||
tags: [ "tar", "backups" ]
 | 
			
		||||
---
 | 
			
		||||
# `tar`
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "unison"
 | 
			
		||||
tags: [ "Documentation", "Backups" ]
 | 
			
		||||
tags: [ "Backups" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
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).
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Base 16"
 | 
			
		||||
tags: [ "Documentation", "Data" ]
 | 
			
		||||
tags: [ "Data" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "exiftool"
 | 
			
		||||
tags: [ "Documentation", "Metadata" ]
 | 
			
		||||
tags: [ "Metadata" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Find metadata.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "git"
 | 
			
		||||
tags: [ "Documentation", "data" ]
 | 
			
		||||
tags: [ "data" ]
 | 
			
		||||
---
 | 
			
		||||
# Starting
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "git-lfs"
 | 
			
		||||
tags: [ "Documentation", "data" ]
 | 
			
		||||
tags: [ "data" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Install, and add with
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "git hooks"
 | 
			
		||||
tags: [ "Documentation", "data", "git" ]
 | 
			
		||||
tags: [ "data", "git" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Check out the sample hooks:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "git"
 | 
			
		||||
tags: [ "Documentation", "data", "git", "subtree" ]
 | 
			
		||||
tags: [ "data", "git", "subtree" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
## Pulling a Subtree from an existing git
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "gpg"
 | 
			
		||||
tags: [ "Documentation", "data", "GPG" ]
 | 
			
		||||
tags: [ "data", "GPG" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
- [Setup](gpg/basics.md)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "GPG Basics"
 | 
			
		||||
tags: [ "Documentation", "data", "GPG" ]
 | 
			
		||||
tags: [ "data", "GPG" ]
 | 
			
		||||
---
 | 
			
		||||
# Making keys
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "gpg"
 | 
			
		||||
tags: [ "Documentation", "vim", "data", "GPG" ]
 | 
			
		||||
tags: [ "vim", "data", "GPG" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
The `vim-gnupg` plugin lets vim edit gpg-encrypted files as if they were unencrypted.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "groff"
 | 
			
		||||
tags: [ "Documentation", "Data" ]
 | 
			
		||||
tags: [ "Data" ]
 | 
			
		||||
---
 | 
			
		||||
# Basic Documents
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "khard"
 | 
			
		||||
tags: [ "Documentation", "Data" ]
 | 
			
		||||
tags: [ "Data" ]
 | 
			
		||||
---
 | 
			
		||||
Get the basic config:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "newsboat"
 | 
			
		||||
tags: [ "Documentation", "RSS" ]
 | 
			
		||||
tags: [ "RSS" ]
 | 
			
		||||
---
 | 
			
		||||
Create the configuration directory before you start, and add at least 1 URL.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "pass"
 | 
			
		||||
tags: [ "Documentation", "data" ]
 | 
			
		||||
tags: [ "data" ]
 | 
			
		||||
---
 | 
			
		||||
[Video instructions](https://www.hooktube.com/watch?v=hlRQTj1D9LA)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "PDF Metadata Erasure"
 | 
			
		||||
tags: [ "Documentation", "Metadata", "Ghost Script" ]
 | 
			
		||||
tags: [ "Metadata", "Ghost Script" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Make a text file called 'pdfmark.txt'.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										51
									
								
								data/recfiles.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								data/recfiles.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,51 @@
 | 
			
		||||
---
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
# Resources
 | 
			
		||||
 | 
			
		||||
- [Recfiles for gemini capsules](gemini://tilde.town/~dozens/gemlog/21.gmi)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										61
									
								
								data/recfiles/Board_Games.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								data/recfiles/Board_Games.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Board Games"
 | 
			
		||||
tags: [ "data", "recfiles", "games" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										118
									
								
								data/recfiles/extended.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								data/recfiles/extended.md
									
									
									
									
									
										Normal 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
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "sc-im"
 | 
			
		||||
tags: [ "Documentation", "TUI", "data" ]
 | 
			
		||||
tags: [ "TUI", "data" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
- [Sample file](sc-im/sample.sc)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Soft Serve through https"
 | 
			
		||||
tags: [ "data", "git" ]
 | 
			
		||||
tags: [ "data", "git", "lfs" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
## `http` Setup
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "sqlite"
 | 
			
		||||
tags: [ "Documentation", "data" ]
 | 
			
		||||
tags: [ "data" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Work with a database:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "task"
 | 
			
		||||
tags: [ "Documentation", "Organization" ]
 | 
			
		||||
tags: [ "Organization" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Set up the configuration file:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "timew"
 | 
			
		||||
tags: [ "Documentation", "Data" ]
 | 
			
		||||
tags: [ "Data" ]
 | 
			
		||||
---
 | 
			
		||||
# Summaries
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "w3m"
 | 
			
		||||
tags: [ "Documentation", "browsers" ]
 | 
			
		||||
tags: [ "browsers" ]
 | 
			
		||||
---
 | 
			
		||||
Open a search tab:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										53
									
								
								distros/arch/Maintenance.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								distros/arch/Maintenance.md
									
									
									
									
									
										Normal 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
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "autologin"
 | 
			
		||||
tags: [ "Documentation", "Distros", "Arch" ]
 | 
			
		||||
tags: [ "Distros", "Arch" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Automatic Login
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
---
 | 
			
		||||
title: "basic-install"
 | 
			
		||||
tags: [ "Documentation", "arch" ]
 | 
			
		||||
tags: [ "arch" ]
 | 
			
		||||
requires: [ "partitions", "time" ]
 | 
			
		||||
---
 | 
			
		||||
Keyboard layout changed.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "fonts"
 | 
			
		||||
tags: [ "Documentation", "distros" ]
 | 
			
		||||
tags: [ "distros" ]
 | 
			
		||||
---
 | 
			
		||||
# Basics
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "fonts"
 | 
			
		||||
tags: [ "Documentation", "distros" ]
 | 
			
		||||
tags: [ "distros" ]
 | 
			
		||||
---
 | 
			
		||||
# Step 1: Multilib
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "pacman"
 | 
			
		||||
tags: [ "Documentation", "distros" ]
 | 
			
		||||
tags: [ "distros" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Packages are kept in /var/cache/pacman/pkg.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "apt"
 | 
			
		||||
tags: [ "Documentation", "distros" ]
 | 
			
		||||
tags: [ "distros" ]
 | 
			
		||||
---
 | 
			
		||||
## apt
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Void Autologin"
 | 
			
		||||
tags: [ "Documentation", "Void" ]
 | 
			
		||||
tags: [ "Void" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Make the autologin service:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "extrace"
 | 
			
		||||
tags: [ "Documentation", "Void" ]
 | 
			
		||||
tags: [ "Void" ]
 | 
			
		||||
---
 | 
			
		||||
Monitor all processes:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "sv"
 | 
			
		||||
tags: [ "Documentation", "Void" ]
 | 
			
		||||
tags: [ "Void" ]
 | 
			
		||||
---
 | 
			
		||||
# List Services
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Void Linux Basics"
 | 
			
		||||
tags: [ "Documentation", "Void" ]
 | 
			
		||||
tags: [ "Void" ]
 | 
			
		||||
---
 | 
			
		||||
# Updates
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "xbps"
 | 
			
		||||
tags: [ "Documentation", "Void" ]
 | 
			
		||||
tags: [ "Void" ]
 | 
			
		||||
---
 | 
			
		||||
## Search
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "brightness"
 | 
			
		||||
tags: [ "Documentation", "hardware" ]
 | 
			
		||||
tags: [ "hardware" ]
 | 
			
		||||
---
 | 
			
		||||
# Brightness
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										65
									
								
								hardware/keyboard.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								hardware/keyboard.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
			
		||||
---
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
su root
 | 
			
		||||
 | 
			
		||||
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:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
echo "KEYMAP=$newmap" >> /etc/rc.conf
 | 
			
		||||
 | 
			
		||||
cat /etc/rc.conf
 | 
			
		||||
reboot
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# 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    ]};
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -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.
 | 
			
		||||
@@ -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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "monitor"
 | 
			
		||||
tags: [ "Documentation", "hardware" ]
 | 
			
		||||
tags: [ "hardware" ]
 | 
			
		||||
---
 | 
			
		||||
See screen size
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "printers"
 | 
			
		||||
tags: [ "Documentation", "hardware" ]
 | 
			
		||||
tags: [ "hardware" ]
 | 
			
		||||
---
 | 
			
		||||
# Cups: The Common Unix Printing System
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
---
 | 
			
		||||
title: "fail2ban"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
requires: [ "ssh" ]
 | 
			
		||||
---
 | 
			
		||||
# SSH Daemon Jail
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Easy Network Graph"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
Set up a file like this, called `troubleshooting.txt`.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "iptables"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
# Intro
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "nmap"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Example:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "pi-hole-server"
 | 
			
		||||
tags: [ "Documentation", "Distros" ]
 | 
			
		||||
tags: [ "Distros" ]
 | 
			
		||||
---
 | 
			
		||||
# Installation
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "rclone"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
The manpage's 'Synopsis' provides a fast reference.
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Download videos"
 | 
			
		||||
tags: [ "Documentation", "Scraping" ]
 | 
			
		||||
tags: [ "Scraping" ]
 | 
			
		||||
---
 | 
			
		||||
Install `yt-dlp`.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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).
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
---
 | 
			
		||||
title: "sshfs"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
requires: [ "ssh" ]
 | 
			
		||||
---
 | 
			
		||||
# Mount 
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "tor"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Get a hostname
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "transmission"
 | 
			
		||||
tags: [ "Documentation", "Networking", "Torrenting" ]
 | 
			
		||||
tags: [ "Networking", "Torrenting" ]
 | 
			
		||||
---
 | 
			
		||||
# Torrench
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "troubleshooting"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Do you have an IP?
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "nginx"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
Install nginx:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "wifi"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
# Netstat Stuff
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "wireguard"
 | 
			
		||||
tags: [ "Documentation", "Networking", "VPN" ]
 | 
			
		||||
tags: [ "Networking", "VPN" ]
 | 
			
		||||
---
 | 
			
		||||
<!--
 | 
			
		||||
from 
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "wireless"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Check wifi's working
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "wpa_supplicant"
 | 
			
		||||
tags: [ "Documentation", "Networking" ]
 | 
			
		||||
tags: [ "Networking" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
wpa_supplicant configurations are stored in /etc/wpa_supplicant/wpa_supplicant-wlan0 (or equivalent).
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								new.sh
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								new.sh
									
									
									
									
									
								
							@@ -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"
 | 
			
		||||
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Basic Sound"
 | 
			
		||||
tags: [ "Documentation", "Sound" ]
 | 
			
		||||
tags: [ "Sound" ]
 | 
			
		||||
---
 | 
			
		||||
# Pulse
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "festival"
 | 
			
		||||
tags: [ "Documentation", "Sound" ]
 | 
			
		||||
tags: [ "Sound" ]
 | 
			
		||||
---
 | 
			
		||||
# Basics
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "mpd"
 | 
			
		||||
tags: [ "Documentation", "Sound" ]
 | 
			
		||||
tags: [ "Sound" ]
 | 
			
		||||
---
 | 
			
		||||
# Setup
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "ncmpcpp"
 | 
			
		||||
tags: [ "Documentation", "Sound" ]
 | 
			
		||||
tags: [ "Sound" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Music Player Daemon
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										187
									
								
								system/Makefiles.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										187
									
								
								system/Makefiles.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,187 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Makefiles"
 | 
			
		||||
tags: [ "system", "makefiles" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
The `make` system wants to know:
 | 
			
		||||
 | 
			
		||||
1. What file you want to make,
 | 
			
		||||
1. Which other files it depends on, and
 | 
			
		||||
1. How to build the file.
 | 
			
		||||
 | 
			
		||||
Start with a basic test-area.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
mkdir make_test ; cd $_
 | 
			
		||||
printf "%s:\n" README.md > Makefile
 | 
			
		||||
printf "\t%s\n" 'echo "Basic makefile example." > $@' >> Makefile
 | 
			
		||||
make
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**NB:** Always tell `make` how to build files with a `\t` (tab) character.
 | 
			
		||||
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:
 | 
			
		||||
 | 
			
		||||
```make
 | 
			
		||||
README.md: Makefile
 | 
			
		||||
	echo "Basic makefile example." > $@
 | 
			
		||||
	echo "" >> $@
 | 
			
		||||
	echo '```' >> $@
 | 
			
		||||
	cat $< >> $@
 | 
			
		||||
	echo '```' >> $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Note the order:
 | 
			
		||||
 | 
			
		||||
1. The first thing is the file you want, then a colon (`:`).
 | 
			
		||||
1. After the colon, any file it depends on.
 | 
			
		||||
1. Finally, the shell commands to execute.
 | 
			
		||||
 | 
			
		||||
# Strange Sigils
 | 
			
		||||
 | 
			
		||||
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, and the result it:
 | 
			
		||||
 | 
			
		||||
```make
 | 
			
		||||
README.md: Makefile
 | 
			
		||||
	echo "Basic makefile example." > README.md
 | 
			
		||||
	echo "" >> README.md
 | 
			
		||||
	echo '```' >> README.md
 | 
			
		||||
	cat Makefile >> README.md
 | 
			
		||||
	echo '```' >> README.md
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
|  Sigil  | Meaning                                |
 | 
			
		||||
|:-------:|:--------------------------------------:|
 | 
			
		||||
| `$@`    | The file we want                       |
 | 
			
		||||
| `$<`    | First dependency file                  |
 | 
			
		||||
| `$^`    | All dependency files                   |
 | 
			
		||||
| `$(@F)` | Filename of the file we want           |
 | 
			
		||||
| `$(@D)` | Directory path of the file we want     |
 | 
			
		||||
| `$(<F)` | Filename of the first dependency       |
 | 
			
		||||
| `$(@D)` | Directory path of the first dependency |
 | 
			
		||||
 | 
			
		||||
## Basic Variables
 | 
			
		||||
 | 
			
		||||
You can assign a variable normally, but must refer to it in brackets.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
```make
 | 
			
		||||
storage_directory = backups
 | 
			
		||||
 | 
			
		||||
README.md: Makefile
 | 
			
		||||
	echo "Basic makefile example." > $@
 | 
			
		||||
	echo "" >> $@
 | 
			
		||||
	echo '```' >> $@
 | 
			
		||||
	cat $< >> $@
 | 
			
		||||
	echo '```' >> $@
 | 
			
		||||
 | 
			
		||||
$(storage_directory)/README.md: README.md
 | 
			
		||||
    mkdir $(@D)
 | 
			
		||||
    cp $< $@
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Now you can tell `make` to create the backup:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
make backups/README.md
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Command Variables
 | 
			
		||||
 | 
			
		||||
The backup `README.md` could be named after the current minute of the day, using `date +%M`.
 | 
			
		||||
This allows up-to-the-minute backups:
 | 
			
		||||
 | 
			
		||||
```make
 | 
			
		||||
current_minute != date +%M
 | 
			
		||||
 | 
			
		||||
storage_directory = backups
 | 
			
		||||
 | 
			
		||||
README.md: Makefile
 | 
			
		||||
	echo "Basic makefile example." > $@
 | 
			
		||||
	echo "" >> $@
 | 
			
		||||
	echo '```' >> $@
 | 
			
		||||
	cat $< >> $@
 | 
			
		||||
	echo '```' >> $@
 | 
			
		||||
 | 
			
		||||
$(storage_directory)/backup_$(current_minute).md: README.md
 | 
			
		||||
	mkdir $(@D)
 | 
			
		||||
	cp $< $@
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
...but the repeated use of `mkdir` is causing an error, because that directory already exists.
 | 
			
		||||
 | 
			
		||||
We can solve this by using `mkdir -p`.
 | 
			
		||||
 | 
			
		||||
## Phony Targets
 | 
			
		||||
 | 
			
		||||
But we don't want to look up the current minute of the day to make backups.
 | 
			
		||||
Better to just say `make backup`.
 | 
			
		||||
However, this will confuse `make`, because `make` thinks everything is a file, so it would try to make a file called `backup`.
 | 
			
		||||
 | 
			
		||||
The solution is to tell `make` that `backup` is a phony target.
 | 
			
		||||
 | 
			
		||||
```make
 | 
			
		||||
  [ ... ]
 | 
			
		||||
 | 
			
		||||
.PHONY: backup
 | 
			
		||||
backup: $(storage_directory)/backup_$(current_minute).md
 | 
			
		||||
$(storage_directory)/backup_$(current_minute).md: README.md
 | 
			
		||||
	mkdir -p $(@D)
 | 
			
		||||
	cp $< $@
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Now run `make backup` to create an up-to-date backup.
 | 
			
		||||
 | 
			
		||||
# Order
 | 
			
		||||
 | 
			
		||||
Makefile thinks like this:
 | 
			
		||||
 | 
			
		||||
1. Fill in all the variables in the file, from top to bottom.
 | 
			
		||||
1. If variables are missing, go through the file again.
 | 
			
		||||
1. Figure out the order the files should be built in.
 | 
			
		||||
 | 
			
		||||
In this case, the makefile can see that `backup` depends on the current backup file (with the minute in the filename), which depends on the `README.md` file, which depends on the Makefile itself.
 | 
			
		||||
 | 
			
		||||
```graph
 | 
			
		||||
 | 
			
		||||
┌──────────────────────┐
 | 
			
		||||
│       Makefile       │
 | 
			
		||||
└──────────────────────┘
 | 
			
		||||
  │
 | 
			
		||||
  │
 | 
			
		||||
  ▼
 | 
			
		||||
┌──────────────────────┐
 | 
			
		||||
│      README.md       │
 | 
			
		||||
└──────────────────────┘
 | 
			
		||||
  │
 | 
			
		||||
  │
 | 
			
		||||
  ▼
 | 
			
		||||
┌──────────────────────┐
 | 
			
		||||
│ backups/backup_06.md │
 | 
			
		||||
└──────────────────────┘
 | 
			
		||||
  │
 | 
			
		||||
  │
 | 
			
		||||
  ▼
 | 
			
		||||
┌──────────────────────┐
 | 
			
		||||
│        backup        │
 | 
			
		||||
└──────────────────────┘
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# The Rest
 | 
			
		||||
 | 
			
		||||
- [File patterns](Makefiles/patterns.md)
 | 
			
		||||
- [Makefile graphs](Makefiles/graph-easy.md)
 | 
			
		||||
- [In-build help](Makefiles/help.md)
 | 
			
		||||
- [Makefile graphs](Makefiles/graph-easy.md)
 | 
			
		||||
							
								
								
									
										15
									
								
								system/Makefiles/graph-easy.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								system/Makefiles/graph-easy.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Makefile Graphs"
 | 
			
		||||
tags: [ "system", "makefiles", "graph" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
If you have `graph-easy` (often in the package `perl-graph-easy` or similar), you can make a graph from the makefile with `make2graph` (the package is often called `makefile2graph`).
 | 
			
		||||
 | 
			
		||||
Start with the command to 'make all targets' (`-B`), and 'do a dummy run' (`-n`) with debug into (`-d`):
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
make -Bnd
 | 
			
		||||
make -Bnd | make2graph
 | 
			
		||||
make -Bnd | make2graph | graph-easy --boxart
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								system/Makefiles/help.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								system/Makefiles/help.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Makefiles"
 | 
			
		||||
tags: [ "system", "makefiles", "help" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
clean: ## Remove generated files
 | 
			
		||||
	$(RM) $(defaults)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										57
									
								
								system/Makefiles/patterns.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								system/Makefiles/patterns.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
title: "Makefile Patterns"
 | 
			
		||||
tags: [ "system", "makefiles" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Using the [basic example](../Makefile.md), you can make a complete backup of all backup files.
 | 
			
		||||
This file will depend upon everything inside the `$(storage_directory)`.
 | 
			
		||||
Unlike `bash`, you can't just say `storage_directory/*`: the pattern must be stated as a 'wildcard'.
 | 
			
		||||
 | 
			
		||||
```make
 | 
			
		||||
$(storage_directory)/backup.tgz: $(wildcard $(storage_directory)/*.md)
 | 
			
		||||
	tar czf $@ $^
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The `make` rules start by processing variables:
 | 
			
		||||
 | 
			
		||||
```make
 | 
			
		||||
backups/backup.tgz: $(wildcard backups/*.md)
 | 
			
		||||
	tar czf backups/backup.tgz $^
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Then the `wildcard` variable equals whichever backup files are in the `backups/` directory:
 | 
			
		||||
 | 
			
		||||
```make
 | 
			
		||||
backups/backup.tgz: backups/backup_29.md backups/backup_30.md
 | 
			
		||||
    tar czf backups/backup.tgz backups/backup_29.md backups/backup_30.md
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
The phony `backup` target should now point to this tar backup.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
```make
 | 
			
		||||
current_minute != date +%M
 | 
			
		||||
 | 
			
		||||
storage_directory = backups
 | 
			
		||||
 | 
			
		||||
.PHONY: backup
 | 
			
		||||
backup: $(storage_directory)/backup.tgz
 | 
			
		||||
$(storage_directory)/backup.tgz: $(wildcard $(storage_directory)/*.md)
 | 
			
		||||
	tar czf $@ $^
 | 
			
		||||
 | 
			
		||||
README.md: Makefile
 | 
			
		||||
	echo "Basic makefile example." > $@
 | 
			
		||||
	echo "" >> $@
 | 
			
		||||
	echo '```' >> $@
 | 
			
		||||
	cat $< >> $@
 | 
			
		||||
	echo '```' >> $@
 | 
			
		||||
 | 
			
		||||
$(storage_directory)/backup_$(current_minute).md: README.md
 | 
			
		||||
	mkdir -p $(@D)
 | 
			
		||||
	cp $< $@
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "android"
 | 
			
		||||
tags: [ "Documentation", "System" ]
 | 
			
		||||
tags: [ "System", "phone" ]
 | 
			
		||||
---
 | 
			
		||||
# mtpfs
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "awk"
 | 
			
		||||
tags: [ "Documentation", "System" ]
 | 
			
		||||
tags: [ "System" ]
 | 
			
		||||
---
 | 
			
		||||
# Basics
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "bash tips"
 | 
			
		||||
tags: [ "Documentation", "Shell", "POSIX" ]
 | 
			
		||||
tags: [ "Shell", "POSIX" ]
 | 
			
		||||
---
 | 
			
		||||
## Track Live Changes
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "character-encoding"
 | 
			
		||||
tags: [ "Documentation", "System" ]
 | 
			
		||||
tags: [ "System" ]
 | 
			
		||||
---
 | 
			
		||||
Convert a text file from one encoding type to another with:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "Default Programs"
 | 
			
		||||
tags: [ "Documentation", "Defaults", "Mime Type" ]
 | 
			
		||||
tags: [ "Defaults", "Mime Type" ]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Install the package `xdg-utils`, then make very liberal use of the tab button.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "$EDITOR"
 | 
			
		||||
tags: [ "Documentation", "System" ]
 | 
			
		||||
tags: [ "System" ]
 | 
			
		||||
---
 | 
			
		||||
The System's default text editor can be defined within /etc/profile.  It's given the variable `EDITOR`.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "fstab"
 | 
			
		||||
tags: [ "Documentation", "System" ]
 | 
			
		||||
tags: [ "System" ]
 | 
			
		||||
---
 | 
			
		||||
# Basics
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: "kernel"
 | 
			
		||||
tags: [ "Documentation", "System" ]
 | 
			
		||||
tags: [ "System" ]
 | 
			
		||||
---
 | 
			
		||||
Check which kernet modules are loaded into memory
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user