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 >> $@
default += db.rec
ignored += db.rec
db.rec: command.rec .dbs/notes.rec
recinf -d $< > $@
echo '' >> $@
@@ -75,7 +76,7 @@ db.rec: command.rec .dbs/notes.rec
$(info Making main database: $@)
.git/info/exclude: $(default)
.git/info/exclude: $(ignored)
@echo $^ | tr ' ' '\n' > $@
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)"'
```
### Guides
The notes are mostly written like a heavily commented script.
Most are setup guides.
### The Function
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.
### 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
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
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*

View File

@@ -115,7 +115,6 @@ bin: ntpd
tag: time
tag: system
aim: Check a service
cmd: sudo systemctl status mpd
shell: sh
@@ -123,7 +122,6 @@ bin: systemd
tag: system
tag: service
aim: Recognize service changes
cmd: sudo systemctl daemon-reload
shell: sh
@@ -131,7 +129,6 @@ bin: systemd
tag: system
tag: service
aim: Start a service (it stops when the computer shuts down)
cmd: sudo systemctl taskd.service start
+ sudo systemctl daemon-reload
@@ -140,7 +137,6 @@ bin: systemd
tag: system
tag: service
aim: Find out why the computer takes so long to start
cmd: sudo systemd-analyze
+ sudo systemd-analyze blame
@@ -149,7 +145,6 @@ bin: systemd
tag: system
tag: boot
aim: See what the computer is doing
cmd: journalctl -f
shell: sh
@@ -188,7 +183,6 @@ shell: sh
bin: journalctl
tag: system
aim: Convert markdown table to csv
cmd: mlr --imarkdown --ocsv cat ${file}.md
bin: mlr
@@ -359,7 +353,6 @@ tag: vision
tag: video
shell: sh
aim: Convert video to audio
cmd: ffmpeg -i ${input}.mp4 -vn ${output}.mp3
bin: ffmpeg
@@ -375,7 +368,6 @@ bin: ffmpeg
tag: vision
shell: sh
aim: Change resolution
cmd: ffmpeg -i ${input}.mp4 -filter:v scale=1280:720 -c:a copy ${output}.mp4
bin: ffmpeg
@@ -453,3 +445,24 @@ tag: writing
tag: comfy
tag: dict
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.
```sh
tar cf "$ARCHIVE".tar $DIR
tar cf "${archive}".tar ${dir}
```
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.
```sh
tar cf "$ARCHIVE".tar -C /etc/ nginx
tar cf "${archive}".tar -C /etc/ nginx
```
Check the contents of your archive with:
```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.
@@ -33,7 +33,7 @@ Instead, you can store the target in a variable:
```sh
files=$(ls /etc/nginx)
tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
tar cf "${archive}".tar -C /etc/nginx/ $file
```
# Extract
@@ -41,7 +41,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'.
@@ -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.
```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'.

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

View File

@@ -8,7 +8,7 @@ requires:
- data/gpg.md
---
Setup [gpg](gpg.md) keys.
Setup [gpg](data/gpg.md) keys.
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:
```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
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
pass $WEBSITE
pass ${website}
```
To insert a multi-line password, e.g. with a login name:
```sh
pass add -m $WEBSITE
pass add -m ${website}
```
Remove a password:
```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`.
```sh
PASS="$(xkcdpass)"
htpasswd -nb $USER "$PASS" | sudo tee -a /etc/radicale/users
echo "Your username is $USER"
echo "Your password is $PASS"
pass="$(xkcdpass)"
username=alice
htpasswd -nb ${username} "${pass}" | sudo tee -a /etc/radicale/users
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.
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.
```sh
DOMAIN=whatever.com
sudo sed -i "s/DOMAIN/$DOMAIN/g" /etc/nginx/sites-available/radicale
domain=whatever.com
sudo sed -i "s/DOMAIN/${domain}/g" /etc/nginx/sites-available/radicale
```
(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:
```sh
sudo certbod -d cal.$DOMAIN
sudo certbod -d cal.${domain}
```
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 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

View File

@@ -41,7 +41,7 @@ git clone http://localhost:23232/${some_repo}.git
### `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).

View File

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

View File

@@ -3,9 +3,10 @@ title: printers
tags:
- hardware
---
# 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

View File

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

View File

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

View File

@@ -2,29 +2,30 @@
title: Download videos
tags:
- scraping
- video
---
Install `yt-dlp`.
```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:
```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:
```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:
```sh
yt-dlp --sub-lang sv --write-auto-sub --skip-download *<URL>*
yt-dlp --sub-lang sv --write-auto-sub --skip-download ${url}
```
## Alternative

View File

@@ -33,6 +33,7 @@ Then start that service:
```sh
sudo systemctl start sshd
```
Test it works by using ssh into your own system, from inside:
@@ -77,6 +78,7 @@ Look at your keys:
```sh
ls ~/.ssh
ls -l ~/.ssh
```
You can share the one ending in `.pub` freely.
@@ -86,6 +88,7 @@ Now send those keys to a remote computer:
```sh
ssh-copy-id ${username}@{ip_address}
ssh ${username}@{ip_address}
```
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
- VPN
---
<!--
from
https://engineerworkshop.com/blog/how-to-set-up-wireguard-on-a-raspberry-pi/
-->
## 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 !^
```
**NB:** this only works when running `bash` interactively, never in scripts.
# Done
`<C-d>`
@@ -29,9 +31,8 @@ cat !^
- If you have a command, Control + d will execute the command.
- If you have nothing, `exit`.
# Clear Search Highlights
# Search & Clear Highlights
`<Esc>+u`
Works in most programs with search.
You can search in many programs by using `/`.
Most programs let you clearn the highlighting with `<Esc>+u`.

View File

@@ -16,7 +16,7 @@ rdfind $dir
$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
rdfind -makehardlinks true $dir

View File

@@ -5,7 +5,7 @@ tags:
- 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)`.
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:
- documentation
- virtualization
- setup
- containers
requires:
- system/groups.md
---
Install docker, add your user to the docker group, and start the service.
```sh
sudo pacman -S docker
```
```sh
sudo usermod -aG docker $USER
```
```sh
sudo su $USER
sudo systemctl start docker
```
@@ -69,9 +67,9 @@ docker rm 97796727e883
# Networking
Get a list of docker container ips
Get a list of docker container IPs
```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:
- system
- setup
- virtualization
requires:
- system/groups.md
---
# Setup
Load the modules (or just reboot):