Compare commits

...

51 Commits

Author SHA1 Message Date
a6907d7a91
Merge branch 'master' into vhs 2024-06-02 05:27:58 +02:00
6d44a44d0d
expand making torrents 2024-05-29 17:09:10 +02:00
60c5cd829e
rename void locale 2024-05-26 16:00:18 +02:00
df53667f91
typo 2024-05-14 18:32:28 +02:00
a710375f82
rename grapheasy network-graph 2024-05-13 22:17:24 +02:00
51e489a8e3
note sharding secrets 2024-05-13 20:19:33 +02:00
d4ca81c2ae
note monitoring basics 2024-04-30 16:44:38 +02:00
ae1e0ad726
remove old scripts 2024-04-30 16:28:50 +02:00
fc085dbb1e
formatting 2024-04-19 17:28:37 +02:00
2ab863d88f
more games 2024-04-19 17:27:08 +02:00
55d5862b10
note making easy pdfs 2024-04-10 23:42:21 +02:00
531cb8da3d
note vim-gnupg 2024-04-07 18:20:42 +02:00
09f3afa35b
edit radicale 2024-04-07 12:38:33 +02:00
e0e403fc96
write eval 2024-04-07 11:52:24 +02:00
72d624ec95
write git hooks 2024-04-06 02:00:18 +02:00
5b3a12d628
place git in dir 2024-04-06 01:25:01 +02:00
f666ac3dc9
tree to markdown command 2024-04-06 01:04:43 +02:00
38bcdd15cc
embiggen cron 2024-03-22 18:58:20 +01:00
54a9444544
split otr from profanity 2024-03-08 23:29:28 +01:00
b8a9fb3fbf
more journalctl checks 2024-02-28 18:45:21 +01:00
ce3e10e442
fix journal command 2024-02-28 18:36:56 +01:00
e4beb16951
add over the wire games 2024-02-27 18:47:53 +01:00
3f98db3d3a
Merge branch 'dev' into vhs 2023-12-02 03:10:14 +01:00
e77d0676cf
fix void locale notes 2023-12-02 03:09:31 +01:00
c6e673f1b0
add cron symlink 2023-10-18 23:25:59 +02:00
772f642679
add keyserver list 2023-10-18 23:25:54 +02:00
69d6c1ab53
syntax 2023-10-18 23:14:09 +02:00
6525ad85ad
add tree 2023-10-17 19:04:59 +02:00
ad9054c212
add void locales 2023-10-15 13:36:47 +02:00
93a48fded8
write basic ssh 2023-09-27 02:18:40 +02:00
c4313277e8
write ls 2023-09-27 02:18:31 +02:00
aac3df9997
add email 2023-09-25 20:20:00 +02:00
c732d7d18d
vim in bash 2023-09-25 00:11:09 +02:00
17b90a54cb
Merge branch 'dev' into vhs 2023-09-23 09:29:51 +02:00
b24a330f7a
add radicale with nginx 2023-09-21 02:01:24 +02:00
0fc1f58d24
add calcurse holidays 2023-09-21 01:53:32 +02:00
ff3a3d2556
spelling 2023-09-18 23:44:39 +02:00
6557ec6ebe
remove dead link 2023-09-18 23:44:29 +02:00
912eeb478b
place posix shell warnings 2023-09-16 18:10:13 +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
aa34b8b6e8
yes yes yes yes 2023-09-14 18:59:50 +02:00
fac575fc59
add void wallpaper nonsense 2023-09-10 18:22:18 +02:00
b7fa4ab8c7
edit bash_tricks 2023-09-08 19:11:08 +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
6f54bad403
add lf documentation 2023-09-04 20:29:06 +02:00
c1aff83d3e
remove old vnc file 2023-09-04 19:37:26 +02:00
92f90b51f7
Merge branch 'dev' into vhs 2023-09-04 19:24:52 +02:00
554eb989d5
add QR code info 2023-09-01 23:39:42 +02:00
47 changed files with 1143 additions and 474 deletions

View File

@ -26,6 +26,8 @@ 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.
---
### Closing
Introductory documents should show anything required to cleanly uninstall a program, without leaving bulky configuration files behind.
@ -52,6 +54,8 @@ Non-commands (e.g. output) should be shown as quoted text:
> Mail kn
> Projects music
---
# Example
```
@ -61,9 +65,9 @@ How to see which websites you're actively accessing:
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
> 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
```

View File

