Compare commits

...

9 Commits

Author SHA1 Message Date
53eba915b3 explain shell-like writing in readme 2026-04-27 13:35:27 +02:00
6a33521f33 edit shell tips 2026-04-27 13:35:22 +02:00
319ae8df79 clean up old formatting 2026-04-27 13:13:22 +02:00
ea4f44e096 clean up networking 2026-04-27 12:59:27 +02:00
1994d9fbb3 move git cleanup 2026-04-27 12:41:06 +02:00
cc811fc025 edit virtualization setup 2026-04-27 12:34:26 +02:00
c2f72aed84 only ignore db.rec 2026-04-27 12:26:43 +02:00
2e305b3604 clean up cmd tags 2026-04-27 12:02:33 +02:00
b2ded0008c cmd: git request-pull 2026-04-27 12:01:22 +02:00
26 changed files with 98 additions and 248 deletions

View File

@@ -68,6 +68,7 @@ include cmd.mk
sed '/^%/d' $^ | recsel -G path | recsel -U >> $@ sed '/^%/d' $^ | recsel -G path | recsel -U >> $@
default += db.rec default += db.rec
ignored += db.rec
db.rec: command.rec .dbs/notes.rec db.rec: command.rec .dbs/notes.rec
recinf -d $< > $@ recinf -d $< > $@
echo '' >> $@ echo '' >> $@
@@ -75,7 +76,7 @@ db.rec: command.rec .dbs/notes.rec
$(info Making main database: $@) $(info Making main database: $@)
.git/info/exclude: $(default) .git/info/exclude: $(ignored)
@echo $^ | tr ' ' '\n' > $@ @echo $^ | tr ' ' '\n' > $@
default += .git/info/exclude default += .git/info/exclude

View File

@@ -38,11 +38,6 @@ The output is a couple of lines of code, with changeable components as variables
alias rrc='$PAGER "$(find . -maxdepth 2 -name "*rc" | fzf)"' alias rrc='$PAGER "$(find . -maxdepth 2 -name "*rc" | fzf)"'
``` ```
### Guides
The notes are mostly written like a heavily commented script.
Most are setup guides.
### The Function ### The Function
Running `make function` outputs a shell function which searches through this Running `make function` outputs a shell function which searches through this
@@ -133,6 +128,16 @@ grep ls --color=always $HISTFILE | $PAGER
Now we can see what can be changed. Now we can see what can be changed.
### Aim to Script
Guides should read like a heavily commented script, so CLI commands are preferred to GUI commands.
- Bad: '*edit the file `.config/tspreed/tspreed.rc` and change `focuscolor` to '2'.*'
- Good: `sed -i '/focuscolor/s/=1/=2/' ~/.config/tspreed/tspreed.rc`
* `cat !$`
Despite being 'script-like', interactive bash commands like `cat !$` are still fine just to show how to double-check results when setting things up interactively.
### Show, Don't Tell ### Show, Don't Tell
Articles should say what to type, not the output. Articles should say what to type, not the output.

View File

@@ -41,7 +41,7 @@ Check your `~/.config/profanity/profrc` for how to data's saved.
## Automatically Sign In ## Automatically Sign In
To automatically sign in, add your password to [pass](../data/pass.md). To automatically sign in, add your password to [pass](data/pass.md).
``` ```
/account set ${name}@${host} eval_password pass *xmpp* /account set ${name}@${host} eval_password pass *xmpp*

View File

