Compare commits
64 Commits
415985d08c
...
master
Author | SHA1 | Date | |
---|---|---|---|
3dface826f
|
|||
a55712032b
|
|||
33a959fcea
|
|||
4ed4c87acf
|
|||
68f9eb2a7d
|
|||
c407e8be9e
|
|||
f52b241dc2
|
|||
c0755da29f
|
|||
c3afb4b562
|
|||
f5b3d969fd
|
|||
7e2487f0d3
|
|||
3fec180a14
|
|||
c08ad6f175
|
|||
1a17ffda7f
|
|||
556dba6f29
|
|||
b7a79951c5
|
|||
2d95304da4
|
|||
8e64f8f58e
|
|||
3b04aaf8be
|
|||
1dfdac516b
|
|||
63e4c409bb
|
|||
98dbb5e3d6
|
|||
45eae50c24
|
|||
24bb7014f9
|
|||
92145ac4b7
|
|||
7292e0625e
|
|||
ffa4dbc51a
|
|||
641b8fb825
|
|||
a6b8420c26
|
|||
68d3a850c0
|
|||
7e75763cee
|
|||
2d3961e0f5
|
|||
72ad0786c8
|
|||
b64d9de0c4
|
|||
fa9c8edb1d
|
|||
741e988536
|
|||
a72e2b117d
|
|||
cc574d5358
|
|||
0d76eb0531
|
|||
3bfeacd2d7
|
|||
ed4b54cf7e
|
|||
4e89c5ab9b
|
|||
1732c62734
|
|||
fb157895fb
|
|||
b3258d9f5f
|
|||
d793bca3ea
|
|||
14470b6f92
|
|||
59fb0ada24
|
|||
b68fa25cea
|
|||
5bd45973b4
|
|||
66cdca5c85
|
|||
aa32bfc249
|
|||
fc88ab6200
|
|||
eaec01076b
|
|||
0abc2818e8
|
|||
4250f619c3
|
|||
4d53f7c7d6
|
|||
38feabb79f
|
|||
b4683a8681
|
|||
d2934bf8a3
|
|||
5afc414a52
|
|||
d8b4a9d00b
|
|||
a15b565e09
|
|||
6ccba626c8
|
43
Makefile
43
Makefile
@@ -4,6 +4,8 @@ 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: ## Print the help message
|
||||
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
|
||||
sort | \
|
||||
@@ -11,39 +13,48 @@ help: ## Print the help message
|
||||
|
||||
articles != find * -type f -name "*.md"
|
||||
|
||||
categories != ls -d */
|
||||
dirs != ls -d */
|
||||
categories = $(patsubst %/, %, $(dirs))
|
||||
|
||||
databases = $(patsubst %/, .dbs/%.rec, $(categories))
|
||||
databases = $(patsubst %, .dbs/%.rec, $(categories))
|
||||
|
||||
default += $(databases)
|
||||
|
||||
$(foreach dir, $(categories), \
|
||||
$(eval .dbs/$(dir).rec: $(wildcard $(dir)/*)) \
|
||||
)
|
||||
|
||||
.dbs/:
|
||||
mkdir $@
|
||||
$(databases): .dbs/%.rec: %/ | .dbs/
|
||||
$(info making $(@F))
|
||||
mkdir -p $(@D)
|
||||
for entry in $(shell find $< -type f -name "*.md") ; do \
|
||||
sed -n '2,/^---$$/ {/^---$$/d; p}' "$$entry" |\
|
||||
sed -e 's/\[ //' -e 's/ \]//' |\
|
||||
tr -d '"' ;\
|
||||
printf "wordcount: %s\n" "$$(wc -w < $$entry)" ;\
|
||||
printf "file: %s\n\n" "$$entry" ;\
|
||||
done >> $@
|
||||
for entry in $(shell find $< -type f -name "*.md"); do \
|
||||
recset $@ -e "file = '$${entry}'" -f wordcount --set-add="$$(wc -w < $${entry})" ;\
|
||||
done
|
||||
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)
|
||||
$(warning 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: title' >> $@
|
||||
printf '%s\n\n' '%sort: wordcount' >> $@
|
||||
cat $^ >> $@
|
||||
recsel $@ -e "requires != ''" -CR title,requires |\
|
||||
while read title requires; do \
|
||||
IFS=', ' && for provider in $$requires; do \
|
||||
for provider in "$$requires" ; do \
|
||||
recset $@ -e "title = '$${provider}'" -f provides -a "$${title}" ;\
|
||||
done ;\
|
||||
done
|
||||
$(info Created main database: $@)
|
||||
sed -i 's/"//g' $@
|
||||
recfix --sort $@
|
||||
$(info Created main database: $@)
|
||||
|
||||
default += db.rec
|
||||
|
||||
@@ -62,7 +73,7 @@ article: ## Write an article
|
||||
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" | sed 's#\/#", "#g' >> $$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"
|
||||
|
||||
|
24
README.md
24
README.md
@@ -4,22 +4,29 @@ title: "Linux Knowledge Base"
|
||||
|
||||
The Linux Knowledge-Base provides quick-start guides for working with terminal programs.
|
||||
|
||||
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 -q gpg
|
||||
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)'
|
||||
```
|
||||
|
||||
# Style
|
||||
@@ -29,6 +36,16 @@ recsel db.rec -e "title ~ 'bash'" -R title,wordcount
|
||||
- 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.
|
||||
|
||||
## State Knowledge Dependencies
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
[Do not Jaquays documentation](https://splint.rs/posts/no_links)
|
||||
|
||||
## Be Opinionated
|
||||
|
||||
- Guides should not ask the reader to select options half-way through.
|
||||
@@ -73,6 +90,11 @@ 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?
|
||||
|
||||
## Man pages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "at"
|
||||
tags: [ "Basics", "time" ]
|
||||
tags: [ "basics", "time" ]
|
||||
---
|
||||
Install with:
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Basics"
|
||||
tags: [ "Basics" ]
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
|
||||
You need about a dozen commands to move around Linux.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "clock"
|
||||
tags: [ "Basics", "time" ]
|
||||
tags: [ "basics", "time" ]
|
||||
---
|
||||
|
||||
Show system time:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "conditionals"
|
||||
tags: [ "Basics" ]
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
# If statements
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "cron"
|
||||
tags: [ "Basics", "time" ]
|
||||
tags: [ "basics", "time" ]
|
||||
---
|
||||
# Cronie
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "bash games"
|
||||
tags: [ "Games" ]
|
||||
tags: [ "games" ]
|
||||
---
|
||||
|
||||
Games are a great way to learn bash.
|
||||
|
@@ -1,34 +0,0 @@
|
||||
---
|
||||
title: "kernel"
|
||||
tags: [ "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
|
||||
```
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "kill"
|
||||
tags: [ "Basics" ]
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
|
||||
If you want to kill a program in a graphical environment, open a terminal and type:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "locale"
|
||||
tags: [ "Basics", "time" ]
|
||||
tags: [ "basics", "time" ]
|
||||
---
|
||||
|
||||
Your locale tells the computer your location, preferred time-and-date format, standard language, papersize, et c.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "locating"
|
||||
tags: [ "Basics" ]
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
# Type
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "processes"
|
||||
tags: [ "Basics" ]
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
# Proccesses
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "time"
|
||||
tags: [ "Basics", "time" ]
|
||||
tags: [ "basics", "time" ]
|
||||
---
|
||||
# systemd
|
||||
|
||||
@@ -56,7 +56,7 @@ Then set that language, with:
|
||||
LANG=pl_PL.UTF-8
|
||||
```
|
||||
|
||||
... then reboot.
|
||||
...then reboot.
|
||||
|
||||
# Network Time Protocol
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "users"
|
||||
tags: [ "Basics" ]
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
# Basic Information
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "profanity"
|
||||
tags: [ "Chat", "omemo" ]
|
||||
tags: [ "chat", "omemo" ]
|
||||
---
|
||||
# Setup (Commands)
|
||||
|
||||
@@ -142,4 +142,3 @@ You can ensure omemo automatcally turns on:
|
||||
```
|
||||
---
|
||||
|
||||
'OTR' encryption is mostly dead, but you can find the old instructions [here](profanity-otr).
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "wgetpaste"
|
||||
tags: [ "Chat" ]
|
||||
tags: [ "chat" ]
|
||||
---
|
||||
|
||||
See available pastebins:
|
||||
|
@@ -8,22 +8,21 @@ tags: [ "tar", "backups", ".tgz", "tar.gz" ]
|
||||
|
||||
Combine many files and directories into a single t-archive file.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
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.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
tar cf "$ARCHIVE".tar -C /etc/ nginx
|
||||
```
|
||||
|
||||
Check the contents of your archive with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
tar tf "$ARCHIVE".tar
|
||||
```
|
||||
|
||||
@@ -31,7 +30,7 @@ If you want to store 'everything in a directory', then using `*` will not work,
|
||||
|
||||
Instead, you can store the target in a variable:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
files=$(ls /etc/nginx)
|
||||
tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
|
||||
```
|
||||
@@ -40,7 +39,9 @@ tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
|
||||
|
||||
Extract the tar archive with
|
||||
|
||||
> tar xf "$ARCHIVE".tar
|
||||
```sh
|
||||
tar xf "$ARCHIVE".tar
|
||||
```
|
||||
|
||||
You can remember this with the mnemonic 'e*X*tract *F*ile'.
|
||||
|
||||
@@ -48,7 +49,7 @@ You can remember this with the mnemonic 'e*X*tract *F*ile'.
|
||||
|
||||
Create a zip-compressed archive with the `z` flag.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
tar czf "$ARCHIVE".tgz -C /etc/nginx/ $file
|
||||
```
|
||||
|
||||
@@ -60,18 +61,16 @@ You can use any file ending you want, but sane people like to use '.tgz' or '.ta
|
||||
|
||||
Make archive:
|
||||
|
||||
```bash
|
||||
PASSWORD=my_password
|
||||
```
|
||||
```bash
|
||||
7za a -tzip -p$PASSWORD -mem=AES256 $ARCHIVE.zip $FILE_1 $FILE_2
|
||||
```sh
|
||||
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:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
7za x archive.zip
|
||||
```
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
---
|
||||
title: "unison"
|
||||
tags: [ "Backups", "synch" ]
|
||||
tags: [ "backups", "synch" ]
|
||||
---
|
||||
|
||||
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).
|
||||
|
||||
```bash
|
||||
```sh
|
||||
unison -version
|
||||
```
|
||||
|
||||
@@ -13,14 +13,14 @@ Create the `~/.unison` directory on both machines.
|
||||
|
||||
Make a job called `backup`:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
JOB=backup
|
||||
```
|
||||
|
||||
Here is an example job, which synchronizes the `~/music` directory with a remote machine which has the same username.
|
||||
|
||||
|
||||
```bash
|
||||
```sh
|
||||
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:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
unison -batch *backup*.prf
|
||||
```
|
||||
|
||||
|
@@ -1,8 +1,26 @@
|
||||
---
|
||||
title: "Base 16"
|
||||
tags: [ "Data" ]
|
||||
tags: [ "data" ]
|
||||
---
|
||||
|
||||
```bash
|
||||
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
|
||||
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
|
||||
```
|
||||
|
@@ -5,5 +5,10 @@ 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).
|
||||
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
|
||||
```
|
||||
|
||||
|
@@ -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:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo grep -r $FRAGMENT /var/spool/*
|
||||
```
|
||||
|
||||
|
@@ -1,17 +1,17 @@
|
||||
---
|
||||
title: "exiftool"
|
||||
tags: [ "Metadata" ]
|
||||
tags: [ "metadata", "exifdata" ]
|
||||
---
|
||||
|
||||
Find metadata.
|
||||
Find metadata:
|
||||
|
||||
```bash
|
||||
exiftool image.jpg
|
||||
```sh
|
||||
exiftool "$file".jpg
|
||||
```
|
||||
|
||||
Find info on all images in current directory.
|
||||
Find info on all `.png` images in current directory.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
exiftool -ext .png .
|
||||
```
|
||||
|
||||
@@ -19,22 +19,14 @@ You can make this recurring with the -r switch.
|
||||
|
||||
And overwrite all metadata:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
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:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
exiftool -gps:all= *.jpg
|
||||
```
|
||||
|
||||
You can also use the imagemagick tool:
|
||||
|
||||
```bash
|
||||
identify -verbose
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
@@ -6,41 +6,40 @@ tags: [ "data" ]
|
||||
|
||||
## New Machines
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git config --global user.email "$YOUR_EMAIL"
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git config --global user.name "$YOUR_NAME"
|
||||
```
|
||||
|
||||
# New Git
|
||||
|
||||
Start a git in directory `$DIR`:
|
||||
Decide on algorithm:
|
||||
|
||||
```bash
|
||||
mkdir $DIR && cd $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
|
||||
git init
|
||||
```
|
||||
Make a file explaining what the project does, and tell `git` to track it:
|
||||
|
||||
Make a file explaining what the project does:
|
||||
|
||||
```bash
|
||||
vim README.md
|
||||
```
|
||||
|
||||
Add this to the git:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
echo "I hereby solemnly swear never to commit a binary file." > README.md
|
||||
git add README.md
|
||||
```
|
||||
|
||||
Then make the initial commit, explaining the change you just made:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git commit
|
||||
```
|
||||
|
||||
@@ -48,17 +47,17 @@ git commit
|
||||
|
||||
Once you make a change to some file, add it and make a commit explaining it.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git add $FILE
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git commit -m"change $FILE"
|
||||
```
|
||||
|
||||
Check your history:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git log
|
||||
```
|
||||
|
||||
@@ -69,20 +68,20 @@ Give it the same name as the `$DIR` directory, above.
|
||||
|
||||
Add this as a remote:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
REMOTE=gitlab
|
||||
git remote add $REMOTE https://gitlab.com/$USERNAME/$DIR
|
||||
```
|
||||
|
||||
Tell git you're pushing the branch "master" to the remote repo "origin":
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git push -u master origin
|
||||
```
|
||||
|
||||
If someone makes a change on the remote, pull it down with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git pull
|
||||
```
|
||||
|
||||
@@ -91,31 +90,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:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git branch $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
Have a look at all your branches:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git branch
|
||||
```
|
||||
|
||||
Switch to your new branch:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git checkout $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
And if your changes are rubbish, checkout the "master" branch again, then delete "featurez":
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git branch -D $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
Or if it's a good branch, push it to the remote:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
remote=origin
|
||||
git push $remote $FEATURE_BRANCH
|
||||
```
|
||||
@@ -124,13 +123,13 @@ git push $remote $FEATURE_BRANCH
|
||||
|
||||
Once you like the feature, merge it into the main branch. Switch to master then merge it:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git merge $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
And delete the branch, as you've already merged it:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git branch -d $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
@@ -138,7 +137,7 @@ git branch -d $FEATURE_BRANCH
|
||||
|
||||
## Pulling another git repo into a subtree
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git subtree add -P config git@gitlab.com:bindrpg/config.git master
|
||||
```
|
||||
|
||||
@@ -146,27 +145,27 @@ git subtree add -P config git@gitlab.com:bindrpg/config.git master
|
||||
|
||||
## Delete All History
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git checkout --orphan temp
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git add -A
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git commit -am "release the commits!"
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git branch -D master
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git branch -m master
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git push -f origin master
|
||||
```
|
||||
|
||||
@@ -174,21 +173,21 @@ Gitlab requires more changes, such as going to `settings > repository` and switc
|
||||
|
||||
## Clean up Bloated Repo
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git fsck --full
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git gc --prune=now --aggressive
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git repack
|
||||
```
|
||||
|
||||
## Find Binary Blobs
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git rev-list --objects --all \
|
||||
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
|
||||
| sed -n 's/^blob //p' \
|
||||
|
22
data/git/commit_for_another.md
Normal file
22
data/git/commit_for_another.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
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}"
|
||||
```
|
||||
|
@@ -1,24 +1,73 @@
|
||||
---
|
||||
title: "git-lfs"
|
||||
tags: [ "data" ]
|
||||
tags: [ "data", "git" ]
|
||||
requires: [ "git" ]
|
||||
---
|
||||
|
||||
Install, and add with
|
||||
Git Large File Storage ('LFS') needs to change your `~/.gitconfig` to check out those binary files:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
cat ~/.gitconfig
|
||||
git lfs install
|
||||
cat ~/.gitconfig
|
||||
```
|
||||
|
||||
Then track some filetype with:
|
||||
Then track some filetypes with:
|
||||
|
||||
```bash
|
||||
git lfs track "\*.ttf"
|
||||
```sh
|
||||
cd $git_repository
|
||||
ext=ttf
|
||||
git lfs track "*.$ext"
|
||||
```
|
||||
|
||||
Or a directory with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
git lfs track "images/"
|
||||
```
|
||||
|
||||
All changes require adding `.gitattributes`.
|
||||
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
|
||||
```
|
||||
|
||||
|
69
data/git/git_stash.md
Normal file
69
data/git/git_stash.md
Normal file
@@ -0,0 +1,69 @@
|
||||
---
|
||||
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
|
||||
```
|
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "git"
|
||||
title: "git subtree"
|
||||
tags: [ "data", "git", "subtree" ]
|
||||
---
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "gpg"
|
||||
tags: [ "data", "GPG" ]
|
||||
tags: [ "data", "gpg" ]
|
||||
---
|
||||
|
||||
- [Setup](gpg/basics.md)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "gpg"
|
||||
title: "gpg with vim"
|
||||
tags: [ "vim", "data", "GPG" ]
|
||||
requires: [ "GPG Basics", "vim basics" ]
|
||||
---
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "groff"
|
||||
tags: [ "Data" ]
|
||||
tags: [ "data", "logic" ]
|
||||
---
|
||||
# Basic Documents
|
||||
|
||||
|
19
data/interactive_string_substitution.md
Normal file
19
data/interactive_string_substitution.md
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
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'
|
||||
```
|
13
data/json.md
Normal file
13
data/json.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
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 `.[]`.
|
@@ -1,60 +1,52 @@
|
||||
---
|
||||
title: "khard"
|
||||
tags: [ "Data" ]
|
||||
tags: [ "data" ]
|
||||
---
|
||||
Get the basic config:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
mkdir ~/.config/khard
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
cp /usr/share/doc/khard/examples/khard/khard.conf.example ~/.config/khard.conf
|
||||
```
|
||||
|
||||
Short list
|
||||
|
||||
```bash
|
||||
```sh
|
||||
khard list
|
||||
```
|
||||
|
||||
Longer list
|
||||
|
||||
```bash
|
||||
```sh
|
||||
khard show
|
||||
```
|
||||
|
||||
Show from addressbook 'work'
|
||||
|
||||
```bash
|
||||
```sh
|
||||
khard list -a work
|
||||
```
|
||||
|
||||
Make a new contact in address book 'family'
|
||||
|
||||
```bash
|
||||
```sh
|
||||
khard new -a family
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
khard edit grampa
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
khard remove bob
|
||||
```
|
||||
|
||||
Move contact 'nina' from 'work' to 'home' address book.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
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]
|
||||
```
|
||||
|
||||
|
14
data/pass.md
14
data/pass.md
@@ -1,42 +1,42 @@
|
||||
---
|
||||
title: "pass"
|
||||
tags: [ "data" ]
|
||||
requires: "GPG Basics"
|
||||
---
|
||||
[Video instructions](https://www.hooktube.com/watch?v=hlRQTj1D9LA)
|
||||
|
||||
Setup [gpg](./gpg.md) keys.
|
||||
|
||||
Show your gpg secret it:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
gpg --list-secret-keys
|
||||
```
|
||||
|
||||
Then use the id number under `sec` to make a pass repo:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
KEY="$(gpg --list-secret-keys | grep -m 1 -A1 '^sec' | tail -n 1)"
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
pass init $KEY
|
||||
```
|
||||
|
||||
To add a basic password, e.g. for `$WEBSITE`:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
pass $WEBSITE
|
||||
```
|
||||
|
||||
To insert a multiline password, e.g. with a login name:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
pass add -m $WEBSITE
|
||||
```
|
||||
|
||||
Remove a password:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
pass rm $WEBSITE
|
||||
```
|
||||
|
||||
|
@@ -2,7 +2,8 @@
|
||||
title: "pdf to txt"
|
||||
tags: [ "data", "pdf", "ocr" ]
|
||||
---
|
||||
How to translate pdf book images to text (results are very poor, and will need lots of corrections).
|
||||
|
||||
How to translate pdfs to text (results are very poor, and will need lots of corrections).
|
||||
|
||||
## Dependencies
|
||||
|
||||
@@ -17,8 +18,8 @@ pdftoppm -png *file*.pdf test
|
||||
```
|
||||
|
||||
```bash
|
||||
for x in \*png; do
|
||||
tesseract -l eng "$x" - >> *out*.txt
|
||||
for x in *png; do
|
||||
tesseract -l eng "$x" - >> out.txt
|
||||
done
|
||||
```
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "PDF Metadata Erasure"
|
||||
tags: [ "Metadata", "Ghost Script", "gs", ".pdf" ]
|
||||
tags: [ "metadata", "ghost script", "gs", ".pdf" ]
|
||||
---
|
||||
|
||||
You cannot erase pdf metadata with `exiftool` (it only *appends* your changes).
|
||||
|
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: "radicale and nginx"
|
||||
tags: [ "data", "calendar" ]
|
||||
requires: [ "nginx", "certbot" ]
|
||||
---
|
||||
|
||||
Check before you start:
|
||||
|
@@ -44,6 +44,9 @@ 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
|
||||
|
||||
|
121
data/recfiles/bibliography.md
Normal file
121
data/recfiles/bibliography.md
Normal file
@@ -0,0 +1,121 @@
|
||||
---
|
||||
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: 217–240
|
||||
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
|
||||
|
||||
```
|
||||
|
16
data/recfiles/ip_asn.md
Normal file
16
data/recfiles/ip_asn.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
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
|
||||
```
|
||||
|
33
data/recfiles/recfixes.md
Normal file
33
data/recfiles/recfixes.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
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"
|
||||
```
|
||||
|
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: "sc-im"
|
||||
tags: [ "TUI", "data", "spreadsheet", ".csv" ]
|
||||
requires: [ "vim basics" ]
|
||||
---
|
||||
|
||||
- [Sample file](sc-im/sample.sc)
|
||||
|
13
data/sc-im/convert_spreadsheets.md
Normal file
13
data/sc-im/convert_spreadsheets.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
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
|
||||
```
|
33
data/search_video_audio.md
Normal file
33
data/search_video_audio.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
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"
|
||||
```
|
24
data/soft-serve/maintenance.md
Normal file
24
data/soft-serve/maintenance.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
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'.
|
||||
```
|
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: "Soft Serve through https"
|
||||
tags: [ "data", "git server", "lfs" ]
|
||||
requires: [ "git", "nginx" ]
|
||||
---
|
||||
|
||||
## `http` Setup
|
||||
@@ -33,7 +34,7 @@ Restart the `soft-serve` service, then check it's working by cloning from localh
|
||||
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).
|
||||
|
||||
@@ -67,3 +68,4 @@ Put this file at `/etc/nginx/sites-enabled/$DOMAIN.tld`, then set up standard ce
|
||||
}
|
||||
|
||||
```
|
||||
|
8
data/soft.md
Normal file
8
data/soft.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
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)
|
34
data/task/contexts.md
Normal file
34
data/task/contexts.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
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
|
||||
```
|
||||
|
@@ -1,23 +1,35 @@
|
||||
---
|
||||
title: "task"
|
||||
tags: [ "Organization" ]
|
||||
title: "Taskwarrior"
|
||||
tags: [ "data", "organization" ]
|
||||
---
|
||||
|
||||
Set up the configuration file:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
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.
|
||||
|
||||
```
|
||||
task config sync.local.server_dir
|
||||
task config data.location ~/.local/state/
|
||||
```
|
||||
|
||||
Add a task:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
task add update linux
|
||||
```
|
||||
|
||||
See which task is next:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
task next
|
||||
```
|
||||
|
||||
@@ -25,13 +37,13 @@ Note the id number.
|
||||
|
||||
Mark a task as started:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
task start 1
|
||||
```
|
||||
|
||||
Once finished:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
task 1 done
|
||||
```
|
||||
|
||||
@@ -39,23 +51,21 @@ task 1 done
|
||||
|
||||
Add a project:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
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
|
||||
task add pro:house.paint buy red paint
|
||||
task add pro:house.paint buy black paint
|
||||
task add pro:house.paint buy brushes
|
||||
|
||||
for t in "buy red paint" "buy black paint" "buy brushes" ; do
|
||||
task add pro:house.paint $t
|
||||
done
|
||||
```
|
||||
|
||||
## Summary
|
||||
|
||||
```bash
|
||||
```sh
|
||||
task pro:house sum
|
||||
```
|
||||
|
||||
```bash
|
||||
task burndown.daily pro:house
|
||||
```
|
||||
|
||||
@@ -63,69 +73,33 @@ The summaries will show how fast a project is being completed, and when you can
|
||||
|
||||
# Tags
|
||||
|
||||
```bash
|
||||
|
||||
```sh
|
||||
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:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
task end.after:today-1wk completed
|
||||
```
|
||||
|
||||
# User Defined Attributes
|
||||
|
||||
Make a UDA 'size'.
|
||||
Define a new attribute for tasks called 'size'.
|
||||
The 'user defined attribute' (UDA) needs a `type` and `label`.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
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.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
task config uda.size.values large,medium,small
|
||||
```
|
||||
|
||||
```bash
|
||||
uda.size.default=medium
|
||||
```
|
||||
|
||||
@@ -133,7 +107,7 @@ uda.size.default=medium
|
||||
|
||||
This command shows tasks I'm most interested in:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
task next +ACTIVE or +OVERDUE or due:today or scheduled:today or pri:H
|
||||
```
|
||||
|
20
data/task/taskwarrior_configuration.md
Normal file
20
data/task/taskwarrior_configuration.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
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
|
||||
```
|
||||
|
@@ -1,18 +1,18 @@
|
||||
---
|
||||
title: "timewarrior"
|
||||
tags: [ "Data", "tracking", "time", "timew" ]
|
||||
tags: [ "data", "tracking", "time", "timew" ]
|
||||
---
|
||||
# Summaries
|
||||
|
||||
Try:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
timew summary :yesterday
|
||||
```
|
||||
|
||||
You can also use :week, :lastweek, :month, :quarter, :year, or a range such as:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
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
|
||||
|
||||
```bash
|
||||
```sh
|
||||
timew start
|
||||
timew stop
|
||||
timew continue
|
||||
@@ -32,7 +32,7 @@ timew tags
|
||||
|
||||
And add ids with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
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.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
timew summary :ids
|
||||
```
|
||||
|
||||
Then if we're looking at task @2:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
timew move @2 12:00
|
||||
timew lengthen @2 3mins
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
time shorten @2 40mins
|
||||
```
|
||||
|
||||
# Forgetting
|
||||
|
||||
```bash
|
||||
```sh
|
||||
timew start 1h ago @4
|
||||
```
|
||||
|
||||
Or if your action actually had a break:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
timew split @8
|
||||
```
|
||||
|
||||
Or maybe not?
|
||||
|
||||
```bash
|
||||
```sh
|
||||
timew join @4 @8
|
||||
timew @8 delete
|
||||
```
|
||||
|
||||
Start at previous time
|
||||
|
||||
```bash
|
||||
```sh
|
||||
timew start 3pm 'Read chapter 12'
|
||||
timew start 90mins ago 'Read chapter 12'
|
||||
```
|
||||
|
||||
Cancel currently tracked time.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
timew cancel
|
||||
```
|
||||
|
||||
@@ -157,11 +157,11 @@ with:
|
||||
|
||||
# Fixing Errors
|
||||
|
||||
```bash
|
||||
```sh
|
||||
curl -O https://taskwarrior.org/download/timew-dbcorrection.py
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
python timew-dbcorrections.py
|
||||
```
|
||||
|
11
data/view_torrents.md
Normal file
11
data/view_torrents.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
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.
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "autologin"
|
||||
tags: [ "Distros", "Arch" ]
|
||||
tags: [ "distros", "arch" ]
|
||||
---
|
||||
|
||||
# Automatic Login
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "fonts"
|
||||
tags: [ "distros" ]
|
||||
title: "Ach Linux GPU Setup"
|
||||
tags: [ "arch", "GPU" ]
|
||||
---
|
||||
# Step 1: Multilib
|
||||
|
||||
@@ -60,4 +60,3 @@ You should see 'true' here.
|
||||
```bash
|
||||
sudo pacman -S --needed lib32-mesa vulkan-radeon lib32-vulkan-radeon vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-amdgpu
|
||||
```
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Aeroplane Mode in Void"
|
||||
tags: [ "Void" ]
|
||||
tags: [ "void" ]
|
||||
---
|
||||
Put your device in 'aeroplane' mode (e.g. where no trace of signal leaves it) by turning off Wi-Fi and blue-tooth.
|
||||
|
||||
@@ -9,7 +9,7 @@ su root
|
||||
sv stop wpa_supplicant bluetoothd
|
||||
```
|
||||
|
||||
Find your device's name with `ip a`.
|
||||
Find your device's name with `ip -color addr`.
|
||||
If unsure, try this:
|
||||
|
||||
```sh
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Void Autologin"
|
||||
tags: [ "Void" ]
|
||||
tags: [ "void" ]
|
||||
---
|
||||
|
||||
Make the autologin service:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "extrace"
|
||||
tags: [ "Void" ]
|
||||
tags: [ "void" ]
|
||||
---
|
||||
Monitor all processes:
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "sv"
|
||||
tags: [ "Void" ]
|
||||
tags: [ "void" ]
|
||||
---
|
||||
# List Services
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Void Linux Basics"
|
||||
tags: [ "Void" ]
|
||||
tags: [ "void" ]
|
||||
---
|
||||
# Updates
|
||||
|
||||
@@ -57,5 +57,5 @@ brightnessctl s 10%+
|
||||
|
||||
- [autologin](autologin.md)
|
||||
- [services](sv.md)
|
||||
- [wifi](wpa_cli.md)
|
||||
- [wifi](../../networking/wpa_supplicant.md)
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "xbps"
|
||||
tags: [ "Void" ]
|
||||
tags: [ "void" ]
|
||||
---
|
||||
## Search
|
||||
|
||||
|
@@ -9,8 +9,9 @@ This works everywhere, including in a bare-ass tty.
|
||||
|
||||
Select a keymap, and create a new custom map.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
su root
|
||||
ls /usr/share/kbd/keymaps/i386/qwerty/
|
||||
|
||||
basemap=/usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz
|
||||
newmap=/usr/share/kbd/keymaps/custom.map.gz
|
||||
@@ -22,7 +23,7 @@ gunzip -c $basemap | \
|
||||
|
||||
Tell the system to use this keymap at startup by naming it in the `rc.conf` file:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
echo "KEYMAP=$newmap" >> /etc/rc.conf
|
||||
|
||||
cat /etc/rc.conf
|
||||
@@ -33,24 +34,24 @@ reboot
|
||||
|
||||
Set layout to British English.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
setxkbmap -layout gb
|
||||
```
|
||||
|
||||
Or Polish with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
setxkbmap -layout pl
|
||||
```
|
||||
|
||||
| Language | short |
|
||||
|:--------|:------|
|
||||
| Polish | pl |
|
||||
| Serbian | rs |
|
||||
|:---------|:------|
|
||||
| Polish | `pl` |
|
||||
| Serbian | `rs` |
|
||||
|
||||
Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle
|
||||
```
|
||||
|
||||
|
20
networking/bad_horse.md
Normal file
20
networking/bad_horse.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: "Mapping the Net"
|
||||
tags: [ "networking", "graph", "fun" ]
|
||||
---
|
||||
|
||||
Find the path to a domain:
|
||||
|
||||
```sh
|
||||
domain=bad.horse
|
||||
max_hops=50
|
||||
|
||||
tracepath -m $maximum_hops $domain
|
||||
```
|
||||
|
||||
If you're on Debian, you can use `graph-easy` and `dothost` to make an instant diagram:
|
||||
|
||||
```sh
|
||||
domain=dice.camp
|
||||
dothost $domain | graph-easy --boxart
|
||||
```
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "fail2ban"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking" ]
|
||||
requires: [ "ssh" ]
|
||||
---
|
||||
# SSH Daemon Jail
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Easy Network Graph"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking" ]
|
||||
---
|
||||
Set up a file like this, called `troubleshooting.txt`.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "iptables"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking" ]
|
||||
---
|
||||
# Intro
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "nmap"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking" ]
|
||||
---
|
||||
|
||||
Example:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "pi-hole-server"
|
||||
tags: [ "Distros" ]
|
||||
tags: [ "distros" ]
|
||||
---
|
||||
# Installation
|
||||
|
||||
|
25
networking/port_scan.md
Normal file
25
networking/port_scan.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: "Port Scan"
|
||||
tags: [ "networking" ]
|
||||
repo: 'https://github.com/mrjackwills/havn/'
|
||||
---
|
||||
|
||||
`havn` scans ports.
|
||||
It's not in many repos, but if you can `cargo install havn`.
|
||||
|
||||
|
||||
```sh
|
||||
havn -h
|
||||
havn -a
|
||||
domain=splint.rs
|
||||
havn -p 19-90 ${domain}
|
||||
```
|
||||
|
||||
That last command doesn't work reliably, so increase the number of retries (`-r`), or decrease concurrent requests (`-c`).
|
||||
|
||||
|
||||
```sh
|
||||
havn -p 19-443 -r 6 ${domain}
|
||||
havn -p 1-1000 -c 500 -r 5 ${domain}
|
||||
```
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "rclone"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking", "synch" ]
|
||||
---
|
||||
The manpage's 'Synopsis' provides a fast reference.
|
||||
```
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Download videos"
|
||||
tags: [ "Scraping" ]
|
||||
tags: [ "scraping" ]
|
||||
---
|
||||
Install `yt-dlp`.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Agate on Arch Linux"
|
||||
tags: [ "Networking", "Arch", "Gemini" ]
|
||||
tags: [ "networking", "arch", "gemini" ]
|
||||
---
|
||||
|
||||
Docs are [here](https://github.com/mbrubeck/agate).
|
||||
|
@@ -7,7 +7,7 @@ tags: [ "networking" ]
|
||||
Try out basic ssh by accessing `git.charm.sh`, without needing authentication:
|
||||
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ssh git.charm.sh
|
||||
```
|
||||
|
||||
@@ -16,32 +16,32 @@ The ssh server is sometimes in a package called `openssh`, and sometimes only in
|
||||
|
||||
Once it's installed, check it's working:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo systemctl status ssh
|
||||
```
|
||||
|
||||
If that doesn't work, the service may be called `sshd`.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo systemctl status sshd
|
||||
```
|
||||
|
||||
Then start that service:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo systemctl start sshd
|
||||
```
|
||||
Test it works by using ssh into your own system, from inside:
|
||||
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ssh $USER@localhost
|
||||
```
|
||||
|
||||
Access the computer from another computer on the same local network by finding your computer's IP address.
|
||||
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ip address | grep inet
|
||||
```
|
||||
|
||||
@@ -56,24 +56,24 @@ Here is mine:
|
||||
|
||||
|
||||
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 second is an ipv6 address, which is too angelic for this world, and has yet to descend.
|
||||
The third will work from a remote computer.
|
||||
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ssh $USERNAME@IP_ADDRESS
|
||||
```
|
||||
|
||||
Once you have that, generate some ssh keys:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ssh-keygen
|
||||
```
|
||||
|
||||
Look at your keys:
|
||||
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ls ~/.ssh
|
||||
```
|
||||
|
||||
@@ -82,7 +82,7 @@ The other is secret.
|
||||
|
||||
Now send those keys to a remote computer:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ssh-copy-id $USERNAME@IP_ADDRESS
|
||||
```
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "sshfs"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking" ]
|
||||
requires: [ "ssh" ]
|
||||
---
|
||||
# Mount
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "ssh-tricks"
|
||||
tags: [ "Networking", "ssh", "tricks" ]
|
||||
tags: [ "networking", "ssh", "tricks" ]
|
||||
requires: [ "ssh" ]
|
||||
---
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: "tor"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking" ]
|
||||
---
|
||||
|
||||
# Get a hostname
|
||||
# Get a Hostname
|
||||
|
||||
```bash
|
||||
sudo vim /etc/tor/torrc
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "transmission"
|
||||
tags: [ "Networking", "Torrenting" ]
|
||||
tags: [ "networking", "torrenting" ]
|
||||
---
|
||||
# Torrench
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
---
|
||||
title: "troubleshooting"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking" ]
|
||||
---
|
||||
|
||||
# Do you have an IP?
|
||||
|
||||
If not, try checking out what your local Networking interfaces are, then check if they have been picked up:
|
||||
If not, try checking out what your local networking interfaces are, then check if they have been picked up:
|
||||
|
||||
```bash
|
||||
dmesg | grep eth0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "nginx"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking", "web" ]
|
||||
---
|
||||
Install nginx:
|
||||
|
||||
|
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: "wifi"
|
||||
tags: [ "Networking" ]
|
||||
title: "network"
|
||||
tags: [ "networking" ]
|
||||
---
|
||||
|
||||
# Netstat Stuff
|
||||
|
||||
Stats on local net usage within domain.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "wireguard"
|
||||
tags: [ "Networking", "VPN" ]
|
||||
tags: [ "networking", "VPN" ]
|
||||
---
|
||||
<!--
|
||||
from
|
||||
@@ -11,25 +11,22 @@ https://engineerworkshop.com/blog/how-to-set-up-wireguard-on-a-raspberry-pi/
|
||||
|
||||
Install `wireguard-tools` on the server.
|
||||
|
||||
```bash
|
||||
sudo -i
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
su root
|
||||
cd /etc/wireguard
|
||||
```
|
||||
|
||||
umask 077
|
||||
|
||||
```bash
|
||||
```sh
|
||||
wg genkey | tee server_private_key | wg pubkey > server_public_key
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
wg genkey | tee client_private_key | wg pubkey > client_public_key
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
echo "
|
||||
[Interface]
|
||||
Address = 10.0.0.1/24
|
||||
@@ -46,20 +43,20 @@ wg genkey | tee client_private_key | wg pubkey > client_public_key
|
||||
" > /etc/wireguard/wg0.conf
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/wg.conf
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
systemctl enable --now wg-quiqck@wg0
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
chown -R root:root /etc/wireguard/
|
||||
```
|
||||
|
||||
```bash
|
||||
chmod -R og-rwx /etc/wireguard/\*
|
||||
```sh
|
||||
chmod -R og-rwx /etc/wireguard/*
|
||||
```
|
||||
|
||||
Forward traffic from port 51900 to the server.
|
||||
@@ -72,21 +69,25 @@ Install `wireguard-tools` on the client.
|
||||
|
||||
Copy the client private key and server public key to the server (or just fill in the variables).
|
||||
|
||||
> server_ip=*your server's public ip*
|
||||
|
||||
echo "
|
||||
[Interface]
|
||||
Address = 10.0.0.2/32
|
||||
PrivateKey = $(cat client_private_key)
|
||||
DNS = 9.9.9.9
|
||||
|
||||
[Peer]
|
||||
PublicKey = $(cat server_public_key)
|
||||
Endpoint = $(echo $server_ip:51900)
|
||||
AllowedIPs = 0.0.0.0/0, ::/0
|
||||
" > /etc/wireguard/wg0-client.conf
|
||||
```sh
|
||||
server_ip=$PUBLIC_IP
|
||||
|
||||
> wg-quick up wg0-client
|
||||
echo "
|
||||
[Interface]
|
||||
Address = 10.0.0.2/32
|
||||
PrivateKey = $(cat client_private_key)
|
||||
DNS = 9.9.9.9
|
||||
|
||||
[Peer]
|
||||
PublicKey = $(cat server_public_key)
|
||||
Endpoint = $(echo $server_ip:51900)
|
||||
AllowedIPs = 0.0.0.0/0, ::/0
|
||||
" > /etc/wireguard/wg0-client.conf
|
||||
|
||||
wg-quick up wg0-client
|
||||
|
||||
```
|
||||
|
||||
## Extras
|
||||
|
||||
@@ -98,6 +99,6 @@ Add multiple peers by copying the `[peer]` section (they each get called `peer`)
|
||||
|
||||
Make a standard client configuration, then:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
qrencode -t ansiutf8 < /etc/wireguard/mobile_user.conf
|
||||
```
|
||||
|
@@ -1,60 +1,63 @@
|
||||
---
|
||||
title: "wireless"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking" ]
|
||||
---
|
||||
|
||||
# Check wifi's working
|
||||
```bash
|
||||
Check wifi's working
|
||||
|
||||
```sh
|
||||
lspci -k
|
||||
```
|
||||
|
||||
Or for usb wifi:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
dmesg | grep usbcore
|
||||
```
|
||||
|
||||
... and hopefully it'll say the new interface is registered.
|
||||
...and hopefully it'll say the new interface is registered.
|
||||
|
||||
# Check if a wifi interface has been created
|
||||
Check if a wifi interface has been created
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ip link
|
||||
```
|
||||
|
||||
or
|
||||
...or
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iw dev
|
||||
```
|
||||
|
||||
Assuming it's wlan0, bring it up with
|
||||
|
||||
```bash
|
||||
```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
|
||||
|
||||
```bash
|
||||
```sh
|
||||
dmesg | grep firmware
|
||||
```
|
||||
|
||||
# Utilities
|
||||
|
||||
iw doesn't do wpa/wpa2. wpa_supplicant does everything. iwd does everything except WEXT encryption.
|
||||
- `iw` doesn't do wpa/wpa2.
|
||||
- `iwd` does everything except WEXT encryption.
|
||||
- `wpa_supplicant` does everything.
|
||||
|
||||
# Connecting
|
||||
|
||||
Get the link status:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iw dev wlan0 link
|
||||
```
|
||||
|
||||
Scan for available points:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iw dev wlan0 scan
|
||||
```
|
||||
|
||||
|
@@ -1,57 +1,57 @@
|
||||
---
|
||||
title: "wpa_supplicant"
|
||||
tags: [ "Networking" ]
|
||||
tags: [ "networking" ]
|
||||
---
|
||||
|
||||
wpa_supplicant configurations are stored in /etc/wpa_supplicant/wpa_supplicant-wlan0 (or equivalent).
|
||||
`wpa_supplicant` configurations are stored in `/etc/wpa_supplicant/wpa_supplicant-wlan0` (or equivalent).
|
||||
|
||||
## WiFi Connection
|
||||
|
||||
```bash
|
||||
```sh
|
||||
wpa_cli
|
||||
```
|
||||
|
||||
Once in, scan the network, add an empty place to store credentials, then input them.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
scan
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
scan_results
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
add_network
|
||||
```
|
||||
|
||||
This outputs a network number, e.g. '3'. This is the new network you'll work with.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
set_network *3* ssid *"Kosachok Cafe"*
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
set_network 3 psk *"Kosachok2019"*
|
||||
```
|
||||
|
||||
OR (for no password)
|
||||
|
||||
```bash
|
||||
```sh
|
||||
set_network *3* key_mgmt NONE
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
enable_network 3
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
save_config
|
||||
```
|
||||
|
||||
This takes a while to connect, so to speed things up, restart the service:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo sv restart wpa_supplicant
|
||||
```
|
||||
|
||||
@@ -59,13 +59,13 @@ sudo sv restart wpa_supplicant
|
||||
|
||||
You can script like this:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
wpa_cli add_network
|
||||
```
|
||||
|
||||
That returns an ID, so you can say:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
newNetwork="$(wpa_cli add_network)"
|
||||
```
|
||||
|
||||
@@ -73,19 +73,19 @@ Then `$newNetwork` would equal that number, and you can add/ remove networks wit
|
||||
|
||||
But remember to escape the quotes, so adding a network would be:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
wpa_cli set_network *3* psk *\""passphrase"\"*
|
||||
```
|
||||
|
||||
## Generating Keys Manually
|
||||
|
||||
```bash
|
||||
```sh
|
||||
wpa_passphrase [ssid] [password]
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
wpa_passphrase 'Cafe Kosachok' 'Kosachok2019'
|
||||
```
|
||||
|
||||
@@ -95,8 +95,11 @@ If you encounter problems, you will probably need to delete the old device pid i
|
||||
|
||||
Next up, start wpa_supplicant:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0
|
||||
```
|
||||
|
||||
The -B flag runs this as a background process. Remove this to see real-time output in order to solve problems. The -i flag denotes the physical device used for the wifi. The -c flag points to the configuration file for use.
|
||||
The `-B` flag runs this as a background process.
|
||||
Remove this to see real-time output in order to solve problems.
|
||||
The `-i` flag denotes the physical device used for the wifi.
|
||||
The `-c` flag points to the configuration file for use.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Basic Sound"
|
||||
tags: [ "Sound" ]
|
||||
tags: [ "sound" ]
|
||||
---
|
||||
# Pulse
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "festival"
|
||||
tags: [ "Sound" ]
|
||||
tags: [ "sound" ]
|
||||
---
|
||||
# Basics
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "mpd"
|
||||
tags: [ "Sound" ]
|
||||
tags: [ "sound" ]
|
||||
---
|
||||
# Setup
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "ncmpcpp"
|
||||
tags: [ "Sound" ]
|
||||
tags: [ "sound" ]
|
||||
---
|
||||
|
||||
# Music Player Daemon
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "android"
|
||||
tags: [ "System", "phone" ]
|
||||
tags: [ "system", "phone" ]
|
||||
---
|
||||
# mtpfs
|
||||
|
||||
|
114
system/ansible/ansible_with_docker.md
Normal file
114
system/ansible/ansible_with_docker.md
Normal file
@@ -0,0 +1,114 @@
|
||||
---
|
||||
title: "Ansible with Docker"
|
||||
tags: [ "system", "ansible", "docker" ]
|
||||
requires: [ "Docker" ]
|
||||
---
|
||||
|
||||
Set up two containers: `deb` and `arch`, add them to an `ansible` hosts file, then do a 'ping' to see if they respond.
|
||||
|
||||
## Required Packages
|
||||
|
||||
- `ansible`
|
||||
- `jq`
|
||||
- `docker`
|
||||
|
||||
## Debian Container
|
||||
|
||||
```sh
|
||||
docker run -di --rm --name deb --hostname deb debian
|
||||
docker exec -it deb sh -c 'apt update && apt -y install openssh-server python3 sudo'
|
||||
```
|
||||
|
||||
Generate the host's ssh keys, then start the ssh daemon:
|
||||
|
||||
```sh
|
||||
docker exec -it deb sh -c 'ssh-keygen -A'
|
||||
docker exec -d deb /usr/sbin/sshd -D
|
||||
```
|
||||
|
||||
## Arch Linux Container
|
||||
|
||||
```sh
|
||||
docker run -di --rm --name arch --hostname arch archlinux
|
||||
docker exec -it arch sh -c 'pacman -Syu --noconfirm python sudo openssh'
|
||||
docker exec -it arch sh -c 'ssh-keygen -A'
|
||||
docker exec -d arch /usr/sbin/sshd -D
|
||||
```
|
||||
|
||||
## `ssh` Keys
|
||||
|
||||
Copy across your public ssh key to the container's `authorized_keys` file:
|
||||
|
||||
```sh
|
||||
pubkey=~/.ssh/id_rsa.pub
|
||||
for hostname in arch deb; do
|
||||
docker cp $pubkey $hostname:/root/.ssh/authorized_keys
|
||||
docker exec -it $hostname sh -c "chown -R root:root /root/.ssh/"
|
||||
docker exec -it $hostname sh -c "chmod -R 700 /root/.ssh/"
|
||||
done
|
||||
```
|
||||
|
||||
## Hosts File
|
||||
|
||||
Find name of containers' IPv4 addresses.
|
||||
|
||||
```sh
|
||||
docker network inspect bridge
|
||||
```
|
||||
|
||||
The output is awful.
|
||||
Use `jq` to parse the `json`:
|
||||
|
||||
```sh
|
||||
docker network inspect bridge | jq -r '.[].Containers | .[].IPv4Address'
|
||||
```
|
||||
|
||||
Now put those into a host file:
|
||||
|
||||
```sh
|
||||
docker_hosts=hosts.txt
|
||||
echo '[containers]' > $docker_hosts
|
||||
|
||||
docker network inspect bridge | \
|
||||
jq -r '.[].Containers | .[] | "root@" + .IPv4Address' | \
|
||||
cut -d/ -f1 >> $docker_hosts
|
||||
```
|
||||
|
||||
You may need to add those host keys to your known hosts file.
|
||||
Either connect interactively, or (for scripts):
|
||||
|
||||
```sh
|
||||
hosts="$(docker network inspect bridge | jq -r '.[].Containers | .[] | .Name + " " + .IPv4Address' | \
|
||||
cut -d/ -f1)"
|
||||
|
||||
echo "$hosts"
|
||||
|
||||
echo "$hosts" | while read hostname ip; do
|
||||
printf "%s" "$ip"
|
||||
key="$(docker exec $hostname cat /etc/ssh/ssh_host_ed25519_key.pub)"
|
||||
echo "$ip $key" >> ~/.ssh/known_hosts
|
||||
done
|
||||
```
|
||||
|
||||
Check if they ping:
|
||||
|
||||
```sh
|
||||
ansible -i $docker_hosts all -m ping
|
||||
```
|
||||
|
||||
This command produces an irritating warning about the python interpreter (i.e., `python3`).
|
||||
|
||||
Make the warning shut-up:
|
||||
|
||||
```sh
|
||||
echo '
|
||||
[containers:vars]
|
||||
ansible_python_interpreter=/usr/bin/python3.13' >> $docker_hosts
|
||||
```
|
||||
|
||||
Now the ping is cleaner:
|
||||
|
||||
```sh
|
||||
ansible -i $docker_hosts all -m ping
|
||||
```
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "awk"
|
||||
tags: [ "System", ".csv" ]
|
||||
tags: [ "system", ".csv" ]
|
||||
---
|
||||
# Basics
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "bash tips"
|
||||
tags: [ "Shell", "POSIX" ]
|
||||
tags: [ "shell", "POSIX" ]
|
||||
---
|
||||
## Track Live Changes
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "character-encoding"
|
||||
tags: [ "System", "encoding" ]
|
||||
tags: [ "system", "encoding" ]
|
||||
---
|
||||
|
||||
Convert a text file from one encoding type to another with:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Default Programs"
|
||||
tags: [ "Defaults", "Mime Type" ]
|
||||
tags: [ "defaults", "mime type" ]
|
||||
---
|
||||
|
||||
Install the package `xdg-utils`, then make very liberal use of the tab button.
|
||||
|
@@ -1,8 +1,36 @@
|
||||
---
|
||||
title: "kernel"
|
||||
title: "kernel modules"
|
||||
tags: [ "system" ]
|
||||
---
|
||||
|
||||
Kernel modules live in lib/modules/$(uname -r)
|
||||
|
||||
## Change
|
||||
|
||||
Load them with
|
||||
|
||||
```sh
|
||||
modprobe ath9k
|
||||
```
|
||||
|
||||
Or remove one with
|
||||
|
||||
```sh
|
||||
modprove uvcvideo
|
||||
```
|
||||
|
||||
The PC's irritating speaker beep can be really annoying. Disable it with:
|
||||
|
||||
```sh
|
||||
modprobe -r pcspeaker
|
||||
```
|
||||
|
||||
Permanently disable a module by blacklisting it in `/etc/modprobe.d`:
|
||||
|
||||
```sh
|
||||
echo 'blacklist pcspkr' > /etc/modprobe.d/*nobeep*.conf
|
||||
```
|
||||
|
||||
Check which kernel modules are loaded into memory:
|
||||
|
||||
```sh
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user