Compare commits

..

36 Commits

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

View File

@@ -1,95 +0,0 @@
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: .git/info/exclude ## 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)
default += db.rec
default += .dbs/map.fmt
$(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)
$(info rebuilding from $? )
printf '%s\n' '%rec: guide' > $@
printf '%s\n' '%key: title' >> $@
printf '%s\n' '%type: requires rec guide' >> $@
printf '%s\n' '%type: provides rec guide' >> $@
printf '%s\n' '%type: wordcount int' >> $@
printf '%s\n\n' '%sort: wordcount' >> $@
cat $^ >> $@
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: $@)
.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"
.dbs/map.fmt:| .dbs/
printf '%s\n' '[ {{requires[0]}} ] --> [ {{title}} ] {border-style: dashed;}' > $@
printf '%s\n' '[ {{requires[1]}} ] --> [ {{title}} ] {border-style: dashed;}' >> $@
printf '%s\n' '[ {{requires[2]}} ] --> [ {{title}} ] {border-style: dashed;}' >> $@
printf '%s\n' '[ {{requires[3]}} ] --> [ {{title}} ] {border-style: dashed;}' >> $@
printf '%s\n' '[ {{requires[4]}} ] --> [ {{title}} ] {border-style: dashed;}' >> $@
.PHONY: map
map: db.rec .dbs/map.fmt ## Show knowledge dependency map
recsel -t guide $< -e 'requires != ""' -p title,requires | recfmt -f .dbs/map.fmt |\
grep -vF '[ ]' | graph-easy --boxart | $${PAGER}
.PHONY: clean
clean: ## Remove all generated files
$(RM) $(default)

120
README.md
View File