@@ -115,7 +115,6 @@ bin: ntpd
tag: time tag: time
tag: system tag: system
aim: Check a service aim: Check a service
cmd: sudo systemctl status mpd cmd: sudo systemctl status mpd
shell: sh shell: sh
@@ -123,7 +122,6 @@ bin: systemd
tag: system tag: system
tag: service tag: service
aim: Recognize service changes aim: Recognize service changes
cmd: sudo systemctl daemon-reload cmd: sudo systemctl daemon-reload
shell: sh shell: sh
@@ -131,7 +129,6 @@ bin: systemd
tag: system tag: system
tag: service tag: service
aim: Start a service (it stops when the computer shuts down) aim: Start a service (it stops when the computer shuts down)
cmd: sudo systemctl taskd.service start cmd: sudo systemctl taskd.service start
+ sudo systemctl daemon-reload + sudo systemctl daemon-reload
@@ -140,7 +137,6 @@ bin: systemd
tag: system tag: system
tag: service tag: service
aim: Find out why the computer takes so long to start aim: Find out why the computer takes so long to start
cmd: sudo systemd-analyze cmd: sudo systemd-analyze
+ sudo systemd-analyze blame + sudo systemd-analyze blame
@@ -149,7 +145,6 @@ bin: systemd
tag: system tag: system
tag: boot tag: boot
aim: See what the computer is doing aim: See what the computer is doing
cmd: journalctl -f cmd: journalctl -f
shell: sh shell: sh
@@ -188,7 +183,6 @@ shell: sh
bin: journalctl bin: journalctl
tag: system tag: system
aim: Convert markdown table to csv aim: Convert markdown table to csv
cmd: mlr --imarkdown --ocsv cat ${file}.md cmd: mlr --imarkdown --ocsv cat ${file}.md
bin: mlr bin: mlr
@@ -359,7 +353,6 @@ tag: vision
tag: video tag: video
shell: sh shell: sh
aim: Convert video to audio aim: Convert video to audio
cmd: ffmpeg -i ${input}.mp4 -vn ${output}.mp3 cmd: ffmpeg -i ${input}.mp4 -vn ${output}.mp3
bin: ffmpeg bin: ffmpeg
@@ -375,7 +368,6 @@ bin: ffmpeg
tag: vision tag: vision
shell: sh shell: sh
aim: Change resolution aim: Change resolution
cmd: ffmpeg -i ${input}.mp4 -filter:v scale=1280:720 -c:a copy ${output}.mp4 cmd: ffmpeg -i ${input}.mp4 -filter:v scale=1280:720 -c:a copy ${output}.mp4
bin: ffmpeg bin: ffmpeg
@@ -453,3 +445,24 @@ tag: writing
tag: comfy tag: comfy
tag: dict tag: dict
shell: sh shell: sh
aim: Email a pull request which points to your git server
tag: git
bin: git
tag: email
tag: pr
cmd: repo=ssh://soft.dmz.rs:2222/mkdots/
+ theirHead='HEAD^^^^'
+ head=master
+ git request-pull "${theirHead}" "${repo}" "${head}"
note: You can note where your branch diverged from theirs with a commit hash,
+ or a relative position, like `HEAD^^` (e.g. 'two commits before your latest').
aim: Clean up a bloated git repo
cmd: git fsck --full
+ git gc --prune=now --aggressive
+ git repack
bin: git
tag: maintenance
shell: sh

View File