@ -14,20 +14,31 @@ Once installed, search for the service name, and start it.
```bash
sudo systemctl list-unit-files | grep cron
sudo systemctl enable --now $NAME
```
Make a file for your crontab, like this:
```bash
sudo systemctl enable --now cron
echo '39 */3 * * * /usr/bin/updatedb' > "$USER".cron
```
You can *e*dit your crontab with:
Then apply that crontab:
```bash
crontab -e
crontab "$USER".cron
rm "$USER".cron
```
The `cron` program will check your syntax before adding the tab.
Your crontab file sits somewhere in `/var/spool/`.
Probably in `/var/spool/cron`.
> 39 */3 * * * /usr/bin/updatedb
Check how your tab currently looks:
```bash
crontab -l
```
## Syntax
@ -91,7 +102,7 @@ run-parts /etc/cron.hourly
### Variables
Add your `$HOME` to crontab to use scripts.
First add `HOME=/home/user`, then you can use syntax like this:
First add `HOME=/home/$USER`, then you can use syntax like this:
0 * * * * $HOME/.scripts/myScript.sh
@ -100,7 +111,6 @@ First add `HOME=/home/user`, then you can use syntax like this:
```bash
$HOME/.scripts/myScript.sh
```
You can also add your regular path to your crontab as a variable (see example below).
If you're using vim as the editor, just run this at the top of your crontab:
@ -131,5 +141,3 @@ PATH=/usr/condabin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/u
50 18 * * * /usr/bin/timeout 30m /usr/bin/syncthing
```

22
basics/eval.md Normal file
View File

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

11
basics/games.md Normal file
View File

@ -0,0 +1,11 @@
---
title: "bash games"
tags: [ "Documentation", "Games" ]
---
Games are a great way to learn bash.
- `mapscii.me` is an interactive terminal map.
1. Install telnet.
1. `telnet mapscii.me`
- [Over the Wire](https://overthewire.org/wargames) teaches bash with small challenging you can do over `ssh`.

46
basics/ls.md Normal file
View File

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

36
basics/tree.md Normal file
View File

@ -0,0 +1,36 @@
---
title: "tree"
tags: [ "basics", "tree", "markdown" ]
---
The `tree` utility outputs a full listing of everything in your current directory, and those below.
- Just directories: `tree -d`
- Output colour to `less`: `tree -C --info | less -re`
- Ignore files in the `.gitignore` file: `tree --gitignore`
You can place information about the files in a directory to use with the `tree --info` option, like this:
```
config
Config files.
This is a git submodule.
README.md
Summary of the git.
*.jpg
Little picture, does not display
words well.
```
Each description-line starts with a tab.
## Markdown Conversion
To represent a file structure as a nested series of markdown lists, you can try this horrifying `sed` one-liner:
```bash
tree -tf --dirsfirst --gitignore --noreport --charset ascii | \
sed -e 's/| \+/ /g' \
-e 's/[|`]-\+/ */g' \
-e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g'
```

View File

@ -1,3 +1,5 @@
Require cmus
Type "whereis cmus"
Enter
Sleep 1s

24
basics/yes.md Normal file
View File

@ -0,0 +1,24 @@
---
title: "yes"
tags: [ "basics" ]
---
# The Best Linux Program: `yes`
The program `yes` prints the word `yes` to your terminal until you cancel it, perhaps with 'Control + c'.
Or technically it prints `yes\n`, meaning `yes` and then a new line (like pressing the Return key).
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.
```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.
```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: [ "Documentation", "Chat" ]
tags: [ "Documentation", "Chat", "omemo" ]
---
# Setup (Commands)
@ -140,54 +140,6 @@ You can ensure omemo automatcally turns on:
```
/omemo policy automatic
```
---
## otr
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
```
'OTR' encryption is mostly dead, but you can find the old instructions [here](profanity-otr).

9
data/calcurse.md Normal file
View File

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

73
data/email.md Normal file
View File

@ -0,0 +1,73 @@
---
title: "e-mail"
tags: [ "data", "smtp" ]
---
This is bare-bones, original, primitive e-mail.
Install `opensmtpd` (or similar), then `ncat` or `nc` or `netcat` (this mysterious cat has many names).
Start the `opensmtpd` service, then use netcat to speak with the mail-daemon:
```
nc localhost 25
```
The computer should respond with code `220`, which means 'I am listening'.
> 220 hex ESMTP OpenSMTPD
```
HELO gmail.com
```
You say `HELO` and say where you are coming from.
The `smtpd` will not check, so I am going to lie to it.
Mail servers are easily impressed, so it will be pleased to meet you.
> 250 hex Hello gmail.com [::1], pleased to meet you
```
MAIL FROM: <admin@gmail.com>
```
All the mail commands start with 4 bytes, because it's easier for admins to program.
Tell the mail daemon who you are in this format.
> 250 2.0.0 Ok
Then tell it who you're sending to.
```
RCPT TO: <www@dmz.rs>
```
> 250 2.1.5 Destination address valid: Recipient ok
Finally, tell it that you want to send `DATA`.
```
DATA
```
> 354 Enter mail, end with "." on a line by itself
```
Subject: turn off server please
very urgent
.
```
> 250 2.0.0 73864a49 Message accepted for delivery
You will find the email under `/var/spool` or `/var/mail` or similar.
If unsure, just take a part of your email, like `FRAGMENT="turn off server please"`, then `grep` for it:
```bash
sudo grep -r $FRAGMENT /var/spool/*
```

