Compare commits
25 Commits
9b89c20c8a
...
9d35d04990
| Author | SHA1 | Date | |
|---|---|---|---|
|
9d35d04990
|
|||
|
c00c9aed16
|
|||
|
5f4873fec5
|
|||
|
44cbac7a98
|
|||
|
cbebcb4fdc
|
|||
|
974ac84cbc
|
|||
|
4bc128cdec
|
|||
|
cc8e051501
|
|||
|
616ac6a2a8
|
|||
|
ce35cd1838
|
|||
|
70871b8944
|
|||
|
995659730f
|
|||
|
4136515526
|
|||
|
e58202c37e
|
|||
|
aee3437156
|
|||
|
c3d4109114
|
|||
|
7e7628a0e3
|
|||
|
5022a3de7d
|
|||
|
0479274245
|
|||
|
4a25476fd6
|
|||
|
cc7d907d6d
|
|||
| a7c18c5ca8 | |||
|
def3a3a87d
|
|||
|
9fc9208226
|
|||
|
|
dba3c91e7f |
37
Makefile
37
Makefile
@@ -7,12 +7,12 @@ FZF != command -v sk || command -v fzy || command -v fzf || \
|
||||
ifeq "$(FZF)" "/usr/bin/fzy"
|
||||
FZF += -i
|
||||
else
|
||||
FZF += --print-query | cat
|
||||
FZF += --print-query | tail -1
|
||||
endif
|
||||
|
||||
spill_contents = sed -e '1,/---/d'
|
||||
|
||||
help: .git/info/exclude ## Print the help message
|
||||
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 | \
|
||||
column -s ':' -t
|
||||
@@ -32,9 +32,11 @@ $(foreach dir, $(categories), \
|
||||
$(eval .dbs/$(dir).rec: $(wildcard $(dir)/*)) \
|
||||
)
|
||||
|
||||
.dbs/:
|
||||
%/:
|
||||
mkdir $@
|
||||
|
||||
include cmd.mk
|
||||
|
||||
$(databases): .dbs/%.rec: %/ | .dbs/
|
||||
$(info making $(@F))
|
||||
for entry in $(shell find $< -type f -name "*.md") ; do \
|
||||
@@ -73,17 +75,28 @@ default += .git/info/exclude
|
||||
.PHONY: database
|
||||
database: $(default) ## Make a recfiles database
|
||||
|
||||
%.md:
|
||||
printf '---\n'
|
||||
printf 'title: "%s"\n' "$(title)"
|
||||
printf 'tags: [ "%s" ]\n' "$(shell echo $(basename $(dir $@)) | sed 's/\/$$//' )" | tr '[:upper:]' '[:lower:]' | sed 's#\/#", "#g'
|
||||
printf 'requires: [ ]\n'
|
||||
printf '---\n'
|
||||
|
||||
ifdef title
|
||||
col = blue
|
||||
path = $(shell find $(categories) -type d | sort | uniq | $(FZF))
|
||||
filename = $(shell echo "$(title)" | tr ' ' '_' | tr -cd '[:alnum:]_')
|
||||
endif
|
||||
|
||||
title = $(shell read -r -p "Title: " line && echo "$${line}" | tr -d '"' | sed 's/\b\(.\)/\U\1/g')
|
||||
|
||||
.PHONY: .entry
|
||||
.entry: $(path)/$(filename).md
|
||||
|
||||
.PHONY: article
|
||||
article: ## Write an article
|
||||
@path=$$(find $(categories) -type d | sort | uniq | $(FZF)) ;\
|
||||
read -p "Title: " title ;\
|
||||
filename="$$(echo "$$title" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')" ;\
|
||||
mkdir -p $$path ;\
|
||||
printf '%s\n' '---' >> $$path/$$filename.md ;\
|
||||
printf 'title: "%s"\n' "$$title" >> $$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"
|
||||
make -e title="$(title)" .entry
|
||||
|
||||
|
||||
.dbs/map.fmt:| .dbs/
|
||||
printf '%s\n' '[ {{requires[0]}} ] --> [ {{title}} ] {border-style: dashed;}' > $@
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
---
|
||||
title: "column"
|
||||
tags: [ "basics", "format", "json" ]
|
||||
---
|
||||
|
||||
Put output into column.
|
||||
|
||||
```sh
|
||||
du -h /etc/* | column
|
||||
```
|
||||
|
||||
Reformat file with an explicit separator (`-s`):
|
||||
|
||||
```sh
|
||||
column -ts: /etc/passwd
|
||||
```
|
||||
|
||||
Give columns names (`-N`), so you can hide some (`-H`):
|
||||
|
||||
```sh
|
||||
column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID /etc/passwd
|
||||
```
|
||||
|
||||
Reorder with `-O` (unspecified items remain):
|
||||
|
||||
|
||||
```sh
|
||||
column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID -O User,Description,shell /etc/passwd
|
||||
```
|
||||
|
||||
Output to json format with `-J`:
|
||||
|
||||
```sh
|
||||
column -J -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd
|
||||
```
|
||||
|
||||
@@ -5,6 +5,7 @@ tags: [ "fun" ]
|
||||
|
||||
- `asciiquarium`
|
||||
- `cbonsai -lim "$(fortune)"`
|
||||
- `printf 'w\na\n' | ssh -tt nethack@alt.org`
|
||||
|
||||
```sh
|
||||
cow=$(cowsay -l | sort -R | head -1)
|
||||
|
||||
@@ -30,6 +30,11 @@ Done
|
||||
- If you have a command, Control + d will execute the command.
|
||||
- If you have nothing, `exit`.
|
||||
|
||||
Clear Search Highlights
|
||||
=======================
|
||||
|
||||
`<Esc>+u`
|
||||
|
||||
Input Run-Commands (`~/.inputrc`)
|
||||
=================================
|
||||
|
||||
|
||||
25
cmd.mk
Normal file
25
cmd.mk
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
cmds != recsel command.rec -t command -G bin -U -CP bin
|
||||
lists = $(patsubst %,lists/%.md, $(cmds))
|
||||
|
||||
default += $(lists)
|
||||
|
||||
get_title = printf 'title: "%s"\n' '${1}'
|
||||
get_tags = recsel -t $(basename $<) $< -G bin \
|
||||
-e 'bin = "$(1)"' -U -CP tag | \
|
||||
sed 's/.*/"&",/g' | \
|
||||
tr '\n' ' ' | \
|
||||
sed 's/.*/tags: [ &]/'
|
||||
|
||||
list_commands = recsel -t $(basename $<) $< -e 'bin = "$(1)"' | \
|
||||
recfmt -f lists.fmt
|
||||
|
||||
lists/%.md: command.rec | lists/
|
||||
@printf '%s\n' '---' > $@
|
||||
@$(call get_title,$(basename $(notdir $@))) >> $@
|
||||
@$(call get_tags,$(basename $(notdir $@))) >> $@
|
||||
@printf '\n%s\n' '---' >> $@
|
||||
@$(call list_commands,$(basename $(notdir $@))) >> $@
|
||||
|
||||
.PHONY: cmd
|
||||
cmd: $(lists) ## Bit lists of commands
|
||||
51
command.rec
Normal file
51
command.rec
Normal file
@@ -0,0 +1,51 @@
|
||||
%rec: command
|
||||
%doc: shell command examples
|
||||
%type: aim line
|
||||
%allowed: aim cmd bin tag
|
||||
|
||||
aim: Put output into column
|
||||
cmd: du -h /etc/* | column
|
||||
bin: column
|
||||
tag: format
|
||||
|
||||
aim: Reformat file with an explicit separator (`-s`)
|
||||
cmd: column -ts: /etc/passwd
|
||||
bin: column
|
||||
tag: format
|
||||
|
||||
aim: Give columns names (`-N`), so you can hide some (`-H`)
|
||||
cmd: column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID /etc/passwd
|
||||
bin: column
|
||||
tag: format
|
||||
|
||||
aim: Reorder with `-O` (unspecified items remain)
|
||||
cmd: column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID -O User,Description,shell /etc/passwd
|
||||
bin: column
|
||||
tag: format
|
||||
|
||||
aim: Output to json format with `-J`
|
||||
cmd: column -J -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd
|
||||
bin: column
|
||||
tag: format
|
||||
tag: json
|
||||
|
||||
aim: Make a QR Code image:
|
||||
cmd: qrencode 'https://play.google.com/store/apps/details?id=org.briarproject.briar.android' -o "$FILE".png
|
||||
bin: qrencode
|
||||
tag: qr
|
||||
|
||||
aim: Make a QR Coded message in the terminal:
|
||||
cmd: qrencode -t ansi "Hello World"
|
||||
bin: qrencode
|
||||
tag: qr
|
||||
|
||||
aim: Read a QR Code image:
|
||||
cmd: zbarimg $FILE
|
||||
bin: qrencode
|
||||
tag: qr
|
||||
|
||||
aim: Show wifi QR code (only with Network Manager):
|
||||
cmd: nmcli device wifi show-password
|
||||
bin: qrencode
|
||||
tag: qr
|
||||
tag: wifi
|
||||
@@ -129,7 +129,7 @@ Refreshing keys will tell you if some key you have contains a signature from som
|
||||
gpg --refresh-keys
|
||||
```
|
||||
|
||||
You can use the [crontab](../../basics/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
|
||||
|
||||
|
||||
@@ -9,3 +9,27 @@ The `vim-gnupg` plugin lets vim edit gpg-encrypted files as if they were unencry
|
||||
It's probably in your package manager.
|
||||
If not, you'll need to endure the faff of following the [instructions](http://www.vim.org/scripts/script.php?script_id=3645).
|
||||
|
||||
|
||||
## Prompt for password in terminal
|
||||
|
||||
Check your current gpg-agent configuration:
|
||||
|
||||
```sh
|
||||
gpgconf --list-options gpg-agent
|
||||
```
|
||||
|
||||
Create file, if it doesnt exit `~/.gnupg/gpg-agent.conf`:
|
||||
|
||||
```
|
||||
# Force terminal prompts for passwords
|
||||
pinentry-mode loopback
|
||||
|
||||
# Optional: specify which pinentry program to use
|
||||
pinentry-program /usr/bin/pinentry-tty
|
||||
```
|
||||
|
||||
Then restart gpg-agent:
|
||||
```sh
|
||||
gpg-connect-agent reloadagent /bye
|
||||
```
|
||||
|
||||
|
||||
@@ -44,11 +44,24 @@ You can get an RSS feed from any YouTube video with this script:
|
||||
```
|
||||
#!/bin/sh
|
||||
|
||||
CHANNEL_ID="$(curl -s "$1" | tr ',' '\n' | grep -Po 'channelId":"\K[\w+-]+' | tail -1)"
|
||||
FEED_URL="https://www.youtube.com/feeds/videos.xml?channel_id=$CHANNEL_ID"
|
||||
CHANNEL_NAME="$(curl -s "$FEED_URL" | grep -m 1 -Po 'title\>\K[\w\s]+')"
|
||||
set -e
|
||||
|
||||
printf '%s "%s"\n' "$FEED_URL" "$CHANNEL_NAME"
|
||||
db=~/rec/feeds.rec
|
||||
|
||||
rec="${2:-$db}"
|
||||
|
||||
[ ! -z "$1" ] || {
|
||||
echo "Give me a youtube URL"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -w "$rec" ] || touch "$rec"
|
||||
|
||||
CHANNEL_ID="$(curl -s "$1" | tr ',' '\n' | grep -Po 'channelId":"\K[\w+-]+' | tail -1)"
|
||||
URL="https://www.youtube.com/feeds/videos.xml?channel_id=$CHANNEL_ID"
|
||||
Name="$(curl -s "$URL" | grep -m 1 -Po 'title\>\K[\w\s]+')"
|
||||
|
||||
recins --verbose -t Feed -f Name -v "${Name}" -f URL -v "${URL}" -f Category -v Videos -f Rating -v 3 -f Working -v yes "$rec"
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "pass"
|
||||
tags: [ "data" ]
|
||||
tags: [ "data", "credentials", "secrets" ]
|
||||
requires: "GPG Basics"
|
||||
---
|
||||
|
||||
@@ -28,7 +28,7 @@ To add a basic password, e.g. for `$WEBSITE`:
|
||||
pass $WEBSITE
|
||||
```
|
||||
|
||||
To insert a multiline password, e.g. with a login name:
|
||||
To insert a multi-line password, e.g. with a login name:
|
||||
|
||||
```sh
|
||||
pass add -m $WEBSITE
|
||||
|
||||
48
data/pass_otp.md
Normal file
48
data/pass_otp.md
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
title: "pass with otp"
|
||||
tags: [ "data", "credentials", "secrets", "2fa", "otp" ]
|
||||
requires: "pass"
|
||||
---
|
||||
|
||||
Need a Microsoft or Google authenticator?
|
||||
No you don't.
|
||||
|
||||
These usually come in the form of QR codes.
|
||||
|
||||
|
||||
```qr code
|
||||
|
||||
|
||||
█▀▀▀▀▀█ ▀ ▀▀▀ ▀ ▄ █▀▀▀▀▀█
|
||||
█ ███ █ ▄▄▀▄▄▀▄▄▀ █ ███ █
|
||||
█ ▀▀▀ █ ██ ▀▄██▀▀ █ ▀▀▀ █
|
||||
▀▀▀▀▀▀▀ █ █▄▀ █ █ ▀▀▀▀▀▀▀
|
||||
█▄▄ █▄▀▀██ ▄▄▀▀▄██▀▀██ ▄▀
|
||||
▄██▄▀█▀█ ▀▄▀ █▀▀▀█ ▀▀▀█▄
|
||||
▄ ▄▄█ ▀▀ ▄▄▀▀█▄█ ▀▀ ▄▀▀█▀
|
||||
█ ▀ ▀▀█▀▀ ▄ ▄█▀▄▀██▀█▄
|
||||
▀▀▀ ▀ ▀ █▄▄▀▄▀▀▄█▀▀▀█▀▀
|
||||
█▀▀▀▀▀█ ▀▄ █▀█▀ █ ▀ █▄▄
|
||||
█ ███ █ ▀ ▄ ▀█▄ ████▀▀█▄█
|
||||
█ ▀▀▀ █ ▄▀ ▄ ▄▄ ██▄▄█▄█
|
||||
▀▀▀▀▀▀▀ ▀ ▀▀ ▀▀▀ ▀▀ ▀▀▀
|
||||
|
||||
|
||||
```
|
||||
|
||||
Download the code, and get the information out:
|
||||
|
||||
|
||||
```sh
|
||||
zbarimg qr.png
|
||||
otp="$(zbarimg qr.png | sed 's/QR-Code://')"
|
||||
otp_name=site.org.otp
|
||||
echo "${otp}" | pass otp add --echo "${otp_name}"
|
||||
```
|
||||
|
||||
Show the OTP:
|
||||
|
||||
|
||||
```sh
|
||||
pass otp "${otp_name}"
|
||||
```
|
||||
@@ -43,8 +43,8 @@ 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)
|
||||
- [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)
|
||||
|
||||
|
||||
65
data/recfiles/nginx_logs.md
Normal file
65
data/recfiles/nginx_logs.md
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title: "nginx logs with recfiles"
|
||||
tags: [ "data", "recfiles", "logs" ]
|
||||
requires: [ "Recfiles", "nginx" ]
|
||||
---
|
||||
|
||||
The standard `nginx` log format has such a lack of consistency or meaning that you might squint your face into a whirlpool making sense of them:
|
||||
|
||||
|
||||
```nonsense
|
||||
18.97.14.85 - - [16/Nov/2025:00:52:12 +0100] "GET /posts/learning_without_experts/content.html HTTP/1.1" 200 1704 "-" "CCBot/2.0 (https://commoncrawl.org/faq/)"
|
||||
57.141.0.25 - - [16/Nov/2025:00:52:18 +0100] "GET /posts/hope_you_win/ HTTP/1.1" 200 61997 "-" "meta-externalagent/1.1 (+https://developers.facebook.com/docs/sharing/webmasters/crawler)"
|
||||
201.17.157.249 - - [16/Nov/2025:00:52:19 +0100] "GET https://ttrpgs.com/post/wp/ HTTP/1.1" 200 45202 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
|
||||
47.246.164.151 - - [16/Nov/2025:00:52:22 +0100] "GET https://ttrpgs.com/css/styles.dc38388a8f0b890e788bd3a99b7495d14e7d5ac4359ed3b49abeb778497863b284ad4cc7e496ef58c84139295f9bafed82f5a41345eda86bd2d429cccb7c2596.css HTTP/1.1" 200 27109 "https://ttrpgs.com/post/wp/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
|
||||
47.246.164.154 - - [16/Nov/2025:00:52:22 +0100] "GET https://ttrpgs.com/fonts/Metropolis-MediumItalic.woff2 HTTP/1.1" 200 28100 "https://ttrpgs.com/css/styles.dc38388a8f0b890e788bd3a99b7495d14e7d5ac4359ed3b49abeb778497863b284ad4cc7e496ef58c84139295f9bafed82f5a41345eda86bd2d429cccb7c2596.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
|
||||
47.246.164.135 - - [16/Nov/2025:00:52:22 +0100] "GET https://ttrpgs.com/fonts/Metropolis-Regular.woff2 HTTP/1.1" 200 24152 "https://ttrpgs.com/css/styles.dc38388a8f0b890e788bd3a99b7495d14e7d5ac4359ed3b49abeb778497863b284ad4cc7e496ef58c84139295f9bafed82f5a41345eda86bd2d429cccb7c2596.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
|
||||
```
|
||||
|
||||
Someone created this logging format on purpose, to make sure nobody could parse it with a hundred `column`, `cut`, or `awk` pipes.
|
||||
|
||||
The problem lies in `/etc/nginx/nginx.conf`:
|
||||
|
||||
|
||||
```conf
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
```
|
||||
|
||||
Despite a request of three strings, this format returns one string.
|
||||
|
||||
It can output to recfile format like this:
|
||||
|
||||
|
||||
```conf
|
||||
log_format main '\nIP: $remote_addr\n'
|
||||
'User: $remote_user\n'
|
||||
'Date: $time_local\n'
|
||||
'Request: $request\n'
|
||||
'Status: $status\n'
|
||||
'Bytes: $body_bytes_sent\n'
|
||||
'Referrer: $http_referer\n'
|
||||
'Agent: $http_user_agent\n'
|
||||
'XForward: $http_x_forwarded_for\n';
|
||||
|
||||
access_log /var/log/nginx/access.rec main;
|
||||
```
|
||||
|
||||
Note the newline (`\n`) symbol, required to start a new entry on a new line.
|
||||
|
||||
1. `cp /etc/nginx.conf /etc/nginx.conf.bak`
|
||||
1. Change `/etc/nginx.conf` to match the format above.
|
||||
1. Check the file works with `nginx -t`.
|
||||
1. Restart the `nginx` service.
|
||||
1. Access that web page to make sure that at least one log exists.
|
||||
1. Check the file with `recfix /var/log/nginx/access.rec`.
|
||||
|
||||
Once it works, you can add the usual recfile headers:
|
||||
|
||||
|
||||
```sh
|
||||
sed -i '1 i \ ' /var/log/nginx/access.rec
|
||||
sed -i '1 i %rec: Weblog' /var/log/nginx/access.rec
|
||||
sed -i '2 i %doc: nginx access logs' /var/log/nginx/access.rec
|
||||
```
|
||||
@@ -36,7 +36,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/website/nginx.md).
|
||||
|
||||
(replace `${DOMAIN_NAME}` with your domain's name).
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ vi /etc/locale.gen
|
||||
locale-gen
|
||||
```
|
||||
|
||||
Make your keyboard changes permenent with:
|
||||
Make your keyboard changes permanent with:
|
||||
|
||||
```sh
|
||||
vi /etc/vconsole.conf
|
||||
|
||||
@@ -6,8 +6,9 @@ requirements: [ "pacman" ]
|
||||
|
||||
```sh
|
||||
pacman --sync --noconfirm --needed base-devel gcc git
|
||||
git clone https://aur.archlinux.org/yay.git /tmp/yay
|
||||
makepkg -C !$ -si
|
||||
git clone https://aur.archlinux.org/yay.git
|
||||
cd yay
|
||||
makepkg -si
|
||||
```
|
||||
|
||||
The flags are mostly the same as in `pacman`.
|
||||
|
||||
8
distros/void/laptops.md
Normal file
8
distros/void/laptops.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: "Laptops with Void Linux"
|
||||
tags: [ "void", "laptop" ]
|
||||
---
|
||||
|
||||
Install and enable `tlp`.
|
||||
|
||||
Decide how to handle events like the lid closing in `/etc/acpi/handler.sh`.
|
||||
@@ -22,6 +22,12 @@ Search with regex:
|
||||
xbps-query --regex -Rs 'cow(s)?\w'
|
||||
```
|
||||
|
||||
Search for `genfstab`:
|
||||
|
||||
```sh
|
||||
xlocate genfstab
|
||||
```
|
||||
|
||||
List what's required for cowsay
|
||||
|
||||
```sh
|
||||
|
||||
@@ -5,9 +5,17 @@ tags: [ "networking" ]
|
||||
|
||||
# Get a Hostname
|
||||
|
||||
[onion hidden service guide](https://community.torproject.org/onion-services/setup/)
|
||||
|
||||
```sh
|
||||
sudo vim /etc/tor/torrc
|
||||
```
|
||||
|
||||
Uncomment the lines about `/var/lib/tor/hidden_services`, including port 22 (or whatever); restart tor, then go to that directory, and cat the hostname.
|
||||
|
||||
|
||||
# SSH over tor
|
||||
|
||||
install package `torsocks`, and add it before `ssh` command, for easier use, add it to `.ssh/config`
|
||||
|
||||
`torsocks ssh user@{someonionhash}.onion`
|
||||
|
||||
@@ -48,7 +48,7 @@ echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/wg.conf
|
||||
```
|
||||
|
||||
```sh
|
||||
systemctl enable --now wg-quiqck@wg0
|
||||
systemctl enable --now wg-quick@wg0
|
||||
```
|
||||
|
||||
```sh
|
||||
@@ -67,7 +67,7 @@ Be root.
|
||||
|
||||
Install `wireguard-tools` on the client.
|
||||
|
||||
Copy the client private key and server public key to the server (or just fill in the variables).
|
||||
Copy the client server public key to the server (or just fill in the variables).
|
||||
|
||||
|
||||
```sh
|
||||
|
||||
83
sound/mpd_pipewire.md
Normal file
83
sound/mpd_pipewire.md
Normal file
@@ -0,0 +1,83 @@
|
||||
---
|
||||
title: "mpd with pipewire"
|
||||
tags: [ "sound", "pipewire" ]
|
||||
requirements: [ "pipewire" ]
|
||||
---
|
||||
# Setup
|
||||
|
||||
## Configuration
|
||||
|
||||
This is a minimum configuration file for /etc/mpd.conf
|
||||
|
||||
> music_directory "/var/lib/mpd/music"
|
||||
>
|
||||
> playlist_directory "/var/lib/mpd/playlists"
|
||||
>
|
||||
> db_file "/var/lib/mpd/mpd.db"
|
||||
>
|
||||
>
|
||||
> pid_file "/run/mpd/mpd.pid"
|
||||
>
|
||||
> state_file "/var/lib/mpd/mpdstate"
|
||||
>
|
||||
>
|
||||
> user "mpd"
|
||||
>
|
||||
> audio_output {
|
||||
> type "pulse"
|
||||
> name "My Pulse Output"
|
||||
> }
|
||||
>
|
||||
|
||||
## Set Pulseaudio to Run System-Wide
|
||||
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /etc/pipewire/pipewire-pulse.conf.d
|
||||
|
||||
cat > /etc/pipewire/pipewire-pulse.conf.d/pulse-server.conf << "EOF"
|
||||
pulse.properties = {
|
||||
server.address = [
|
||||
"unix:native"
|
||||
"tcp:4713" # IPv4 and IPv6 on all addresses
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
|
||||
```
|
||||
|
||||
Give `mpd` access to pulse:
|
||||
|
||||
```sh
|
||||
grep pulse /etc/group | cut -d: -f1
|
||||
|
||||
grep pulse /etc/group | cut -d: -f1 | while read g; do
|
||||
sudo usermod -aG $g mpd
|
||||
done
|
||||
```
|
||||
|
||||
Working with mpd will be easier if you have access to its files, so maybe:
|
||||
|
||||
```sh
|
||||
sudo usermod -aG mpd $USER
|
||||
```
|
||||
|
||||
Remember to reboot.
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
Check pulse is working.
|
||||
|
||||
```sh
|
||||
ss | grep 4713
|
||||
```
|
||||
|
||||
# Notifications (AUR)
|
||||
|
||||
Install `mpd-notification` and then start the service:
|
||||
|
||||
```sh
|
||||
systemctl --user enable mpd-notification
|
||||
```
|
||||
|
||||
12
sound/pipewire.md
Normal file
12
sound/pipewire.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: "pipewire"
|
||||
tags: [ "sound" ]
|
||||
---
|
||||
|
||||
Install `wireplumber` and `pipewire`, then add your user to any `pipewire` group.
|
||||
|
||||
```sh
|
||||
sudo ln -s /usr/share/examples/pipewire/20-pipewire-pulse.conf /etc/pipewire/pipewire.conf.d/20-pipewire-pulse.conf
|
||||
|
||||
sudo ln -s /usr/share/examples/wireplumber/10-wireplumber.conf /etc/pipewire/pipewire.conf.d/10-wireplumber.conf
|
||||
```
|
||||
@@ -14,12 +14,27 @@ Say 'hello' to yourself:
|
||||
ansible --module-name=ping localhost
|
||||
```
|
||||
|
||||
Ansible takes a lot of information about each machine during setup:
|
||||
|
||||
```sh
|
||||
TMP=$(mktemp)
|
||||
ansible --module-name=setup localhost | tee $TMP
|
||||
less !$
|
||||
```
|
||||
|
||||
If you have `jq`, you can pull out info:
|
||||
|
||||
```sh
|
||||
sed -i 's/.*SUCC.*/{/' $TMP
|
||||
jq '.ansible_facts.ansible_distribution' < $TMP
|
||||
```
|
||||
|
||||
Upgrade through the package manager.
|
||||
|
||||
`packager=apt` (or `pacman` or `xbps`,...)
|
||||
|
||||
```sh
|
||||
packager=apt
|
||||
packager="$( jq -r '.ansible_facts.ansible_pkg_mgr' < $TMP )"
|
||||
ansible --module-name=${packager} --args "upgrade=yes" localhost
|
||||
```
|
||||
|
||||
@@ -87,4 +102,8 @@ ansible-inventory --list -y -i
|
||||
ansible-vault view sec.yml --vault-pass-file pass.sh
|
||||
```
|
||||
|
||||
community.general.say voice=en_GB msg="Testing 123"
|
||||
Install `espeak', then make the computer say something:
|
||||
|
||||
```sh
|
||||
ansible --module-name=say --args "msg='testing'" localhost
|
||||
```
|
||||
|
||||
@@ -178,6 +178,6 @@ In this case, the makefile can see that `backup` depends on the current backup f
|
||||
|
||||
# The Rest
|
||||
|
||||
- [File patterns](Makefiles/patterns.md)
|
||||
- [Makefile graphs](Makefiles/graph-easy.md)
|
||||
- [In-build help](Makefiles/help.md)
|
||||
- [File patterns](makefiles/patterns.md)
|
||||
- [Makefile graphs](makefiles/graph-easy.md)
|
||||
- [In-build help](makefiles/help.md)
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Makefile Patterns"
|
||||
tags: [ "system", "make" ]
|
||||
---
|
||||
|
||||
Using the [basic example](../Makefile.md), you can make a complete backup of all backup files.
|
||||
Using the [basic example](../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'.
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
---
|
||||
title: "QR Codes"
|
||||
tags: [ "qrencode", "zbar" ]
|
||||
---
|
||||
|
||||
Make a QR Code image:
|
||||
|
||||
```sh
|
||||
qrencode 'https://play.google.com/store/apps/details?id=org.briarproject.briar.android' -o "$FILE".png
|
||||
```
|
||||
|
||||
Make a QR Coded message in the terminal:
|
||||
|
||||
```sh
|
||||
qrencode -t ansi "Hello World"
|
||||
```
|
||||
|
||||
Read a QR Code image:
|
||||
|
||||
```sh
|
||||
zbarimg $FILE
|
||||
```
|
||||
|
||||
Show wifi QR code (only with Network Manager):
|
||||
|
||||
```sh
|
||||
nmcli device wifi show-password
|
||||
```
|
||||
71
vision/record_terminal.md
Normal file
71
vision/record_terminal.md
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
title: "Record a Terminal Session"
|
||||
tags: [ "vision", "share" ]
|
||||
---
|
||||
|
||||
Record a terminal command, then press 'Control + d' to exit.
|
||||
|
||||
```sh
|
||||
script --timing=time.log stat.txt
|
||||
ls -a
|
||||
ls -al
|
||||
stat ~/.bashrc
|
||||
^D
|
||||
```
|
||||
|
||||
Replay the session:
|
||||
|
||||
```sh
|
||||
scriptreplay --timing=time.log stat.txt
|
||||
```
|
||||
|
||||
Try a bare command, without any timing:
|
||||
|
||||
```sh
|
||||
script -c 'top | lolcat' loltop
|
||||
nl loltop
|
||||
```
|
||||
|
||||
Has your terminal messed up?
|
||||
Is the cursor hiding?
|
||||
Reset it!
|
||||
|
||||
```sh
|
||||
reset
|
||||
```
|
||||
If you can't see any keys, keep typing anyway: have faith in your terminal.
|
||||
|
||||
This `loltop` file will not play properly as it has no timings file.
|
||||
But you can cheat the system and use your other timings file:
|
||||
|
||||
```sh
|
||||
scriptreplay --timing=time.log loltop
|
||||
```
|
||||
|
||||
This will mostly not work well, but it shows how the timing file works:
|
||||
|
||||
|
||||
```text
|
||||
0.033401 23
|
||||
0.044513 8
|
||||
0.000016 219
|
||||
1.349324 114
|
||||
0.179106 1
|
||||
0.088790 1
|
||||
0.072821 1
|
||||
0.358337 2
|
||||
0.000254 9
|
||||
0.004720 52
|
||||
0.000084 21
|
||||
0.155462 671
|
||||
```
|
||||
|
||||
I think it works like this?
|
||||
|
||||
| How long it took | to type *n* characters |
|
||||
|:----------------:|:----------------------:|
|
||||
| 0.033401 | 23 |
|
||||
| 0.044513 | 8 |
|
||||
| 0.000016 | 219 |
|
||||
| 1.349324 | 114 |
|
||||
|
||||
@@ -20,6 +20,5 @@ Keybind to exit this mode is `Ctrl+q`
|
||||
- [Learning Vim](vim/vi.md)
|
||||
- [Navigation](vim/navigate.md)
|
||||
- [Completion](vim/completion.md)
|
||||
- [Search](vim/search.md)
|
||||
- [Window Splits](vim/windows.md)
|
||||
- [Use vim bindings in bash](vim/vim_in_bash.md)
|
||||
|
||||
32
writing/vim/linewrap.md
Normal file
32
writing/vim/linewrap.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
title: "vim linewrap"
|
||||
tags: [ "vim", "format", "linewrap" ]
|
||||
requires: [ "vim basics" ]
|
||||
---
|
||||
|
||||
Wrap lines in a file to 80 characters with `gqG`.
|
||||
|
||||
Take this markdown file:
|
||||
|
||||
|
||||
```markdown
|
||||
This is a looooooooooooooooooooooooong line, and reeeeeeeeeeeeeeding it can be a paaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiin in the aaaaaaaaaaaaaaaaaaaaaaaarse.
|
||||
```
|
||||
|
||||
Reformat the line to the proper text width by pressing `gqw`.
|
||||
The output looks like this:
|
||||
|
||||
```markdown
|
||||
This is a looooooooooooooooooooooooong line, and reeeeeeeeeeeeeeding it can be
|
||||
a paaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiin in the
|
||||
aaaaaaaaaaaaaaaaaaaaaaaarse.
|
||||
```
|
||||
|
||||
This works with chunks of text in visual mode.
|
||||
|
||||
Change what width the text should be:
|
||||
|
||||
```vim
|
||||
:set textwidth=100
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "vim search"
|
||||
tags: [ "vim", "search" ]
|
||||
title: "find and replace"
|
||||
tags: [ "vim", "search", "replace", "find" ]
|
||||
requires: [ "vim basics" ]
|
||||
---
|
||||
Search for the next and or previous occurrence of the word under your cursor with `*` and `#`.
|
||||
@@ -9,7 +9,11 @@ Search and replace the first 'one' found with 'two':
|
||||
|
||||
`:%s/one/two/`
|
||||
|
||||
Same, but replace 'one' globally:
|
||||
Run the last substitution globally:
|
||||
|
||||
`g&`
|
||||
|
||||
Same, but just replace 'one' globally:
|
||||
|
||||
`:%s/one/two/g`
|
||||
|
||||
Reference in New Issue
Block a user