@@ -10,7 +10,7 @@ tags:
Combine many files and directories into a single t-archive file. Combine many files and directories into a single t-archive file.
```sh ```sh
tar cf "$ARCHIVE".tar $DIR tar cf "${archive}".tar ${dir}
``` ```
You can remember this with the mnemonic '*C*reate *F*ile'. You can remember this with the mnemonic '*C*reate *F*ile'.
@@ -18,13 +18,13 @@ Unfortunately, this stores the full file path, so making a tar archive of `/etc/
It's often better to tell tar which path to start from using the `-C` flag. It's often better to tell tar which path to start from using the `-C` flag.
```sh ```sh
tar cf "$ARCHIVE".tar -C /etc/ nginx tar cf "${archive}".tar -C /etc/ nginx
``` ```
Check the contents of your archive with: Check the contents of your archive with:
```sh ```sh
tar tf "$ARCHIVE".tar tar tf "${archive}".tar
``` ```
If you want to store 'everything in a directory', then using `*` will not work, because it will target everything in the *current* directory. If you want to store 'everything in a directory', then using `*` will not work, because it will target everything in the *current* directory.
@@ -33,7 +33,7 @@ Instead, you can store the target in a variable:
```sh ```sh
files=$(ls /etc/nginx) files=$(ls /etc/nginx)
tar cf "$ARCHIVE".tar -C /etc/nginx/ $file tar cf "${archive}".tar -C /etc/nginx/ $file
``` ```
# Extract # Extract
@@ -41,7 +41,7 @@ tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
Extract the tar archive with Extract the tar archive with
```sh ```sh
tar xf "$ARCHIVE".tar tar xf "${archive}".tar
``` ```
You can remember this with the mnemonic 'e*X*tract *F*ile'. You can remember this with the mnemonic 'e*X*tract *F*ile'.
@@ -51,7 +51,7 @@ You can remember this with the mnemonic 'e*X*tract *F*ile'.
Create a zip-compressed archive with the `z` flag. Create a zip-compressed archive with the `z` flag.
```sh ```sh
tar czf "$ARCHIVE".tgz -C /etc/nginx/ $file tar czf "${archive}".tgz -C /etc/nginx/ $file
``` ```
You can use any file ending you want, but sane people like to use '.tgz' or '.tar.tgz'. You can use any file ending you want, but sane people like to use '.tgz' or '.tar.tgz'.

View File

@@ -1,22 +0,0 @@
---
title: Clean up a bloated git repo
tags:
- data
- setup
requires:
- data/git.md
---
```sh
git fsck --full
```
```sh
git gc --prune=now --aggressive
```
```sh
git repack
```

View File

@@ -132,7 +132,7 @@ Refreshing keys will tell you if some key you have contains a signature from som
gpg --refresh-keys gpg --refresh-keys
``` ```
You can use the [crontab](../../system/cron.md) to refresh keys, but this will mostly fail, since keyservers often don't hold the right data. You can use the [crontab](system/cron.md) to refresh keys, but this will mostly fail, since keyservers often don't hold the right data.
# Export # Export

View File

@@ -8,7 +8,7 @@ requires:
- data/gpg.md - data/gpg.md
--- ---
Setup [gpg](gpg.md) keys. Setup [gpg](data/gpg.md) keys.
Show your gpg secret it: Show your gpg secret it:
@@ -19,28 +19,37 @@ gpg --list-secret-keys
Then use the id number under `sec` to make a pass repo: Then use the id number under `sec` to make a pass repo:
```sh ```sh
KEY="$(gpg --list-secret-keys | grep -m 1 -A1 '^sec' | tail -n 1)" key="$(gpg --list-secret-keys | grep -m 1 -A1 '^sec' | tail -n 1)"
``` ```
```sh ```sh
pass init $KEY pass init $key
cat .password-store/.gpg-id
``` ```
To add a basic password, e.g. for `$WEBSITE`: To add a basic password, e.g. for `${website}`:
```sh ```sh
pass $WEBSITE pass ${website}
``` ```
To insert a multi-line password, e.g. with a login name: To insert a multi-line password, e.g. with a login name:
```sh ```sh
pass add -m $WEBSITE pass add -m ${website}
``` ```
Remove a password: Remove a password:
```sh ```sh
pass rm $WEBSITE pass rm ${website}
``` ```
You can generate passwords with `xkcdpass`.
Automatically insert a password with `pass insert`:
```sh
xkcdpass | pass insert --echo ${website}
```

View File

@@ -44,10 +44,11 @@ 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`. `htpasswd` allows you to generate passwords for users, and place them in `/etc/radicale/users`.
```sh ```sh
PASS="$(xkcdpass)" pass="$(xkcdpass)"
htpasswd -nb $USER "$PASS" | sudo tee -a /etc/radicale/users username=alice
echo "Your username is $USER" htpasswd -nb ${username} "${pass}" | sudo tee -a /etc/radicale/users
echo "Your password is $PASS" echo "Your username is ${username}"
echo "Your password is ${pass}"
``` ```
Right now, you can't sign into the server except through the localhost, which is pointless. Right now, you can't sign into the server except through the localhost, which is pointless.
So now we add a subdomain to `nginx`. So now we add a subdomain to `nginx`.
@@ -97,8 +98,8 @@ sudo ln -s /etc/nginx/sites-available/radicale /etc/nginx/sites-enables/
Finally, replace the example `DOMAIN` with your actual domain name. Finally, replace the example `DOMAIN` with your actual domain name.
```sh ```sh
DOMAIN=whatever.com domain=whatever.com
sudo sed -i "s/DOMAIN/$DOMAIN/g" /etc/nginx/sites-available/radicale sudo sed -i "s/DOMAIN/${domain}/g" /etc/nginx/sites-available/radicale
``` ```
(optional: replace that `cal.` prefix with anything else) (optional: replace that `cal.` prefix with anything else)
@@ -111,7 +112,7 @@ sudo nginx -t
You will almost certainly need a new SSL certificate for the site: You will almost certainly need a new SSL certificate for the site:
```sh ```sh
sudo certbod -d cal.$DOMAIN sudo certbod -d cal.${domain}
``` ```
Start or restart both services: Start or restart both services:

