Compare commits
41 Commits
13b3d7a839
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
58f794d7b8
|
|||
|
49452db82d
|
|||
|
a3ffdd8ae6
|
|||
|
fe1c524dc3
|
|||
|
668d605dcb
|
|||
|
cc3ac0d7b0
|
|||
|
8811e94b11
|
|||
|
cd7ddd15b2
|
|||
|
88eefd2c1e
|
|||
|
54e4cc5149
|
|||
|
9901404a91
|
|||
|
4e76fec33c
|
|||
|
d7f8c9bae1
|
|||
|
6a10468d4d
|
|||
|
ab079fedfa
|
|||
|
2bdc293263
|
|||
|
2f7ad89bbb
|
|||
|
5e9d08286b
|
|||
|
4c9dacbd45
|
|||
|
9e4889daea
|
|||
|
e35e9a7766
|
|||
|
f4f6da1250
|
|||
|
f47a28b359
|
|||
|
77af4be50c
|
|||
|
5cae2da19c
|
|||
|
a4ca6023d1
|
|||
|
5ca15bc33f
|
|||
|
6325a32c85
|
|||
|
b50709b7c4
|
|||
|
03e3ebd748
|
|||
|
fa409cb8fb
|
|||
|
db380464a2
|
|||
|
7f91ab754c
|
|||
|
c949094bc8
|
|||
|
6289dbe32e
|
|||
|
b01fc9ff0d
|
|||
|
ffd058dc45
|
|||
|
ef7d1a0f5e
|
|||
|
b7493ddbaf
|
|||
|
c3293ec3ac
|
|||
|
23ff184688
|
@@ -33,6 +33,7 @@ default += .dbs/map.fmt
|
||||
echo '*' > $@.gitignore
|
||||
|
||||
include cmd.mk
|
||||
include pub.mk
|
||||
|
||||
.dbs/head.rec: | .dbs/
|
||||
printf '%s\n' '%rec: guide' > $@
|
||||
@@ -58,6 +59,7 @@ include cmd.mk
|
||||
sed '1,/^---$$/d' $$entry | sed 's/^.*/+ &/' ;\
|
||||
echo '' ;\
|
||||
done >> $@
|
||||
recfix $@
|
||||
|
||||
.dbs/requires.rec: .dbs/new.rec
|
||||
recinf -d $< > $@
|
||||
@@ -100,7 +102,7 @@ map: .dbs/requires.rec .dbs/map.fmt ## Show knowledge dependency map
|
||||
|
||||
.PHONY: clean
|
||||
clean: ## Remove all generated files
|
||||
$(RM) -r $(default) .dbs/
|
||||
$(RM) -r $(default) .dbs/ .publish/
|
||||
|
||||
.PHONY: article
|
||||
article: */ */*/ ## Write a new article
|
||||
@@ -109,7 +111,9 @@ article: */ */*/ ## Write a new article
|
||||
&& filename="$$(echo "$$name" \
|
||||
| cut -d: -f1 \
|
||||
| tr '[A-Z ]' '[a-z_]' | tr -cd '[:alpha:]_' )" \
|
||||
&& $(MAKE) -e TITLE="$$name" "$$category"/"$$filename.md"
|
||||
&& $(MAKE) -e TITLE="$$name" "$$category""$$filename.md"
|
||||
|
||||
default += $(lists) $(publish)
|
||||
|
||||
.PHONY: all
|
||||
all: $(default) ## All file targets
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ title: profanity
|
||||
tags:
|
||||
- chat
|
||||
- omemo
|
||||
- TUI
|
||||
---
|
||||
|
||||
# Setup (Commands)
|
||||
@@ -44,7 +45,7 @@ Check your `~/.config/profanity/profrc` for how to data's saved.
|
||||
To automatically sign in, add your password to [pass](data/pass.md).
|
||||
|
||||
```
|
||||
/account set ${name}@${host} eval_password pass *xmpp*
|
||||
/account set ${name}@${host} eval_password "pass ${account}"
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
@@ -3,6 +3,7 @@ title: profanity automation
|
||||
tags:
|
||||
- chat
|
||||
- omemo
|
||||
- TUI
|
||||
requires:
|
||||
- chat/profanity.md
|
||||
---
|
||||
|
||||
@@ -1,25 +1,6 @@
|
||||
|
||||
cmds != recsel command.rec -t command -G bin -CP bin | sort -u
|
||||
lists = $(patsubst %,lists/%.md, $(cmds))
|
||||
|
||||
get_title = printf 'title: %s\n' '${1}'
|
||||
get_tags = recsel -t $(basename $<) $< -G bin \
|
||||
-e 'bin = "$(1)"' -U -CP tag,bin | \
|
||||
sed 's/.*/- &/'
|
||||
|
||||
list_commands = recsel -t $(basename $<) $< -e 'bin = "$(1)"' | \
|
||||
recfmt -f lists.fmt
|
||||
|
||||
$(lists): lists/%.md: command.rec | lists/
|
||||
@printf '%s\n' '---' > $@
|
||||
@$(call get_title,$(basename $(notdir $@))) >> $@
|
||||
@printf '%s\n' 'tags: ' >> $@
|
||||
@$(call get_tags,$(basename $(notdir $@))) >> $@
|
||||
@printf '%s\n' '---' >> $@
|
||||
@$(call list_commands,$(basename $(notdir $@))) >> $@
|
||||
|
||||
.PHONY: function
|
||||
function: ## Output a search function for .bashrc
|
||||
function: | db.rec ## Output a search function for .bashrc
|
||||
${MAKE} --silent --touch query
|
||||
printf '%s\n' 'lk(){'
|
||||
${MAKE} --silent --dry-run query | sed 's/^/\t/'
|
||||
|
||||
+56
-8
@@ -200,6 +200,13 @@ shell: sh
|
||||
bin: fzf
|
||||
tag: comfy
|
||||
|
||||
aim: Read the minimal size of a git repo
|
||||
cmd: git count-objects -vH | grep -Po 'size-pack: \K.*'
|
||||
note: Git repositories are never at their minimal size.
|
||||
shell: sh
|
||||
bin: git
|
||||
tag: size
|
||||
|
||||
aim: Email a pull request which points to your git server
|
||||
tag: git
|
||||
shell: sh
|
||||
@@ -251,10 +258,10 @@ tag: web
|
||||
shell: sh
|
||||
|
||||
aim: Run commands in background
|
||||
cmd: du -sh .* | sort -h | tail &
|
||||
cmd: jobs
|
||||
cmd: grep -ri password /etc/ &
|
||||
cmd: jobs
|
||||
cmd: ls -Rilt ~ &
|
||||
+ jobs
|
||||
+ find ~/.cache/ -type d -exec du '{}' -h ';' | sort -h &
|
||||
+ jobs
|
||||
shell: sh
|
||||
bin: jobs
|
||||
tag: shell
|
||||
@@ -286,7 +293,7 @@ shell: sh
|
||||
bin: journalctl
|
||||
tag: system
|
||||
|
||||
aim: Find errors since a date
|
||||
aim: Find service errors in systemd since a date
|
||||
cmd: date=2027-01-01
|
||||
+ journalctl --since=${date} --grep="EXT4-fs error"
|
||||
shell: sh
|
||||
@@ -294,7 +301,8 @@ bin: journalctl
|
||||
tag: system
|
||||
|
||||
aim: Limit the systemd's journal size to 2 gigabytes
|
||||
cmd: journalctl --vacuum-size=2G
|
||||
cmd: journalctl --disk-usage
|
||||
+ journalctl --vacuum-size=2G
|
||||
+ journalctl --disk-usage
|
||||
shell: sh
|
||||
bin: journalctl
|
||||
@@ -413,6 +421,13 @@ bin: ntpd
|
||||
tag: time
|
||||
tag: system
|
||||
|
||||
aim: Convert bytes to human readable size
|
||||
cmd: b=10392309
|
||||
+ echo "$b" | numfmt --to=eic
|
||||
shell: sh
|
||||
bin: numfmt
|
||||
tag: size
|
||||
|
||||
aim: Uncompress a PDF
|
||||
cmd: pdftk ${input}.pdf output ${output}.pdf uncompress
|
||||
shell: sh
|
||||
@@ -477,6 +492,14 @@ bin: ssh
|
||||
tag: system
|
||||
tag: comfy
|
||||
|
||||
aim: List enabled systemd services
|
||||
cmd: systemctl list-unit-files --state enabled
|
||||
cmd: systemctl --user list-unit-files --state enabled
|
||||
shell: sh
|
||||
bin: systemd
|
||||
tag: system
|
||||
tag: service
|
||||
|
||||
aim: Check a service
|
||||
cmd: sudo systemctl status mpd
|
||||
shell: sh
|
||||
@@ -545,7 +568,7 @@ tag: writing
|
||||
|
||||
aim: Edit users in /etc/passwd directly
|
||||
cmd: sudo vipw
|
||||
note: You can't edit passwords with black magic.
|
||||
note: You can't edit passwords without strange cyphers.
|
||||
shell: sh
|
||||
bin: vipw
|
||||
bin: sudo
|
||||
@@ -554,9 +577,34 @@ tag: users
|
||||
|
||||
aim: Edit groups in /etc/group directly
|
||||
cmd: sudo vigr
|
||||
note: You can't edit passwords with black magic.
|
||||
shell: sh
|
||||
bin: vipw
|
||||
bin: sudo
|
||||
tag: system
|
||||
tag: groups
|
||||
|
||||
aim: Check current keyboard layout on sway
|
||||
cmd: swaymsg -t get_inputs --raw | jq -r '.[0].xkb_active_layout_name'
|
||||
bin: sway
|
||||
bin: jq
|
||||
tag: keyboard
|
||||
tag: locale
|
||||
shell: sh
|
||||
|
||||
aim: Show name of currently selected app in sway
|
||||
cmd: swaymsg -t get_tree | jq -C '.. | select(.type?) | select(.focused==true)'
|
||||
bin: sway
|
||||
bin: jq
|
||||
tag: bar
|
||||
shell: sh
|
||||
|
||||
aim: Share a directory as a local website
|
||||
cmd: python3 -m http.server
|
||||
note: Anyone can go to your computer's IP address and access all files in the current directory.
|
||||
shell: sh
|
||||
bin: python3
|
||||
tag: tip
|
||||
tag: network
|
||||
tag: share
|
||||
cmd: qrencode -t ansi "$(ip route show | grep -Pom1 'src \K[\d.]+')"
|
||||
+ sudo python -m http.server 80
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: git
|
||||
title: Setup git
|
||||
tags:
|
||||
- data
|
||||
- setup
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: git-secret
|
||||
title: "Review: git-secret"
|
||||
tags:
|
||||
- data
|
||||
- git
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: newsboat
|
||||
tags:
|
||||
- RSS
|
||||
- Setup
|
||||
---
|
||||
Create the configuration directory before you start, and add at least 1 URL.
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ title: Newsraft
|
||||
tags:
|
||||
- data
|
||||
- RSS
|
||||
- Setup
|
||||
---
|
||||
|
||||
# Setup
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: pass
|
||||
title: Store passwords
|
||||
tags:
|
||||
- data
|
||||
- Setup
|
||||
- credentials
|
||||
- secrets
|
||||
requires:
|
||||
|
||||
@@ -10,5 +10,6 @@ requires:
|
||||
- networking/nginx.md
|
||||
---
|
||||
|
||||
- [Soft-Serve with https](soft-serve/commands.md)
|
||||
- [Soft-Serve with https](soft-serve/soft_https.md)
|
||||
- [Maintenance](soft-serve/soft_maintenance.md)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: Soft-Serve Commands
|
||||
tags:
|
||||
- data
|
||||
- git server
|
||||
- CLI
|
||||
requires:
|
||||
- data/git.md
|
||||
- networking/ssh.md
|
||||
---
|
||||
|
||||
Some commands to try with an active soft server:
|
||||
|
||||
```sh
|
||||
ssh -p 2222 splint.rs repo list
|
||||
|
||||
ssh -p 2222 splint.rs repo info nd6
|
||||
|
||||
ssh -p 2222 splint.rs repo tree nd6 /
|
||||
|
||||
ssh -p 2222 splint.rs repo info newsraft
|
||||
|
||||
ssh -p 2222 splint.rs repo tree newsraft main doc
|
||||
|
||||
ssh -p 2222 splint.rs repo tree mkdots all scripts
|
||||
|
||||
ssh -p 2222 splint.rs repo -cl cat mkdots all scripts/nb | less -R
|
||||
|
||||
```
|
||||
@@ -2,7 +2,6 @@
|
||||
title: Arch on a Raspberry Pi 4
|
||||
tags:
|
||||
- distros
|
||||
- raspberry pi
|
||||
- rpi
|
||||
---
|
||||
|
||||
|
||||
+128
-5
@@ -1,7 +1,7 @@
|
||||
%rec: example
|
||||
%key: filename
|
||||
%type: note line
|
||||
%key: name
|
||||
|
||||
name: Default systemd service file
|
||||
filename: default.service
|
||||
bin: systemd
|
||||
usage: mv {{filename}} /usr/lib/systemd/system/
|
||||
@@ -31,6 +31,7 @@ content: [Unit]
|
||||
+ Alias=test.service
|
||||
+
|
||||
|
||||
name: Example sc-im file
|
||||
filename: food.sc
|
||||
bin: sc-im
|
||||
usage: {{bin}} {{filename}}
|
||||
@@ -81,8 +82,11 @@ content: # This data file was generated by the Spreadsheet Calculator Improvised
|
||||
+ pad 4 A10
|
||||
+ goto A10
|
||||
|
||||
name: Example makefile producing html from markdown
|
||||
filename: lowdown.mk
|
||||
bin: make
|
||||
bin: lowdown
|
||||
bin: fortune
|
||||
usage: {{bin}} -f {{filename}} example
|
||||
content: output: all
|
||||
+
|
||||
@@ -121,6 +125,7 @@ content: output: all
|
||||
+ clean :
|
||||
+ rm -rf public html
|
||||
|
||||
name: Default makefile
|
||||
filename: Makefile
|
||||
bin: make
|
||||
usage: make
|
||||
@@ -142,9 +147,7 @@ content: ### Variables
|
||||
+
|
||||
+ .PHONY: help
|
||||
+ help:
|
||||
+ @awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
|
||||
+ sort | \
|
||||
+ column -s ':' -t
|
||||
+ @awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | + sort | + column -s ':' -t
|
||||
+
|
||||
+ .PHONY: check
|
||||
+ check: ## Check you have the required dependencies
|
||||
@@ -153,3 +156,123 @@ content: ### Variables
|
||||
+ .PHONY: clean
|
||||
+ clean: ## Remove generated files.
|
||||
+ $(RM) $(defaults)
|
||||
|
||||
name: Issues tracker
|
||||
filename: Makefile
|
||||
bin: make
|
||||
content: hdr = @printf "\n\033[37;1;4m%s\033[0m\n"
|
||||
+ msg = @printf "\033[37;1m%s\033[0m\n"
|
||||
+
|
||||
+ issues = $(wildcard open/*) $(wildcard closed/*)
|
||||
+
|
||||
+ number_of_issues != echo $(issues) | wc -w
|
||||
+
|
||||
+ name = open/issue_$(number_of_issues).md
|
||||
+
|
||||
+ last_modified != ls -t open/* 2>/dev/null | head -1
|
||||
+ ifndef last_modified
|
||||
+ setup:
|
||||
+ @mkdir open closed
|
||||
+ @git init
|
||||
+ @echo '---' > open/issue_1.md
|
||||
+ @echo 'title: Setup git' >> open/issue_1.md
|
||||
+ @echo 'priority: high' >> open/issue_1.md
|
||||
+ @printf 'responsible: ' >> open/issue_1.md
|
||||
+ @git config user.name >> open/issue_1.md
|
||||
+ @echo '---' >> open/issue_1.md
|
||||
+ @echo 'Push to a remote repository' >> open/issue_1.md
|
||||
+ @git add $(MAKEFILE_LIST) open/issue_1.md
|
||||
+ @git commit -m'Init the git!'
|
||||
+ $(info Check issue 1)
|
||||
+ $(info Run make again)
|
||||
+ endif
|
||||
+
|
||||
+ open_issues = $(wildcard open/*)
|
||||
+ closed_issues = $(patsubst open/%, closed/%, $(open_issues))
|
||||
+
|
||||
+ EDITOR ?= vi
|
||||
+
|
||||
+ close_issue_command = @git commit --message "Close $$(basename -s .md $(last_modified) | tr '_' ' ')"
|
||||
+
|
||||
+ random_helper = $(shell git shortlog -se | sort -R | head -1 | cut -d '<' -f2 | tr -d '>')
|
||||
+
|
||||
+ contact = Get outside help
|
||||
+ ifeq ($(MAKECMDGOALS),help)
|
||||
+ contact = Email $(random_helper)
|
||||
+ endif
|
||||
+
|
||||
+ help:
|
||||
+ @printf "\033[36m%s\t\033[0m %s\n" "help" "$(contact)"
|
||||
+ @printf "\033[36m%s\t" "done"
|
||||
+ @printf "\033[0m %s " "Close $$(basename -s .md $(last_modified) | tr '_' ' ')"
|
||||
+ @printf "\033[0m %s\n" "[$$(grep -Pom1 'title: \K.*' $(last_modified))]"
|
||||
+ @awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | + column -s ':' -t
|
||||
+
|
||||
+ $(closed_issues): closed/%.md: open/%.md
|
||||
+ @git add $<
|
||||
+ @git mv $< $@
|
||||
+ $(close_issue_command)
|
||||
+
|
||||
+ .PHONY: issue
|
||||
+ issue: $(name) ## Make an issue
|
||||
+ $(name):
|
||||
+ @echo '---' > $(name)
|
||||
+ @read -p 'Title? ' title && echo title: $$title >> $@
|
||||
+ @echo priority: low >> $@
|
||||
+ @echo responsible: $(shell git config user.name) >> $@
|
||||
+ @echo '---' >> $@
|
||||
+ @printf '\n\n' >> $@
|
||||
+ @$(EDITOR) +7 $@
|
||||
+ @git add $@
|
||||
+ @git commit --quiet --message "$$(grep -Pom1 'title: \K.*' $@)"
|
||||
+ $(info Commit created, remember to push!)
|
||||
+
|
||||
+ .PHONY: done
|
||||
+ done:
|
||||
+ $(info Closing $(shell basename -s .md $(last_modified) | tr '_' ' '))
|
||||
+ @git add $(last_modified)
|
||||
+ @git mv $(last_modified) closed/
|
||||
+ $(close_issue_command)
|
||||
+
|
||||
+ .PHONY: stats
|
||||
+ stats: ## Summarise issue
|
||||
+ $(hdr) "Priorities"
|
||||
+ $(msg) "$$(head -n 7 $(wildcard open/*) | sort | grep -Po 'priority: \K.*' | uniq -c)"
|
||||
+ $(msg) "$$(ls closed/ | wc -l) closed"
|
||||
+ $(hdr) "Holders"
|
||||
+ $(msg) "$$(head -n 7 $(wildcard open/*) | grep -Po 'responsible: \K.*' | tr [:upper:] [:lower:] | sort | uniq -c)"
|
||||
+
|
||||
+ .PHONY: rundown
|
||||
+ rundown: ## Summarize events
|
||||
+ @printf "\033[33;5m# %s\033[0m\n" "Outstanding Calamities"
|
||||
+ @$(foreach bug, $(wildcard open/*.md), + a="$$(lowdown -X responsible $(bug))" && + n="$$(echo $(bug) | cut -d_ -f2 | cut -d. -f1)" && + t="$$(lowdown -X title $(bug))" && echo "$$n: $$t ($$a)" ;+ )
|
||||
|
||||
name: RSS feed
|
||||
filename: rss.xml
|
||||
note: Only 'description', 'link', and 'title' are required.
|
||||
+
|
||||
+ Extra fields include 'textInput' (for a paragraph about the feed), 'skipHours' (for the hours to wait before refreshing), and 'language'.
|
||||
content: <?xml version="1.0" encoding="UTF-8" ?>
|
||||
+ <rss version="2.0">
|
||||
+
|
||||
+ <channel>
|
||||
+ <title>{{title}}</title>
|
||||
+ <link>{{url}}</link>
|
||||
+ <generator>Recutils</generator>
|
||||
+ <docs>https://www.w3schools.com/XML/xml_rss.asp</docs>
|
||||
+ <skipDays>{{frequency}}</skipDays>
|
||||
+ <description>{{description}}</description>
|
||||
note: Output the next content field separately to produce multiple post items.
|
||||
content: <item>
|
||||
+ <guid>{{post_id}}</guid>
|
||||
+ <category>{{post_category}}</category>
|
||||
+ <pubDate>{{post_date}}</pubDate>
|
||||
+ <title>{{post_title}}</title>
|
||||
+ <link>{{url}}/{{post_link}}</link>
|
||||
+ <description>{{post_description}}</description>
|
||||
+ <source>{{post_source}}</source>
|
||||
+ </item>
|
||||
note: The last content field closes the XML tags opened in the first content field.
|
||||
content: </channel>
|
||||
+
|
||||
+ </rss>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
title: monitor
|
||||
tags:
|
||||
- hardware
|
||||
---
|
||||
See screen size
|
||||
|
||||
```sh
|
||||
xrandr -q
|
||||
```
|
||||
|
||||
Automatically configure:
|
||||
|
||||
```sh
|
||||
xrandr --auto
|
||||
```
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
---
|
||||
title: fail2ban
|
||||
title: fail2ban for ssh
|
||||
tags:
|
||||
- networking
|
||||
- system
|
||||
- Setup
|
||||
requires:
|
||||
- networking/ssh.md
|
||||
---
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
---
|
||||
title: pi-hole-server
|
||||
tags:
|
||||
- distros
|
||||
---
|
||||
# Installation
|
||||
|
||||
## Arch
|
||||
|
||||
```sh
|
||||
yay -S pi-hole-server
|
||||
```
|
||||
|
||||
```sh
|
||||
sudo systemctl enable --now pihole-FTL
|
||||
```
|
||||
|
||||
```sh
|
||||
sudo systemctl disable --now systemd-resolved
|
||||
```
|
||||
|
||||
```sh
|
||||
sudo rm -f /dev/shm/FTL-\*
|
||||
```
|
||||
|
||||
## Debian
|
||||
|
||||
Debian has a long, boring setup.
|
||||
|
||||
```sh
|
||||
sudo apt-get install wget curl net-tools gamin lighttpd lighttpd-mod-deflate
|
||||
curl -sSL https://install.pi-hole.net | PIHOLE_SKIP_OS_CHECK=true sudo -E bash
|
||||
```
|
||||
|
||||
# Setup
|
||||
|
||||
```sh
|
||||
sudo usermod -aG pihole $USER
|
||||
```
|
||||
|
||||
Remove that google dns server.
|
||||
|
||||
```sh
|
||||
pihole -a setdns 9.9.9.9 1.0.0.1
|
||||
```
|
||||
|
||||
Disable pihole password by setting a blank password.
|
||||
|
||||
```sh
|
||||
pihole -a -p
|
||||
```
|
||||
|
||||
Get a new list of blocked domains, then reload:
|
||||
|
||||
```sh
|
||||
pihole -g -r
|
||||
```
|
||||
|
||||
Every so often, run `pihole -g` again (perhaps put it in crontab).
|
||||
|
||||
## Check the Pihole
|
||||
|
||||
Observe the pihole's output while you ask it a question:
|
||||
|
||||
```sh
|
||||
pihole -t
|
||||
```
|
||||
|
||||
Then ask the question from another computer:
|
||||
|
||||
```sh
|
||||
dig @[ pihole ip ] archlinux.org
|
||||
```
|
||||
|
||||
## System-Wide Setup
|
||||
|
||||
To make the pihole work for the entire Network, enter your router and set the DNS server as nothing but your pihole.
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
title: Remote Desktop between Sway
|
||||
tags:
|
||||
- networking
|
||||
requires:
|
||||
- networking/ssh.md
|
||||
---
|
||||
|
||||
# On the Host
|
||||
|
||||
Install and run `wayvnc`.
|
||||
|
||||
```sh
|
||||
export WAYLAND_DISPLAY=wayland-1
|
||||
wayvnc
|
||||
```
|
||||
|
||||
Only the `localhost` can access this (highly insecure) desktop sharing, at port 5900.
|
||||
|
||||
# On the Client
|
||||
|
||||
You'll need to disable your main modifier key on the client while accessing the host.
|
||||
Edit `~/.config/sway/config`, and create a new `passthrough` mode where the modifier key does nothing.
|
||||
|
||||
```config
|
||||
mode passthrough {
|
||||
bindsym $mod+c mode default
|
||||
}
|
||||
bindsym $mod+c mode passthrough
|
||||
```
|
||||
|
||||
Reload sway to make the changes take effect.
|
||||
|
||||
```sh
|
||||
swaymsg reload
|
||||
```
|
||||
|
||||
Use `ssh` to grab the host's port 5900.
|
||||
|
||||
```sh
|
||||
ssh -L 5900:localhost:5900 ${remote_username}@${remote_ip}
|
||||
```
|
||||
|
||||
Leave that session running, and connect with `vncviewer`:
|
||||
|
||||
```sh
|
||||
vncviewer localhost:5900
|
||||
```
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: New Sway Remote Desktop
|
||||
tags:
|
||||
- networking
|
||||
requires:
|
||||
- networking/remote_sway.md
|
||||
---
|
||||
|
||||
Check the host is using only one display:
|
||||
|
||||
```sh
|
||||
test "$WAYLAND_DISPLAY" = "wayland-1"
|
||||
```
|
||||
|
||||
Start a new sway session, and a `wayvnc` session:
|
||||
|
||||
```sh
|
||||
WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 sway &
|
||||
WAYLAND_DISPLAY=wayland-2 wayvnc
|
||||
```
|
||||
|
||||
On the client, [connect as usual](networking/remote_sway.md).
|
||||
+1
-2
@@ -8,9 +8,8 @@ tags:
|
||||
|
||||
Try out basic ssh by accessing `git.charm.sh`, without needing authentication:
|
||||
|
||||
|
||||
```sh
|
||||
ssh git.charm.sh
|
||||
ssh -t git.charm.sh
|
||||
```
|
||||
|
||||
Start an ssh server to try it out.
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
markdown = $(wildcard */*.md */*/*.md)
|
||||
|
||||
publish = $(patsubst %, .publish/%, $(markdown))
|
||||
|
||||
.dbs/requires.fmt: | .dbs/
|
||||
echo "- [{{requires_title}}]({{requires_path}})" > $@
|
||||
|
||||
$(publish): .publish/%.md: %.md | .dbs/notes.rec .dbs/requires.fmt
|
||||
mkdir -p $(@D)
|
||||
sed -n '1,/^---$$/p' $< > $@
|
||||
test "$$(recsel -t guide -j requires .dbs/notes.rec -e "path = '$<'" -c)" -lt 1 \
|
||||
|| { printf '\n---\n%s\n\n' "**Requirements**" >> $@ \
|
||||
&& recsel -t guide -j requires .dbs/notes.rec -e "path = '$<'" -p requires_title,requires_path | recfmt -f .dbs/requires.fmt >> $@ \
|
||||
&& printf '\n%s\n\n' '---' >> $@ ;}
|
||||
sed '1,/---/d' $< >> $@
|
||||
|
||||
cmds != recsel command.rec -t command -G bin -CP bin | sort -u
|
||||
lists = $(patsubst %,.publish/lists/%.md, $(cmds))
|
||||
|
||||
get_title = printf 'title: "Rundown: %s"\n' '${1}'
|
||||
get_tags = recsel -t $(basename $<) $< -G bin \
|
||||
-e 'bin = "$(1)"' -U -CP tag,bin | \
|
||||
sed 's/.*/- &/'
|
||||
|
||||
list_commands = recsel -t $(basename $<) $< -e 'bin = "$(1)"' | \
|
||||
recfmt -f lists.fmt
|
||||
|
||||
.publish/lists/:| .publish/
|
||||
|
||||
$(lists): .publish/lists/%.md: command.rec | .publish/lists/
|
||||
@printf '%s\n' '---' > $@
|
||||
@$(call get_title,$(basename $(notdir $@))) >> $@
|
||||
@printf '%s\n' 'tags: ' >> $@
|
||||
@$(call get_tags,$(basename $(notdir $@))) >> $@
|
||||
@printf '%s\n' '---' >> $@
|
||||
@$(call list_commands,$(basename $(notdir $@))) >> $@
|
||||
|
||||
|
||||
.PHONY: publish
|
||||
publish: $(lists) $(publish) ## Web publishable web pages
|
||||
|
||||
@@ -68,3 +68,9 @@ x="$(!!)"
|
||||
echo $x
|
||||
for file in $x ; do fortune > $file ; done
|
||||
```
|
||||
|
||||
# See Also
|
||||
|
||||
- [Readline](shell/readline.md)
|
||||
- [Shell tips](shell/shell_tips.md)
|
||||
|
||||
|
||||
@@ -25,3 +25,9 @@ until [ "$x" -eq "1" ]; do
|
||||
sleep 1
|
||||
done
|
||||
```
|
||||
|
||||
[Slow down the terminal][slow] then enjoy some [old ASCII art][ascii].
|
||||
|
||||
[slow]: shell/slow.md
|
||||
[ascii]: http://artscene.textfiles.com/vt100/
|
||||
|
||||
|
||||
+23
-1
@@ -15,5 +15,27 @@ tags:
|
||||
# Search & Clear Highlights
|
||||
|
||||
You can search in many programs by using `/`.
|
||||
Most programs let you clearn the highlighting with `<Esc>+u`.
|
||||
Most programs let you clear the highlighting with `<Esc>+u`.
|
||||
|
||||
|
||||
## Track Live Changes
|
||||
|
||||
Follow a file as new lines are added to it:
|
||||
|
||||
```sh
|
||||
tail -f *somefile*
|
||||
```
|
||||
|
||||
See changes in a directory, as it changes:
|
||||
|
||||
`watch -d ls *directory*`
|
||||
|
||||
Or use the `-g` flag to exit once the output changes.
|
||||
This command will look at whether you're connected to the internet, and turn into a rainbow once the connection hits.
|
||||
|
||||
> watch -g ip address && clear && ip address | lolcat
|
||||
|
||||
|
||||
# See Also
|
||||
|
||||
- [Bash tips](shell/bash_tips.md)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: Slow the Terminal Down
|
||||
tags:
|
||||
- fun
|
||||
---
|
||||
|
||||
Slow the terminal to the old rates with a pipe and perl:
|
||||
|
||||
```sh
|
||||
ff=/tmp/bashpipe
|
||||
mkfifo $ff
|
||||
( cat $ff | perl -We 'use Time::HiRes;$|++;while(read(STDIN,$c,1)){Time::HiRes::usleep(15000);print $c;}' ) & exec &> $ff
|
||||
|
||||
```
|
||||
|
||||
- Try running `dir` and `dir -F`!
|
||||
- Don't run interactive commands like `vim` or `top`!
|
||||
|
||||
You can make it into a bash function by putting this into your `~/.bashrc`:
|
||||
|
||||
|
||||
```bash
|
||||
slow ()
|
||||
{
|
||||
unset VISUAL;
|
||||
EDITOR=ed;
|
||||
alias ls='dir -F';
|
||||
export PS1='[$?] \W $ ';
|
||||
ff=/tmp/bashpipe_$(date +%s);
|
||||
mkfifo $ff 2> /dev/null;
|
||||
( cat $ff | perl -We 'use Time::HiRes;$|++;while(read(STDIN,$c,1)){Time::HiRes::usleep(15000);print $c;}' ) & exec &> $ff;
|
||||
}
|
||||
```
|
||||
|
||||
Then type:
|
||||
|
||||
```bash
|
||||
exec bash
|
||||
slow
|
||||
```
|
||||
@@ -1,53 +0,0 @@
|
||||
---
|
||||
title: mpd
|
||||
tags:
|
||||
- sound
|
||||
---
|
||||
# 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"
|
||||
> }
|
||||
>
|
||||
> audio_output {
|
||||
> type "fifo"
|
||||
> name "my_fifo"
|
||||
> path "/tmp/mpd.fifo"
|
||||
> format "44100:16:2"
|
||||
> }
|
||||
|
||||
|
||||
You can use alsa instead of pulse, but don't unless you're on a Pi.
|
||||
|
||||
Since this is run as the mpd user, you'll need to grant that user pulse acceess, often with the user-group `pulse` or `pulse-access`, but your distro may vary.
|
||||
|
||||
```sh
|
||||
sudo usermod -aG pulse-access mpd
|
||||
```
|
||||
|
||||
Working with mpd will be easier if you have access to its files, so maybe:
|
||||
|
||||
```sh
|
||||
sudo usermod -aG mpd $USER
|
||||
```
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
---
|
||||
title: bash tips
|
||||
tags:
|
||||
- shell
|
||||
- POSIX
|
||||
---
|
||||
## Track Live Changes
|
||||
|
||||
See changes in a file as it changes:
|
||||
|
||||
`tail -f *somefile*`
|
||||
|
||||
See changes in a directory, as it changes:
|
||||
|
||||
`watch -d ls *directory*`
|
||||
|
||||
Or use the `-g` flag to exit once the output changes.
|
||||
This command will look at whether you're connected to the internet, and turn into a rainbow once the connection hits.
|
||||
|
||||
> watch -g ip address && clear && ip address | lolcat
|
||||
|
||||
## Automatic Renaming
|
||||
|
||||
There are a bunch of files:
|
||||
|
||||
* Column CV.aux
|
||||
* Column CV.log
|
||||
* Column CV.out
|
||||
* Column CV.pdf
|
||||
* Column CV.tex
|
||||
* tccv.cls
|
||||
|
||||
Goal: swap the word "Column" for "Alice" in all files.
|
||||
|
||||
```sh
|
||||
IFS=$'\n'
|
||||
for f in $(find . -name "Col*"); do
|
||||
mv "$f" $(echo "$f" | sed s/Column/Alice/)
|
||||
done
|
||||
```
|
||||
|
||||
IFS is the field separator. This is required to denote the different files as marked by a new line, and not the spaces.
|
||||
|
||||
(Alternatively, just install `renameutils` and do `rename Column Alice *`)
|
||||
|
||||
## Arguments and Input
|
||||
|
||||
The `rm' program takes arguments, but not `stdin' from a keyboard, and therefore programs cannot pipe results into rm.
|
||||
To fix this, use `xargs` to turn the stdin into an argument.
|
||||
For example, if we have a list of files called `list.txt' then we could use cat as so:
|
||||
|
||||
```sh
|
||||
cat list.txt | xargs rm
|
||||
```
|
||||
|
||||
Of course if spaces are included in the file, you would have to account for that.
|
||||
|
||||
## Numbers
|
||||
|
||||
Add number to variables with:
|
||||
|
||||
* `let "var=var+1"`
|
||||
* `let "var+=1"`
|
||||
* `let "var++"`
|
||||
* `((++var))`
|
||||
* `((var=var+1))`
|
||||
* `((var+=1))`
|
||||
* `var=$(expr $var + 1)`
|
||||
|
||||
`((n--))` works identically.
|
||||
|
||||
### POSIX WARNING
|
||||
|
||||
The number commands above work in `bash`, but not in bare-ass POSIX shells, such as `dash`.
|
||||
|
||||
Instead, you might do:
|
||||
|
||||
```sh
|
||||
x=2
|
||||
x=$(( x +1 ))
|
||||
x=$(( x*x ))
|
||||
```
|
||||
|
||||
## Finding Duplicate Files
|
||||
|
||||
```sh
|
||||
find . -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 15 > all-files.txt
|
||||
```
|
||||
|
||||
## Output random characters
|
||||
|
||||
```sh
|
||||
cat /dev/urandom | tr -cd [:alnum:] | dd bs=1 count=200 status=none && echo
|
||||
```
|
||||
|
||||
## Temporary Working Directory
|
||||
|
||||
Try something out in a random directory in `/tmp` so the files will be deleted when you next shut down.
|
||||
|
||||
```sh
|
||||
mktemp -d
|
||||
```
|
||||
|
||||
That gives you a random directory to mess about in.
|
||||
|
||||
```sh
|
||||
dir=$(mktemp -d)
|
||||
for x in {A..Z}; do
|
||||
fortune > "$dir"/chimpan-$x
|
||||
done
|
||||
cd $dir
|
||||
```
|
||||
|
||||
### POSIX WARNING
|
||||
|
||||
These smart-brackets are a bash feature.
|
||||
If you try to use `{A..Z}` in dash, it will think of this as a single item.
|
||||
|
||||
@@ -4,9 +4,6 @@ tags:
|
||||
- basics
|
||||
- time
|
||||
---
|
||||
# Cronie
|
||||
|
||||
The `cronie` program is also known as `crond`.
|
||||
|
||||
## Install
|
||||
|
||||
|
||||
+1
-1
@@ -22,4 +22,4 @@ You can add a GUI editor as the `$VISUAL` editor:
|
||||
VISUAL=gedit
|
||||
```
|
||||
|
||||
To use a true line editor, as `$EDITOR`, see [ed][writing/ed.md].
|
||||
To use a true line editor, as `$EDITOR`, see [ed](writing/ed.md).
|
||||
|
||||
@@ -6,6 +6,7 @@ tags:
|
||||
- makefiles
|
||||
- graphviz
|
||||
- python
|
||||
- Setup
|
||||
requires:
|
||||
- system/makefiles.md
|
||||
---
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-
|
||||
title: Making Services
|
||||
---
|
||||
title: Make a Service
|
||||
tags:
|
||||
- systemd
|
||||
---
|
||||
|
||||
@@ -4,6 +4,7 @@ tags:
|
||||
- virtualization
|
||||
- kubernetes
|
||||
- minikube
|
||||
- Setup
|
||||
requires:
|
||||
- virtualization/docker.md
|
||||
---
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Proxy API
|
||||
title: Kubernetes Proxy API
|
||||
tags:
|
||||
- virtualization
|
||||
- kubernetes
|
||||
|
||||
+3
-12
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Ed: The Standard Editor
|
||||
title: "Ed: The Standard Editor"
|
||||
tags:
|
||||
- writing
|
||||
- guide
|
||||
@@ -15,18 +15,9 @@ You would type a command to the computer, and it would type out any errors.
|
||||
It would not waste paper, ink, and time by typing out `COMMAND RUN SUCCESSFULLY` after each command.
|
||||
A silent machine meant a happy machine.
|
||||
|
||||
To fully appreciate `ed`, you can slow down your terminal with the following command:
|
||||
To fully appreciate `ed`, you should [slow down your terminal][slow].
|
||||
|
||||
```sh
|
||||
ff=/tmp/bashpipe
|
||||
mkfifo $ff
|
||||
( cat $ff | perl -We 'use Time::HiRes;$|++;while(read(STDIN,$c,1)){Time::HiRes::usleep(15000);print $c;}' ) & exec &> $ff
|
||||
|
||||
```
|
||||
|
||||
Try running `dir` and `dir -F`!
|
||||
|
||||
Okay, now onto `ed`...
|
||||
[slow]: shell/slow.md
|
||||
|
||||
# Basic Usage
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
title: Format a CSV file as markdown in vim
|
||||
tags:
|
||||
- vim
|
||||
- markdown
|
||||
- csv
|
||||
---
|
||||
|
||||
The command to format CSV tables works similarly to [formatting markdown][formarkdown].
|
||||
|
||||
Put this in your `~/.vimrc` and use `Control + s` after highlighting a cs
|
||||
|
||||
```vim
|
||||
vmap <C-s> :!column -ts, -o " \| "<Enter>yyp:s/[^\|:]/-/g<Enter>
|
||||
```
|
||||
|
||||
Read a CSV file into Vim:
|
||||
|
||||
```vim
|
||||
r ${file}.csv
|
||||
```
|
||||
|
||||
Select the csv output:
|
||||
|
||||
```csv
|
||||
Transaction Date,Transaction Type,Transaction Description,Debit Amount,Credit Amount
|
||||
29/12/2020,DEB,NON-GBP CASH FEE,1.50
|
||||
29/12/2020,DEB,NON-GBP TRANS FEE,4.60
|
||||
29/12/2020,DEB,KBA BRANKOVA 34,153.85
|
||||
29/12/2020,DEB,NON-GBP PURCH FEE,0.50
|
||||
29/12/2020,DEB,NON-GBP TRANS FEE,0.30
|
||||
29/12/2020,DEB,BIOMARKET 2,10.36
|
||||
29/12/2020,DEB,NON-GBP PURCH FEE,0.50
|
||||
|
||||
```
|
||||
|
||||
Press `Control + s`:
|
||||
|
||||
```markdown
|
||||
|
||||
Transaction Date | Transaction Type | Transaction Description | Debit Amount | Credit Amount
|
||||
-----------------|------------------|-------------------------|--------------|--------------
|
||||
29/12/2020 | DEB | NON-GBP CASH FEE | 1.50 |
|
||||
29/12/2020 | DEB | NON-GBP TRANS FEE | 4.60 |
|
||||
29/12/2020 | DEB | KBA BRANKOVA 34 | 153.85 |
|
||||
29/12/2020 | DEB | NON-GBP PURCH FEE | 0.50 |
|
||||
29/12/2020 | DEB | NON-GBP TRANS FEE | 0.30 |
|
||||
29/12/2020 | DEB | BIOMARKET 2 | 10.36 |
|
||||
29/12/2020 | DEB | NON-GBP PURCH FEE | 0.50 |
|
||||
```
|
||||
|
||||
[formarkdown]: writing/vim/md_columns.md
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
title: Format Markdown Columns in Vim
|
||||
tags:
|
||||
- writing
|
||||
- vim
|
||||
- markdown
|
||||
- TUI
|
||||
---
|
||||
|
||||
Got a wonky markdown table?
|
||||
|
||||
|
||||
```markdown
|
||||
|
||||
| Real Time | Game Time |
|
||||
|:--|:-|
|
||||
| 1 week | 1 month |
|
||||
| 3 weeks | 3 months|
|
||||
| 6 months | 2 years|
|
||||
| 1 year | 4 years|
|
||||
|
||||
```
|
||||
|
||||
Vim can fix it without plugins.
|
||||
Just use this snippet (type `:` to begin inputting a command):
|
||||
|
||||
```vim
|
||||
:vmap <C-t> :!tr -s ' -' \|column -ts '\|' -o '\|'<Enter>j:s/ /-/g<Enter>k
|
||||
```
|
||||
|
||||
Highlight the whole thing with `vap` then press `Control + t`.
|
||||
Instantly, it is aligned:
|
||||
|
||||
```markdown
|
||||
|
||||
| Real Time | Game Time |
|
||||
|:----------|:----------|
|
||||
| 1 week | 1 month |
|
||||
| 3 weeks | 3 months |
|
||||
| 6 months | 2 years |
|
||||
| 1 year | 4 years |
|
||||
```
|
||||
|
||||
**NB:** This method has problems with centre-aligned columns (using `:---:`).
|
||||
|
||||
## Vim Run Commands
|
||||
|
||||
Put this in your `~/.vimrc` to make the mapping permanent:
|
||||
|
||||
```vim
|
||||
vmap <C-t> :!tr -s ' -' \|column -ts '\|' -o '\|'<Enter>j:s/ /-/g<Enter>k
|
||||
```
|
||||
|
||||
@@ -4,8 +4,6 @@ tags:
|
||||
- vim
|
||||
- learning
|
||||
- TUI
|
||||
requires:
|
||||
- writing/vim.md
|
||||
---
|
||||
|
||||
1. Uninstall `vim`.
|
||||
|
||||
Reference in New Issue
Block a user