@@ -1,101 +1,77 @@
---
title: "Linux Knowledge Base"
title: "Knowledge Base"
---
The Linux Knowledge-Base provides quick-start guides for working with terminal programs.
# Linux Knowledgebase
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)'
```
This is a list of quickstart guides for Linux programs, designed to get the user up and running as fast as possible.
# Style
## No History, No Context
## Praxis Only
- 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 leave theory alone as much as possible.
The documentation should be of the form 'if you want *X*, type *Y*'.
## State Knowledge Dependencies
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`.
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.
Any interest in these tools only comes after we can use them.
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.
## Chronological
[Do not Jaquays documentation](https://splint.rs/posts/no_links)
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:
```sh
grep ls --color=always $HISTFILE | less -R
Fixed input:
```bash
ls
```
What else can go in place of `always`?
Can you say `--color=red`?
Can you put anything?
The answer is not obvious.
Anything with arbitrary input should be shown as a variable.
What about this line:
```sh
git branch new
git checkout new
```bash
ls $FILE
```
Do you always use `new`?
Can you use another word here?
The answer is not obvious.
Non-commands (e.g. output) should be shown as quoted text:
It's better to make all arbitrary values variables.
> 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
```sh
git branch $branch_name
git checkout $branch_name
PAGER='less -R'
grep ls --color=always $HISTFILE | $PAGER
```
Now we can see what can be changed.
## Assume People Follow the Instructions
Articles should say what to type, not the output.
If the command is `ls`, users will see files once they try the command, but the article does not need to provide an example list of files unless an important point has to be made about output.
# What's Wrong with Everything Else?
# What's wrong with everything else?
## Man pages
@@ -103,14 +79,12 @@ If the command is `ls`, users will see files once they try the command, but the
- 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

12
basics/Joyous_ASCII.md Normal file
View File

@@ -0,0 +1,12 @@
---
title: "Joyous ASCII"
tags: [ "fun" ]
---
- `asciiquarium`
- `cbonsai -lim "$(fortune)"`
```bash
cow=$(cowsay -l | sort -R | head -1)
fortune -s | figlet | cowsay -nf $cow | lolcat
```

View File

@@ -1,46 +1,46 @@
---
title: "at"
tags: [ "basics", "time" ]
tags: [ "Documentation", "Basics" ]
---
Install with:
```sh
```bash
sudo apt install at
```
Enable the daemon service with:
```sh
```bash
sudo systemctl enable --now atd
```
Then jobs can be specified with absolute time, such as:
```sh
```bash
at 16:20
```
```sh
```bash
at noon
```
```sh
```bash
at midnight
```
```sh
```bash
at teatime
```
Type in your command, e.g.:
```sh
```bash
touch /tmp/$FILE.txt
```
The jobs can also be specified relative to the current time:
```sh
```bash
at now +15 minutes
```
@@ -50,7 +50,7 @@ Finally, accept the jobs with ^D.
Display a list of commands to run with:
```sh
```bash
atq
```
@@ -58,17 +58,19 @@ atq
This will print all pending IDs. Remove a job by the ID with:
```sh
```bash
atrm 2
```
Check `/var/spool/atd/` to see the jobs.
![At it again](/tapes/at.gif)
## Automation
Automatically add a job for later, by setting the date, then using echo for the command.
```sh
```bash
t="$(date -d "2 minutes" +%R)"
echo "fortune > ~/$FILE" | at "$t"
watch cat $FILE

42
basics/at.tape Normal file
View File

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

View File

@@ -1,6 +1,6 @@
---
title: "Basics"
tags: [ "basics" ]
tags: [ "Documentation", "Basics" ]
---
You need about a dozen commands to move around Linux.
@@ -9,13 +9,13 @@ Don't worry about understanding any of it, just type it in and the habit forms p
You start in a dark room. You want to know where you are by **p**rinting out your **w**orking '**d**irectory' (i.e. 'location'):
```sh
```bash
pwd
```
Have a look at what is here:
```sh
```bash
ls
```
@@ -23,11 +23,11 @@ If you get no response, the list of items is "", meaning "nothing here".
Have a look at **a**ll the files:
```sh
```bash
ls -a
```
```sh
```bash
. ..
```
@@ -35,38 +35,38 @@ So `.` means 'here' and `..` means 'you see stairs leading downwards' (e.g. 'the
Change directory (`cd`) down one level:
```sh
```bash
cd ..
```
Look where you are again with `pwd`, then go back up. Use `ls`, and if you see `bob`, then:
```sh
```bash
cd bob
```
Move around the directories. The place at the bottom is the 'root', and is known as `/`. Go to the root:
```sh
```bash
cd /
```
Do `ls` again and `cd` into `etc`. Look at how much space those folders are taking up:
```sh
```bash
du iptables
```
That's the number of kilobytes the file is taking up.
Do the same again, but in a human-readable format:
```sh
```bash
du -h iptables
```
The `du` program has `-h` for 'human', '-s' for 'short', and a bunch of other commands.
Have a look at the manual and try another command:
```sh
```bash
man du
```
@@ -74,7 +74,7 @@ Once you're done, press 'q' to quit the manual page and try the extra `du` flag
Now you can try to gain super-powers and take over the system:
```sh
```bash
sudo -i
```
@@ -82,61 +82,61 @@ At this point, you are 'root'.
All your commands will be executed, even if they're unsafe, or even if you ask to delete the entire machine.
Best to exit out of the root account:
```sh
```bash
exit
```
Go find a file that isn't a directory. You can tell which is which with:
```sh
```bash
ls -l
```
A directory starts with a 'd', like this:
```sh
```bash
drwxr-xr-x 79 root root 4096 Jan 3 05:15 /etc/
```
A standard file starts with '-', like this:
```sh
```bash
`-rw-r--r-- 1 root root 8 Dec 11 17:26 hostname`
```
Look inside the file /etc/hostname to find out your computer's name:
```sh
```bash
cat /etc/hostname
```
Print out the words "hello world":
```sh
```bash
echo "hello world"
```
Move back to your home directory:
```sh
```bash
cd
```
Take the words 'hello world', and put them in 'my_file':
```sh
```bash
echo 'hello world' > my_file
```
Measure the disk usage of that file, then put the results at the bottom of the file:
```sh
```bash
du $FILE >> $FILE
```
And check the results:
```sh
```bash
cat $FILE
```
@@ -148,7 +148,7 @@ Press tab after typing a few keys and bash will guess what you're trying to typ
Look at your file's owner:
```sh
```bash
ls -l $FILE
```
@@ -156,19 +156,19 @@ If it says `-rw-r--r-- 1 root root 8 Dec 11 17:26 hostname` then the file is own
Take your file and change the owner to root:
```sh
```bash
sudo chown root $FILE
```
Change the same file so it's owned by the group 'audio':
```sh
```bash
sudo chown :audio $FILE
```
Check you did that correctly:
```sh
```bash
ls -l my_file
```
@@ -176,7 +176,7 @@ ls -l my_file
Read the start of that line. Root can 'read' and 'write' to or delete the file. Try to remove (delete) it:
```sh
```bash
rm $FILE
```
@@ -184,32 +184,32 @@ You'll see you're not allowed, because you don't own it.
Look at which groups you're in:
```sh
```bash
groups
```
Change the file so that members of the audio group can write to the file:
```sh
```bash
sudo chmod g+w $FILE
```
Check you got it right with `ls -l`:
```sh
```bash
-rw-rw-r-- 1 root audio 0 Jan 3 19:20 my_file
```
Try to delete the file again:
```sh
```bash
rm my_file
```
If you can't, you're not in the audio group. Add yourself. You'll need to *modify* your *user account*, by **a**ppending 'audio' to your list of groups.
Use `-a` to **a**ppend, and `-G`, to say you're modifying groups:
```sh
```bash
sudo usermod -a -G audio [ your username here ]
```
@@ -219,19 +219,19 @@ Now you should be able to remove (delete) the file. Remember, that using 'rm fi
Make a directory called 'new test':
```sh
```bash
mkdir 'new test'
```
Make two directories, called 'A', and 'Z':
```sh
```bash
mkdir A Z
```
Make a single directory called 'A Z'
```sh
```bash
mkdir 'A Z'
```
@@ -239,19 +239,19 @@ mkdir 'A Z'
Measure the disk usage of everything ('\*' means 'everything'), and put it in a file called 'disk usage.txt':
```sh
```bash
du -sch * > A/'disk usage'.txt
```
Look at your file:
```sh
```bash
cat A/'disk usage.txt'
```
If you think you have too much information, use `grep` to just get the one line of text you want:
```sh
```bash
grep total A/disk\ usage.txt
```
@@ -259,7 +259,7 @@ The `grep` program also has a manual ('man page'). You should find out what tha
Start the manual:
```sh
```bash
man du
```
@@ -267,7 +267,7 @@ Then search for `-c` by pressing `/`. Your final keys should be `man du`, then
Find out if the `ls` program also has a 'human readable' format by using `grep` to search for the word 'human':
```sh
```bash
man ls | grep human
```
@@ -275,25 +275,25 @@ Now use that flag that you've found in combinatin with the `-l` flag to look at
Remove the directory 'Z':
```sh
```bash
rmdir Z
```
Remove the directory 'Z':
```sh
```bash
rmdir Z
```
And then remove all the rest:
```sh
```bash
rmdir *
```
The 'A' directory will not budge because it's not empty. Remove it recursively, so the computer will remove the things inside the directory as well as the directory itself:
```sh
```bash
rm -r A
```
@@ -303,11 +303,11 @@ You get a package manager which installs programs, fonts, et c.
If you're on something like Debian, you'll have `apt`, or if you're on something like Red Hat, you'll have `yum`.
If unsure, ask where a program is:
```sh
```bash
whereis yum
```
```sh
```bash
whereis apt
```
@@ -315,14 +315,14 @@ If you get a hit, you can use whatever program that is to install things.
Set a reminder of your package manager:
```sh
```bash
echo my package manager is yum | lolcat
```
If that failed it's because you don't have `lolcat` installed.
Install lolcat:
```sh
```bash
sudo apt install lolcat
```
@@ -330,24 +330,23 @@ Try the same command again.
Search for things you want, like `libreoffice`, or `gimp`:
```sh
```bash
apt search libreoffice
```
... then install one of them with:
```sh
```bash
apt install $PROGRAM
```
Remove `lolcat`, because it's useless:
```sh
```bash
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,41 +1,41 @@
---
title: "clock"
tags: [ "basics", "time" ]
tags: [ "Documentation", "Basics" ]
---
Show system time:
```sh
```bash
date
```
Show hardware time:
```sh
```bash
sudo hwclock -r
```
Change system time to match hardware time:
```sh
```bash
sudo hwclock --hctosys
```
Change hardware time to match system time:
```sh
```bash
sudo hwclock --systohc
```
Manually set the hardware time to a specified date:
```sh
```bash
sudo hwclock --set --date="8/25/19 13:30:00"
```
## Normal Date
```sh
```bash
date +%d/%m/%y
```
@@ -45,7 +45,7 @@ Computers started counting time on January 1st, 1970, and added one second-per-s
Track the time in Unix-time:
```sh
```bash
date +%s
```
@@ -55,13 +55,13 @@ Servers which take their time from an observatory we call Stratum 1 servers. Se
Install ntp with:
```sh
```bash
sudo apt-get install -y ntp
```
The shell command for this is `ntpq`. Monitor the service providers using:
```sh
```bash
ntpq -p
```

View File

@@ -1,36 +0,0 @@
---
title: "column"
tags: [ "basics", "format", "json" ]
---
Put output into column.
```sh
du -h /etc/* | column
```
Reformat file with an explicit separator (`-s`):
```sh
column -ts: /etc/passwd
```
Give columns names (`-N`), so you can hide some (`-H`):
```sh
column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID /etc/passwd
```
Reorder with `-O` (unspecified items remain):
```sh
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`:
```sh
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: [ "basics" ]
tags: [ "Documentation", "Basics" ]
---
# If statements
@@ -46,7 +46,7 @@ esac
# While and Until
This prints from 1 until 9.
```sh
```bash
COUNTER=1
while [ $COUNTER -lt 2 ]; do
> ((COUNTER++))
@@ -58,7 +58,7 @@ There's also 'until', which stops when something is true, rather than keeping go
# For
```sh
```bash
for i in $( ls ); do
> du -sh $i
> done
@@ -70,19 +70,19 @@ The sequences tool counts up from X in jumps of Y to number Z.
Count from 1 to 10.
```sh
```bash
seq 10
```
Count from 4 to 11.
```sh
```bash
seq 4 11
```
Count from 1 to 100 in steps of 5.
```sh
```bash
seq 1 5 100
```

129
basics/cron.md Normal file
View File

@@ -0,0 +1,129 @@
---
title: "cron"
tags: [ "Documentation", "Basics" ]
---
# Cronie
The `cronie` program is also known as `crond`.
## Install
```bash
sudo apt search -n ^cron
```
Once installed, search for the service name, and start it.
```bash
sudo systemctl list-unit-files | grep cron
sudo systemctl enable --now $NAME
```
## Usage
Show your current crontab:
```bash
crontab -l
```
You can put this in a file and edit it:
```bash
crontab -l > $filename
echo '39 3 */3 * * /bin/tar czf /tmp/etc_backup.tgz /etc/' >> $filename
```
Then apply that crontab:
```bash
crontab $filename
rm $filename
```
The `cron` program will check your syntax before adding the tab.
Your crontab file sits somewhere in `/var/spool/`.
Probably in `/var/spool/cron`.
## Syntax
`* * * * *`
These five points refer to:
`minute hour day month weekday`
So '3pm every Sunday' would be:
`0 15 * * 7`
Here 'Sunday' is indicated by "7", and '3pm' is 'the 15th hour'.
The minute is '0' (i.e. '0 minutes past three pm').
Doing the same thing, but only in February, would be:
`0 15 * 2 7`
### Variables
`cronie` doesn't know where you live, so to put something in your `$HOME` directory, you have to tell it:
```bash
echo "HOME=$HOME" > $filename
crontab -l >> $filename
crontab $filename
```
`cronie` doesn't know where anything lives, including programs.
You can give it your usual `$PATH` variable like this:
```bash
echo $PATH > $filename
crontab -l >> $filename
crontab $filename
```
Now instead of doing this
`40 */3 * * * /usr/bin/du -sh $HOME/* | sort -h > $HOME/sum.txt`
You can simply do this:
`40 */3 * * * du -sh $HOME/* | sort -h > $HOME/sum.txt`
## Run as Root
You can execute a script as root by putting it into a directory, instead of in the tab.
Look at the available cron directories:
```bash
ls -d /etc/cron.*
```
Make a script which runs daily:
```bash
f=apt_update.sh
echo '#!/bin/bash' > $f
echo 'apt update --yes' >> $f
chmod +x $f
sudo mv $f /etc/cron.daily/
```
### Testing with runparts
Run-parts runs all executable scripts in a directory.
```bash
run-parts /etc/cron.hourly
```
# Troubleshooting
### `date` Commands
Cron doesn't understand the `%` sign, so if you want to use `date +%R`, then it should be escaped with a backslash: `date +\%R`.

View File

@@ -5,7 +5,7 @@ tags: [ "basics" ]
Compose a statement for execution.
```sh
```bash
x='echo $y'
echo $x
y=dragon
@@ -14,7 +14,7 @@ eval "$x"
The results remain in the current shell, unlike sub-shells.
```sh
```bash
b=basilisk
sh -c 'echo $b'
eval "g=goblin"

View File

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

View File

@@ -11,20 +11,20 @@ This ID is called the 'inode'.
Create a file, and a hard link:
```sh
```bash
fortune > $file_1
mkdir -p x/y/z/
ln $file_1 x/y/z/$file_2
```
Have a long look at the file with the `-l` flag, and check the inode with `-i`:
```sh
```bash
ls -li $file_1 x/y/z/$file_2
```
Since they are the same file, you can make a change to one, and it changes both:
```sh
```bash
fortune | tee x/y/z/$file_2
cat $file_1
cat x/y/z/$file_2

View File

@@ -1,25 +0,0 @@
---
title: "Joyous ASCII"
tags: [ "fun" ]
---
- `asciiquarium`
- `cbonsai -lim "$(fortune)"`
```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
```

34
basics/kernel.md Normal file
View File

@@ -0,0 +1,34 @@
---
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,13 +1,13 @@
---
title: "kill"
tags: [ "basics" ]
tags: [ "Documentation", "Basics" ]
---
If you want to kill a program in a graphical environment, open a terminal and type:
# Graphical Programs
```sh
```bash
xkill
```
@@ -17,7 +17,7 @@ Then click on the application which you want to kill.
To kill a program, find it with:
```sh
```bash
pgrep discord
```
@@ -25,7 +25,7 @@ This will give you the UUID, e.g. `19643`.
Kill the program with:
```sh
```bash
kill 19643
```
@@ -33,7 +33,7 @@ kill 19643
To see an ordered list of termination signals:
```sh
```bash
kill -l
```
@@ -49,7 +49,7 @@ Higher numbers are roughly equivalent to insistence.
For example:
```sh
```bash
kill -1 3498
```
@@ -57,7 +57,7 @@ This roughly means 'maybe stop the program, if you can, maybe reload'.
Or the famous:
```sh
```bash
kill -9 3298
```

View File

@@ -1,6 +1,6 @@
---
title: "locale"
tags: [ "basics", "time" ]
tags: [ "Documentation", "Basics" ]
---
Your locale tells the computer your location, preferred time-and-date format, standard language, papersize, et c.
@@ -8,25 +8,25 @@ A list of supported locales is available at /usr/share/i18n/SUPPORTED
See a full list with:
```sh
```bash
cat /usr/share/i18n/SUPPORTED
```
Take the first portion to generate full locale information for a region:
```sh
```bash
locale-gen ru_RU.UTF-8
```
Then use this for the current shell session with
```sh
```bash
LANG=ru_RU.utf8
```
Expand this to the entire system with:
```sh
```bash
export LANG=ru_RU.utf8
```
@@ -34,7 +34,7 @@ You can make this permanent for one user by adding this line to the ~/.profile o
Make it permanent for the entire system by editing:
```sh
```bash
sudo vim /etc/defaults/locale
```

View File

@@ -1,33 +1,43 @@
---
title: "locating"
tags: [ "basics" ]
tags: [ "Documentation", "Basics" ]
---
# Type
`type` shows what kind of thing you're running, be it an alias, function, or binary program.
```sh
type cd
type ls
type -P ls
type -a cat
```bash
type cmus
```
![where is cmus?](/tapes/which.gif)
# Whereis the Program
Where is `grep` and all its configuration files?
Ask where the `angband` program is, along with all its configuration files:
```sh
whereis grep
`whereis angband`
Also `which` shows where a binary file (the program) is,
```bash
which cmus
```
Which one of these is the binary file which you actually use?
# Quick Search for Files
```sh
which grep
You'll need to set up `locate` for this by installing `mlocate`.
`mlocate` needs a list of all files on the machine, so run:
```bash
sudo updatedb
```
# More
Then to find a file called 'my-cats.jpg', run:
- [Search instantly with `plocate`](data/search_system.md)
```bash
locate cats
```
For best results, run `updatedb` regularly, perhaps in crontab.

View File

@@ -8,13 +8,13 @@ Firstly, your `ls` is probably aliased to something.
Check it with:
```sh
```bash
alias ls
```
If the prompt shows some alias, then start by removing it:
```sh
```bash
unalias ls
```
@@ -23,24 +23,24 @@ Now we can begin.
Check the most recently modified file:
```sh
```bash
ls -t
```
Reverse this with `tac` to see the file which has been unmodified the longest:
```sh
```bash
ls -t | tac
```
Group files by extension:
```sh
```bash
ls -X
```
Sort largest files first:
```sh
```bash
ls -X
```

View File

@@ -1,36 +1,36 @@
---
title: "processes"
tags: [ "basics" ]
tags: [ "Documentation", "Basics" ]
---
# Proccesses
See running items in current terminal with
```sh
```bash
ps
```
or more with
```sh
```bash
ps -a
```
Or the entire system with
```sh
```bash
ps -e
```
Or the entire system with more information, BSD style, with:
```sh
```bash
ps aux
```
And then search for a particular program with
```sh
```bash
ps aux | grep cmus
```
@@ -40,19 +40,19 @@ Pause a job with ^z. Put it in the background with the '&' suffix.
List jobs in the current shell with
```sh
```bash
jobs
```
And then you can pull number 1 up again with
```sh
```bash
fg 1
```
Or continue running a stopped job with:
```sh
```bash
bg 1
```
@@ -62,31 +62,31 @@ This changes how nice a program is, from -20 to 19.
Install a program, but nicely, at nice value '10':
```sh
```bash
nice -10 sudo apt -y install libreoffice
```
Aggressively use Steam, with a nice value of '-13'.
```sh
```bash
nice --13 steam&
```
Find out that Steam's fucking everything up, so you change its nice value with 'renice':
```sh
```bash
renice --5 -p 3781
```
Nerf all of roach-1's processes:
```sh
```bash
renice 10 -u roach-1
```
... or the entire group
```sh
```bash
renice -14 -g hackers
```

View File

@@ -9,7 +9,7 @@ This & That
Refer to 'that last thing', and 'the first thing':
```sh
```bash
fortune -l > file1
cat !$ | tr -d u
diff !^ !$
@@ -17,7 +17,7 @@ diff !^ !$
**NB:** this can go wrong:
```sh
```bash
ls -l file1 file2
cat !^
```
@@ -36,7 +36,7 @@ Input Run-Commands (`~/.inputrc`)
Alias Expansion
---------------
```sh
```bash
echo '"\C- ": shell-expand-line' >> ~/.inputrc
exec bash
```
@@ -47,7 +47,7 @@ Try just `ls`, then 'Control + Space'.
Glob Expansion (`*`)
--------------------
```sh
```bash
echo '"\C-x": glob-expand-word' >> ~/.inputrc
exec bash
ls *<C-x>
@@ -63,13 +63,13 @@ Arbitrary Commands
Use `\n` as a 'newline' character to automatically press `<Return>`.
```sh
```bash
echo 'Control-y: "| lolcat\n"' >> ~/.inputrc
exec bash
ls<C-y>
```
```sh
```bash
Control-l: "\C-u clear -x && ls\n"
exec bash
cd /etc/<C-l>
@@ -78,7 +78,7 @@ cd /etc/<C-l>
Readline as Vi
--------------
```sh
```bash
echo 'set editing-mode vi' >> ~/.inputrc
echo 'set keymap vi-insert' >> ~/.inputrc
exec bash
@@ -100,13 +100,7 @@ Try:
- `<Esc>kcw`
- ls -a<Esc>xxxx
Readline can work with python one you set `PYTHON_BASIC_REPL` to `true`.
```sh
echo 'export PYTHON_BASIC_REPL=true' >> ~/.bashrc
exec bash
```
Works with `python` too:
```python
im<C-n>os<Return>
@@ -121,7 +115,7 @@ Fix Globs!
If you tried the previous commands then they will not work any more, because the `vi`-commands overwrite the other commands.
Remove them.
```sh
```bash
sed '/ vi/d' ~/.inputrc
sed -i '/ vi/d' ~/.inputrc
@@ -136,14 +130,14 @@ Vi-sibility
The `readline` prompt becomes confusing if you don't remember if you're in insert or normal mode.
But you can show the current mode in the prompt:
```sh
```bash
echo 'set show-mode-in-prompt on' >> ~/.inputrc
exec bash
```
Set new symbols for normal and insert mode:
```sh
```bash
echo 'set vi-ins-mode-string " "' >> ~/.inputrc
echo 'set vi-cmd-mode-string " "' >> ~/.inputrc
```
@@ -154,33 +148,33 @@ Fuzzy Sort
Check your repos for `sk-im`, and install.
The program is called `sk`.
```sh
```bash
FUZZY=sk
```
If you don't have it, `fzy` or `fzf` should work the same way.
```sh
```bash
FUZZY=fzy
```
Find some 'read-config' files to check out:
```sh
```bash
find . -maxdepth 2 -name "*rc"
find . -maxdepth 2 -name "*rc" | $FUZZY
```
And read some:
```sh
```bash
PAGER='less -R'
$PAGER "$(find . -maxdepth 2 -name "*rc" | $FUZZY)"
```
Make the change long-term:
```sh
```bash
alias rrc='$PAGER "$(find . -maxdepth 2 -name "*rc" | sk)"'
alias | grep rrc= >> ~/.bash_aliases
```

View File

@@ -7,7 +7,7 @@ When a program encounters a soft link, it will make a guess at whether it shoul
To make a soft link to a file in the current directory, linking is easy:
```sh
```bash
fortune > $file_1
ln -s $file_1 $link_1
```
@@ -27,14 +27,14 @@ dir_0/
Inside `dir_1`, making a soft link to `dir_0/file_1` would mean putting the directions to that file:
```sh
```bash
cd dir_1
ln -s ../file_1 link_1
```
The real content of the file is just '`../file_1`, so making it from another directory would mean writing exactly the same address to that file:
```sh
```bash
ln -s ../file_1 dir_2/link_2
```
@@ -54,7 +54,7 @@ dir_0/
Since it's just an address, you can delete the original file, then make another.
```sh
```bash
rm file_1
ls -l dir_1/
fortune > file_1
@@ -65,7 +65,7 @@ cat dir_1/link_1
Last, let's make a link from `dir_2/link_2` to `dir_1/file_1` (this will delete the old link):
```sh
```bash
ln -s -f ../dir_1/file_1 dir_2/link_2
cat dir_2/link_2
```

View File

@@ -1,12 +1,12 @@
---
title: "time"
tags: [ "basics", "time" ]
tags: [ "Documentation", "Basics" ]
---
# systemd
Set time to synchronize with an ntp server:
```sh
```bash
timedatectl set-ntp true
```
@@ -18,7 +18,7 @@ Local time is kept in /etc/localtime.
According to Dave's LPIC guide, you can set the local time by making asymboling link from your timezone to /etc/localtime, as so:
```sh
```bash
sudo ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
```
@@ -28,41 +28,41 @@ sudo ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
See local time, language and character settings with:
```sh
```bash
locale
```
List available locales with:
```sh
```bash
locale -a
```
To see additional locales which are available (but not necessarily installed):
```sh
```bash
cat /usr/share/i18n/SUPPORTED
```
Set a supported locale with:
```sh
```bash
locale-gen pl_PL.UTF-8
```
Then set that language, with:
```sh
```bash
LANG=pl_PL.UTF-8
```
...then reboot.
... then reboot.
# Network Time Protocol
Glimpse an overview with:
```sh
```bash
ntpq -p
```
@@ -73,6 +73,6 @@ Usually this is run as a service, so just start that service.
If your clock drifts too far from the right time, it will not reset happily.
For it to reset like this:
```sh
```bash
sudo ntpd -q -g -x -n
```

View File

@@ -28,7 +28,7 @@ Each description-line starts with a tab.
To represent a file structure as a nested series of markdown lists, you can try this horrifying `sed` one-liner:
```sh
```bash
tree -tf --dirsfirst --gitignore --noreport --charset ascii | \
sed -e 's/| \+/ /g' \
-e 's/[|`]-\+/ */g' \

View File

@@ -1,28 +1,28 @@
---
title: "users"
tags: [ "basics" ]
tags: [ "Documentation", "Basics" ]
---
# Basic Information
Let's get some entries with 'getent', e.g. passwd or group.
```sh
```bash
getent passwd
```
```sh
```bash
getent group
```
Obviously:
```sh
```bash
getent shadow
```
## Examples
```sh
```bash
sudo adduser maestro
```
@@ -30,71 +30,71 @@ add user 'maestro'
This depends upon the settings in the /etc/default/useradd file and /etc/login.defs
```sh
```bash
sudo useradd -m pinkie
```
add user 'pinkie' with a home directory
```sh
```bash
sudo adduser -m -e 2017-04-25 temp
```
add expiry date to user
```sh
```bash
userdel maestro
```
delete maestro
```sh
```bash
userdel -r maestro
```
delete maestro and hir homefolder
```sh
```bash
groups
```
find which group you are in
```sh
```bash
id
```
same
```sh
```bash
id -Gn maestro
```
Find which groups maestro is in
```sh
```bash
deluser --remove-home maestro
```
delete user maestro
```sh
```bash
usermod -aG sudo maestro
```
Add user maestro to group sudo:
```sh
```bash
cat /etc/passwd
```
list users' passwords (and therefore users)
```sh
```bash
groupadd awesome
```
@@ -104,33 +104,33 @@ Passwords are stored in /etc/shadow.
There are user accounts for processes such as 'bin' and 'nobody' which are locked, so they're unusable.
```sh
```bash
passwd -l bin
```
Lock the user 'bin'.
```sh
```bash
more /etc/passwd | grep games
```
we find the name, password and user id of the user 'games'. I.e. the password is 'x', and the user id is '5'. The password is an impossible hash, so no input password could match.
```sh
```bash
groupdel learners | delete the group 'learners'
```
```sh
```bash
gpasswd -d pi games | remove user 'pi' from the group 'games'
```
```sh
```bash
id games
```
find the id number of group 'games' (60)
```sh
```bash
usermod -aG sudo maestro
```
@@ -156,7 +156,7 @@ Alternatively, change the shell in /etc/passwd.
Usermod also lets you change a user's username:
```sh
```bash
usermod -l henry mark
```
@@ -170,7 +170,7 @@ usermod -L henry
-G or -groups adds the user to other groups:
```sh
```bash
usermod -G sudo henry
```
@@ -186,13 +186,13 @@ In /etc/group, a group file may look like this:
We can use groupmod, like like usermod, e.g. to change a name:
```sh
```bash
groupmod -n frontoffice backoffice
```
Delte a group:
```sh
```bash
groupdel frontoffice
```
@@ -200,37 +200,37 @@ groupdel frontoffice
See list of logged on users.
```sh
```bash
w
```
See last logons:
```sh
```bash
last
```
or all logon attempts, including bad attempts:
```sh
```bash
lastb
```
List recently accessed files:
```sh
```bash
last -d
```
See files opened by steve
```sh
```bash
lsof -t -u steve
```
See files opened by anyone but steve
```sh
```bash
lsof -u ^steve
```
@@ -240,19 +240,19 @@ Some files can be executed by people as if they had super user permissions, and
Let's start with files executable by user:
```sh
```bash
sudo find / -type f -perm -g=s -ls
```
And then those executable by the group:
```sh
```bash
find / -type f -perm -g=s -ls
```
And finally, worrying files, executable by anyone as if sie were the owner:
```sh
```bash
find / -xdev \( -o -nogroup \) -print
```
@@ -260,7 +260,7 @@ Then have a look at resource usage per user.
# SGID
```sh
```bash
sudo chmod u+s process.sh
```

33
basics/which.tape Normal file
View File

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

View File

@@ -11,14 +11,14 @@ This is extremely powerful.
If you ever want to automatically install something which persistently nags you with `do you want to do the thing? [y/N]?`, then you can just pipe `yes` into that program, and it will answer 'yes' to all questions.
```sh
```bash
yes | $INSTALL_SCRIPT_FILE.sh
```
This works best for disposable systems, like VMs or containers.
Try this on a live system, and you might find out that you should have read that message fully.
```sh
```bash
yes | yay
```

11
basics/yes.tape Normal file
View File

@@ -0,0 +1,11 @@
Require yay
Set Shell "bash"
Set FontSize 20
Set Width 1400
Set Height 900
Sleep 2s
Type "yes | yay"

57
chat/profanity-otr.md Normal file
View File

@@ -0,0 +1,57 @@
---
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: [ "chat", "omemo" ]
tags: [ "Documentation", "Chat", "omemo" ]
---
# Setup (Commands)
@@ -142,3 +142,4 @@ You can ensure omemo automatcally turns on:
```
---
'OTR' encryption is mostly dead, but you can find the old instructions [here](profanity-otr).

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,10 +5,5 @@ tags: [ "data", "calendar", "daylight savings" ]
## Setup
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
```
The UK government keeps an ics file with clock, [here](https://www.gov.uk/when-do-the-clocks-change/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:
```sh
```bash
sudo grep -r $FRAGMENT /var/spool/*
```

View File

@@ -1,17 +1,17 @@
---
title: "exiftool"
tags: [ "metadata", "exifdata" ]
tags: [ "Documentation", "Metadata" ]
---
Find metadata:
Find metadata.
```sh
exiftool "$file".jpg
```bash
exiftool image.jpg
```
Find info on all `.png` images in current directory.
Find info on all images in current directory.
```sh
```bash
exiftool -ext .png .
```
@@ -19,14 +19,22 @@ You can make this recurring with the -r switch.
And overwrite all metadata:
```sh
```bash
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:
```sh
```bash
exiftool -gps:all= *.jpg
```
You can also use the imagemagick tool:
```bash
identify -verbose
```

View File

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

View File

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

View File

@@ -1,73 +1,24 @@
---
title: "git-lfs"
tags: [ "data", "git" ]
requires: [ "git" ]
tags: [ "Documentation", "data" ]
---
Git Large File Storage ('LFS') needs to change your `~/.gitconfig` to check out those binary files:
Install, and add with
```sh
cat ~/.gitconfig
```bash
git lfs install
cat ~/.gitconfig
```
Then track some filetypes with:
Then track some filetype with:
```sh
cd $git_repository
ext=ttf
git lfs track "*.$ext"
```bash
git lfs track "\*.ttf"
```
Or a directory with:
```sh
```bash
git lfs track "images/"
```
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
```
All changes require adding `.gitattributes`.

View File

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

View File

@@ -1,11 +1,11 @@
---
title: "git hooks"
tags: [ "data", "git" ]
tags: [ "Documentation", "data", "git" ]
---
Check out the sample hooks:
```sh
```bash
cd $GIT_REPO
ls .git/hooks
head .git/hooks/pre-commit.sample
@@ -13,7 +13,7 @@ head .git/hooks/pre-commit.sample
Add a hook to check the shell scripts in `$GIT_REPO` before making a commit:
```sh
```bash
echo '#!/bin/sh
shellcheck *.sh' > .git/hooks/commit-msg
chmod u+x .git/hooks/commit-msg

View File

@@ -1,6 +1,6 @@
---
title: "git subtree"
tags: [ "data", "git", "subtree" ]
title: "git"
tags: [ "Documentation", "data", "git", "subtree" ]
---
## Pulling a Subtree from an existing git
@@ -10,7 +10,7 @@ The first should be its own repository, but should also retain its own history.
First, we extract its history as an independent item, and make that into a seprate branch.
```sh
```bash
git subtree split --prefix=sub-1 -b sub
```
@@ -18,7 +18,7 @@ If you want something a few directories deep, you can use `--prefix=sub-1/dir-2/
Then go and create a new git somewhere else:
```sh
```bash
cd ..;mkdir sub-1;cd sub-1;git init --bare
```
@@ -28,7 +28,7 @@ git push ../subtest sub:master
Finally, you can clone this repo from your original.
```sh
```bash
git clone ../subtest
```

View File

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

View File

@@ -1,12 +1,12 @@
---
title: "GPG Basics"
tags: [ "data", "GPG" ]
tags: [ "Documentation", "data", "GPG" ]
---
# Making keys
Generate keys:
```sh
```bash
gpg --full-generate-key
```
@@ -14,7 +14,7 @@ Follow the guide.
# Encrypting a file
```sh
```bash
gpg -r malinfreeborn@posteo.net -e file
```
@@ -25,7 +25,7 @@ Check you have an encrypted version of your file.
# Changing Expiration Dates
```sh
```bash
gpg --list-keys
# or...
gpg -k
@@ -37,13 +37,13 @@ gpg -k
Make a password with a password (cypher encryption).
```sh
```bash
gpg -c --output passwords.txt
```
or
```sh
```bash
gpg -c > passwords.txt
```
@@ -53,7 +53,7 @@ Write message then stop with Ctrl+d.
Get the message back out the file with:
```sh
```bash
gpg -d passwords.txt
```
@@ -61,13 +61,13 @@ gpg -d passwords.txt
Search for a key at any key store:
```sh
```bash
gpg --search-keys nestorv
```
Once you've made a decision about someone:
```sh
```bash
gpg --list-keys
```
@@ -86,13 +86,13 @@ This is a fingerprint.
You can now decide the trust level (this stays on your computer).
```sh
```bash
gpg --edit-key CD30421FD825696BD95F1FF644C62C57B790D3CF
```
Once you're in the interface, type `trust`.
```sh
```bash
gpg --sign-key alice@posteo.net
```
@@ -104,7 +104,7 @@ This system relies on a ring of people swapping key information.
Send those trusted keys up to a server, so people can see you have verified them:
```sh
```bash
gpg --send-keys 024C6B1C84449BD1CB4DF7A152295D2377F4D70F
```
@@ -125,7 +125,7 @@ keyserver hkps://keys.mailvelope.com
Refreshing keys will tell you if some key you have contains a signature from someone you already trust, or if someone has published a revocation certificate (meaning their key should not be trusted any more).
```sh
```bash
gpg --refresh-keys
```
@@ -135,12 +135,12 @@ You can use the [crontab](../../basics/cron.md) to refresh keys, but this will m
Your public key:
```sh
```bash
gpg --output me.gpg --armor --export
```
Alternatively:
```sh
```bash
gpg --export -a person@email.tld > my_key.pub
```

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,52 +1,60 @@
---
title: "khard"
tags: [ "data" ]
tags: [ "Documentation", "Data" ]
---
Get the basic config:
```sh
```bash
mkdir ~/.config/khard
```
```sh
```bash
cp /usr/share/doc/khard/examples/khard/khard.conf.example ~/.config/khard.conf
```
Short list
```sh
```bash
khard list
```
Longer list
```sh
```bash
khard show
```
Show from addressbook 'work'
```sh
```bash
khard list -a work
```
Make a new contact in address book 'family'
```sh
```bash
khard new -a family
```
```sh
```bash
khard edit grampa
```
```sh
```bash
khard remove bob
```
Move contact 'nina' from 'work' to 'home' address book.
```sh
```bash
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,14 +1,14 @@
---
title: "newsboat"
tags: [ "RSS" ]
tags: [ "Documentation", "RSS" ]
---
Create the configuration directory before you start, and add at least 1 URL.
```sh
```bash
mkdir ~/.config/newsboat
```
```sh
```bash
echo 'https://voidlinux.org/atom.xml foss tech' >> ~/.config/newsboat/urls
```
@@ -28,7 +28,7 @@ You can input a Youtube channel by adding this, with the channel's ID at the end
To get the channel ID without hunting:
```sh
```bash
curl *'https://www.youtube.com/@1minfilms'* | grep -oE 'browseId":"U\w+"' | tail | cut -d'"' -f3
```

View File

@@ -1,54 +0,0 @@
---
title: "Newsraft"
tags: [ "data", "RSS" ]
requires: [ "Shell Scripts" ]
---
# Setup
Install newsraft, then:
```sh
mkdir ~/.config/newsraft
echo 'https://codeberg.org/newsraft/newsraft.atom "Newsraft git"' >> ~/.config/newsraft/feeds
newsraft
```
# Commands
Copy the default config file:
```
cp /usr/share/doc/newsraft/example/config ~/.config/newsraft/config
```
Add a line to check the man page while inside the program:
```
bind M exec man newsraft
```
This will fail, because the letter 'M' is taken by `mpv`.
Add this line to take the default link, and place it in a list of videos.
```
bind V mark-read; exec echo "%l" >> ~/.cache/vidlist.txt
```
# Videos
You can get an RSS feed from any YouTube video with this script:
```
#!/bin/sh
CHANNEL_ID="$(curl -s "$1" | tr ',' '\n' | grep -Po 'channelId":"\K[\w+-]+' | tail -1)"
FEED_URL="https://www.youtube.com/feeds/videos.xml?channel_id=$CHANNEL_ID"
CHANNEL_NAME="$(curl -s "$FEED_URL" | grep -m 1 -Po 'title\>\K[\w\s]+')"
printf '%s "%s"\n' "$FEED_URL" "$CHANNEL_NAME"
```

View File

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

View File

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

View File

@@ -1,11 +1,8 @@
---
title: "PDF Metadata Erasure"
tags: [ "metadata", "ghost script", "gs", ".pdf" ]
tags: [ "Documentation", "Metadata", "Ghost Script" ]
---
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'.
@@ -23,6 +20,6 @@ Make a text file called 'pdfmark.txt'.
Then run:
```sh
```bash
gs -o output.pdf -sDEVICE=pdfwrite "$FILE".pdf pdfmark.txt
```

View File

@@ -1,7 +1,6 @@
---
title: "radicale and nginx"
tags: [ "data", "calendar" ]
requires: [ "nginx", "certbot" ]
---
Check before you start:
@@ -16,7 +15,7 @@ The standard `radicale` package should come with a nice `systemd` service file.
If the service comes already-started, stop it immediately:
```sh
```bash
sudo systemctl stop radicale
```
@@ -40,7 +39,7 @@ You might get it in the `apache` package or similar.
`htpasswd` allows you to generate passwords for users, and place them in `/etc/radicale/users`.
```sh
```bash
PASS="$(xkcdpass)"
htpasswd -nb $USER "$PASS" | sudo tee -a /etc/radicale/users
echo "Your username is $USER"
@@ -93,7 +92,7 @@ sudo ln -s /etc/nginx/sites-available/radicale /etc/nginx/sites-enables/
Finally, replace the example `DOMAIN` with your actual domain name.
```sh
```bash
DOMAIN=whatever.com
sudo sed -i "s/DOMAIN/$DOMAIN/g" /etc/nginx/sites-available/radicale
```
@@ -102,18 +101,18 @@ sudo sed -i "s/DOMAIN/$DOMAIN/g" /etc/nginx/sites-available/radicale
Check nginx is happy:
```sh
```bash
sudo nginx -t
```
You will almost certainly need a new SSL certificate for the site:
```sh
```bash
sudo certbod -d cal.$DOMAIN
```
Start or restart both services:
```sh
```bash
sudo systemctl start radicale
sudo systemctl restart nginx
```

View File

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

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

View File

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

View File

@@ -1,118 +0,0 @@
---
title: "Recfiles Extended Example"
tags: [ "data", "database", "recfiles" ]
---
## Create
Make a database for your boardgames, specifying only one field and value:
```sh
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:
```sh
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:
```sh
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`.
```sh
f=played
v=yes
recset -f $f -a $v $database
```
...but the field is wrong, it should have a capital letter:
```sh
new_field=Played
recset -f $f --rename $new_field
```
## Read
Check how many records the database has:
```sh
recinf $database
```
Look at just the games you've never played:
```sh
recsel --expression="Played = 'no'" $database
```
Print how many, then just print the names:
```sh
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.
```sh
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`.
```sh
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.
```sh
recset -e "Playtime = 40" -f Max_Players --set-add 50 games.rec
```
## Delete
Remove `Played` record from first game:
```sh
num=0
recset --number=$num -f Played --delete $database
```
You can comment the line instead of deleting it:
```sh
num=1
recset --number=$num -f Played --delete $database
recsel $database
cat $database
```
Delete an entire record:
```sh
num=2
recdel --number=$num $database
```

View File

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

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

View File

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

View File

@@ -1,49 +0,0 @@
---
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.
```sh
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

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

View File

@@ -7,7 +7,7 @@ You can share parts of a secret with multiple people, so only some of them need
Install `ssss`, then decide on the total number of secrets (`N`), and the threshold of people who must share their shard of the secret in order to reveal the secret.
```sh
```bash
N=5
T=3
FILE=secret.txt
@@ -17,7 +17,7 @@ Each shard is a line inside secret.txt.
Check it's working:
```sh
```bash
head -n $T $FILE | ssss-combine -t $T
tail -n $T $FILE | ssss-combine -t $T
```

View File

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

View File

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

View File

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

View File

@@ -1,11 +1,11 @@
---
title: "sqlite"
tags: [ "data" ]
tags: [ "Documentation", "data" ]
---
Work with a database:
```sh
```bash
sqlite3 "$FILE".sqlite3
```
Compress the database:

View File

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

View File

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

View File

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

View File

@@ -1,18 +1,18 @@
---
title: "timewarrior"
tags: [ "data", "tracking", "time", "timew" ]
title: "timew"
tags: [ "Documentation", "Data" ]
---
# Summaries
Try:
```sh
```bash
timew summary :yesterday
```
You can also use :week, :lastweek, :month, :quarter, :year, or a range such as:
```sh
```bash
timew summary today to tomorrow
timew today - tomorrow
2018-10-15T06:00 - 2018-10-17T06:00
@@ -22,7 +22,7 @@ Each of these can gain with the :ids tag.
# Basics
```sh
```bash
timew start
timew stop
timew continue
@@ -32,7 +32,7 @@ timew tags
And add ids with:
```sh
```bash
timew summary :ids
timew track 10am - 1pm timewarrior
timew track 1pm for 2h walk
@@ -42,50 +42,50 @@ timew track 1pm for 2h walk
First get ids.
```sh
```bash
timew summary :ids
```
Then if we're looking at task @2:
```sh
```bash
timew move @2 12:00
timew lengthen @2 3mins
```
```sh
```bash
time shorten @2 40mins
```
# Forgetting
```sh
```bash
timew start 1h ago @4
```
Or if your action actually had a break:
```sh
```bash
timew split @8
```
Or maybe not?
```sh
```bash
timew join @4 @8
timew @8 delete
```
Start at previous time
```sh
```bash
timew start 3pm 'Read chapter 12'
timew start 90mins ago 'Read chapter 12'
```
Cancel currently tracked time.
```sh
```bash
timew cancel
```
@@ -157,11 +157,11 @@ with:
# Fixing Errors
```sh
```bash
curl -O https://taskwarrior.org/download/timew-dbcorrection.py
```
```sh
```bash
python timew-dbcorrections.py
```

View File

@@ -1,11 +0,0 @@
---
title: "View Torrents"
tags: [ "data", "transmission", "torrenting" ]
---
```sh
transmission-show $file.torrent | less
```
`TRACKERS` shows where transmission will ask who has the torrent, but will probably be out of date.

View File

@@ -1,10 +1,10 @@
---
title: "w3m"
tags: [ "browsers" ]
tags: [ "Documentation", "browsers" ]
---
Open a search tab:
```sh
```bash
w3m ddg.gg
```
@@ -19,3 +19,4 @@ w3m ddg.gg
| T | new tab |
| { / } | switch tabs |
![w3m browser](/tapes/w3m.gif)

43
data/w3m.tape Normal file
View File

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

View File

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

View File

@@ -1,6 +1,6 @@
---
title: "Arch on a Raspberry Pi 4"
tags: [ "distros", "raspberry pi", "rpi" ]
tags: [ "Documentation", "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,13 +1,13 @@
---
title: "autologin"
tags: [ "distros", "arch" ]
tags: [ "Documentation", "Distros", "Arch" ]
---
# Automatic Login
Edit `/etc/systemd/system/getty@tty1.service.d/override.conf` by typing:
```sh
```bash
sudo systemctl edit getty@tty1
```

View File

@@ -1,21 +1,20 @@
---
title: "basic-install"
tags: [ "arch" ]
requires: [ "partitions", "time" ]
tags: [ "Documentation", "arch" ]
---
Keyboard layout changed.
```sh
```bash
ls /usr/share/kbd/keymaps/**/*.map.gz
```
```sh
```bash
loadkeys uk.map.gz
```
Check if boot mode is UEFI
```sh
```bash
ls /sys/firmware/efi/efivars
```
@@ -23,115 +22,115 @@ Without efivars, the system must boot with BIOS.
# Check network's up
```sh
```bash
ping archlinux.org
```
Set system clock properly
```sh
```bash
timedatectl set-ntp true
```
Check disks
```sh
```bash
lsblk
```
Make partition
```sh
```bash
parted -s /dev/sda mklabel gpt
```
```sh
```bash
parted -s /dev/sda mklabel msdos
```
```sh
```bash
parted -s /dev/sda mkpart primary ext4 512 100%
```
```sh
```bash
parted -s /dev/sda set 1 boot on
```
```sh
```bash
mkfs.ext4 /dev/sda1
```
Use pacstrap to get the base install.
```sh
```bash
mount /dev/sda1 /mnt/
```
```sh
```bash
pacstrap /mnt base base-devel vim linux linux-firmware
```
Make fstab notes for new system.
```sh
```bash
genfstab -U /mnt >> /mnt/etc/fstab
```
```sh
```bash
arch-chroot /mnt
```
```sh
```bash
echo 'en_GB.UTF-8' > /etc/default/locale
```
```sh
```bash
pacman -Sy networkmanager grub
```
For legacy:
```sh
```bash
grub-install --target=i386-pc /dev/sda
```
For EFI:
```sh
```bash
sudo pacman -S efibootmgr
```
```sh
```bash
mkdir /boot/efi
```
```sh
```bash
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --remmovable
```
```sh
```bash
grub-mkconfig -o /boot/grub/grub.cfg
```
set local time
```sh
```bash
ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
```
Find the desired locale's and uncomment them.
```sh
```bash
vi /etc/locale.gen
```
```sh
```bash
locale-gen
```
Make your keyboard changes permenent with:
```sh
```bash
vi /etc/vconsole.conf
```
@@ -140,13 +139,13 @@ unsure about this bit - is this name just for the loadkeys function?
Make a hostname
```sh
```bash
echo pc > /etc/hostname
```
Set hostnames for network, or at least your own.
```sh
```bash
vi /etc/hosts
```
@@ -160,27 +159,27 @@ If the system has a permanent IP address, it should be used instead of localhost
Ping some sites to make sure the network's working
```sh
```bash
passwd
```
```sh
```bash
exit
```
```sh
```bash
umount -R /mnt
```
Remove that awful beep sound:
```sh
```bash
rmmod pcspkr
```
...and make the change permanent:
```sh
```bash
sudo echo "blacklist pcspkr" >> /etc/modprobe.d/nobeep.conf
```

View File

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

View File

@@ -1,6 +1,6 @@
---
title: "Ach Linux GPU Setup"
tags: [ "arch", "GPU" ]
title: "fonts"
tags: [ "Documentation", "distros" ]
---
# Step 1: Multilib
@@ -13,7 +13,7 @@ Include = /etc/pacman.d/mirrorlist
And update:
```sh
```bash
sudo pacman -Syu
```
@@ -21,7 +21,7 @@ sudo pacman -Syu
Check your graphics card type:
```sh
```bash
lspci | grep VGA
```
@@ -31,7 +31,7 @@ lspci | grep VGA
If you see `Nvidia`, then install the intel drivers:
```sh
```bash
sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader
```
@@ -39,7 +39,7 @@ sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-lo
If you see `Intel`, then install the intel drivers:
```sh
```bash
sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-intel
```
@@ -47,16 +47,17 @@ sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-lo
If you see `AMD`, then check your card support `vulkan`:
```sh
```bash
yay -S gpu-viewer
```
```sh
```bash
vulkaninfo | grep 'VkPhysicalDeviceVulkanMemoryModelFeatures' -A 3
```
You should see 'true' here.
```sh
```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,53 +0,0 @@
---
title: "Maintenance"
tags: [ "arch" ]
---
# Package Cache
Clean the cache of old packages in `/var/cachepacman/pkg/`:
```sh
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):
```sh
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.
```sh
sudo find /etc/ /var/ /usr/ -name "*.pacnew"
diff /etc/pacman.d/mirrorlist*
```
Either,
- Update the files manually,
```sh
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`.
```sh
sudo pacman -S pacman-contrib
sudo pacdiff
```

View File

@@ -1,19 +1,19 @@
---
title: "pacman"
tags: [ "distros" ]
tags: [ "Documentation", "distros" ]
---
Packages are kept in /var/cache/pacman/pkg.
Delete unused old packages with:
```sh
```bash
sudo pacman -Sc
```
Signatures are handled by the pacman-key, initially set up with:
```sh
```bash
sudo pacman-key --populate archlinux
```
@@ -23,31 +23,31 @@ sudo pacman-key --refresh-keys
If you have usigned keys, you can refresh with:
```sh
```bash
sudo pacman -Sc
```
or
```sh
```bash
sudo pacman -Scc
```
Reset all keys with:
```sh
```bash
sudo rm -r /etc/pacmand.d/gnupg/ && sudo pacman-key --init
```
If you're constantly getting 'everything corrupted, nothing upgraded', try running:
```sh
```bash
sudo pacman -S archlinux-keyring
```
List all orphaned packages:
```sh
```bash
sudo pacman -Qtdq
```

View File

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

View File

@@ -7,24 +7,24 @@ To automatically stick the logo onto your background, do these commands in the d
Get the void linux logo from wikipedia
```sh
```bash
wget https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Void_Linux_logo.svg/256px-Void_Linux_logo.svg.png?20170131170632
```
Rename it, and resize it (the standard size is too small for most wallpapers)
```sh
```bash
convert -resize 200% '256px-Void_Linux_logo.svg.png?20170131170632' void-logo.png
```
Download a pretty wallpaper
```sh
```bash
wget http://wallpapercave.com/wp/Wlm9Gv0.jpg
```
Put the void logo on all *jpg and *png images
```sh
```bash
for x in *.jpg
do
composite -compose multiply -gravity Center void-logo.png "$x" "$x"

View File

@@ -1,24 +1,18 @@
---
title: "Aeroplane Mode in Void"
tags: [ "void" ]
tags: [ "Documentation", "Void" ]
---
Put your device in 'aeroplane' mode (e.g. where no trace of signal leaves it) by turning off Wi-Fi and blue-tooth.
```sh
su root
sv stop wpa_supplicant bluetoothd
```
> sudo sv stop wpa_supplicant bluetoothd
Find your device's name with `ip -color addr`.
Find your device's name with `ip a`.
If unsure, try this:
```sh
name=$(ip a | grep -Eo 'wlp\w{3}')
echo $name
```
> name=$(ip a | grep -Eo 'wlp\w{3}')
> echo $name
Then set that device down:
```sh
ip link set $name down
```
> sudo ip link set $name down

View File

@@ -1,11 +1,11 @@
---
title: "Void Autologin"
tags: [ "void" ]
tags: [ "Documentation", "Void" ]
---
Make the autologin service:
```sh
```bash
cp -R /etc/sv/agetty-tty1 /etc/sv/agetty-autologin-tty1
```

View File

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

View File

@@ -9,17 +9,16 @@ Jenkins is janky.
## Start
Start the service file.
```sh
su root
ln -s /etc/sv/jenkins /var/service
sv start jenkins
```bash
sudo ln -s /etc/sv/jenkins /var/service
sudo 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:
```sh
```bash
chpst -u jenkins java -jar /opt/jenkins/jenkins.war
```

View File

@@ -6,13 +6,13 @@ tags: [ "void", "locale" ]
Check the current locales:
```sh
```bash
locale -a
```
Add the languages you want by editing `/etc/default/libc-locales`, and uncommenting your choice:
```sh
```bash
#en_DK.UTF-8 UTF-8
#en_DK ISO-8859-1
en_GB.UTF-8 UTF-8
@@ -25,14 +25,13 @@ 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:
```sh
su root
xbps-reconfigure glibc-locales
```bash
sudo xbps-reconfigure glibc-locales
```
Finally, select your chosen locale by placing it in `/etc/locale.conf`.
```sh
```bash
echo "LC_ALL=en_GB.UTF-8
LANG=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8" > /etc/locale.conf
@@ -49,7 +48,7 @@ en_GB ISO-8859-1
Check your new locales are available:
```sh
```bash
locale -a
```

View File

@@ -1,18 +1,18 @@
---
title: "sv"
tags: [ "void" ]
tags: [ "Documentation", "Void" ]
---
# List Services
All possible services are in:
```sh
```bash
ls /etc/sv
```
The computer only uses those in /var/service, so symbolic links are made to start and stop services.
```sh
```bash
ls /var/service
```
@@ -20,13 +20,13 @@ ls /var/service
Enable the sshd service, so that ssh will work every time you boot up:
```sh
```bash
sudo ln -s /etc/sv/sshd /var/service
```
Then start the service:
```sh
```bash
sudo sv start sshd
```
@@ -34,19 +34,19 @@ sudo sv start sshd
Stop `mpd` with:
```sh
```bash
sudo sv stop mpd
```
And stop it automatically loading at startup with:
```sh
```bash
sudo rm /var/service/mpd
```
You can also just make a file called 'down':
```sh
```bash
sudo touch /var/service/mpd/down
```
@@ -63,7 +63,7 @@ If unsure, use `#!/bin/bash` as the first line. When Void Linux says `sh`, it m
Confirm the shell you'll use:
```sh
```bash
ls -l $(which sh)
```

View File

@@ -1,12 +1,12 @@
---
title: "Void Linux Basics"
tags: [ "void" ]
tags: [ "Documentation", "Void" ]
---
# Updates
Update all packages with
```sh
```bash
sudo xbps-install -Su
```
@@ -17,7 +17,7 @@ See [xbps](xbps.md) for more.
Void keeps *every* version of everything you install, so you can roll back to them.
Remove old packages with:
```sh
```bash
sudo xbps-remove -O
```
@@ -25,19 +25,19 @@ sudo xbps-remove -O
Old Void kernels are left on the boot partition. List them with:
```sh
```bash
vkpurge list
```
Remove one with:
```sh
```bash
vkpurge 2.8.2_4
```
Remove all but the latest with:
```sh
```bash
vkpurge rm all
```
@@ -48,7 +48,7 @@ You can change this number to change the screen brightness.
For an easy utility, install `brightnessctl`.
```sh
```bash
brightnessctl s 10%-
brightnessctl s 10%+
```
@@ -57,5 +57,5 @@ brightnessctl s 10%+
- [autologin](autologin.md)
- [services](sv.md)
- [wifi](../../networking/wpa_supplicant.md)
- [wifi](wpa_cli.md)

View File

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

View File

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

View File

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

View File

@@ -1,55 +1,57 @@
---
title: "xbps"
tags: [ "void" ]
tags: [ "Documentation", "Void" ]
---
## Search
Look for cowsay in the repository:
```sh
```bash
xbps-query --repository --search cowsay
```
Short version:
```sh
```bash
xbps-query -Rs cowsay
```
Search with regex:
```sh
```bash
xbps-query --regex -Rs 'cow(s)?\w'
```
![xbps searches](/tapes/xbps-query.gif)
List what's required for cowsay
```sh
```bash
xbps-query -x cowsay
```
What packages are orphaned (i.e. installed as a dependency for another package, which has since been removed)?
```sh
```bash
xbps-query -O
```
Show cowsay's dependencies.
```sh
```bash
xbps-query -x cowsay
```
This shows `perl`.
To see what else depends on perl:
```sh
```bash
xbps-query -X perl
```
List all manually installed software.
```sh
```bash
xbps-query -m
```
@@ -57,56 +59,60 @@ xbps-query -m
Install cowsay
```sh
```bash
xbps-install cowsay
```
Upgrade current packages.
`-R` looks at repositories, `-s` makes a sloppy search (for rough matches).
```sh
```bash
xbps-install -Suv
```
![xbps searches](/tapes/xbps-install.gif)
## Remove/ Uninstall
Remove cowsay
```sh
```bash
xbps-remove cowsay
```
...and all dependencies
```sh
```bash
xbps-remove -R cowsay
```
Remove all orphaned dependencies.
```sh
```bash
xbps-remove -o
```
Show information about cowsay
![xbps searches](/tapes/xbps-remove.gif)
## Fixes
Reinstall cowsay
```sh
```bash
xbps-install -f cowsay
```
Look for broken packages.
```sh
```bash
sudo xbps-pkgdb -a
```
And if you've found any, you might reconfigure all packages forcefully:
```sh
```bash
sudo xbps-reconfigure -af
```

View File

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

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