View File

@@ -26,7 +26,7 @@ Once you have the database, you can find nearly any file instantly.
- Search for jpg images with 'dog' or 'Dog' in the name: `locate -i dog jpg` - 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$'` - Search for videos: `plocate --regex '.mp4$|.mkv$|.wmv$|.webm$|.mov$|.avi$'`
For best results, run `updatedb` regularly, perhaps in [crontab](../system/cron.md). For best results, run `updatedb` regularly, perhaps in [crontab](system/cron.md).
## Search More Places ## Search More Places

View File

@@ -41,7 +41,7 @@ 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). Put this file at `/etc/nginx/sites-enabled/$DOMAIN.tld`, then set up standard certificates with [nginx](networking/nginx.md).
(replace `${DOMAIN_NAME}` with your domain's name). (replace `${DOMAIN_NAME}` with your domain's name).

View File

@@ -58,5 +58,5 @@ brightnessctl s 10%+
- [autologin](autologin.md) - [autologin](autologin.md)
- [services](sv.md) - [services](sv.md)
- [wifi](../../networking/wpa_supplicant.md) - [wifi](networking/wpa_supplicant.md)

View File

@@ -3,9 +3,10 @@ title: printers
tags: tags:
- hardware - hardware
--- ---
# Cups: The Common Unix Printing System # Cups: The Common Unix Printing System
Configure cups at /etc/cups/supsd.conf, or visit the local webpage at http://localhost:631 if you want to use the Apple interface, otherwise, it's the printing daemon. Configure cups at `/etc/cups/supsd.conf`, or visit the local webpage at http://localhost:631 if you want to use the Apple interface, otherwise, it's the printing daemon.
# The Printing Daemon # The Printing Daemon

View File

@@ -3,6 +3,7 @@ title: rclone
tags: tags:
- networking - networking
- synch - synch
- backup
--- ---
The manpage's 'Synopsis' provides a fast reference. The manpage's 'Synopsis' provides a fast reference.
``` ```

View File

@@ -3,6 +3,7 @@ title: Download Website
tags: tags:
- networking - networking
- scraping - scraping
- web
--- ---
```sh ```sh

View File

@@ -2,29 +2,30 @@
title: Download videos title: Download videos
tags: tags:
- scraping - scraping
- video
--- ---
Install `yt-dlp`. Install `yt-dlp`.
```sh ```sh
yt-dlp --write-auto-sub *<URL>* yt-dlp --write-auto-sub ${url}
``` ```
It will default to English, but you can specify another language with the flag --sub-lang: It will default to English, but you can specify another language with the flag --sub-lang:
```sh ```sh
youtube-dl --sub-lang sv --write-auto-sub *<URL>* youtube-dl --sub-lang sv --write-auto-sub ${url}
``` ```
You can list all available subtitles with: You can list all available subtitles with:
```sh ```sh
yt-dlp --list-subs *<URL>* yt-dlp --list-subs ${url}
``` ```
It's also possible to skip the video and only download the subtitle if you add the flag --skip-download: It's also possible to skip the video and only download the subtitle if you add the flag --skip-download:
```sh ```sh
yt-dlp --sub-lang sv --write-auto-sub --skip-download *<URL>* yt-dlp --sub-lang sv --write-auto-sub --skip-download ${url}
``` ```
## Alternative ## Alternative

View File

@@ -33,6 +33,7 @@ Then start that service:
```sh ```sh
sudo systemctl start sshd sudo systemctl start sshd
``` ```
Test it works by using ssh into your own system, from inside: Test it works by using ssh into your own system, from inside:
@@ -77,6 +78,7 @@ Look at your keys:
```sh ```sh
ls ~/.ssh ls ~/.ssh
ls -l ~/.ssh
``` ```
You can share the one ending in `.pub` freely. You can share the one ending in `.pub` freely.
@@ -86,6 +88,7 @@ Now send those keys to a remote computer:
```sh ```sh
ssh-copy-id ${username}@{ip_address} ssh-copy-id ${username}@{ip_address}
ssh ${username}@{ip_address}
``` ```
Now you can log in without a password. Now you can log in without a password.

View File