29
data/git/hooks.md Normal file
View File

@ -0,0 +1,29 @@
---
title: "git hooks"
tags: [ "Documentation", "data", "git" ]
---
Check out the sample hooks:
```bash
cd $GIT_REPO
ls .git/hooks
head .git/hooks/pre-commit.sample
```
Add a hook to check the shell scripts in `$GIT_REPO` before making a commit:
```bash
echo '#!/bin/sh
shellcheck *.sh' > .git/hooks/commit-msg
chmod u+x .git/hooks/commit-msg
```
## Committing
Your `git hooks` will not enter the repository, but you can commit them to a repository, then request others add these git hooks to their own branch, by putting a note in the project's `README.md`.
```markdown
The project comes with recommended git hooks.
You can activate the hooks with `git config core.hooksPath hooks`.
```

View File

@ -1,119 +1,7 @@
---
title: "gpg"
tags: [ "Documentation", "data" ]
tags: [ "Documentation", "data", "GPG" ]
---
# Making keys
Generate keys:
```bash
gpg --gen-key
```
Follow the guide.
# Encrypting a file
```bash
gpg -r malinfreeborn@posteo.net -e file
```
`-r` specifies the recipient.
Check you have an encrypted version of your file.
# Changing Expiration Dates
gpg --list-keys
... and then use the second part of 'pub', which is the ID. But that's not appearing here so... on with gpg2?
# Making encrypted files with a local password
Make a password with a password (cypher encryption).
```bash
gpg -c --output passwords.txt
```
or
```bash
gpg -c > passwords.txt
```
Put in a password.
Write message then stop with Ctrl+d.
Get the message back out the file with:
```bash
gpg -d passwords.txt
```
# Circles of Trust
Search for a key at any key store:
```bash
gpg --search-keys nestorv
```
Once you've made a decision about someone:
```bash
gpg --list-keys
```
You get something like this:
```
pub rsa3072 2021-08-15 [SC] [expires: 2023-08-15]
CD30421FD825696BD95F1FF644C62C57B790D3CF
uid [ultimate] Malin Freeborn <malinfreeborn@posteo.net>
sub rsa3072 2021-08-15 [E] [expires: 2023-08-15]
```
Notice the long, ugly, string - CD30421FD825696BD95F1FF644C62C57B790D3CF - and how horribly ugly it is.
This is a fingerprint.
You can now decide the trust level (this stays on your computer).
```bash
gpg --edit-key *CD30421FD825696BD95F1FF644C62C57B790D3CF*
```
Once you're in the interface, type `trust`.
```bash
gpg --sign-key alice@posteo.net
```
Then send those trusted keys up to a server, so people can see you have verified them:
```bash
gpg --send-keys *024C6B1C84449BD1CB4DF7A152295D2377F4D70F*
```
# Refresh Keys
```bash
gpg --refresh-keys
```
# Export
Your public key:
```bash
gpg --output *me*.gpg --armor --export
```
or
```bash
gpg --export -a *person@email.tld* > *my_key*.pub
```
- [Setup](gpg/basics.md)
- [Extras](gpg/extras.md)

141
data/gpg/basics.md Normal file
View File

@ -0,0 +1,141 @@
---
title: "GPG Basics"
tags: [ "Documentation", "data", "GPG" ]
---
# Making keys
Generate keys:
```bash
gpg --gen-key
```
Follow the guide.
# Encrypting a file
```bash
gpg -r malinfreeborn@posteo.net -e file
```
`-r` specifies the recipient.
Check you have an encrypted version of your file.
# Changing Expiration Dates
gpg --list-keys
... and then use the second part of 'pub', which is the ID. But that's not appearing here so... on with gpg2?
# Making encrypted files with a local password
Make a password with a password (cypher encryption).
```bash
gpg -c --output passwords.txt
```
or
```bash
gpg -c > passwords.txt
```
Put in a password.
Write message then stop with Ctrl+d.
Get the message back out the file with:
```bash
gpg -d passwords.txt
```
# Circles of Trust
Search for a key at any key store:
```bash
gpg --search-keys nestorv
```
Once you've made a decision about someone:
```bash
gpg --list-keys
```
You get something like this:
```
pub rsa3072 2021-08-15 [SC] [expires: 2023-08-15]
CD30421FD825696BD95F1FF644C62C57B790D3CF
uid [ultimate] Malin Freeborn <malinfreeborn@posteo.net>
sub rsa3072 2021-08-15 [E] [expires: 2023-08-15]
```
Notice the long, ugly, string - CD30421FD825696BD95F1FF644C62C57B790D3CF - and how horribly ugly it is.
This is a fingerprint.
You can now decide the trust level (this stays on your computer).
```bash
gpg --edit-key CD30421FD825696BD95F1FF644C62C57B790D3CF
```
Once you're in the interface, type `trust`.
```bash
gpg --sign-key alice@posteo.net
```
# Swapping Keys
This system relies on a ring of people swapping key information.
## Sending
Send those trusted keys up to a server, so people can see you have verified them:
```bash
gpg --send-keys 024C6B1C84449BD1CB4DF7A152295D2377F4D70F
```
## Upload Your Keys
## Add More Key Servers
Key servers often swap keys, but it's best to just send to multiple places immediately.
You can add key servers by adding this to `~/.gnupg/gpg.conf`.
```
keyserver hkps://keys.openpgp.org
keyserver hkps://mail-api.proton.me
keyserver hkps://keys.mailvelope.com
```
# Refresh Keys
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).
```bash
gpg --refresh-keys
```
You can use the [crontab](../basics/cron.md) to refresh keys.
# Export
Your public key:
```bash
gpg --output me.gpg --armor --export
```
Alternatively:
```bash
gpg --export -a person@email.tld > my_key.pub
```

