Compare commits
8 Commits
68734cfd1b
...
6d00283fe2
| Author | SHA1 | Date | |
|---|---|---|---|
|
6d00283fe2
|
|||
|
a2c3521c48
|
|||
|
0a824f10c8
|
|||
|
8bb26740b0
|
|||
|
0d053e9a7d
|
|||
|
ec3c355ac4
|
|||
|
2a010a777e
|
|||
|
12064196d2
|
2
Makefile
2
Makefile
@@ -34,7 +34,7 @@ default += .dbs/map.fmt
|
||||
|
||||
include cmd.mk
|
||||
|
||||
.dbs/head.rec: | .dbs/ $(lists)
|
||||
.dbs/head.rec: | .dbs/
|
||||
printf '%s\n' '%rec: guide' > $@
|
||||
printf '%s\n' '%key: path' >> $@
|
||||
printf '%s\n' '%type: requires rec guide' >> $@
|
||||
|
||||
5
cmd.mk
5
cmd.mk
@@ -2,8 +2,6 @@
|
||||
cmds != recsel command.rec -t command -G bin -CP bin | sort -u
|
||||
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,bin | \
|
||||
@@ -20,9 +18,6 @@ $(lists): lists/%.md: command.rec | lists/
|
||||
@printf '%s\n' '---' >> $@
|
||||
@$(call list_commands,$(basename $(notdir $@))) >> $@
|
||||
|
||||
.PHONY: cmd
|
||||
cmd: $(lists) ## Big lists of commands
|
||||
|
||||
.PHONY: function
|
||||
function: ## Output a search function for .bashrc
|
||||
${MAKE} --silent --touch query
|
||||
|
||||
35
command.rec
35
command.rec
@@ -157,12 +157,37 @@ shell: sh
|
||||
bin: journalctl
|
||||
tag: system
|
||||
|
||||
aim: Edit users in /etc/passwd directly
|
||||
cmd: sudo vipw
|
||||
note: You can't edit passwords with black magic.
|
||||
shell: sh
|
||||
bin: vipw
|
||||
bin: sudo
|
||||
tag: system
|
||||
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: Follow the `ssh` daemon service
|
||||
cmd: journalctl -f -u sshd
|
||||
shell: sh
|
||||
bin: journalctl
|
||||
tag: system
|
||||
|
||||
aim: Get back terminal after ssh freezes remote machine
|
||||
cmd: <Return>~.
|
||||
shell: sh
|
||||
bin: ssh
|
||||
tag: system
|
||||
tag: comfy
|
||||
|
||||
aim: Find errors since a date
|
||||
cmd: date=2027-01-01
|
||||
+ journalctl --since=${date} --grep="EXT4-fs error"
|
||||
@@ -170,18 +195,22 @@ shell: sh
|
||||
bin: journalctl
|
||||
tag: system
|
||||
|
||||
aim: Limit the journal's size to 2 gigabytes
|
||||
aim: Limit the systemd's journal size to 2 gigabytes
|
||||
cmd: journalctl --vacuum-size=2G
|
||||
+ journalctl --disk-usage
|
||||
shell: sh
|
||||
bin: journalctl
|
||||
tag: system
|
||||
tag: logs
|
||||
|
||||
aim: Log the fact that you've installed your own `dnsmasq` on your system to `journalctl`, so that you can determine why your system's broken later
|
||||
cmd: logger "Installed new dnsmasq"
|
||||
+ sudo journalctl -f
|
||||
shell: sh
|
||||
bin: journalctl
|
||||
bin: logger
|
||||
tag: system
|
||||
tag: logs
|
||||
|
||||
aim: Convert markdown table to csv
|
||||
cmd: mlr --imarkdown --ocsv cat ${file}.md
|
||||
@@ -218,8 +247,8 @@ cmd: grep -o "\b${word}\b" ${file}
|
||||
bin: grep
|
||||
tag: search
|
||||
|
||||
aim: Reformat variable for shell input
|
||||
cmd: printf "%q\n" "${variable}"
|
||||
aim: Reformat text for shell input
|
||||
cmd: printf "%q\n" "${text}"
|
||||
bin: printf
|
||||
tag: xargs
|
||||
tag: stdout
|
||||
|
||||
@@ -16,23 +16,23 @@ Make a database for your boardgames, specifying only one field and value:
|
||||
database=games.rec
|
||||
n=Name
|
||||
g=Vojvodina
|
||||
touch $database
|
||||
recins -f $n --value $g $database
|
||||
recsel $database
|
||||
touch ${database}
|
||||
recins -f ${n} --value ${g} ${database}
|
||||
recsel ${database}
|
||||
```
|
||||
|
||||
Insert a few more, with the estimated playtime:
|
||||
|
||||
```sh
|
||||
recins -f Name -v Saboter -f Playtime -v 30 $database
|
||||
recins -f Name -v Chess -f Playtime -v 30 $database
|
||||
recins -f Name -v Saboter -f Playtime -v 30 ${database}
|
||||
recins -f Name -v Chess -f Playtime -v 30 ${database}
|
||||
```
|
||||
|
||||
View all games, or select one by number:
|
||||
|
||||
```sh
|
||||
recsel $database
|
||||
recsel -n 0 $database
|
||||
recsel ${database}
|
||||
recsel -n 0 ${database}
|
||||
```
|
||||
|
||||
Each game should note whether or not you have played it yet, so you can add that field and set the default to `yes`.
|
||||
@@ -40,14 +40,14 @@ Each game should note whether or not you have played it yet, so you can add that
|
||||
```sh
|
||||
f=played
|
||||
v=yes
|
||||
recset -f $f -a $v $database
|
||||
recset -f ${f} -a ${v} ${database}
|
||||
```
|
||||
|
||||
...but the field is wrong, it should have a capital letter:
|
||||
|
||||
```sh
|
||||
new_field=Played
|
||||
recset -f $f --rename $new_field
|
||||
recset -f ${f} --rename ${new_field}
|
||||
```
|
||||
|
||||
## Read
|
||||
@@ -55,20 +55,20 @@ recset -f $f --rename $new_field
|
||||
Check how many records the database has:
|
||||
|
||||
```sh
|
||||
recinf $database
|
||||
recinf ${database}
|
||||
```
|
||||
|
||||
Look at just the games you've never played:
|
||||
|
||||
```sh
|
||||
recsel --expression="Played = 'no'" $database
|
||||
recsel --expression="Played = 'no'" ${database}
|
||||
```
|
||||
|
||||
Print how many, then just print the names:
|
||||
|
||||
```sh
|
||||
recsel -e "Played = 'no'" --count $database
|
||||
recsel -e "Played = 'no'" --print=Name $database
|
||||
recsel -e "Played = 'no'" --count ${database}
|
||||
recsel -e "Played = 'no'" --print=Name ${database}
|
||||
```
|
||||
|
||||
## Update
|
||||
@@ -79,8 +79,8 @@ To change a game's `Played` field from `no` to `yes`, use `recset` to specify th
|
||||
num=0
|
||||
f=Played
|
||||
value=yes
|
||||
recsel --number=$num $database
|
||||
recset --number=$num -f $f --set=$value $database
|
||||
recsel --number=${num} ${database}
|
||||
recset --number=${num} -f ${f} --set=${value} ${database}
|
||||
```
|
||||
|
||||
Find all games with a playtime of `30`, and set the field `Max_Players` to `4`.
|
||||
@@ -102,22 +102,22 @@ Remove `Played` record from first game:
|
||||
|
||||
```sh
|
||||
num=0
|
||||
recset --number=$num -f Played --delete $database
|
||||
recset --number=${num} -f Played --delete ${database}
|
||||
```
|
||||
|
||||
You can comment the line instead of deleting it:
|
||||
|
||||
```sh
|
||||
num=1
|
||||
recset --number=$num -f Played --delete $database
|
||||
recsel $database
|
||||
cat $database
|
||||
recset --number=${num} -f Played --delete ${database}
|
||||
recsel ${database}
|
||||
cat ${database}
|
||||
```
|
||||
|
||||
Delete an entire record:
|
||||
|
||||
```sh
|
||||
num=2
|
||||
recdel --number=$num $database
|
||||
recdel --number=${num} ${database}
|
||||
```
|
||||
|
||||
|
||||
22
networking/stop_email.md
Normal file
22
networking/stop_email.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: Stop email impersonating your domain
|
||||
tags:
|
||||
- networking
|
||||
requires:
|
||||
- networking/dns_records.md
|
||||
---
|
||||
|
||||
There is nothing to stop scammers from sending email claiming to be coming from your domain.
|
||||
And the older it gets, the more valuable it is for spoofing.
|
||||
|
||||
Just add these two TXT records to the DNS for your domain:
|
||||
|
||||
|
||||
Name | Type | Value
|
||||
:------|:----:|:-----
|
||||
@ | TXT | v=spf1 -all
|
||||
_dmarc | TXT | v=DMARC1; p=reject;
|
||||
|
||||
The first says there is not a single SMTP server on earth authorized to send email on behalf of your domain.
|
||||
The second says that any email that says otherwise should be trashed.
|
||||
|
||||
@@ -20,9 +20,9 @@ Keybind to exit this mode is `Ctrl+q`
|
||||
|
||||
## Extras
|
||||
|
||||
- [Learning Vim](vim/vi.md)
|
||||
- [Navigation](vim/navigate.md)
|
||||
- [Completion](vim/completion.md)
|
||||
- [Window Splits](vim/windows.md)
|
||||
- [Use vim bindings in bash](vim/vim_in_bash.md)
|
||||
- [Learning Vim](writing/vim/vi.md)
|
||||
- [Navigation](writing/vim/navigate.md)
|
||||
- [Completion](writing/vim/completion.md)
|
||||
- [Window Splits](writing/vim/windows.md)
|
||||
- [Use vim bindings in bash](writing/vim/vim_in_bash.md)
|
||||
- [A game to learn how to code in Vim](https://www.vim-hero.com/)
|
||||
|
||||
Reference in New Issue
Block a user