@@ -1,94 +0,0 @@
---
title: network
tags:
- networking
---
# Netstat Stuff
Stats on local net usage within domain.
```sh
iftop -p -n
```
```sh
whois domain.com
```
Info on domain, whether it's taken, et c.:
```sh
dig domain.com
```
```sh
ifconfig
```
Versatile wifi tool:
```sh
nmcli
```
# Examples
You want to connect to the internet.
```sh
sudo iwconfig
```
Get knowledge of wireless state. The output might be:
> wlp3s0 IEEE 802.11 ESSID:"Gandalf WajFaj"
> Mode:Managed Frequency:2.412 GHz Access Point: 10:05:01:90:AC:1A
> Bit Rate=144.4 Mb/s Tx-Power=15 dBm
> Retry short limit:7 RTS thr:off Fragment thr:off
> Encryption key:off
> Power Management:on
> Link Quality=64/70 Signal level=-46 dBm
> Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag
> Tx excessive retries:0 Invalid misc:363 Missed beacon
This tells you that your ESSID is 'Gandalf WajFaj', and the access point name is 10:05:......
```sh
nmcli radio
```
You get an overview of your radio devices.
You're told that eth0 deals with your ethernet and `wlan0` deals with wifi.
`wlan0` is a file which represents your wifi device.
```sh
nmcli wlan0 wifi rescan
```
```sh
nmcli device wifi list
```
Now to connect.
```sh
nmcli device wifi connect [SSID] [your password] [wifi password]
```
Alternatively, you can use
```sh
nmcli -ask device wifi connect [SSID]
```
And it'll ask for your password, so you're not typing it in in full view.

View File

@@ -4,10 +4,6 @@ tags:
- networking - networking
- VPN - VPN
--- ---
<!--
from
https://engineerworkshop.com/blog/how-to-set-up-wireguard-on-a-raspberry-pi/
-->
## On Server ## On Server

View File

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

View File

@@ -22,6 +22,8 @@ ls -l file1 file2
cat !^ cat !^
``` ```
**NB:** this only works when running `bash` interactively, never in scripts.
# Done # Done
`<C-d>` `<C-d>`
@@ -29,9 +31,8 @@ cat !^
- If you have a command, Control + d will execute the command. - If you have a command, Control + d will execute the command.
- If you have nothing, `exit`. - If you have nothing, `exit`.
# Clear Search Highlights # Search & Clear Highlights
`<Esc>+u` You can search in many programs by using `/`.
Most programs let you clearn the highlighting with `<Esc>+u`.
Works in most programs with search.

View File

@@ -16,7 +16,7 @@ rdfind $dir
$EDITOR results.txt $EDITOR results.txt
``` ```
Replace the duplicated files with [hard links](../basics/hard_links.md). Replace the duplicated files with [hard links](system/hard_links.md).
```sh ```sh
rdfind -makehardlinks true $dir rdfind -makehardlinks true $dir

View File

@@ -5,7 +5,7 @@ tags:
- make - make
--- ---
Using the [basic example](../makefiles.md), you can make a complete backup of all backup files. Using the [basic example](system/makefiles.md), you can make a complete backup of all backup files.
This file will depend upon everything inside the `$(storage_directory)`. This file will depend upon everything inside the `$(storage_directory)`.
Unlike `bash`, you can't just say `storage_directory/*`: the pattern must be stated as a 'wildcard'. Unlike `bash`, you can't just say `storage_directory/*`: the pattern must be stated as a 'wildcard'.

View File

@@ -1,21 +1,19 @@
--- ---
title: Docker title: Setup Docker
tags: tags:
- documentation - documentation
- virtualization - setup
- containers
requires: requires:
- system/groups.md - system/groups.md
--- ---
Install docker, add your user to the docker group, and start the service.
```sh ```sh
sudo pacman -S docker sudo pacman -S docker
```
```sh
sudo usermod -aG docker $USER sudo usermod -aG docker $USER
``` sudo su $USER
```sh
sudo systemctl start docker sudo systemctl start docker
``` ```
@@ -69,9 +67,9 @@ docker rm 97796727e883
# Networking # Networking
Get a list of docker container ips Get a list of docker container IPs
```sh ```sh
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' *container_name_or_id* docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${name}
``` ```

View File

@@ -1,11 +1,12 @@
--- ---
title: virtualbox title: Setup Virtualbox
tags: tags:
- system - system
- setup
- virtualization
requires: requires:
- system/groups.md - system/groups.md
--- ---
# Setup
Load the modules (or just reboot): Load the modules (or just reboot):