10
data/gpg/extras.md Normal file
View File

@ -0,0 +1,10 @@
---
title: "gpg"
tags: [ "Documentation", "vim", "data", "GPG" ]
---
The `vim-gnupg` plugin lets vim edit gpg-encrypted files as if they were unencrypted.
It's probably in your package manager.
If not, you'll need to endure the faff of following the [instructions](http://www.vim.org/scripts/script.php?script_id=3645).

122
data/radicale.md Normal file
View File

@ -0,0 +1,122 @@
---
title: "radicale and nginx"
tags: [ "data", "calendar" ]
---
Check before you start:
- you have a normally running site on nginx already.
- your server has the directory `/etc/nginx/sites-enabled/` enabled in the nginx config.
## Installation and Service
Install `radicale` through your package manager (not `pip`).
The standard `radicale` package should come with a nice `systemd` service file.
If the service comes already-started, stop it immediately:
```bash
sudo systemctl stop radicale
```
## Set up Passwords
Edit `/etc/radicale/config`, changing the `[auth]` section from this:
```
#type = none
```
...to this:
```
type = htpasswd
```
Make sure the service is off, as people may be able to sign in without a password at this point.
Next, find the `htpasswd` program.
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`.
```bash
PASS="$(xkcdpass)"
htpasswd -nb $USER "$PASS" | sudo tee -a /etc/radicale/users
echo "Your username is $USER"
echo "Your password is $PASS"
```
Right now, you can't sign into the server except through the localhost, which is pointless.
So now we add a subdomain to `nginx`.
```nginx
echo '
server {
if ($host = cal.DOMAIN) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name cal.DOMAIN;
location / {
proxy_pass http://localhost:5232;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name cal.DOMAIN;
ssl_certificate /etc/letsencrypt/live/cal.DOMAIN/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/cal.DOMAIN/privkey.pem; # managed by Certbot
location / {
proxy_pass http://localhost:5232;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
' > /etc/nginx/sites-available/radicale
sudo ln -s /etc/nginx/sites-available/radicale /etc/nginx/sites-enables/
```
Finally, replace the example `DOMAIN` with your actual domain name.
```bash
DOMAIN=whatever.com
sudo sed -i "s/DOMAIN/$DOMAIN/g" /etc/nginx/sites-available/radicale
```
(optional: replace that `cal.` prefix with anything else)
Check nginx is happy:
```bash
sudo nginx -t
```
You will almost certainly need a new SSL certificate for the site:
```bash
sudo certbod -d cal.$DOMAIN
```
Start or restart both services:
```bash
sudo systemctl start radicale
sudo systemctl restart nginx
```
You should now be able to log into your calendar, and add it to a phone.
**NB:** you don't need the port number.

23
data/sharing_secrets.md Normal file
View File

@ -0,0 +1,23 @@
---
title: "Sharing Secrets"
tags: [ "data", "death", "secrets", "ssss" ]
---
You can share parts of a secret with multiple people, so only some of them need to agree to see the secret.
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.
```bash
N=5
T=3
FILE=secret.txt
fortune | ssss-split -t $T -n $N > $FILE
```
Each shard is a line inside secret.txt.
Check it's working:
```bash
head -n $T $FILE | ssss-combine -t $T
tail -n $T $FILE | ssss-combine -t $T
```

21
data/sqlite.md Normal file
View File

@ -0,0 +1,21 @@
---
title: "sqlite"
tags: [ "Documentation", "data" ]
---
Work with a database:
```bash
sqlite3 "$FILE".sqlite3
```
Compress the database:
```sqlite
pragma vacuum;
```
Optimize the database:
```sqlite
pragma optimize;
```

View File

@ -1,3 +1,5 @@
Require w3m
Sleep 1s
Type "w3m ddg.gg"
Sleep 500ms
@ -39,4 +41,3 @@ Type " "
Sleep 2s
Type "qy"
Sleep 500ms
Ctrl+D

View File

@ -1,57 +0,0 @@
#!/bin/bash
# https://www.unixmen.com/install-arch-linux-raspberry-pi/
pacman-key --init || echo init fail >> log
pacman-key --populate archlinuxarm || echo update fail >> log
pacman -Syyuu || echo update fail >> log
sed -i s/#en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/ /etc/locale.gen
echo 'LANG=en_GB.UTF-8' >> /etc/locale.conf
locale-gen
pacman -S base-devel htop ranger tmux lolcat fortune-mod git figlet rxvt-unicode task timew calcurse fail2ban
# texlive-most
if [[ $2 == all || $1 == all ]]; then
pacman -S nnn feh dmenu rofi xf86-video-fbdev xorg xorg-xinit xorg-server xorg-server-utils xterm
fi
# Audio
echo 'dtparam=audio=on' >> /boot/config.txt
if [[ $1 == audio ]]; then
pacman -S alsa-utils alsa-firmware alsa-lib alsa-plugins
fi
echo 'device_tree_param=spi=on' >> /boot/config.txt
# for a vnc viewer
if [[ $1 == vnc ]]; then
tigervnc gcc geany i3 i3status compton feh sxiv rxvt-unicode
fi
# Swap
cd /var/cache/swap
dd if=/dev/zero of=swapfile bs=1K count=2M
chmod 600 swapfile
mkswap swapfile
swapon swapfile
echo "/var/cache/swap/swapfile none swap sw 0 0" > /etc/fstab
# fail2ban
[ -e sshd.local ] && \
pacman -S fail2ban && \
mv sshd.local /etc/fail2ban/jail.d && \
systemctl start fail2ban
# If it won't reboot, install `arch-install-scripts` then try again and firstly:
# genfstab / > /etc/fstab

View File

@ -1,9 +0,0 @@
#!/bin/sh
pacman -S gitea postgresql
sudo su postgres -c 'initdb -D /var/lib/postgres/data'
sudo systemctl start postgresql
sudo su postgres -c 'createuser -P gitea'
sudo su postgres -c 'createdb -O gitea gitea'
sudo sed -i 's/mysql/postgres/' /etc/gitea/app.ini
sudo sed -i 's/root/gitea/' /etc/gitea/app.ini
sudo systemctl start gitea

View File

@ -1,79 +0,0 @@
#!/bin/bash
set -e
yay -S pi-hole-ftl pi-hole-server
# Configuration in /etc/pihole/pihole-FTL.db
# You can change DBINTERVAL to 60 or more to limit writes to disk
sudo systemctl disable --now systemd-resolved
sudo systemctl enable --now pihole-FTL
pihole -g
pihole -c
if [ "$1" == "unbound" ]; then
sudo pacman -S unbound
sudo cp /etc/unbound/unbound.conf /etc/unbound/unbound.conf.old
echo "server:
# If no logfile is specified, syslog is used
# logfile: "/var/log/unbound/unbound.log"
verbosity: 0
interface: 127.0.0.1
port: 5335
do-ip4: yes
do-udp: yes
do-tcp: yes
# May be set to yes if you have IPv6 connectivity
do-ip6: no
# You want to leave this to no unless you have *native* IPv6. With 6to4 and
# Terredo tunnels your web browser should favor IPv4 for the same reasons
prefer-ip6: no
# Use this only when you downloaded the list of primary root servers!
# If you use the default dns-root-data package, unbound will find it automatically
#root-hints: "/var/lib/unbound/root.hints"
# Trust glue only if it is within the server's authority
harden-glue: yes
# Require DNSSEC data for trust-anchored zones, if such data is absent, the zone becomes BOGUS
harden-dnssec-stripped: yes
# Don't use Capitalization randomization as it known to cause DNSSEC issues sometimes
# see https://discourse.pi-hole.net/t/unbound-stubby-or-dnscrypt-proxy/9378 for further details
use-caps-for-id: no
# Reduce EDNS reassembly buffer size.
# Suggested by the unbound man page to reduce fragmentation reassembly problems
edns-buffer-size: 1472
# Perform prefetching of close to expired message cache entries
# This only applies to domains that have been frequently queried
prefetch: yes
# One thread should be sufficient, can be increased on beefy machines. In reality for most users running on small networks or on a single machine, it should be unnecessary to seek performance enhancement by increasing num-threads above 1.
num-threads: 1
# Ensure kernel buffer is large enough to not lose messages in traffic spikes
so-rcvbuf: 1m
# Ensure privacy of local IP ranges
private-address: 192.168.0.0/16
private-address: 169.254.0.0/16
private-address: 172.16.0.0/12
private-address: 10.0.0.0/8
private-address: fd00::/8
private-address: fe80::/10
" | sudo tee /etc/unbound.conf
echo "Make this the only pihole DNS: PIHOLE_DNS_1=127.0.0.1 in /etc/pihole/setupVars.conf"
fi

View File

@ -1,8 +0,0 @@
#!/bin/bash
flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak --user install flathub com.valvesoftware.Steam
flatpak run com.valvesoftware.Steam

View File

@ -1,10 +0,0 @@
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay -S perl-graph-easy signal-desktop sc-im ncpamixer xdg-utils-mimeo torrench
yay -S ttf-tengwar-annatar

View File

@ -0,0 +1,33 @@
---
title: "Brand Name Wallpaper"
tags: [ "void" ]
---
To automatically stick the logo onto your background, do these commands in the directory.
Get the void linux logo from wikipedia
```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)
```bash
convert -resize 200% '256px-Void_Linux_logo.svg.png?20170131170632' void-logo.png
```
Download a pretty wallpaper
```bash
wget http://wallpapercave.com/wp/Wlm9Gv0.jpg
```
Put the void logo on all *jpg and *png images
```bash
for x in *.jpg
do
composite -compose multiply -gravity Center void-logo.png "$x" "$x"
done
```

54
distros/void/locale.md Normal file
View File

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

View File

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

View File

@ -1,27 +0,0 @@
---
title: "pip"
tags: [ "Documentation", "Networking" ]
---
```
Searching does not work.
Install with:
```bash
pip install [ package ]
```
Upgrade all packages
```bash
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
```
# Troubleshooting
You may need a python3 package.
In this case, try:
```bash
pip3 install [ package ]

89
networking/ssh.md Normal file
View File

@ -0,0 +1,89 @@
---
title: "ssh"
tags: [ "networking" ]
---
# Basic `ssh`
Try out basic ssh by accessing `git.charm.sh`, without needing authentication:
```bash
ssh git.charm.sh
```
Start an ssh server to try it out.
The ssh server is sometimes in a package called `openssh`, and sometimes only in `openssh-server`.
Once it's installed, check it's working:
```bash
sudo systemctl status ssh
```
If that doesn't work, the service may be called `sshd`.
```bash
sudo systemctl status sshd
```
Then start that service:
```bash
sudo systemctl start sshd
```
Test it works by using ssh into your own system, from inside:
```bash
ssh $USER@localhost
```
Access the computer from another computer on the same local network by finding your computer's IP address.
```bash
ip address | grep inet
```
Here is mine:
> inet 127.0.0.1/8 scope host lo
>
> inet6 ::1/128 scope host noprefixroute
>
> inet 192.168.0.12/24 brd 192.168.0.255 scope global dynamic noprefixroute en
The first one starts `127`, which means it returns back to that computer (like `localhost`).
The second is an ipv6 address, which is too angelic for this world, and has yet to ascend.
The third will work from a remote computer.
```bash
ssh $USERNAME@IP_ADDRESS
```
Once you have that, generate some ssh keys:
```bash
ssh-keygen
```
Look at your keys:
```bash
ls ~/.ssh
```
You can share the one ending in `.pub` freely.
The other is secret.
Now send those keys to a remote computer:
```bash
ssh-copy-id $USERNAME@IP_ADDRESS
```
Now you can log in without a password.

View File

@ -136,3 +136,32 @@ Without the `--anonymize` flag, the torrent file output will have a 'created by'
- udp://explodie.org:6969/announce
- https://tracker.gbitt.info:443/announce
- http://tracker.gbitt.info:80/announce
## Verify
Add your torrent and notes its number:
```bash
transmission-remote -a "$file".torrent
transmission-remote -l
transmission-remote -t "$number" -i
```
The information in the last command shows that it's not verified, so you can verify with `-v`.
```bash
transmission-remote -t "$number" -v
```
If transmission cannot find it, then tell it where to find the torrent:
```bash
transmission-remote -t "$number" --find "$(pwd)"
```
...and of course, make sure the permissions allow transmission to see the target.
```bash
ls -ld "$file"
```

2
new.sh
View File

@ -14,7 +14,7 @@ filePath="$category/$(echo $name | sed 's/ /_/g').md"
tagsList="$(echo \"$category | sed 's#\/#", "#g')\""
[ -e "$filePath" ] && $EDITOR $filePath && exit 0
[ -e "$filePath" ] && $EDITOR "$filePath" && exit 0
echo "---
title: \"$name\"

View File

@ -1,6 +1,6 @@
---
title: "Terminal Tips"
tags: [ "Documentation", "System" ]
title: "bash tips"
tags: [ "Documentation", "Shell", "POSIX" ]
---
## Track Live Changes
@ -12,6 +12,11 @@ See changes in a directory, as it changes:
`watch -d ls *directory*`
Or use the `-g` flag to exit once the output changes.
This command will look at whether you're connected to the internet, and turn into a rainbow once the connection hits.
> watch -g ip address && clear && ip address | lolcat
## Automatic Renaming
There are a bunch of files:
@ -34,17 +39,19 @@ done
IFS is the field separator. This is required to denote the different files as marked by a new line, and not the spaces.
(Alternatively, just install `renameutils` and do `rename Column Alice *`)
## Arguments and Input
The `rm' program takes arguments, but not `stdin' from a keyboard, and therefore programs cannot pipe results into rm.
That said, we can sometimes pipe into rm with `xargs rm' to turn the stdin into an argument. For example, if we have a list of files called `list.txt' then we could use cat as so:
To fix this, use `xargs` to turn the stdin into an argument.
For example, if we have a list of files called `list.txt' then we could use cat as so:
```bash
cat list.txt | xargs rm
```
... *However*, this wouldn't work if spaces were included, as rm would take everything literally.
Of course if spaces are included in the file, you would have to account for that.
## Numbers
@ -60,6 +67,18 @@ Add number to variables with:
`((n--))` works identically.
### POSIX WARNING
The number commands above work in `bash`, but not in bare-ass POSIX shells, such as `dash`.
Instead, you might do:
```sh
x=2
x=$(( x +1 ))
x=$(( x*x ))
```
## Finding Duplicate Files
```bash
@ -71,3 +90,27 @@ find . -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 15
```bash
cat /dev/urandom | tr -cd [:alnum:] | dd bs=1 count=200 status=none && echo
```
## Temporary Working Directory
Try something out in a random directory in `/tmp` so the files will be deleted when you next shut down.
```bash
mktemp -d
```
That gives you a random directory to mess about in.
```bash
dir=$(mktemp -d)
for x in {A..Z}; do
fortune > "$dir"/chimpan-$x
done
cd $dir
```
### POSIX WARNING
These smart-brackets are a bash feature.
If you try to use `{A..Z}` in dash, it will think of this as a single item.

1
system/cron.md Symbolic link
View File

@ -0,0 +1 @@
../basics/cron.md

77
system/lf.md Normal file
View File

@ -0,0 +1,77 @@
---
title: "lf - The Light File Manager"
tags: [ "Documentation", "File Browser" ]
---
![lf](/tapes/lf.gif)
## Config File
If you don't have a `~/.config/lf/lfrc` file, you can probably find an example in `/usr/share/examples/lf`.
```bash
cp -r /usr/share/examples/lf ~/.config/
```
Go straight to root with two keys.
```bash
map g/ cd /
```
Have lf open a file with the default program when you press 'o', using the program `mimeo`.
```bash
map o &mimeo $f
```
Change that default text editor to look at the extension first.
```bash
cmd open ${{
case $(file --mime-type $f -b) in
application/x-sc) sc-im $fx;;
text/html) w3m $fx;;
text/*) $EDITOR $fx;;
video/*) nohup mpv $fx --really-quiet >/dev/null &;;
*) nohup $OPENER $fx >/dev/null &;;
esac
}}
```
The idea here is to use the default `$OPENER` for lf, but first check extensions.
Note the extra `mpv` commands to leave the video to play, without blocking the terminal.
### Interesting Options
You can set the screen ratio with
`set ratios 1:2:3`
That leaves it as a small initial pane, a medium pane, and a large pane for file previews.
### Rename
The standard renaming is bad, because you have to re-type the file extension.
Use this instead:
```bash
# rename current file without overwrite
cmd rename %echo 'name: ' ; read name ; extension="${f##*.}" && newname="$name.$extension"; [ "$f" = "$extension" ] && newname="$name"; [ ! -e "$newname" ] && mv "$f" "$newname" || echo file exists
map r push :rename<enter>
```
If you try to rename `image_1.png` with this command, you can type in `cats`, and the result will be `cats.png`.
## Image Previews
First, install `ueberzug` (to show images).
Then clone the lfrun repo.
```bash
git clone https://github.com/cirala/lfimg.git
cd lfimg
sudo make install
```

24
system/lf.tape Normal file
View File

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

24
system/monitoring.md Normal file
View File

@ -0,0 +1,24 @@
---
title: "Monitoring"
tags: [ "Documentation", "System", "CPU", "Memory" ]
---
Print the average CPU load over 1 minute, 5 minutes, and 15 minutes:
```bash
watch -d cat /proc/loadavg
stress="$(cat /proc/loadavg | awk '{print "Usage:" $2"%"}')"
```
Show memory usage in Gibitytes.
```bash
free -g
```
Show low and high gigibtye usage on a *l*ine, and repeat the measurement every 5 seconds:
```bash
REP=5
free --lohi -g -s $REP | lolcat
```

View File

@ -2,6 +2,18 @@
title: "journal"
tags: [ "Documentation", "systemd" ]
---
See a running log of all system messages:
```bash
journalctl -f
```
Or just one unit (`sshd`):
```bash
journalctl -f -u sshd
```
Find errors since November
@ -14,3 +26,13 @@ Limit size to 2G.
```bash
journalctl --vacuum-size=2G
```
Log the fact that you've installed your own `dnsmasq` on your system to `journalctl`, so that you can notice why your system's broken:
```bash
logger "Installed new dnsmasq"
sudo journalctl -f
```

View File

@ -1,77 +0,0 @@
# Ubuntu
https://linuxconfig.org/vnc-server-on-ubuntu-18-04-bionic-beaver-linux
# On server
Enable remote desktop access.
```bash
sudo apt install vnc4server xfce4 xfce4-goodies
```
Disable the vncserver desktop:
```bash
vncserver -kill :1
```
Replace the config in ~/.vnc/xstartup with:
`#!/bin/bash`
`startxfce4 &`
# Arch
Install tigervnc, then run it to set a password:
```bash
vncserver
```
You'll get a session number.
Shut it down with the 'kill' command and the session's number:
```bash
vncserver -kill :1
```
This will forward over port 5900+x where x is the session number. For the first server, that's port 5901.
# Create a systemd service
```bash
sudo vim /etc/systemd/system/vncserver@:1.service
```
Then enter:
> [Unit]
> Description=Remote desktop service (VNC)
> After=syslog.target network.target
>
> [Service]
> Type=simple
> User=foo
> PAMName=login
> PIDFile=/home/%u/.vnc/%H%i.pid
> ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
> ExecStart=/usr/bin/vncserver %i -geometry 1440x900 -alwaysshared -fg
> ExecStop=/usr/bin/vncserver -kill %i
>
> [Install]
> WantedBy=multi-user.target
Then enable that service:
```bash
sudo systemctl start vncserver@:1.service
```

19
vim/vim_in_bash.md Normal file
View File

@ -0,0 +1,19 @@
---
title: "vim in bash"
tags: [ "vim", "bash", "inputrc" ]
---
Put bash in vim mode!
Place the following in your `~/.inputrc`:
```bash
set editing-mode vi
set show-mode-in-prompt on
set vi-ins-mode-string \1\e[33;32m\2[>]=\1\e[0m\2
set vi-cmd-mode-string \1\e[33;1m\2[?]=\1\e[0m\2
set keymap vi-insert
RETURN: "\e\n"
```

28
vision/QR_Codes.md Normal file
View File

@ -0,0 +1,28 @@
---
title: "QR Codes"
tags: [ "Documentation", "qrencode", "zbar" ]
---
Make a QR Code image:
```bash
qrencode 'https://play.google.com/store/apps/details?id=org.briarproject.briar.android' -o "$FILE".png
```
Make a QR Coded message in the terminal:
```bash
qrencode -t ansi "Hello World"
```
Read a QR Code image:
```bash
zbarimg $FILE
```
Show wifi QR code (only with Network Manager):
```bash
nmcli device wifi show-password
```

View File

@ -2,7 +2,6 @@
title: "imagemagick"
tags: [ "Documentation", "Vision" ]
---
[Source](http://lxlinux.com/imagemagick.html)
Convert jpg to png.
@ -41,13 +40,13 @@ convert image.jpg -resize 25% output.jpg
# Trim images to border
This is generally used for transparrent images.
This is generally used for transparent images.
```bash
convert -trim image.png output.png
```
Make the white of an image transparrent.
Make the white of an image transparent.
```bash
convert -transparent white -fuzz 10% input.png output.png
@ -101,7 +100,7 @@ See your installed fonts:
convert -list font
```
Make na image showing day of the week:
Make an image showing day of the week:
```bash
convert -fill blue -font Sauce-Code-Pro-Semibold-Nerd-Font-Complete-Mono -gravity center -pointsize 79 label:$(date +%A) day.png

21
vision/lowdown.md Normal file
View File

@ -0,0 +1,21 @@
---
title: "Markdown to PDF"
tags: [ "Documentation", "Markdown", "PDF", "Vision" ]
---
Turn a markdown file into a pdf:
```bash
lowdown -stms "$FILE".md | pdfroff -itk -mspdf > "$FILE".pdf
```
To give the document a title, put that title in the metadata:
```bash
sed -i "1 i---" "$FILE".md
sed -i "1 ititle: $TITLE" "$FILE".md
sed -i "1 i---" "$FILE".md
lowdown -L "$FILE".md
lowdown -X title "$FILE".md
lowdown -stms "$FILE".md | pdfroff -itk -mspdf > "$FILE".pdf
```

View File

@ -1,17 +0,0 @@
---
title: "qrencode"
tags: [ "Documentation", "vision" ]
---
Make a QR Code image:
```bash
qrencode 'https://play.google.com/store/apps/details?id=org.briarproject.briar.android' -o qr_briar.png
```
Make a QR Coded message in the terminal:
```bash
qrencode -t ansi "Hello World"
```