Merge branch 'dev' into vhs

This commit is contained in:
Malin Freeborn 2023-12-02 03:10:14 +01:00
commit 3f98db3d3a
Signed by: andonome
GPG Key ID: 52295D2377F4D70F
8 changed files with 335 additions and 5 deletions

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

25
basics/tree.md Normal file
View File

@ -0,0 +1,25 @@
---
title: "tree"
tags: [ "basics" ]
---
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.

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/*
```

View File

@ -82,7 +82,7 @@ This is a fingerprint.
You can now decide the trust level (this stays on your computer). You can now decide the trust level (this stays on your computer).
```bash ```bash
gpg --edit-key *CD30421FD825696BD95F1FF644C62C57B790D3CF* gpg --edit-key CD30421FD825696BD95F1FF644C62C57B790D3CF
``` ```
Once you're in the interface, type `trust`. Once you're in the interface, type `trust`.
@ -91,29 +91,52 @@ Once you're in the interface, type `trust`.
gpg --sign-key alice@posteo.net gpg --sign-key alice@posteo.net
``` ```
Then send those trusted keys up to a server, so people can see you have verified them: # 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 ```bash
gpg --send-keys *024C6B1C84449BD1CB4DF7A152295D2377F4D70F* 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 # 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 ```bash
gpg --refresh-keys gpg --refresh-keys
``` ```
You can use the [crontab](../basics/cron.md) to refresh keys.
# Export # Export
Your public key: Your public key:
```bash ```bash
gpg --output *me*.gpg --armor --export gpg --output me.gpg --armor --export
``` ```
or or
```bash ```bash
gpg --export -a *person@email.tld* > *my_key*.pub gpg --export -a person@email.tld > my_key.pub
``` ```

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

@ -0,0 +1,54 @@
---
title: "locales"
tags: [ "void" ]
---
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
```

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.

1
system/cron.md Symbolic link
View File

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

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