Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
5460e90137
|
|||
|
4cc4603b2e
|
|||
|
a8617fb5b1
|
|||
|
04814ff498
|
|||
|
7eea76f2be
|
|||
|
f3143876db
|
|||
|
3457ed4c61
|
|||
|
786178195b
|
|||
|
29bff234fd
|
|||
| 3e3e072623 | |||
|
a6907d7a91
|
|||
|
3f98db3d3a
|
|||
|
17b90a54cb
|
|||
|
0587e9914a
|
|||
|
257ece871c
|
|||
|
89ec9614e5
|
|||
|
6f8902ff8f
|
|||
|
1eab64e1bc
|
|||
|
92f90b51f7
|
|||
|
b44d6b88ed
|
|||
|
23160b22ad
|
|||
|
fd2c44f49b
|
|||
|
8b599e2c77
|
|||
|
4a9d2d61d2
|
|||
|
fda9fcdec4
|
|||
|
395cb363db
|
|||
|
abc2add177
|
|||
|
2dbc7965da
|
|||
|
4dd6c979b6
|
|||
|
8672905dc4
|
|||
|
6a3703a2d0
|
|||
|
8bb0c57ddb
|
|||
|
8994bbe0e2
|
|||
|
ea5ecad274
|
|||
|
c6f2891003
|
|||
|
46f538bbe8
|
|||
|
f80bc47a24
|
|||
|
6162bb1502
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.pdf
|
||||
*.gif
|
||||
*.jpeg
|
||||
126
Makefile
126
Makefile
@@ -1,126 +0,0 @@
|
||||
MAKEFLAGS += -j
|
||||
MAKEFLAGS += -s
|
||||
EDITOR ?= vi
|
||||
PAGER ?= less -Ri
|
||||
READER != command -v mdless bat glow less more pg | head -1
|
||||
FZF != command -v fzf sk | head -1
|
||||
|
||||
markdown = $(wildcard */*.md */*/*.md)
|
||||
|
||||
ifeq "$(FZF)" ""
|
||||
$(info Install fzf)
|
||||
endif
|
||||
|
||||
ifeq "$(FZF)" "/usr/bin/fzy"
|
||||
FZF += -i
|
||||
endif
|
||||
|
||||
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 | \
|
||||
column -s ':' -t
|
||||
|
||||
articles != find * -type f -name "*.md"
|
||||
|
||||
default += .dbs/notes.rec
|
||||
default += .dbs/map.fmt
|
||||
|
||||
|
||||
%/:
|
||||
mkdir $@
|
||||
echo '*' > $@.gitignore
|
||||
|
||||
include cmd.mk
|
||||
|
||||
.dbs/head.rec: | .dbs/
|
||||
printf '%s\n' '%rec: guide' > $@
|
||||
printf '%s\n' '%key: path' >> $@
|
||||
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: wordcount' >> $@
|
||||
|
||||
.dbs/new.rec: $(markdown) | .dbs/head.rec
|
||||
$(info Updating: $?)
|
||||
grep -q guide $@ 2>/dev/null || cp $| $@
|
||||
@-$(foreach entry, $?, \
|
||||
recdel -t guide $@ -e "path = '$(entry)'" 2>/dev/null ;\
|
||||
)
|
||||
for entry in $? ; do \
|
||||
echo '' ;\
|
||||
printf "path: %s\n" "$$entry" ;\
|
||||
sed -n '2,/^---$$/ {/^---$$/d; p}' "$$entry" |\
|
||||
while read -r line; do if [ -z "$${line#*:}" ] ; then type="$$line"; else echo "$$line" | sed -r "s/- (.*)/$$type \1/" | sed s'/tags: /tag: /' ; fi ; done ;\
|
||||
printf "wordcount: %s\n" "$$(wc -w < $$entry)" ;\
|
||||
echo 'cmd: ' ;\
|
||||
sed '1,/^---$$/d' $$entry | sed 's/^.*/+ &/' ;\
|
||||
echo '' ;\
|
||||
done >> $@
|
||||
|
||||
.dbs/requires.rec: .dbs/new.rec
|
||||
recinf -d $< > $@
|
||||
echo "" >> $@
|
||||
recsel $< -t guide -j requires -G requires -p 'path,title,tag,wordcount,requires_path:requires,requires_requires:requires,cmd' >> $@
|
||||
|
||||
.dbs/notes.rec: .dbs/requires.rec .dbs/new.rec
|
||||
recinf -d $< > $@
|
||||
echo '' >> $@
|
||||
sed '/^%/d' $^ | recsel -G path | recsel -U >> $@
|
||||
|
||||
default += db.rec
|
||||
ignored += db.rec
|
||||
db.rec: command.rec .dbs/notes.rec
|
||||
recinf -d $< > $@
|
||||
echo '' >> $@
|
||||
sed '/^%/d' $^ | recsel -U -p 'title:aim,aim,cmd,note,shell,tag,bin:tag' >> $@
|
||||
$(info Making main database: $@)
|
||||
|
||||
|
||||
.git/info/exclude: $(ignored)
|
||||
@echo $^ | tr ' ' '\n' > $@
|
||||
|
||||
default += .git/info/exclude
|
||||
|
||||
.PHONY: database
|
||||
database: $(default) ## Make a recfiles database
|
||||
|
||||
.dbs/map.fmt:| .dbs/
|
||||
printf '%s\n' '[ {{requires[0]}} ] --> [ {{path}} ] {border-style: dashed;}' > $@
|
||||
printf '%s\n' '[ {{requires[1]}} ] --> [ {{path}} ] {border-style: dashed;}' >> $@
|
||||
printf '%s\n' '[ {{requires[2]}} ] --> [ {{path}} ] {border-style: dashed;}' >> $@
|
||||
printf '%s\n' '[ {{requires[3]}} ] --> [ {{path}} ] {border-style: dashed;}' >> $@
|
||||
printf '%s\n' '[ {{requires[4]}} ] --> [ {{path}} ] {border-style: dashed;}' >> $@
|
||||
|
||||
.PHONY: map
|
||||
map: .dbs/requires.rec .dbs/map.fmt ## Show knowledge dependency map
|
||||
recsel -t guide $< -e 'requires != ""' -p path,requires | recfmt -f .dbs/map.fmt |\
|
||||
grep -vF '[ ]' | graph-easy --boxart 2>/dev/null | ${PAGER} -S
|
||||
|
||||
.PHONY: clean
|
||||
clean: ## Remove all generated files
|
||||
$(RM) -r $(default) .dbs/
|
||||
|
||||
.PHONY: article
|
||||
article: */ */*/ ## Write a new article
|
||||
category=$(shell echo $^ | tr ' ' '\n' | $(FZF) --print-query | tail -1 ) \
|
||||
&& read -p "Article title? " name \
|
||||
&& filename="$$(echo "$$name" \
|
||||
| cut -d: -f1 \
|
||||
| tr '[A-Z ]' '[a-z_]' | tr -cd '[:alpha:]_' )" \
|
||||
&& $(MAKE) -e TITLE="$$name" "$$category"/"$$filename.md"
|
||||
|
||||
.PHONY: all
|
||||
all: $(default) ## All file targets
|
||||
|
||||
|
||||
%.md:
|
||||
[ -d "$(@D)" ] || mkdir $(@D)
|
||||
printf '%s\n' '---' >> $@
|
||||
printf 'title: %s\n' '$(TITLE)' >> $@
|
||||
printf "tags: " >> $@
|
||||
echo $(@D) | sed 's#\b\w#\n- &#g; s/\///g' >> $@
|
||||
printf '%s\n\n' '---' >> $@
|
||||
$(EDITOR) +5 $@
|
||||
|
||||
199
README.md
199
README.md
@@ -1,171 +1,77 @@
|
||||
# Linux Knowledge Base
|
||||
---
|
||||
title: "Knowledge Base"
|
||||
---
|
||||
|
||||
These notes Linux programs have grown into a searchable knowledge base.
|
||||
# Linux Knowledgebase
|
||||
|
||||
# Usage
|
||||
|
||||
## Setup
|
||||
|
||||
Install `make`, `recutils`, and any a fuzzy-finder (like `fzf` or `sk`).
|
||||
|
||||
To find the options, run `make`.
|
||||
|
||||
## Queries
|
||||
|
||||
The fuzzy finder opens an interactive menu to find information.
|
||||
|
||||
There are two types of notes:
|
||||
|
||||
1. Short commands, catalogued by aim (in `command.rec`).
|
||||
1. Short notes, mostly on getting set up with something (in the markdown files).
|
||||
|
||||
### Short Commands
|
||||
|
||||
Running `make check` will start a search of the snippets, ordered by what you
|
||||
want to do, not by the name of the binary:
|
||||
|
||||
```
|
||||
Hard reset ntp service
|
||||
-> Quickly find and open run-command files
|
||||
Turn markdown into a man page
|
||||
Rotate a video
|
||||
Translate a media file to a new type
|
||||
```
|
||||
|
||||
The output is a couple of lines of code, with changeable components as variables:
|
||||
|
||||
```
|
||||
alias rrc='$PAGER "$(find . -maxdepth 2 -name "*rc" | fzf)"'
|
||||
```
|
||||
|
||||
### The Function
|
||||
|
||||
Running `make function` outputs a shell function which searches through this
|
||||
knowledge base, so you don't have to `cd` to use it.
|
||||
|
||||
|
||||
```sh
|
||||
lk(){
|
||||
/usr/bin/mdless "$(recsel ${your-path-here}/lk/db.rec \
|
||||
-q "$(recsel ${your-path-here}/lk/db.rec -CP title,tag \
|
||||
| sort -u \
|
||||
| /usr/bin/fzf )" -CP path \
|
||||
| fzf --sync -1 --preview='less -iR {}' )"
|
||||
}
|
||||
```
|
||||
|
||||
Add the function to your bash shell like this:
|
||||
|
||||
```bash
|
||||
make function
|
||||
make function >> ~/.bashrc
|
||||
exec bash
|
||||
lk
|
||||
```
|
||||
This is a list of quickstart guides for Linux programs, designed to get the user up and running as fast as possible.
|
||||
|
||||
# Style
|
||||
|
||||
## State Knowledge Dependencies
|
||||
## Praxis Only
|
||||
|
||||
Articles should never link to other resources part-way through.
|
||||
If the article assumes an understanding of GPG keys, then it should say that at the top.
|
||||
People should be able to read documentation from the beginning, then keep going until the end, and then stop.
|
||||
Setup guides should not send the reader on a detour through labyrinths of links.
|
||||
We leave theory alone as much as possible.
|
||||
The documentation should be of the form 'if you want *X*, type *Y*'.
|
||||
|
||||
## No History, No Context
|
||||
We don't need to explain what a program does - anyone looking up 'how to X', already knows what they want to do.
|
||||
We don't even need to explain which program to use - if someone wants to combine an mp4 and webm video into a single video file, they only care about that result, not about learning `ffmpeg`.
|
||||
|
||||
Anyone who wants to read how to use OTP with GPG already knows what those words mean, so guides should not spend time explaining.
|
||||
Anyone who doesn't know what GPG keys are can find the link to using them, which explains them better than using door-blocking devices as a metaphor for prime number factorization.
|
||||
Any interest in these tools only comes after we can use them.
|
||||
|
||||
## Index by Purpose
|
||||
## Chronological
|
||||
|
||||
Nobody wants to read about `grep`, they want to find words, like 'cat'.
|
||||
They want to 'download a website', not learn about `wget`.
|
||||
Guides should be created and indexed by purpose, not by binary.
|
||||
Entries should read like scripts - everything in the right order, with small notes on what this does.
|
||||
|
||||
## Be Opinionated
|
||||
The chronology should never branch.
|
||||
If `gitea` can use three different types of database, the documentation should simply pick one and continue instructions from there.
|
||||
Repetition works better than a reference - if a database requires three commands to set up, it's better to repeat those three commands for every program that requires a database than to just link to another file which discusses databases.
|
||||
|
||||
- Guides should not ask the reader to pick from a list of options.
|
||||
- Options for different filesystems, databases, et c., should be written as separate guides.
|
||||
---
|
||||
|
||||
## Repetition Beats Reference
|
||||
### Closing
|
||||
|
||||
If a database requires three commands to set up, it's better to repeat those three commands for every program that requires a database than to just link to another file which discusses databases.
|
||||
Introductory documents should show anything required to cleanly uninstall a program, without leaving bulky configuration files behind.
|
||||
|
||||
## Show Options as Variables
|
||||
## Three Input Types
|
||||
|
||||
Look at this line:
|
||||
There are three types of examples:
|
||||
|
||||
```sh
|
||||
grep ls --color=always $HISTFILE | less -R
|
||||
Fixed input:
|
||||
|
||||
```bash
|
||||
ls
|
||||
```
|
||||
|
||||
What else can go in place of `always`?
|
||||
Can you say `--color=red`?
|
||||
Can you put anything?
|
||||
The answer is not obvious.
|
||||
Anything with arbitrary input should be shown as a variable.
|
||||
|
||||
What about this line:
|
||||
|
||||
```sh
|
||||
git branch new
|
||||
git checkout new
|
||||
```bash
|
||||
ls $FILE
|
||||
```
|
||||
|
||||
Do you always use `new`?
|
||||
Can you use another word here?
|
||||
The answer is not obvious.
|
||||
Non-commands (e.g. output) should be shown as quoted text:
|
||||
|
||||
It's better to make all arbitrary values variables.
|
||||
> LK img
|
||||
> Mail kn
|
||||
> Projects music
|
||||
|
||||
---
|
||||
|
||||
# Example
|
||||
|
||||
```
|
||||
How to see which websites you're actively accessing:
|
||||
|
||||
` ` `bash
|
||||
ss -tr dst :$PORT
|
||||
` ` `
|
||||
|
||||
> State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
|
||||
> ESTAB 0 0 192.168.0.14:42476 149.154.167.91:https
|
||||
> ESTAB 0 0 192.168.0.14:43644 104.17.90.199:https
|
||||
|
||||
```sh
|
||||
name=new
|
||||
git branch ${name}
|
||||
git checkout ${name}
|
||||
PAGER='less -R'
|
||||
grep ls --color=always $HISTFILE | $PAGER
|
||||
```
|
||||
|
||||
Now we can see what can be changed.
|
||||
|
||||
### Aim to Script
|
||||
|
||||
Guides should read like a heavily commented script, so CLI commands are preferred to GUI commands.
|
||||
|
||||
- Bad: '*edit the file `.config/tspreed/tspreed.rc` and change `focuscolor` to '2'.*'
|
||||
- Good: `sed -i '/focuscolor/s/=1/=2/' ~/.config/tspreed/tspreed.rc`
|
||||
* `cat !$`
|
||||
|
||||
Despite being 'script-like', interactive bash commands like `cat !$` are still fine just to show how to double-check results when setting things up interactively.
|
||||
|
||||
### Show, Don't Tell
|
||||
|
||||
Articles should say what to type, not the output.
|
||||
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.
|
||||
|
||||
Once a user enters a new group, the change doesn't take effect until you log
|
||||
in. This could be explained at length, or the reader can see what this means
|
||||
for themselves:
|
||||
|
||||
|
||||
```sh
|
||||
groups
|
||||
grep audio /etc/group
|
||||
|
||||
sudo usermod -aG audio $USER
|
||||
groups
|
||||
grep audio /etc/group
|
||||
|
||||
su $USER
|
||||
groups
|
||||
grep audio /etc/group
|
||||
```
|
||||
|
||||
Troubleshooting steps can often be implied by adding commands which do nothing but check the results of previous commands.
|
||||
|
||||
# What's Wrong with Everything Else?
|
||||
|
||||
Why bother writing yet another cheat-sheet collection?
|
||||
# What's wrong with everything else?
|
||||
|
||||
## Man pages
|
||||
|
||||
@@ -173,17 +79,18 @@ Why bother writing yet another cheat-sheet collection?
|
||||
- Often presumes you know everything except that one program.
|
||||
- Often written in the 80's, and it shows.
|
||||
- Zero respect for your time.
|
||||
- Sometimes reference `info` pages (yuck).
|
||||
|
||||
## `curl cheat.sh`
|
||||
## curl cheat.sh/
|
||||
|
||||
- Doesn't have the programs I like.
|
||||
- Too short to get you started on many programs.
|
||||
- Poor understanding of priority (`git stash` is covered before `git commit`).
|
||||
- Repetitive
|
||||
|
||||
# Current State
|
||||
|
||||
This started as a few personal notes, and will probably continue to look like that for some time.
|
||||
It's a bit of a mess.
|
||||
If you like the format, send me a pull request.
|
||||
|
||||
Systemd is taken as a default.
|
||||
Non-systemd commands are mentioned when required for a distro, e.g. runit for Void Linux.
|
||||
|
||||
|
||||
12
basics/Joyous_ASCII.md
Normal file
12
basics/Joyous_ASCII.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: "Joyous ASCII"
|
||||
tags: [ "fun" ]
|
||||
---
|
||||
|
||||
- `asciiquarium`
|
||||
- `cbonsai -lim "$(fortune)"`
|
||||
|
||||
```bash
|
||||
cow=$(cowsay -l | sort -R | head -1)
|
||||
fortune -s | figlet | cowsay -nf $cow | lolcat
|
||||
```
|
||||
@@ -1,48 +1,46 @@
|
||||
---
|
||||
title: at
|
||||
tags:
|
||||
- basics
|
||||
- time
|
||||
title: "at"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
Install with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo apt install at
|
||||
```
|
||||
|
||||
Enable the daemon service with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo systemctl enable --now atd
|
||||
```
|
||||
|
||||
Then jobs can be specified with absolute time, such as:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
at 16:20
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
at noon
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
at midnight
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
at teatime
|
||||
```
|
||||
|
||||
Type in your command, e.g.:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
touch /tmp/$FILE.txt
|
||||
```
|
||||
|
||||
The jobs can also be specified relative to the current time:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
at now +15 minutes
|
||||
```
|
||||
|
||||
@@ -52,7 +50,7 @@ Finally, accept the jobs with ^D.
|
||||
|
||||
Display a list of commands to run with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
atq
|
||||
```
|
||||
|
||||
@@ -60,17 +58,19 @@ atq
|
||||
|
||||
This will print all pending IDs. Remove a job by the ID with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
atrm 2
|
||||
```
|
||||
|
||||
Check `/var/spool/atd/` to see the jobs.
|
||||
|
||||

|
||||
|
||||
## Automation
|
||||
|
||||
Automatically add a job for later, by setting the date, then using echo for the command.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
t="$(date -d "2 minutes" +%R)"
|
||||
echo "fortune > ~/$FILE" | at "$t"
|
||||
watch cat $FILE
|
||||
42
basics/at.tape
Normal file
42
basics/at.tape
Normal file
@@ -0,0 +1,42 @@
|
||||
Require at
|
||||
Require atd
|
||||
Sleep 500ms
|
||||
Type "at teatime"
|
||||
Enter
|
||||
Sleep 1.5s
|
||||
Type "./"
|
||||
Sleep 500ms
|
||||
Type "baskup.sh"
|
||||
Sleep 1.5s
|
||||
Enter
|
||||
Sleep 1.5s
|
||||
Ctrl+D
|
||||
Sleep 3.5s
|
||||
Type "atq"
|
||||
Enter
|
||||
Sleep 1.5s
|
||||
Type "atq 1"
|
||||
Sleep 500ms
|
||||
Type "4"
|
||||
Enter
|
||||
Sleep 500ms
|
||||
Type "at"
|
||||
Sleep 1s
|
||||
Type " -c 15"
|
||||
Enter
|
||||
Sleep 1.5s
|
||||
Type "at"
|
||||
Sleep 500ms
|
||||
Type " "
|
||||
Sleep 500ms
|
||||
Type "-"
|
||||
Sleep 500ms
|
||||
Type "c 15 | grep PWD"
|
||||
Enter
|
||||
Sleep 5.5s
|
||||
Type "atrm 15"
|
||||
Sleep 2s
|
||||
Enter
|
||||
Sleep 3s
|
||||
Ctrl+D
|
||||
|
||||
359
basics/basics.md
Normal file
359
basics/basics.md
Normal file
@@ -0,0 +1,359 @@
|
||||
---
|
||||
title: "Basics"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
|
||||
You need about a dozen commands to move around Linux.
|
||||
After that, you look up the rest as you go.
|
||||
Don't worry about understanding any of it, just type it in and the habit forms pretty quickly.
|
||||
|
||||
You start in a dark room. You want to know where you are by **p**rinting out your **w**orking '**d**irectory' (i.e. 'location'):
|
||||
|
||||
```bash
|
||||
pwd
|
||||
```
|
||||
|
||||
Have a look at what is here:
|
||||
|
||||
```bash
|
||||
ls
|
||||
```
|
||||
|
||||
If you get no response, the list of items is "", meaning "nothing here".
|
||||
|
||||
Have a look at **a**ll the files:
|
||||
|
||||
```bash
|
||||
ls -a
|
||||
```
|
||||
|
||||
```bash
|
||||
. ..
|
||||
```
|
||||
|
||||
So `.` means 'here' and `..` means 'you see stairs leading downwards' (e.g. 'the directory behind you').
|
||||
|
||||
Change directory (`cd`) down one level:
|
||||
|
||||
```bash
|
||||
cd ..
|
||||
```
|
||||
|
||||
Look where you are again with `pwd`, then go back up. Use `ls`, and if you see `bob`, then:
|
||||
|
||||
```bash
|
||||
cd bob
|
||||
```
|
||||
|
||||
Move around the directories. The place at the bottom is the 'root', and is known as `/`. Go to the root:
|
||||
|
||||
```bash
|
||||
cd /
|
||||
```
|
||||
|
||||
Do `ls` again and `cd` into `etc`. Look at how much space those folders are taking up:
|
||||
|
||||
```bash
|
||||
du iptables
|
||||
```
|
||||
That's the number of kilobytes the file is taking up.
|
||||
Do the same again, but in a human-readable format:
|
||||
|
||||
```bash
|
||||
du -h iptables
|
||||
```
|
||||
|
||||
The `du` program has `-h` for 'human', '-s' for 'short', and a bunch of other commands.
|
||||
Have a look at the manual and try another command:
|
||||
|
||||
```bash
|
||||
man du
|
||||
```
|
||||
|
||||
Once you're done, press 'q' to quit the manual page and try the extra `du` flag you've found.
|
||||
|
||||
Now you can try to gain super-powers and take over the system:
|
||||
|
||||
```bash
|
||||
sudo -i
|
||||
```
|
||||
|
||||
At this point, you are 'root'.
|
||||
All your commands will be executed, even if they're unsafe, or even if you ask to delete the entire machine.
|
||||
Best to exit out of the root account:
|
||||
|
||||
```bash
|
||||
exit
|
||||
```
|
||||
|
||||
Go find a file that isn't a directory. You can tell which is which with:
|
||||
|
||||
```bash
|
||||
ls -l
|
||||
```
|
||||
|
||||
A directory starts with a 'd', like this:
|
||||
|
||||
```bash
|
||||
drwxr-xr-x 79 root root 4096 Jan 3 05:15 /etc/
|
||||
```
|
||||
|
||||
A standard file starts with '-', like this:
|
||||
|
||||
```bash
|
||||
`-rw-r--r-- 1 root root 8 Dec 11 17:26 hostname`
|
||||
```
|
||||
|
||||
Look inside the file /etc/hostname to find out your computer's name:
|
||||
|
||||
```bash
|
||||
cat /etc/hostname
|
||||
```
|
||||
|
||||
Print out the words "hello world":
|
||||
|
||||
```bash
|
||||
echo "hello world"
|
||||
```
|
||||
|
||||
Move back to your home directory:
|
||||
|
||||
```bash
|
||||
cd
|
||||
```
|
||||
|
||||
Take the words 'hello world', and put them in 'my_file':
|
||||
|
||||
```bash
|
||||
echo 'hello world' > my_file
|
||||
```
|
||||
|
||||
Measure the disk usage of that file, then put the results at the bottom of the file:
|
||||
|
||||
```bash
|
||||
du $FILE >> $FILE
|
||||
```
|
||||
|
||||
And check the results:
|
||||
|
||||
```bash
|
||||
cat $FILE
|
||||
```
|
||||
|
||||
# Autocompletion
|
||||
|
||||
Press tab after typing a few keys and bash will guess what you're trying to type.
|
||||
|
||||
# Permissions
|
||||
|
||||
Look at your file's owner:
|
||||
|
||||
```bash
|
||||
ls -l $FILE
|
||||
```
|
||||
|
||||
If it says `-rw-r--r-- 1 root root 8 Dec 11 17:26 hostname` then the file is owned by 'root'.
|
||||
|
||||
Take your file and change the owner to root:
|
||||
|
||||
```bash
|
||||
sudo chown root $FILE
|
||||
```
|
||||
|
||||
Change the same file so it's owned by the group 'audio':
|
||||
|
||||
```bash
|
||||
sudo chown :audio $FILE
|
||||
```
|
||||
|
||||
Check you did that correctly:
|
||||
|
||||
```bash
|
||||
ls -l my_file
|
||||
```
|
||||
|
||||
> -rw-r--r-- 1 root audio 0 Jan 3 19:20 my_file
|
||||
|
||||
Read the start of that line. Root can 'read' and 'write' to or delete the file. Try to remove (delete) it:
|
||||
|
||||
```bash
|
||||
rm $FILE
|
||||
```
|
||||
|
||||
You'll see you're not allowed, because you don't own it.
|
||||
|
||||
Look at which groups you're in:
|
||||
|
||||
```bash
|
||||
groups
|
||||
```
|
||||
|
||||
Change the file so that members of the audio group can write to the file:
|
||||
|
||||
```bash
|
||||
sudo chmod g+w $FILE
|
||||
```
|
||||
|
||||
Check you got it right with `ls -l`:
|
||||
|
||||
```bash
|
||||
-rw-rw-r-- 1 root audio 0 Jan 3 19:20 my_file
|
||||
```
|
||||
|
||||
Try to delete the file again:
|
||||
|
||||
```bash
|
||||
rm my_file
|
||||
```
|
||||
|
||||
If you can't, you're not in the audio group. Add yourself. You'll need to *modify* your *user account*, by **a**ppending 'audio' to your list of groups.
|
||||
Use `-a` to **a**ppend, and `-G`, to say you're modifying groups:
|
||||
|
||||
```bash
|
||||
sudo usermod -a -G audio [ your username here ]
|
||||
```
|
||||
|
||||
Now you should be able to remove (delete) the file. Remember, that using 'rm file' will not send it to a recycling bin. The file is gone.
|
||||
|
||||
# Directories
|
||||
|
||||
Make a directory called 'new test':
|
||||
|
||||
```bash
|
||||
mkdir 'new test'
|
||||
```
|
||||
|
||||
Make two directories, called 'A', and 'Z':
|
||||
|
||||
```bash
|
||||
mkdir A Z
|
||||
```
|
||||
|
||||
Make a single directory called 'A Z'
|
||||
|
||||
```bash
|
||||
mkdir 'A Z'
|
||||
```
|
||||
|
||||
# Text Searches
|
||||
|
||||
Measure the disk usage of everything ('\*' means 'everything'), and put it in a file called 'disk usage.txt':
|
||||
|
||||
```bash
|
||||
du -sch * > A/'disk usage'.txt
|
||||
```
|
||||
|
||||
Look at your file:
|
||||
|
||||
```bash
|
||||
cat A/'disk usage.txt'
|
||||
```
|
||||
|
||||
If you think you have too much information, use `grep` to just get the one line of text you want:
|
||||
|
||||
```bash
|
||||
grep total A/disk\ usage.txt
|
||||
```
|
||||
|
||||
The `grep` program also has a manual ('man page'). You should find out what that `-c` flag does, but the manual is too long to read.
|
||||
|
||||
Start the manual:
|
||||
|
||||
```bash
|
||||
man du
|
||||
```
|
||||
|
||||
Then search for `-c` by pressing `/`. Your final keys should be `man du`, then `/-c`
|
||||
|
||||
Find out if the `ls` program also has a 'human readable' format by using `grep` to search for the word 'human':
|
||||
|
||||
```bash
|
||||
man ls | grep human
|
||||
```
|
||||
|
||||
Now use that flag that you've found in combinatin with the `-l` flag to look at a file.
|
||||
|
||||
Remove the directory 'Z':
|
||||
|
||||
```bash
|
||||
rmdir Z
|
||||
```
|
||||
|
||||
Remove the directory 'Z':
|
||||
|
||||
```bash
|
||||
rmdir Z
|
||||
```
|
||||
|
||||
And then remove all the rest:
|
||||
|
||||
```bash
|
||||
rmdir *
|
||||
```
|
||||
|
||||
The 'A' directory will not budge because it's not empty. Remove it recursively, so the computer will remove the things inside the directory as well as the directory itself:
|
||||
|
||||
```bash
|
||||
rm -r A
|
||||
```
|
||||
|
||||
# Installation
|
||||
|
||||
You get a package manager which installs programs, fonts, et c.
|
||||
If you're on something like Debian, you'll have `apt`, or if you're on something like Red Hat, you'll have `yum`.
|
||||
If unsure, ask where a program is:
|
||||
|
||||
```bash
|
||||
whereis yum
|
||||
```
|
||||
|
||||
```bash
|
||||
whereis apt
|
||||
```
|
||||
|
||||
If you get a hit, you can use whatever program that is to install things.
|
||||
|
||||
Set a reminder of your package manager:
|
||||
|
||||
```bash
|
||||
echo my package manager is yum | lolcat
|
||||
```
|
||||
|
||||
If that failed it's because you don't have `lolcat` installed.
|
||||
Install lolcat:
|
||||
|
||||
```bash
|
||||
sudo apt install lolcat
|
||||
```
|
||||
|
||||
Try the same command again.
|
||||
|
||||
Search for things you want, like `libreoffice`, or `gimp`:
|
||||
|
||||
```bash
|
||||
apt search libreoffice
|
||||
```
|
||||
|
||||
... then install one of them with:
|
||||
|
||||
```bash
|
||||
apt install $PROGRAM
|
||||
```
|
||||
|
||||
Remove `lolcat`, because it's useless:
|
||||
|
||||
```bash
|
||||
sudo apt remove lolcat
|
||||
```
|
||||
|
||||
... and that's pretty much it. You can move, create, destroy, install things, and look things up.
|
||||
|
||||
# Review
|
||||
|
||||
- Search for random things with your package manager and install the interesting ones.
|
||||
* Read the manual with `man thing`
|
||||
* If it's useless, remember to uninstall it.
|
||||
- Have a look around the file system in `/`.
|
||||
- Look in the `.config` folder in your home directory.
|
||||
* If you copy a program's config to another machine, the program will behave just like you set it up in your own machine.
|
||||
|
||||
@@ -1,43 +1,41 @@
|
||||
---
|
||||
title: clock
|
||||
tags:
|
||||
- basics
|
||||
- time
|
||||
title: "clock"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
|
||||
Show system time:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
date
|
||||
```
|
||||
|
||||
Show hardware time:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo hwclock -r
|
||||
```
|
||||
|
||||
Change system time to match hardware time:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo hwclock --hctosys
|
||||
```
|
||||
|
||||
Change hardware time to match system time:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo hwclock --systohc
|
||||
```
|
||||
|
||||
Manually set the hardware time to a specified date:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo hwclock --set --date="8/25/19 13:30:00"
|
||||
```
|
||||
|
||||
## Normal Date
|
||||
|
||||
```sh
|
||||
```bash
|
||||
date +%d/%m/%y
|
||||
```
|
||||
|
||||
@@ -47,7 +45,7 @@ Computers started counting time on January 1st, 1970, and added one second-per-s
|
||||
|
||||
Track the time in Unix-time:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
date +%s
|
||||
```
|
||||
|
||||
@@ -57,13 +55,13 @@ Servers which take their time from an observatory we call Stratum 1 servers. Se
|
||||
|
||||
Install ntp with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo apt-get install -y ntp
|
||||
```
|
||||
|
||||
The shell command for this is `ntpq`. Monitor the service providers using:
|
||||
|
||||
```sh
|
||||
ntpd -q
|
||||
```bash
|
||||
ntpq -p
|
||||
```
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
title: conditionals
|
||||
tags:
|
||||
- basics
|
||||
title: "conditionals"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
# If statements
|
||||
|
||||
@@ -47,7 +46,7 @@ esac
|
||||
# While and Until
|
||||
This prints from 1 until 9.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
COUNTER=1
|
||||
while [ $COUNTER -lt 2 ]; do
|
||||
> ((COUNTER++))
|
||||
@@ -59,7 +58,7 @@ There's also 'until', which stops when something is true, rather than keeping go
|
||||
|
||||
# For
|
||||
|
||||
```sh
|
||||
```bash
|
||||
for i in $( ls ); do
|
||||
> du -sh $i
|
||||
> done
|
||||
@@ -71,19 +70,19 @@ The sequences tool counts up from X in jumps of Y to number Z.
|
||||
|
||||
Count from 1 to 10.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
seq 10
|
||||
```
|
||||
|
||||
Count from 4 to 11.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
seq 4 11
|
||||
```
|
||||
|
||||
Count from 1 to 100 in steps of 5.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
seq 1 5 100
|
||||
```
|
||||
|
||||
129
basics/cron.md
Normal file
129
basics/cron.md
Normal file
@@ -0,0 +1,129 @@
|
||||
---
|
||||
title: "cron"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
# Cronie
|
||||
|
||||
The `cronie` program is also known as `crond`.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
sudo apt search -n ^cron
|
||||
```
|
||||
|
||||
Once installed, search for the service name, and start it.
|
||||
|
||||
```bash
|
||||
sudo systemctl list-unit-files | grep cron
|
||||
sudo systemctl enable --now $NAME
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Show your current crontab:
|
||||
|
||||
```bash
|
||||
crontab -l
|
||||
```
|
||||
|
||||
You can put this in a file and edit it:
|
||||
|
||||
```bash
|
||||
crontab -l > $filename
|
||||
echo '39 3 */3 * * /bin/tar czf /tmp/etc_backup.tgz /etc/' >> $filename
|
||||
```
|
||||
|
||||
Then apply that crontab:
|
||||
|
||||
```bash
|
||||
crontab $filename
|
||||
rm $filename
|
||||
```
|
||||
|
||||
The `cron` program will check your syntax before adding the tab.
|
||||
|
||||
Your crontab file sits somewhere in `/var/spool/`.
|
||||
Probably in `/var/spool/cron`.
|
||||
|
||||
## Syntax
|
||||
|
||||
`* * * * *`
|
||||
|
||||
These five points refer to:
|
||||
|
||||
`minute hour day month weekday`
|
||||
|
||||
So '3pm every Sunday' would be:
|
||||
|
||||
`0 15 * * 7`
|
||||
|
||||
Here 'Sunday' is indicated by "7", and '3pm' is 'the 15th hour'.
|
||||
The minute is '0' (i.e. '0 minutes past three pm').
|
||||
|
||||
Doing the same thing, but only in February, would be:
|
||||
|
||||
`0 15 * 2 7`
|
||||
|
||||
### Variables
|
||||
|
||||
`cronie` doesn't know where you live, so to put something in your `$HOME` directory, you have to tell it:
|
||||
|
||||
|
||||
```bash
|
||||
echo "HOME=$HOME" > $filename
|
||||
crontab -l >> $filename
|
||||
crontab $filename
|
||||
```
|
||||
|
||||
`cronie` doesn't know where anything lives, including programs.
|
||||
You can give it your usual `$PATH` variable like this:
|
||||
|
||||
|
||||
```bash
|
||||
echo $PATH > $filename
|
||||
crontab -l >> $filename
|
||||
crontab $filename
|
||||
```
|
||||
|
||||
Now instead of doing this
|
||||
|
||||
`40 */3 * * * /usr/bin/du -sh $HOME/* | sort -h > $HOME/sum.txt`
|
||||
|
||||
You can simply do this:
|
||||
|
||||
`40 */3 * * * du -sh $HOME/* | sort -h > $HOME/sum.txt`
|
||||
|
||||
## Run as Root
|
||||
|
||||
You can execute a script as root by putting it into a directory, instead of in the tab.
|
||||
Look at the available cron directories:
|
||||
|
||||
```bash
|
||||
ls -d /etc/cron.*
|
||||
```
|
||||
|
||||
Make a script which runs daily:
|
||||
|
||||
```bash
|
||||
f=apt_update.sh
|
||||
echo '#!/bin/bash' > $f
|
||||
echo 'apt update --yes' >> $f
|
||||
chmod +x $f
|
||||
sudo mv $f /etc/cron.daily/
|
||||
```
|
||||
|
||||
### Testing with runparts
|
||||
|
||||
Run-parts runs all executable scripts in a directory.
|
||||
|
||||
```bash
|
||||
run-parts /etc/cron.hourly
|
||||
```
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
### `date` Commands
|
||||
|
||||
Cron doesn't understand the `%` sign, so if you want to use `date +%R`, then it should be escaped with a backslash: `date +\%R`.
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
---
|
||||
title: eval
|
||||
tags:
|
||||
- basics
|
||||
title: "eval"
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
|
||||
Compose a statement for execution.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
x='echo $y'
|
||||
echo $x
|
||||
y=dragon
|
||||
@@ -15,7 +14,7 @@ eval "$x"
|
||||
|
||||
The results remain in the current shell, unlike sub-shells.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
b=basilisk
|
||||
sh -c 'echo $b'
|
||||
eval "g=goblin"
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
title: bash games
|
||||
tags:
|
||||
- fun
|
||||
title: "bash games"
|
||||
tags: [ "Documentation", "Games" ]
|
||||
---
|
||||
|
||||
Games are a great way to learn bash.
|
||||
@@ -1,8 +1,6 @@
|
||||
---
|
||||
title: hard links
|
||||
tags:
|
||||
- basics
|
||||
- links
|
||||
title: "hard links"
|
||||
tags: [ "basics", "links" ]
|
||||
---
|
||||
|
||||
A hard link is one file which exists in multiple locations.
|
||||
@@ -13,20 +11,20 @@ This ID is called the 'inode'.
|
||||
|
||||
Create a file, and a hard link:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
fortune > $file_1
|
||||
mkdir -p x/y/z/
|
||||
ln $file_1 x/y/z/$file_2
|
||||
```
|
||||
Have a long look at the file with the `-l` flag, and check the inode with `-i`:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ls -li $file_1 x/y/z/$file_2
|
||||
```
|
||||
|
||||
Since they are the same file, you can make a change to one, and it changes both:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
fortune | tee x/y/z/$file_2
|
||||
cat $file_1
|
||||
cat x/y/z/$file_2
|
||||
34
basics/kernel.md
Normal file
34
basics/kernel.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title: "kernel"
|
||||
tags: [ "Documentation", "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,14 +1,13 @@
|
||||
---
|
||||
title: kill
|
||||
tags:
|
||||
- basics
|
||||
title: "kill"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
|
||||
If you want to kill a program in a graphical environment, open a terminal and type:
|
||||
|
||||
# Graphical Programs
|
||||
|
||||
```sh
|
||||
```bash
|
||||
xkill
|
||||
```
|
||||
|
||||
@@ -18,7 +17,7 @@ Then click on the application which you want to kill.
|
||||
|
||||
To kill a program, find it with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
pgrep discord
|
||||
```
|
||||
|
||||
@@ -26,7 +25,7 @@ This will give you the UUID, e.g. `19643`.
|
||||
|
||||
Kill the program with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
kill 19643
|
||||
```
|
||||
|
||||
@@ -34,7 +33,7 @@ kill 19643
|
||||
|
||||
To see an ordered list of termination signals:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
kill -l
|
||||
```
|
||||
|
||||
@@ -50,7 +49,7 @@ Higher numbers are roughly equivalent to insistence.
|
||||
|
||||
For example:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
kill -1 3498
|
||||
```
|
||||
|
||||
@@ -58,7 +57,7 @@ This roughly means 'maybe stop the program, if you can, maybe reload'.
|
||||
|
||||
Or the famous:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
kill -9 3298
|
||||
```
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
---
|
||||
title: links
|
||||
tags:
|
||||
- basics
|
||||
- links
|
||||
title: "links"
|
||||
tags: [ "basics", "links" ]
|
||||
---
|
||||
|
||||
There are two types:
|
||||
@@ -1,8 +1,6 @@
|
||||
---
|
||||
title: locale
|
||||
tags:
|
||||
- basics
|
||||
- time
|
||||
title: "locale"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
|
||||
Your locale tells the computer your location, preferred time-and-date format, standard language, papersize, et c.
|
||||
@@ -10,25 +8,25 @@ A list of supported locales is available at /usr/share/i18n/SUPPORTED
|
||||
|
||||
See a full list with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
cat /usr/share/i18n/SUPPORTED
|
||||
```
|
||||
|
||||
Take the first portion to generate full locale information for a region:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
locale-gen ru_RU.UTF-8
|
||||
```
|
||||
|
||||
Then use this for the current shell session with
|
||||
|
||||
```sh
|
||||
```bash
|
||||
LANG=ru_RU.utf8
|
||||
```
|
||||
|
||||
Expand this to the entire system with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
export LANG=ru_RU.utf8
|
||||
```
|
||||
|
||||
@@ -36,7 +34,7 @@ You can make this permanent for one user by adding this line to the ~/.profile o
|
||||
|
||||
Make it permanent for the entire system by editing:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo vim /etc/defaults/locale
|
||||
```
|
||||
|
||||
@@ -1,13 +1,30 @@
|
||||
---
|
||||
title: Search System
|
||||
tags:
|
||||
- data
|
||||
- search
|
||||
- locate
|
||||
- plocate
|
||||
requires:
|
||||
- system/cron.md
|
||||
title: "locating"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
# Type
|
||||
|
||||
`type` shows what kind of thing you're running, be it an alias, function, or binary program.
|
||||
|
||||
```bash
|
||||
type cmus
|
||||
```
|
||||
|
||||

|
||||
|
||||
# Whereis the Program
|
||||
|
||||
Ask where the `angband` program is, along with all its configuration files:
|
||||
|
||||
`whereis angband`
|
||||
|
||||
Also `which` shows where a binary file (the program) is,
|
||||
|
||||
```bash
|
||||
which cmus
|
||||
```
|
||||
|
||||
# Search Instantly with `plocate`
|
||||
|
||||
You can search every file on the computer instantly by installing `plocate`.
|
||||
|
||||
@@ -15,7 +32,7 @@ Once installed, run `sudo updatedb` to create the database of (nearly) every fil
|
||||
|
||||
Check how big the database is:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
du -h /var/lib/plocate/plocate.db
|
||||
```
|
||||
|
||||
@@ -26,7 +43,7 @@ Once you have the database, you can find nearly any file instantly.
|
||||
- Search for jpg images with 'dog' or 'Dog' in the name: `locate -i dog jpg`
|
||||
- Search for videos: `plocate --regex '.mp4$|.mkv$|.wmv$|.webm$|.mov$|.avi$'`
|
||||
|
||||
For best results, run `updatedb` regularly, perhaps in [crontab](system/cron.md).
|
||||
For best results, run `updatedb` regularly, perhaps in [crontab](../system/cron.md).
|
||||
|
||||
## Search More Places
|
||||
|
||||
@@ -38,17 +55,10 @@ By default, the `/mnt` directory is 'pruned' from the database.
|
||||
So if you want to search `/mnt` for videos, remove the word `/mnt` from the configuration file.
|
||||
|
||||
|
||||
```sh
|
||||
su root
|
||||
```bash
|
||||
cat /etc/updatedb.conf
|
||||
sed -i 's#/mnt/##' /etc/updatedb.conf
|
||||
updatedb
|
||||
exit
|
||||
```
|
||||
|
||||
Now you can search in `/mnt` for films:
|
||||
|
||||
```sh
|
||||
sudo sed 's#/mnt/##' /etc/updatedb.conf
|
||||
sudo updatedb
|
||||
plocate --regex '.mp4$|.mkv$|.wmv$|.webm$|.mov$|.avi$'
|
||||
```
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
title: ls
|
||||
tags:
|
||||
- basics
|
||||
title: "ls"
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
|
||||
Firstly, your `ls` is probably aliased to something.
|
||||
@@ -9,13 +8,13 @@ Firstly, your `ls` is probably aliased to something.
|
||||
Check it with:
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
alias ls
|
||||
```
|
||||
If the prompt shows some alias, then start by removing it:
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
unalias ls
|
||||
```
|
||||
|
||||
@@ -24,24 +23,24 @@ Now we can begin.
|
||||
Check the most recently modified file:
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ls -t
|
||||
```
|
||||
|
||||
Reverse this with `tac` to see the file which has been unmodified the longest:
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ls -t | tac
|
||||
```
|
||||
Group files by extension:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ls -X
|
||||
```
|
||||
Sort largest files first:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ls -X
|
||||
```
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
---
|
||||
title: processes
|
||||
tags:
|
||||
- basics
|
||||
title: "processes"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
# Processes
|
||||
# Proccesses
|
||||
|
||||
See running items in current terminal with
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ps
|
||||
```
|
||||
|
||||
or more with
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ps -a
|
||||
```
|
||||
|
||||
Or the entire system with
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ps -e
|
||||
```
|
||||
|
||||
Or the entire system with more information, BSD style, with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ps aux
|
||||
```
|
||||
|
||||
And then search for a particular program with
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ps aux | grep cmus
|
||||
```
|
||||
|
||||
@@ -41,19 +40,19 @@ Pause a job with ^z. Put it in the background with the '&' suffix.
|
||||
|
||||
List jobs in the current shell with
|
||||
|
||||
```sh
|
||||
```bash
|
||||
jobs
|
||||
```
|
||||
|
||||
And then you can pull number 1 up again with
|
||||
|
||||
```sh
|
||||
```bash
|
||||
fg 1
|
||||
```
|
||||
|
||||
Or continue running a stopped job with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
bg 1
|
||||
```
|
||||
|
||||
@@ -63,31 +62,31 @@ This changes how nice a program is, from -20 to 19.
|
||||
|
||||
Install a program, but nicely, at nice value '10':
|
||||
|
||||
```sh
|
||||
```bash
|
||||
nice -10 sudo apt -y install libreoffice
|
||||
```
|
||||
|
||||
Aggressively use Steam, with a nice value of '-13'.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
nice --13 steam&
|
||||
```
|
||||
|
||||
Find out that Steam's fucking everything up, so you change its nice value with 'renice':
|
||||
|
||||
```sh
|
||||
```bash
|
||||
renice --5 -p 3781
|
||||
```
|
||||
|
||||
Nerf all of roach-1's processes:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
renice 10 -u roach-1
|
||||
```
|
||||
|
||||
... or the entire group
|
||||
|
||||
```sh
|
||||
```bash
|
||||
renice -14 -g hackers
|
||||
```
|
||||
|
||||
180
basics/setup/Quality_of_Life.md
Normal file
180
basics/setup/Quality_of_Life.md
Normal file
@@ -0,0 +1,180 @@
|
||||
---
|
||||
title: "Quality of Life"
|
||||
tags: [ "basics", "setup" ]
|
||||
dependencies: [ "vi", "basics" ]
|
||||
---
|
||||
|
||||
This & That
|
||||
===========
|
||||
|
||||
Refer to 'that last thing', and 'the first thing':
|
||||
|
||||
```bash
|
||||
fortune -l > file1
|
||||
cat !$ | tr -d u
|
||||
diff !^ !$
|
||||
```
|
||||
|
||||
**NB:** this can go wrong:
|
||||
|
||||
```bash
|
||||
ls -l file1 file2
|
||||
cat !^
|
||||
```
|
||||
|
||||
Done
|
||||
----
|
||||
|
||||
`<C-d>`
|
||||
|
||||
- If you have a command, Control + d will execute the command.
|
||||
- If you have nothing, `exit`.
|
||||
|
||||
Input Run-Commands (`~/.inputrc`)
|
||||
=================================
|
||||
|
||||
Alias Expansion
|
||||
---------------
|
||||
|
||||
```bash
|
||||
echo '"\C- ": shell-expand-line' >> ~/.inputrc
|
||||
exec bash
|
||||
```
|
||||
|
||||
Now you can expand all aliases with 'Control + Space'.
|
||||
Try just `ls`, then 'Control + Space'.
|
||||
|
||||
Glob Expansion (`*`)
|
||||
--------------------
|
||||
|
||||
```bash
|
||||
echo '"\C-x": glob-expand-word' >> ~/.inputrc
|
||||
exec bash
|
||||
ls *<C-x>
|
||||
```
|
||||
|
||||
- Are you sure you want to delete that?
|
||||
* `rm -r *<C-x>`
|
||||
- Clean up the Downloads folder:
|
||||
* `rm Downloads/*pdf<C-x>`
|
||||
|
||||
Arbitrary Commands
|
||||
------------------
|
||||
|
||||
Use `\n` as a 'newline' character to automatically press `<Return>`.
|
||||
|
||||
```bash
|
||||
echo 'Control-y: "| lolcat\n"' >> ~/.inputrc
|
||||
exec bash
|
||||
ls<C-y>
|
||||
```
|
||||
|
||||
```bash
|
||||
Control-l: "\C-u clear -x && ls\n"
|
||||
exec bash
|
||||
cd /etc/<C-l>
|
||||
```
|
||||
|
||||
Readline as Vi
|
||||
--------------
|
||||
|
||||
```bash
|
||||
echo 'set editing-mode vi' >> ~/.inputrc
|
||||
echo 'set keymap vi-insert' >> ~/.inputrc
|
||||
exec bash
|
||||
```
|
||||
|
||||
The prompt now works according to `vi`-motions.
|
||||
This goes much further than the bash-option, `set -o vi` ('set option: `vi`').
|
||||
It changes the cursor in the terminal, not just bash.
|
||||
|
||||
Try:
|
||||
|
||||
- `ls <C-n>`
|
||||
- `ls <C-p>`
|
||||
- Type some words.
|
||||
- `<Esc>0dw$p`
|
||||
- <Esc> to normal-mode, and go back with 'b', and forward with 'e'.
|
||||
- `4b` to step back four times.
|
||||
- `cE`
|
||||
- `<Esc>kcw`
|
||||
- ls -a<Esc>xxxx
|
||||
|
||||
Works with `python` too:
|
||||
|
||||
```python
|
||||
im<C-n>os<Return>
|
||||
os.li<C-n><Return>
|
||||
<Esc>kfn
|
||||
<C-d>
|
||||
```
|
||||
|
||||
Fix Globs!
|
||||
----------
|
||||
|
||||
If you tried the previous commands then they will not work any more, because the `vi`-commands overwrite the other commands.
|
||||
Remove them.
|
||||
|
||||
```bash
|
||||
sed '/ vi/d' ~/.inputrc
|
||||
sed -i '/ vi/d' ~/.inputrc
|
||||
|
||||
sed '1 i set editing-mode vi' .inputrc
|
||||
sed -i '1 i set editing-mode vi' ~/.inputrc
|
||||
sed -i '2 i set keymap vi-insert' ~/.inputrc
|
||||
```
|
||||
|
||||
Vi-sibility
|
||||
-----------
|
||||
|
||||
The `readline` prompt becomes confusing if you don't remember if you're in insert or normal mode.
|
||||
But you can show the current mode in the prompt:
|
||||
|
||||
```bash
|
||||
echo 'set show-mode-in-prompt on' >> ~/.inputrc
|
||||
exec bash
|
||||
```
|
||||
|
||||
Set new symbols for normal and insert mode:
|
||||
|
||||
```bash
|
||||
echo 'set vi-ins-mode-string " "' >> ~/.inputrc
|
||||
echo 'set vi-cmd-mode-string " "' >> ~/.inputrc
|
||||
```
|
||||
|
||||
Fuzzy Sort
|
||||
==========
|
||||
|
||||
Check your repos for `sk-im`, and install.
|
||||
The program is called `sk`.
|
||||
|
||||
```bash
|
||||
FUZZY=sk
|
||||
```
|
||||
|
||||
If you don't have it, `fzy` or `fzf` should work the same way.
|
||||
|
||||
```bash
|
||||
FUZZY=fzy
|
||||
```
|
||||
|
||||
Find some 'read-config' files to check out:
|
||||
|
||||
```bash
|
||||
find . -maxdepth 2 -name "*rc"
|
||||
find . -maxdepth 2 -name "*rc" | $FUZZY
|
||||
```
|
||||
|
||||
And read some:
|
||||
|
||||
```bash
|
||||
PAGER='less -R'
|
||||
$PAGER "$(find . -maxdepth 2 -name "*rc" | $FUZZY)"
|
||||
```
|
||||
|
||||
Make the change long-term:
|
||||
|
||||
```bash
|
||||
alias rrc='$PAGER "$(find . -maxdepth 2 -name "*rc" | sk)"'
|
||||
alias | grep rrc= >> ~/.bash_aliases
|
||||
```
|
||||
@@ -1,15 +1,13 @@
|
||||
---
|
||||
title: soft links
|
||||
tags:
|
||||
- basics
|
||||
- links
|
||||
title: "soft links"
|
||||
tags: [ "basics", "links" ]
|
||||
---
|
||||
A soft link is a file which says how to go to another file.
|
||||
When a program encounters a soft link, it will make a guess at whether it should ignore it, or try to get to that file.
|
||||
|
||||
To make a soft link to a file in the current directory, linking is easy:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
fortune > $file_1
|
||||
ln -s $file_1 $link_1
|
||||
```
|
||||
@@ -29,14 +27,14 @@ dir_0/
|
||||
|
||||
Inside `dir_1`, making a soft link to `dir_0/file_1` would mean putting the directions to that file:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
cd dir_1
|
||||
ln -s ../file_1 link_1
|
||||
```
|
||||
|
||||
The real content of the file is just '`../file_1`, so making it from another directory would mean writing exactly the same address to that file:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ln -s ../file_1 dir_2/link_2
|
||||
```
|
||||
|
||||
@@ -56,7 +54,7 @@ dir_0/
|
||||
|
||||
Since it's just an address, you can delete the original file, then make another.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
rm file_1
|
||||
ls -l dir_1/
|
||||
fortune > file_1
|
||||
@@ -67,7 +65,7 @@ cat dir_1/link_1
|
||||
|
||||
Last, let's make a link from `dir_2/link_2` to `dir_1/file_1` (this will delete the old link):
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ln -s -f ../dir_1/file_1 dir_2/link_2
|
||||
cat dir_2/link_2
|
||||
```
|
||||
78
basics/time.md
Normal file
78
basics/time.md
Normal file
@@ -0,0 +1,78 @@
|
||||
---
|
||||
title: "time"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
# systemd
|
||||
|
||||
Set time to synchronize with an ntp server:
|
||||
|
||||
```bash
|
||||
timedatectl set-ntp true
|
||||
```
|
||||
|
||||
This info stays in `/usr/share/zoneinfo`.
|
||||
|
||||
# Local Time
|
||||
|
||||
Local time is kept in /etc/localtime.
|
||||
|
||||
According to Dave's LPIC guide, you can set the local time by making asymboling link from your timezone to /etc/localtime, as so:
|
||||
|
||||
```bash
|
||||
sudo ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
|
||||
```
|
||||
|
||||
...however this produced the wrong time for me. Further, /etc/localtime produces an output with cat, while the zoneinfo files do not.
|
||||
|
||||
# Locale
|
||||
|
||||
See local time, language and character settings with:
|
||||
|
||||
```bash
|
||||
locale
|
||||
```
|
||||
|
||||
List available locales with:
|
||||
|
||||
```bash
|
||||
locale -a
|
||||
```
|
||||
|
||||
To see additional locales which are available (but not necessarily installed):
|
||||
|
||||
```bash
|
||||
cat /usr/share/i18n/SUPPORTED
|
||||
```
|
||||
|
||||
Set a supported locale with:
|
||||
|
||||
```bash
|
||||
locale-gen pl_PL.UTF-8
|
||||
```
|
||||
|
||||
Then set that language, with:
|
||||
|
||||
```bash
|
||||
LANG=pl_PL.UTF-8
|
||||
```
|
||||
|
||||
... then reboot.
|
||||
|
||||
# Network Time Protocol
|
||||
|
||||
Glimpse an overview with:
|
||||
|
||||
```bash
|
||||
ntpq -p
|
||||
```
|
||||
|
||||
Usually this is run as a service, so just start that service.
|
||||
|
||||
# Force Reset
|
||||
|
||||
If your clock drifts too far from the right time, it will not reset happily.
|
||||
For it to reset like this:
|
||||
|
||||
```bash
|
||||
sudo ntpd -q -g -x -n
|
||||
```
|
||||
@@ -1,9 +1,6 @@
|
||||
---
|
||||
title: tree
|
||||
tags:
|
||||
- basics
|
||||
- tree
|
||||
- markdown
|
||||
title: "tree"
|
||||
tags: [ "basics", "tree", "markdown" ]
|
||||
---
|
||||
|
||||
The `tree` utility outputs a full listing of everything in your current directory, and those below.
|
||||
@@ -31,7 +28,7 @@ Each description-line starts with a tab.
|
||||
|
||||
To represent a file structure as a nested series of markdown lists, you can try this horrifying `sed` one-liner:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
tree -tf --dirsfirst --gitignore --noreport --charset ascii | \
|
||||
sed -e 's/| \+/ /g' \
|
||||
-e 's/[|`]-\+/ */g' \
|
||||
@@ -1,29 +1,28 @@
|
||||
---
|
||||
title: users
|
||||
tags:
|
||||
- basics
|
||||
title: "users"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
# Basic Information
|
||||
|
||||
Let's get some entries with 'getent', e.g. passwd or group.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
getent passwd
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
getent group
|
||||
```
|
||||
|
||||
Obviously:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
getent shadow
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo adduser maestro
|
||||
```
|
||||
|
||||
@@ -31,71 +30,71 @@ add user 'maestro'
|
||||
|
||||
This depends upon the settings in the /etc/default/useradd file and /etc/login.defs
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo useradd -m pinkie
|
||||
```
|
||||
|
||||
add user 'pinkie' with a home directory
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo adduser -m -e 2017-04-25 temp
|
||||
```
|
||||
|
||||
add expiry date to user
|
||||
|
||||
```sh
|
||||
```bash
|
||||
userdel maestro
|
||||
```
|
||||
|
||||
delete maestro
|
||||
|
||||
```sh
|
||||
```bash
|
||||
userdel -r maestro
|
||||
```
|
||||
|
||||
delete maestro and hir homefolder
|
||||
|
||||
```sh
|
||||
```bash
|
||||
groups
|
||||
```
|
||||
|
||||
find which group you are in
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
id
|
||||
```
|
||||
|
||||
same
|
||||
|
||||
```sh
|
||||
```bash
|
||||
id -Gn maestro
|
||||
```
|
||||
|
||||
Find which groups maestro is in
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
deluser --remove-home maestro
|
||||
```
|
||||
|
||||
delete user maestro
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
usermod -aG sudo maestro
|
||||
```
|
||||
|
||||
Add user maestro to group sudo:
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
cat /etc/passwd
|
||||
```
|
||||
|
||||
list users' passwords (and therefore users)
|
||||
|
||||
```sh
|
||||
```bash
|
||||
groupadd awesome
|
||||
```
|
||||
|
||||
@@ -105,33 +104,33 @@ Passwords are stored in /etc/shadow.
|
||||
|
||||
There are user accounts for processes such as 'bin' and 'nobody' which are locked, so they're unusable.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
passwd -l bin
|
||||
```
|
||||
|
||||
Lock the user 'bin'.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
more /etc/passwd | grep games
|
||||
```
|
||||
|
||||
we find the name, password and user id of the user 'games'. I.e. the password is 'x', and the user id is '5'. The password is an impossible hash, so no input password could match.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
groupdel learners | delete the group 'learners'
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
gpasswd -d pi games | remove user 'pi' from the group 'games'
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
id games
|
||||
```
|
||||
|
||||
find the id number of group 'games' (60)
|
||||
|
||||
```sh
|
||||
```bash
|
||||
usermod -aG sudo maestro
|
||||
```
|
||||
|
||||
@@ -157,7 +156,7 @@ Alternatively, change the shell in /etc/passwd.
|
||||
|
||||
Usermod also lets you change a user's username:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
usermod -l henry mark
|
||||
```
|
||||
|
||||
@@ -171,7 +170,7 @@ usermod -L henry
|
||||
|
||||
-G or -groups adds the user to other groups:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
usermod -G sudo henry
|
||||
```
|
||||
|
||||
@@ -187,13 +186,13 @@ In /etc/group, a group file may look like this:
|
||||
|
||||
We can use groupmod, like like usermod, e.g. to change a name:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
groupmod -n frontoffice backoffice
|
||||
```
|
||||
|
||||
Delte a group:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
groupdel frontoffice
|
||||
```
|
||||
|
||||
@@ -201,37 +200,37 @@ groupdel frontoffice
|
||||
|
||||
See list of logged on users.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
w
|
||||
```
|
||||
|
||||
See last logons:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
last
|
||||
```
|
||||
|
||||
or all logon attempts, including bad attempts:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
lastb
|
||||
```
|
||||
|
||||
List recently accessed files:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
last -d
|
||||
```
|
||||
|
||||
See files opened by steve
|
||||
|
||||
```sh
|
||||
```bash
|
||||
lsof -t -u steve
|
||||
```
|
||||
|
||||
See files opened by anyone but steve
|
||||
|
||||
```sh
|
||||
```bash
|
||||
lsof -u ^steve
|
||||
```
|
||||
|
||||
@@ -241,19 +240,19 @@ Some files can be executed by people as if they had super user permissions, and
|
||||
|
||||
Let's start with files executable by user:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo find / -type f -perm -g=s -ls
|
||||
```
|
||||
|
||||
And then those executable by the group:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
find / -type f -perm -g=s -ls
|
||||
```
|
||||
|
||||
And finally, worrying files, executable by anyone as if sie were the owner:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
find / -xdev \( -o -nogroup \) -print
|
||||
```
|
||||
|
||||
@@ -261,7 +260,7 @@ Then have a look at resource usage per user.
|
||||
|
||||
# SGID
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo chmod u+s process.sh
|
||||
```
|
||||
|
||||
33
basics/which.tape
Normal file
33
basics/which.tape
Normal file
@@ -0,0 +1,33 @@
|
||||
Require cmus
|
||||
|
||||
Type "whereis cmus"
|
||||
Enter
|
||||
Sleep 1s
|
||||
Type "which cmus"
|
||||
Enter
|
||||
Sleep 500ms
|
||||
Type "type /bin/cmus"
|
||||
Enter
|
||||
Sleep 5s
|
||||
Type "man cmus"
|
||||
Enter
|
||||
Sleep 1s
|
||||
Type " "
|
||||
Sleep 1s
|
||||
Type " "
|
||||
Sleep 1s
|
||||
Type " "
|
||||
Sleep 500ms
|
||||
Type " "
|
||||
Sleep 1.5s
|
||||
Type " "
|
||||
Sleep 500ms
|
||||
Type " "
|
||||
Sleep 1.5s
|
||||
Type " "
|
||||
Sleep 500ms
|
||||
Type " q"
|
||||
Sleep 500ms
|
||||
Type "cmus"
|
||||
Sleep 3s
|
||||
Ctrl+D
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
title: yes
|
||||
tags:
|
||||
- basics
|
||||
title: "yes"
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
# The Best Linux Program: `yes`
|
||||
|
||||
@@ -12,14 +11,14 @@ This is extremely powerful.
|
||||
|
||||
If you ever want to automatically install something which persistently nags you with `do you want to do the thing? [y/N]?`, then you can just pipe `yes` into that program, and it will answer 'yes' to all questions.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
yes | $INSTALL_SCRIPT_FILE.sh
|
||||
```
|
||||
|
||||
This works best for disposable systems, like VMs or containers.
|
||||
Try this on a live system, and you might find out that you should have read that message fully.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
yes | yay
|
||||
```
|
||||
|
||||
11
basics/yes.tape
Normal file
11
basics/yes.tape
Normal file
@@ -0,0 +1,11 @@
|
||||
Require yay
|
||||
|
||||
Set Shell "bash"
|
||||
Set FontSize 20
|
||||
Set Width 1400
|
||||
Set Height 900
|
||||
|
||||
Sleep 2s
|
||||
|
||||
|
||||
Type "yes | yay"
|
||||
57
chat/profanity-otr.md
Normal file
57
chat/profanity-otr.md
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
title: "profanity"
|
||||
tags: [ "Documentation", "Chat", "OTR" ]
|
||||
---
|
||||
# otr
|
||||
|
||||
'Off The Record' encryption seems mostly dead to me.
|
||||
But this is what I did, back in the day...
|
||||
|
||||
Install libotr-dev or libotr5-dev or whatever..
|
||||
|
||||
```
|
||||
sudo apt -y install lib5otr-dev
|
||||
```
|
||||
|
||||
Make your otr keys.
|
||||
|
||||
```
|
||||
/otr gen
|
||||
```
|
||||
|
||||
Then you can start an otr converstation.
|
||||
|
||||
```
|
||||
/otr start bob@jobbies.org
|
||||
```
|
||||
|
||||
Or if you already have a conversation windows open, switch to our using:
|
||||
|
||||
```
|
||||
/otr
|
||||
```
|
||||
|
||||
Finally, verify!
|
||||
|
||||
```
|
||||
/otr question "Who are you?" bob
|
||||
```
|
||||
|
||||
Bob is verified upon the answer, 'bob'.
|
||||
|
||||
### OTR Finger Prints
|
||||
|
||||
Get yours with
|
||||
|
||||
```
|
||||
/otr myfp
|
||||
```
|
||||
|
||||
```
|
||||
/otr theirfp
|
||||
```
|
||||
|
||||
```
|
||||
/otr myfp
|
||||
```
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
---
|
||||
title: profanity
|
||||
tags:
|
||||
- chat
|
||||
- omemo
|
||||
title: "profanity"
|
||||
tags: [ "Documentation", "Chat", "omemo" ]
|
||||
---
|
||||
|
||||
# Setup (Commands)
|
||||
|
||||
Sign up to an account somewhere.
|
||||
|
||||
```
|
||||
/connect ${name}@${host}
|
||||
/connect bob@bobserver.org
|
||||
```
|
||||
|
||||
Check if someone wants to be your friend:
|
||||
@@ -22,13 +19,13 @@ Check if someone wants to be your friend:
|
||||
Accept a friend's subscription request:
|
||||
|
||||
```
|
||||
/sub add ${name}@${host}
|
||||
/sub add alice@aliceserver.org
|
||||
```
|
||||
|
||||
Join a room:
|
||||
|
||||
```
|
||||
/join ${room}@${host}
|
||||
/join room1@bobserver.org
|
||||
```
|
||||
|
||||
Save your configuration so you don't have to do this again:
|
||||
@@ -41,14 +38,14 @@ Check your `~/.config/profanity/profrc` for how to data's saved.
|
||||
|
||||
## Automatically Sign In
|
||||
|
||||
To automatically sign in, add your password to [pass](data/pass.md).
|
||||
To automatically sign in, add your password to [pass](../data/pass.md).
|
||||
|
||||
```
|
||||
/account set ${name}@${host} eval_password pass *xmpp*
|
||||
/account set *malin@oosm.org* eval_password pass *xmpp*
|
||||
```
|
||||
|
||||
```
|
||||
/autoconnect set ${name}@${host}}
|
||||
/autoconnect set *malin@oosm.org*
|
||||
```
|
||||
|
||||
```
|
||||
@@ -62,7 +59,7 @@ Remember to save the config for other commands too.
|
||||
## Messages
|
||||
|
||||
```
|
||||
/msg ${name}@${host}}
|
||||
/msg alice@aliceserver.org
|
||||
```
|
||||
|
||||
This opens in a new tab.
|
||||
@@ -99,7 +96,7 @@ Tell it how to save files:
|
||||
Then get the file with:
|
||||
|
||||
```
|
||||
/urlsave <Tab>
|
||||
/urlsave *<Tab>*
|
||||
```
|
||||
|
||||
Same for `/urlopen`
|
||||
@@ -143,3 +140,6 @@ You can ensure omemo automatcally turns on:
|
||||
```
|
||||
/omemo policy automatic
|
||||
```
|
||||
---
|
||||
|
||||
'OTR' encryption is mostly dead, but you can find the old instructions [here](profanity-otr).
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
title: profanity automation
|
||||
tags:
|
||||
- chat
|
||||
- omemo
|
||||
requires:
|
||||
- chat/profanity.md
|
||||
---
|
||||
|
||||
Automate profanity with `--cmd`.
|
||||
|
||||
|
||||
```sh
|
||||
profanity --cmd /foo --cmd "/sleep 10" --cmd /quit
|
||||
```
|
||||
@@ -1,76 +0,0 @@
|
||||
---
|
||||
title: Send an email with a CLI command
|
||||
tags:
|
||||
- email
|
||||
requires:
|
||||
- data/pass.md
|
||||
---
|
||||
|
||||
# Setup the Config
|
||||
|
||||
Install `msmtp` and set up the defaults.
|
||||
|
||||
```sh
|
||||
mkdir ~/.config/msmtp/
|
||||
cat > ~/.config/msmtp/config << EOF
|
||||
defaults
|
||||
tls on
|
||||
auth on
|
||||
|
||||
EOF
|
||||
```
|
||||
|
||||
You'll need to fill in some variables, like your provider's hostname and SMTP port.
|
||||
The `${pass_name}` is just the `pass` command which gives your email password.
|
||||
|
||||
```sh
|
||||
name=posteo
|
||||
host=posteo.de
|
||||
port=587
|
||||
user=bob@posteo.net
|
||||
pass_name=posteo.net
|
||||
```
|
||||
|
||||
With those in, add that default account.
|
||||
|
||||
|
||||
```sh
|
||||
cat >> ~/.config/msmtp/config << EOF
|
||||
|
||||
account ${name}
|
||||
host ${host}
|
||||
port ${port}
|
||||
user ${user}
|
||||
from ${user}
|
||||
passwordeval pass ${pass_name}
|
||||
|
||||
```
|
||||
|
||||
Finally, set this as the default account:
|
||||
|
||||
|
||||
```sh
|
||||
account default : ${account} >> ~/.config/msmtp/config
|
||||
```
|
||||
|
||||
# Write an Email
|
||||
|
||||
Fill out the headers in a file called `mail`.
|
||||
|
||||
```
|
||||
From: MSMTP ${user}
|
||||
Subject: Pipes
|
||||
To: ${recipient_name} <${recipient_email}>
|
||||
|
||||
A pipe gives a wise man time to think and a fool something to stick in his
|
||||
mouth.
|
||||
```
|
||||
|
||||
# Send
|
||||
|
||||
Send the email:
|
||||
|
||||
```sh
|
||||
msmtp -t bindrpg@posteo.uk < mail
|
||||
```
|
||||
|
||||
@@ -1,36 +1,29 @@
|
||||
---
|
||||
title: wgetpaste
|
||||
tags:
|
||||
- chat
|
||||
title: "wgetpaste"
|
||||
tags: [ "Documentation", "Chat" ]
|
||||
---
|
||||
|
||||
See available pastebins:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
wgetpaste -S
|
||||
```
|
||||
|
||||
Upload script.sh to bpaste:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
wgetpaste -s bpaste script.sh
|
||||
```
|
||||
|
||||
Input clipboard to dpaste with the heading "Title"
|
||||
|
||||
```sh
|
||||
```bash
|
||||
wgetpaste -s dpaste -d Title -x
|
||||
```
|
||||
|
||||
Paste in the file then load the result to the right-hand clipboard:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
wgetpaste -s dpaste -X
|
||||
```
|
||||
|
||||
---
|
||||
title:
|
||||
tags:
|
||||
chat
|
||||
---
|
||||
|
||||
|
||||
36
cmd.mk
36
cmd.mk
@@ -1,36 +0,0 @@
|
||||
|
||||
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
|
||||
${MAKE} --silent --touch query
|
||||
printf '%s\n' 'lk(){'
|
||||
${MAKE} --silent --dry-run query | sed 's/^/\t/'
|
||||
printf '%s\n' '}'
|
||||
|
||||
.PHONY: query
|
||||
query: db.rec ## Search the setup notes
|
||||
passes=0 count=0; until [ "$$count" -eq "1" ] || [ "$$passes" -gt 2 ] ; do \
|
||||
query="$$(recsel "${PWD}"/db.rec -p aim,tag | recsel -iq "$$query" -CP aim,tag | sort -u | fzf --preview='recsel "${PWD}"/db.rec -e "aim~{}"')" \
|
||||
&& count="$$(recsel "${PWD}"/db.rec -q "$$query" -c )" ;\
|
||||
passes=$$(( passes + 1 )) ;\
|
||||
done \
|
||||
&& recsel "${PWD}"/db.rec -q "$$query" | recfmt -f "${PWD}/lists.fmt" | ${PAGER}
|
||||
|
||||
504
command.rec
504
command.rec
@@ -1,504 +0,0 @@
|
||||
%rec: command
|
||||
%doc: shell command examples
|
||||
%type: aim line
|
||||
%allowed: aim cmd bin tag note shell
|
||||
%unique: shell
|
||||
|
||||
aim: Put output into columns
|
||||
cmd: ip a | grep inet | column -ts' '
|
||||
shell: sh
|
||||
bin: column
|
||||
tag: format
|
||||
|
||||
aim: Reformat user accounts with an explicit separator (`-s`)
|
||||
cmd: column -ts: /etc/passwd
|
||||
shell: sh
|
||||
bin: column
|
||||
tag: format
|
||||
|
||||
aim: Sort user accounts into columns with names
|
||||
cmd: column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID /etc/passwd
|
||||
note: Hide some columns with `-H`.
|
||||
shell: sh
|
||||
bin: column
|
||||
tag: format
|
||||
|
||||
aim: Sort user accounts into columns and reorder them
|
||||
cmd: column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID -O User,Description,shell /etc/passwd
|
||||
note: Unspecified items remain.
|
||||
shell: sh
|
||||
bin: column
|
||||
tag: format
|
||||
|
||||
aim: Output user accounts in json format with `-J`
|
||||
cmd: column -J -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd
|
||||
shell: sh
|
||||
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
|
||||
shell: sh
|
||||
bin: qrencode
|
||||
tag: qr
|
||||
|
||||
aim: Make a QR Coded message in the terminal
|
||||
cmd: qrencode -t ansi "Hello World"
|
||||
shell: sh
|
||||
bin: qrencode
|
||||
tag: qr
|
||||
|
||||
aim: Read a QR Code image
|
||||
cmd: zbarimg ${file}
|
||||
shell: sh
|
||||
bin: qrencode
|
||||
tag: qr
|
||||
|
||||
aim: Show wifi QR code (only with Network Manager)
|
||||
cmd: nmcli device wifi show-password
|
||||
shell: sh
|
||||
bin: qrencode
|
||||
bin: nmcli
|
||||
tag: qr
|
||||
tag: wifi
|
||||
|
||||
aim: Combine many recfiles of different types into one
|
||||
cmd: sed '1i\ ' *.rec > all.rec
|
||||
shell: sh
|
||||
bin: sed
|
||||
tag: recfiles
|
||||
tag: database
|
||||
|
||||
aim: Combine many recfiles of the same type into one
|
||||
cmd: recinf -d -t ${type} ${one}.rec > ${all}.rec
|
||||
+ sed '/^%/d' ${one}.rec ${two}.rec > all.rec
|
||||
note: The strange syntax used by `sed` only makes sense after using [ed](writing/ed.md)
|
||||
shell: sh
|
||||
bin: sed
|
||||
bin: recinf
|
||||
tag: recfiles
|
||||
tag: database
|
||||
|
||||
aim: Roll a die
|
||||
cmd: echo $(( RANDOM % 6+1 ))
|
||||
shell: bash
|
||||
tag: random
|
||||
|
||||
aim: Remotely edit a file with vim
|
||||
cmd: vim scp://${server}/~/${file}
|
||||
cmd: vim scp://${user}@${server}:${port}//${path}/${file}
|
||||
shell: sh
|
||||
bin: vim
|
||||
bin: scp
|
||||
tag: network
|
||||
|
||||
aim: Find and replace across all files open in vim
|
||||
cmd: :bufdo! %s/${pattern}/${replacement}/g
|
||||
shell: sh
|
||||
bin: vim
|
||||
tag: writing
|
||||
tag: replace
|
||||
|
||||
aim: Find and replace words, but confirm each replacement
|
||||
cmd: vim -c "%s/${pattern}/${replacement}/gc" -c 'wq' ${file}
|
||||
shell: sh
|
||||
bin: vim
|
||||
tag: replace
|
||||
tag: substitution
|
||||
tag: TUI
|
||||
tag: writing
|
||||
|
||||
aim: Hard reset ntp service
|
||||
cmd: sudo ntpd -q -g -x -n
|
||||
bin: ntpd
|
||||
tag: time
|
||||
tag: system
|
||||
|
||||
aim: Check a service
|
||||
cmd: sudo systemctl status mpd
|
||||
shell: sh
|
||||
bin: systemd
|
||||
tag: system
|
||||
tag: service
|
||||
|
||||
aim: Recognize service changes
|
||||
cmd: sudo systemctl daemon-reload
|
||||
shell: sh
|
||||
bin: systemd
|
||||
tag: system
|
||||
tag: service
|
||||
|
||||
aim: Start a service (it stops when the computer shuts down)
|
||||
cmd: sudo systemctl taskd.service start
|
||||
+ sudo systemctl daemon-reload
|
||||
shell: sh
|
||||
bin: systemd
|
||||
tag: system
|
||||
tag: service
|
||||
|
||||
aim: Find out why the computer takes so long to start
|
||||
cmd: sudo systemd-analyze
|
||||
+ sudo systemd-analyze blame
|
||||
shell: sh
|
||||
bin: systemd
|
||||
tag: system
|
||||
tag: boot
|
||||
|
||||
aim: See what the computer is doing
|
||||
cmd: journalctl -f
|
||||
shell: sh
|
||||
bin: journalctl
|
||||
tag: system
|
||||
|
||||
aim: Check your own user services:
|
||||
cmd: journalctl -f
|
||||
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"
|
||||
shell: sh
|
||||
bin: journalctl
|
||||
tag: system
|
||||
|
||||
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
|
||||
bin: mlr
|
||||
tag: csv
|
||||
tag: markdown
|
||||
tag: data
|
||||
|
||||
aim: Convert a csv file to markdown
|
||||
cmd: mlr --icsv --omd cat ${file}.csv
|
||||
bin: mlr
|
||||
tag: csv
|
||||
tag: markdown
|
||||
|
||||
aim: Quickly find and open run-command files
|
||||
cmd: alias rrc='$PAGER "$(find . -maxdepth 2 -name "*rc" | fzf)"'
|
||||
bin: fzf
|
||||
bin: find
|
||||
tag: comfy
|
||||
|
||||
aim: Quickly hunt and kill processes
|
||||
cmd: kill $(pgrep less | fzf -m --preview='ps {}')
|
||||
note: Select many with shift/tab.
|
||||
bin: fzf
|
||||
tag: comfy
|
||||
|
||||
aim: Search for a short word
|
||||
cmd: grep "\b${word}\b" ${file}
|
||||
bin: grep
|
||||
tag: search
|
||||
|
||||
aim: Extract words in quotes
|
||||
cmd: grep -o "\b${word}\b" ${file}
|
||||
bin: grep
|
||||
tag: search
|
||||
|
||||
aim: Reformat text for shell input
|
||||
cmd: printf "%q\n" "${text}"
|
||||
bin: printf
|
||||
tag: xargs
|
||||
tag: stdout
|
||||
|
||||
aim: Find your public IP address
|
||||
cmd: dig +short myip.opendns.com @resolver$((RANDOM % 4 + 1)).opendns.com
|
||||
shell: bash
|
||||
bin: dig
|
||||
tag: ip
|
||||
tag: network
|
||||
|
||||
aim: Turn markdown into a man page
|
||||
cmd: man <(lowdown -stman ${file}.md)
|
||||
cmd: top_title="Bugs in netcat"
|
||||
+ someplace=LK
|
||||
+ vol=Security
|
||||
+ sec=6
|
||||
+ lowdown -m manheader="${top_title}" -m source="${someplace}" -m volume="${vol}" -m section=${sec} -stman ${file}.md > ${file}.${sec}
|
||||
+ man ./${file}.${sec}
|
||||
shell: bash
|
||||
bin: lowdown
|
||||
bin: groff
|
||||
bin: man
|
||||
tag: markdown
|
||||
|
||||
aim: Convert jpg to png
|
||||
cmd: magick ${input}.jpg ${output}.png
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Reduce jpg size by reducing quality
|
||||
cmd: quality=70
|
||||
+ magick ${input}.jpg -quality ${quality} ${output}.jpg
|
||||
cmd: size=50
|
||||
+ magick -resize ${size}% ${input}.jpg ${output}.jpg
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Reduce png size
|
||||
cmd: magick ${input}.png png8:${output}.png
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Invert jpg colours
|
||||
cmd: magick ${input}.jpg ${output}.jpg -negate
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Make jpg smaller
|
||||
cmd: magick ${input}.jpg -resize 25% ${output}.jpg
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Trim images to border
|
||||
cmd: magick -trim ${image}.png ${output}.png
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Make the white of an image transparent
|
||||
cmd: magick -transparent white -fuzz 10% ${input}.png ${output}.png
|
||||
bin: magick
|
||||
tag: vision
|
||||
note: The 'fuzz' option tells the computer that 'close to white' is fine. You might want to use 20% or higher fuzz.
|
||||
|
||||
aim: Give transparrent image a dropshadow
|
||||
cmd: magick ${input}.png \( +clone -background black -shadow 50x8+0+5 \) +swap -background none -layers merge +repage ${output}.png
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Convert every jpg in directory to png
|
||||
cmd: mogrify -format png *.jpg
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Convert from jpg to svg
|
||||
cmd: magick -flatten ${input}.jpg ${output}.ppm
|
||||
+ potrace -s ${output}.ppm -o ${svgout}.svg
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Make an image showing day of the week
|
||||
cmd: magick -list font
|
||||
+ font="$(magick -list font | grep -oP 'Font: \K.*' | head -1)"
|
||||
+
|
||||
+ magick -fill blue -font "${font}" -gravity center -pointsize 79 label:$(date +%A) day.png
|
||||
bin: magick
|
||||
tag: vision
|
||||
|
||||
aim: Make a meme
|
||||
cmd: magick ${input} -font impact -fill white -pointsize 84 -stroke black -strokewidth 3 -gravity north -annotate +0+20 'TOP MEME TEXT' -gravity south -annotate +0+20 'BOTTOM MEME TEXT' ${output}
|
||||
bin: magick
|
||||
tag: vision
|
||||
tag: memes
|
||||
|
||||
aim: Rotate a video
|
||||
cmd: ffmpeg -i "${input}" -vf "transpose=1" "${out.mov}"
|
||||
note:
|
||||
+ | No. | Degrees | Flip |
|
||||
+ |:---:|:-------:|:---------------------------------------|
|
||||
+ | 0 | 90 Counterclockwise and verfical flip (default) |
|
||||
+ | 1 | 90 Clockwise |
|
||||
+ | 2 | 90 CounterClockwise |
|
||||
+ | 3 | 90Clockwise and vertical flip |
|
||||
tag: vision
|
||||
tag: video
|
||||
shell: sh
|
||||
|
||||
aim: Translate a media file to a new type
|
||||
cmd: ffmpeg -formats
|
||||
+ ffmpeg -i ${input} ${output}
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
tag: music
|
||||
tag: video
|
||||
shell: sh
|
||||
|
||||
aim: Reduce video quality
|
||||
cmd: quality=20
|
||||
+ ffmpeg -i ${input}.mp4 -vcodec libx264 -crf ${quality} ${output}.mp4
|
||||
note: A crf quality of 18 is high, while 24 is low quality.
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
tag: video
|
||||
shell: sh
|
||||
|
||||
aim: Convert from mkv to mp4 with a codec
|
||||
cmd: ffmpeg -i ${input}.mkv -codec copy ${output}.mp4
|
||||
note: Both mp4 and mkv are wrappers around other formats, so this conversion loses less quality than other conversion types.
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
tag: video
|
||||
shell: sh
|
||||
|
||||
aim: Convert video to audio
|
||||
cmd: ffmpeg -i ${input}.mp4 -vn ${output}.mp3
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
tag: video
|
||||
shell: sh
|
||||
|
||||
aim: Convert all mkv files to mp4
|
||||
cmd: for i in *.mkv; do
|
||||
+ ffmpeg -i "$i" -codec copy "${i%.*}.mp4"
|
||||
+ done
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
shell: sh
|
||||
|
||||
aim: Change resolution
|
||||
cmd: ffmpeg -i ${input}.mp4 -filter:v scale=1280:720 -c:a copy ${output}.mp4
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
shell: sh
|
||||
|
||||
aim: Change video aspect ratio
|
||||
cmd: ffmpeg -i input.mp4 -aspect 16:9 output.mp4
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
tag: video
|
||||
shell: sh
|
||||
|
||||
aim: Trim video to start and stop times
|
||||
cmd: start=00:00:50
|
||||
+ stop=50
|
||||
+ ffmpeg -i ${input}.mp4 -ss ${start} -codec copy -t ${stop} ${output}.mp4
|
||||
note: The `$stop` time shows how many seconds after the start you want.
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
shell: sh
|
||||
|
||||
aim: Compress a video file
|
||||
cmd: quality=21
|
||||
+ ffmpeg -i ${input}.mp4 -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf ${quality} ${output}.mp4
|
||||
note: A crf quality of 18 is high, while 24 is low quality.
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
tag: video
|
||||
shell: sh
|
||||
|
||||
aim: Convert video to a series of images
|
||||
cmd: framerate=1
|
||||
+ format=image2
|
||||
+ ffmpeg -i input.mp4 -r ${framerate} -f ${format} image-%2d.png
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
shell: sh
|
||||
|
||||
aim: Add subtitles to a video file
|
||||
cmd: fmpeg -i ${input}.mp4 -i subtitle.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast ${output}.mp4
|
||||
bin: ffmpeg
|
||||
tag: vision
|
||||
shell: sh
|
||||
|
||||
aim: Convert a web page to markdown
|
||||
cmd: curl -sL "${url}" | html2markdown > "${file}}".md
|
||||
cmd: curl -sL "${url}" | html2text > "${file}}".md
|
||||
note: The `[html2markdown](https://github.com/JohannesKaufmann/html-to-markdown)` and `html2md` programs works better than any other.
|
||||
bin: html2markdown
|
||||
bin: curl
|
||||
tag: writing
|
||||
tag: web
|
||||
shell: sh
|
||||
|
||||
aim: Decode a URL with function
|
||||
cmd: urldecode() { echo -e "${@//%/\\x}"; }
|
||||
+ urldecode "${magnet}"
|
||||
tag: web
|
||||
shell: bash
|
||||
|
||||
aim: Choose which parts to commit with git
|
||||
cmd: git commit -p
|
||||
note: Use `P` to see big changes which cannot fit on the screen.
|
||||
tag: comfy
|
||||
bin: git
|
||||
shell: sh
|
||||
|
||||
aim: Request a definition from the terminal.
|
||||
cmd: word='abderian'
|
||||
+ curl -s dict://dict.org/define:${word}:
|
||||
cmd: function wotsa(){
|
||||
+ def="$(curl -s dict://dict.org/define:${1// /+}: | grep -vP '^\d\d\d ')"
|
||||
+ if [ "$def" = "" ]; then
|
||||
+ echo no definition
|
||||
+ else
|
||||
+ echo "$def" | $PAGER
|
||||
+ fi
|
||||
+ }
|
||||
bin: curl
|
||||
tag: writing
|
||||
tag: comfy
|
||||
tag: dict
|
||||
shell: sh
|
||||
|
||||
aim: Email a pull request which points to your git server
|
||||
tag: git
|
||||
bin: git
|
||||
tag: email
|
||||
tag: pr
|
||||
cmd: repo=ssh://soft.dmz.rs:2222/mkdots/
|
||||
+ theirHead='HEAD^^^^'
|
||||
+ head=master
|
||||
+ git request-pull "${theirHead}" "${repo}" "${head}"
|
||||
note: You can note where your branch diverged from theirs with a commit hash,
|
||||
+ or a relative position, like `HEAD^^` (e.g. 'two commits before your latest').
|
||||
|
||||
aim: Clean up a bloated git repo
|
||||
cmd: git fsck --full
|
||||
+ git gc --prune=now --aggressive
|
||||
+ git repack
|
||||
bin: git
|
||||
tag: maintenance
|
||||
shell: sh
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
---
|
||||
title: Archives
|
||||
tags:
|
||||
- archives
|
||||
- backups
|
||||
---
|
||||
|
||||
# Create
|
||||
|
||||
Combine many files and directories into a single t-archive file.
|
||||
|
||||
```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 `/`).
|
||||
It's often better to tell tar which path to start from using the `-C` flag.
|
||||
|
||||
```sh
|
||||
tar cf "${archive}".tar -C /etc/ nginx
|
||||
```
|
||||
|
||||
Check the contents of your archive with:
|
||||
|
||||
```sh
|
||||
tar tf "${archive}".tar
|
||||
```
|
||||
|
||||
If you want to store 'everything in a directory', then using `*` will not work, because it will target everything in the *current* directory.
|
||||
|
||||
Instead, you can store the target in a variable:
|
||||
|
||||
```sh
|
||||
files=$(ls /etc/nginx)
|
||||
tar cf "${archive}".tar -C /etc/nginx/ $file
|
||||
```
|
||||
|
||||
# Extract
|
||||
|
||||
Extract the tar archive with
|
||||
|
||||
```sh
|
||||
tar xf "${archive}".tar
|
||||
```
|
||||
|
||||
You can remember this with the mnemonic 'e*X*tract *F*ile'.
|
||||
|
||||
# Compress
|
||||
|
||||
Create a zip-compressed archive with the `z` flag.
|
||||
|
||||
```sh
|
||||
tar czf "${archive}".tgz -C /etc/nginx/ $file
|
||||
```
|
||||
|
||||
You can use any file ending you want, but sane people like to use '.tgz' or '.tar.tgz'.
|
||||
|
||||
79
data/backups/archives.md
Normal file
79
data/backups/archives.md
Normal file
@@ -0,0 +1,79 @@
|
||||
---
|
||||
title: "Archives"
|
||||
tags: [ "Documentation", "tar", "backups" ]
|
||||
---
|
||||
# `tar`
|
||||
|
||||
## Create
|
||||
|
||||
Combine many files and directories into a single t-archive file.
|
||||
|
||||
```bash
|
||||
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 `/`.
|
||||
|
||||
It's often better to tell tar which path to start from using the `-C` flag.
|
||||
|
||||
```bash
|
||||
tar cf "$ARCHIVE".tar -C /etc/ nginx
|
||||
```
|
||||
|
||||
Check the contents of your archive with:
|
||||
|
||||
```bash
|
||||
tar tf "$ARCHIVE".tar
|
||||
```
|
||||
|
||||
If you want to store 'everything in a directory', then using `*` will not work, because it will target everything in the *current* directory.
|
||||
|
||||
Instead, you can store the target in a variable:
|
||||
|
||||
```bash
|
||||
files=$(ls /etc/nginx)
|
||||
tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
|
||||
```
|
||||
|
||||
## Extract
|
||||
|
||||
Extract the tar archive with
|
||||
|
||||
> tar xf "$ARCHIVE".tar
|
||||
|
||||
You can remember this with the mnemonic 'e*X*tract *F*ile'.
|
||||
|
||||
## Compress
|
||||
|
||||
Create a zip-compressed archive with the `z` flag.
|
||||
|
||||
```bash
|
||||
tar czf "$ARCHIVE".tgz -C /etc/nginx/ $file
|
||||
```
|
||||
|
||||
You can use any file ending you want, but sane people like to use '.tgz' or '.tar.tgz'.
|
||||
|
||||
# 7zip
|
||||
|
||||
(also called 'p7zip' or '7z')
|
||||
|
||||
Make archive:
|
||||
|
||||
```bash
|
||||
PASSWORD=my_password
|
||||
```
|
||||
```bash
|
||||
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
|
||||
7za x archive.zip
|
||||
```
|
||||
|
||||
7zip will open anything: zip-files, rar-files, a tin of beans, *anything*.
|
||||
However, the extracted tgz files will just be tar files, so you will still need to use tar to extract them (see above).
|
||||
@@ -1,15 +1,11 @@
|
||||
---
|
||||
title: unison
|
||||
tags:
|
||||
- backups
|
||||
- synch
|
||||
requires:
|
||||
- networking/ssh.md
|
||||
title: "unison"
|
||||
tags: [ "Documentation", "Backups" ]
|
||||
---
|
||||
|
||||
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).
|
||||
|
||||
```sh
|
||||
```bash
|
||||
unison -version
|
||||
```
|
||||
|
||||
@@ -17,27 +13,27 @@ Create the `~/.unison` directory on both machines.
|
||||
|
||||
Make a job called `backup`:
|
||||
|
||||
```sh
|
||||
job=backup
|
||||
```bash
|
||||
JOB=backup
|
||||
```
|
||||
|
||||
Here is an example job, which synchronizes the `~/music` directory with a remote machine which has the same username.
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
echo "
|
||||
auto = true
|
||||
root=$HOME
|
||||
root=ssh://${user}@${ip_address}/$HOME
|
||||
root=ssh://$USER@$IP_ADDRESS/$HOME
|
||||
|
||||
path=music
|
||||
|
||||
ignore=Name *.flac
|
||||
" > ~/.unison/"${job}".prf
|
||||
" > ~/.unison/"$JOB".prf
|
||||
|
||||
```
|
||||
|
||||
Remember to specify `${ip_address}`
|
||||
Remember to specify `$IP_ADDRESS`
|
||||
|
||||
The last command means it will ignore any file with a name ending in `.flac`.
|
||||
|
||||
@@ -46,8 +42,8 @@ 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:
|
||||
|
||||
```sh
|
||||
unison -batch ${job}.prf
|
||||
```bash
|
||||
unison -batch *backup*.prf
|
||||
```
|
||||
|
||||
Set unison to run with crontab or a systemd unit file to have directories synchronize automatically.
|
||||
@@ -1,27 +1,8 @@
|
||||
---
|
||||
title: Base 16
|
||||
tags:
|
||||
- data
|
||||
title: "Base 16"
|
||||
tags: [ "Documentation", "Data" ]
|
||||
---
|
||||
|
||||
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
|
||||
```bash
|
||||
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
|
||||
```
|
||||
|
||||
9
data/calcurse.md
Normal file
9
data/calcurse.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
title: "calcurse"
|
||||
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).
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
---
|
||||
title: Import an ICS file into calcurse
|
||||
tags:
|
||||
- data
|
||||
- calendar
|
||||
- daylight savings
|
||||
requires:
|
||||
- calcurse
|
||||
---
|
||||
|
||||
## Setup
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
If you already have some of these events, and don't want duplicates, import the events into a temporary file.
|
||||
|
||||
|
||||
```sh
|
||||
TMP=$(mktemp)
|
||||
curl -s "$1" | calcurse -q -i - -c "$TMP"
|
||||
```
|
||||
|
||||
Then search for new lines in the new calendar file to put into your appointments file.
|
||||
|
||||
```sh
|
||||
CALDATA=~/.local/share/calcurse/apts
|
||||
grep -vf "$CALDATA" "$TMP" >> "$CALDATA"
|
||||
rm $TMP
|
||||
```
|
||||
@@ -1,8 +1,6 @@
|
||||
---
|
||||
title: e-mail
|
||||
tags:
|
||||
- data
|
||||
- smtp
|
||||
title: "e-mail"
|
||||
tags: [ "data", "smtp" ]
|
||||
---
|
||||
|
||||
This is bare-bones, original, primitive e-mail.
|
||||
@@ -11,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
|
||||
@@ -42,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>
|
||||
```
|
||||
|
||||
@@ -69,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:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo grep -r $FRAGMENT /var/spool/*
|
||||
```
|
||||
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
---
|
||||
title: exiftool
|
||||
tags:
|
||||
- metadata
|
||||
- exifdata
|
||||
title: "exiftool"
|
||||
tags: [ "Documentation", "Metadata" ]
|
||||
---
|
||||
|
||||
Find metadata:
|
||||
Find metadata.
|
||||
|
||||
```sh
|
||||
exiftool "$file".jpg
|
||||
```bash
|
||||
exiftool image.jpg
|
||||
```
|
||||
|
||||
Find info on all `.png` images in current directory.
|
||||
Find info on all images in current directory.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
exiftool -ext .png .
|
||||
```
|
||||
|
||||
@@ -21,14 +19,22 @@ You can make this recurring with the -r switch.
|
||||
|
||||
And overwrite all metadata:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
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:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
exiftool -gps:all= *.jpg
|
||||
```
|
||||
|
||||
You can also use the imagemagick tool:
|
||||
|
||||
```bash
|
||||
identify -verbose
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
133
data/git.md
133
data/git.md
@@ -1,133 +0,0 @@
|
||||
---
|
||||
title: git
|
||||
tags:
|
||||
- data
|
||||
- setup
|
||||
---
|
||||
|
||||
|
||||
```sh
|
||||
git config --global user.email "${email}"
|
||||
```
|
||||
|
||||
```sh
|
||||
git config --global user.name "${name}"
|
||||
```
|
||||
|
||||
Decide on algorithm:
|
||||
|
||||
- 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}/
|
||||
```
|
||||
|
||||
Make a file explaining what the project does, and tell `git` to track it:
|
||||
|
||||
```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:
|
||||
|
||||
```sh
|
||||
git commit
|
||||
```
|
||||
|
||||
# Working
|
||||
|
||||
Once you make a change to some file, add it and make a commit explaining it.
|
||||
|
||||
```sh
|
||||
git add ${file}
|
||||
```
|
||||
|
||||
```sh
|
||||
git commit -m"change ${file}"
|
||||
```
|
||||
|
||||
Check your history:
|
||||
|
||||
```sh
|
||||
git log
|
||||
```
|
||||
|
||||
# Remotes
|
||||
|
||||
If you want to keep a copy on a public site such as Gitlab, so others can see it, then go there and create a blank project (no readme, nothing).
|
||||
Give it the same name as the `$DIR` directory, above.
|
||||
|
||||
Add this as a remote:
|
||||
|
||||
```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':
|
||||
|
||||
```sh
|
||||
git push -u master origin
|
||||
```
|
||||
|
||||
Pull down changes that others have made:
|
||||
|
||||
```sh
|
||||
git pull
|
||||
```
|
||||
|
||||
# Branches
|
||||
|
||||
A branch is a full copy of the project to test additional ideas.
|
||||
You can make a new branch called 'featurez' like this:
|
||||
|
||||
```sh
|
||||
git branch ${feature_branch}
|
||||
```
|
||||
|
||||
Have a look at all your branches:
|
||||
|
||||
```sh
|
||||
git branch
|
||||
```
|
||||
|
||||
Switch to your new branch:
|
||||
|
||||
```sh
|
||||
git checkout ${feature_branch}
|
||||
```
|
||||
|
||||
And if your changes are rubbish, checkout the "master" branch again, then delete "featurez":
|
||||
|
||||
```sh
|
||||
git branch -D ${feature_branch}
|
||||
```
|
||||
|
||||
Or if it's a good branch, push it to the remote:
|
||||
|
||||
```sh
|
||||
remote=origin
|
||||
git push $remote ${feature_branch}
|
||||
```
|
||||
|
||||
# Merging
|
||||
|
||||
Once you like the feature, merge it into the main branch. Switch to master then merge it:
|
||||
|
||||
```sh
|
||||
git merge ${feature_branch}
|
||||
```
|
||||
|
||||
And delete the branch, as you've already merged it:
|
||||
|
||||
```sh
|
||||
git branch -d ${feature_branch}
|
||||
```
|
||||
|
||||
203
data/git/basics.md
Normal file
203
data/git/basics.md
Normal file
@@ -0,0 +1,203 @@
|
||||
---
|
||||
title: "git"
|
||||
tags: [ "Documentation", "data" ]
|
||||
---
|
||||
# Starting
|
||||
|
||||
## New Machines
|
||||
|
||||
```bash
|
||||
git config --global user.email "$YOUR_EMAIL"
|
||||
```
|
||||
|
||||
```bash
|
||||
git config --global user.name "$YOUR_NAME"
|
||||
```
|
||||
|
||||
# New Git
|
||||
|
||||
Start a git in directory `$DIR`:
|
||||
|
||||
```bash
|
||||
mkdir $DIR && cd $DIR
|
||||
```
|
||||
|
||||
```bash
|
||||
git init
|
||||
```
|
||||
|
||||
Make a file explaining what the project does:
|
||||
|
||||
```bash
|
||||
vim README.md
|
||||
```
|
||||
|
||||
Add this to the git:
|
||||
|
||||
```bash
|
||||
git add README.md
|
||||
```
|
||||
|
||||
Then make the initial commit, explaining the change you just made:
|
||||
|
||||
```bash
|
||||
git commit
|
||||
```
|
||||
|
||||
# Working
|
||||
|
||||
Once you make a change to some file, add it and make a commit explaining it.
|
||||
|
||||
```bash
|
||||
git add $FILE
|
||||
```
|
||||
|
||||
```bash
|
||||
git commit -m"change $FILE"
|
||||
```
|
||||
|
||||
Check your history:
|
||||
|
||||
```bash
|
||||
git log
|
||||
```
|
||||
|
||||
# Remotes
|
||||
|
||||
If you want to keep a copy on a public site such as Gitlab, so others can see it, then go there and create a blank project (no readme, nothing).
|
||||
Give it the same name as the `$DIR` directory, above.
|
||||
|
||||
Add this as a remote:
|
||||
|
||||
```bash
|
||||
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
|
||||
git push -u master origin
|
||||
```
|
||||
|
||||
If someone makes a change on the remote, pull it down with:
|
||||
|
||||
```bash
|
||||
git pull
|
||||
```
|
||||
|
||||
# Branches
|
||||
|
||||
A branch is a full copy of the project to test additional ideas.
|
||||
You can make a new branch called 'featurez' like this:
|
||||
|
||||
```bash
|
||||
git branch $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
Have a look at all your branches:
|
||||
|
||||
```bash
|
||||
git branch
|
||||
```
|
||||
|
||||
Switch to your new branch:
|
||||
|
||||
```bash
|
||||
git checkout $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
And if your changes are rubbish, checkout the "master" branch again, then delete "featurez":
|
||||
|
||||
```bash
|
||||
git branch -D $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
Or if it's a good branch, push it to the remote:
|
||||
|
||||
```bash
|
||||
remote=origin
|
||||
git push $remote $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
## Merging
|
||||
|
||||
Once you like the feature, merge it into the main branch. Switch to master then merge it:
|
||||
|
||||
```bash
|
||||
git merge $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
And delete the branch, as you've already merged it:
|
||||
|
||||
```bash
|
||||
git branch -d $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
# Subtree
|
||||
|
||||
## Pulling another git repo into a subtree
|
||||
|
||||
```bash
|
||||
git subtree add -P config git@gitlab.com:bindrpg/config.git master
|
||||
```
|
||||
|
||||
# Tricks
|
||||
|
||||
## Delete All History
|
||||
|
||||
```bash
|
||||
git checkout --orphan temp
|
||||
```
|
||||
|
||||
```bash
|
||||
git add -A
|
||||
```
|
||||
|
||||
```bash
|
||||
git commit -am "release the commits!"
|
||||
```
|
||||
|
||||
```bash
|
||||
git branch -D master
|
||||
```
|
||||
|
||||
```bash
|
||||
git branch -m master
|
||||
```
|
||||
|
||||
```bash
|
||||
git push -f origin master
|
||||
```
|
||||
|
||||
Gitlab requires more changes, such as going to `settings > repository` and switching the main branch, then stripping protection.
|
||||
|
||||
## Clean up Bloated Repo
|
||||
|
||||
```bash
|
||||
git fsck --full
|
||||
```
|
||||
|
||||
```bash
|
||||
git gc --prune=now --aggressive
|
||||
```
|
||||
|
||||
```bash
|
||||
git repack
|
||||
```
|
||||
|
||||
## Find Binary Blobs
|
||||
|
||||
```bash
|
||||
git rev-list --objects --all \
|
||||
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
|
||||
| sed -n 's/^blob //p' \
|
||||
| sort --numeric-sort --key=2 \
|
||||
| cut -c 1-12,41- \
|
||||
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
|
||||
|
||||
```
|
||||
|
||||
# More
|
||||
|
||||
For big binary files (like images), see [git large-file-storage](git-lfs.md)
|
||||
@@ -1,26 +0,0 @@
|
||||
---
|
||||
title: Commit for Another
|
||||
tags:
|
||||
- data
|
||||
- git
|
||||
requires:
|
||||
- data/git.md
|
||||
---
|
||||
|
||||
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,76 +1,24 @@
|
||||
---
|
||||
title: git-lfs
|
||||
tags:
|
||||
- data
|
||||
- git
|
||||
requires:
|
||||
- data/git.md
|
||||
title: "git-lfs"
|
||||
tags: [ "Documentation", "data" ]
|
||||
---
|
||||
|
||||
Git Large File Storage ('LFS') needs to change your `~/.gitconfig` to check out those binary files:
|
||||
Install, and add with
|
||||
|
||||
```sh
|
||||
cat ~/.gitconfig
|
||||
```bash
|
||||
git lfs install
|
||||
cat ~/.gitconfig
|
||||
```
|
||||
|
||||
Then track some filetypes with:
|
||||
Then track some filetype with:
|
||||
|
||||
```sh
|
||||
cd $git_repository
|
||||
ext=ttf
|
||||
git lfs track "*.$ext"
|
||||
```bash
|
||||
git lfs track "\*.ttf"
|
||||
```
|
||||
|
||||
Or a directory with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
git lfs track "images/"
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
All changes require adding `.gitattributes`.
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
---
|
||||
title: git-secret
|
||||
tags:
|
||||
- data
|
||||
- git
|
||||
- review
|
||||
title: "git-secret"
|
||||
tags: [ "data", "git" ]
|
||||
---
|
||||
|
||||
This utility is largely useless, as it can only identify people by their email.
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
---
|
||||
title: git stash
|
||||
tags:
|
||||
- data
|
||||
- git
|
||||
requires:
|
||||
- data/git.md
|
||||
---
|
||||
|
||||
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,21 +1,19 @@
|
||||
---
|
||||
title: git hooks
|
||||
tags:
|
||||
- data
|
||||
- git
|
||||
title: "git hooks"
|
||||
tags: [ "Documentation", "data", "git" ]
|
||||
---
|
||||
|
||||
Check out the sample hooks:
|
||||
|
||||
```sh
|
||||
cd ${git_repo}
|
||||
```bash
|
||||
cd $GIT_REPO
|
||||
ls .git/hooks
|
||||
head .git/hooks/pre-commit.sample
|
||||
```
|
||||
|
||||
Add a hook to check the shell scripts in `$GIT_REPO` before making a commit:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
echo '#!/bin/sh
|
||||
shellcheck *.sh' > .git/hooks/commit-msg
|
||||
chmod u+x .git/hooks/commit-msg
|
||||
@@ -23,9 +21,7 @@ chmod u+x .git/hooks/commit-msg
|
||||
|
||||
## Committing
|
||||
|
||||
The `git hooks` will not work on other people who use the repository, but you
|
||||
can commit them to a repository, then request others add these git hooks to
|
||||
their own branch, by putting a note in the project's `README.md`.
|
||||
Your `git hooks` will not enter the repository, but you can commit them to a repository, then request others add these git hooks to their own branch, by putting a note in the project's `README.md`.
|
||||
|
||||
```markdown
|
||||
The project comes with recommended git hooks.
|
||||
|
||||
34
data/git/subtree.md
Normal file
34
data/git/subtree.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title: "git"
|
||||
tags: [ "Documentation", "data", "git", "subtree" ]
|
||||
---
|
||||
|
||||
## Pulling a Subtree from an existing git
|
||||
|
||||
The project has subdirectories `sub-1`, `sub-2`, `sub-3`.
|
||||
The first should be its own repository, but should also retain its own history.
|
||||
|
||||
First, we extract its history as an independent item, and make that into a seprate branch.
|
||||
|
||||
```bash
|
||||
git subtree split --prefix=sub-1 -b sub
|
||||
```
|
||||
|
||||
If you want something a few directories deep, you can use `--prefix=sub-1/dir-2/dir-3
|
||||
|
||||
Then go and create a new git somewhere else:
|
||||
|
||||
```bash
|
||||
cd ..;mkdir sub-1;cd sub-1;git init --bare
|
||||
```
|
||||
|
||||
Then go back to your initial git repo, and do the following:
|
||||
|
||||
git push ../subtest sub:master
|
||||
|
||||
Finally, you can clone this repo from your original.
|
||||
|
||||
```bash
|
||||
git clone ../subtest
|
||||
```
|
||||
|
||||
150
data/gpg.md
150
data/gpg.md
@@ -1,149 +1,7 @@
|
||||
---
|
||||
title: GPG Basics
|
||||
tags:
|
||||
- data
|
||||
- GPG
|
||||
title: "gpg"
|
||||
tags: [ "Documentation", "data", "GPG" ]
|
||||
---
|
||||
|
||||
# Making keys
|
||||
|
||||
Generate keys:
|
||||
|
||||
```sh
|
||||
gpg --full-generate-key
|
||||
```
|
||||
|
||||
Follow the guide.
|
||||
|
||||
# Encrypting a file
|
||||
|
||||
```sh
|
||||
gpg -r malinfreeborn@posteo.net -e file
|
||||
```
|
||||
|
||||
`-r` specifies the recipient.
|
||||
|
||||
Check you have an encrypted version of your file.
|
||||
|
||||
# Changing Expiration Dates
|
||||
|
||||
|
||||
```sh
|
||||
gpg --list-keys
|
||||
# or...
|
||||
gpg -k
|
||||
```
|
||||
|
||||
... and then use the second part of 'pub', which is the ID. But that's not appearing here so... on with gpg2?
|
||||
|
||||
# Making encrypted files with a local password
|
||||
|
||||
Make a password with a password (cypher encryption).
|
||||
|
||||
```sh
|
||||
gpg -c --output passwords.txt
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
gpg -c > passwords.txt
|
||||
```
|
||||
|
||||
Put in a password.
|
||||
|
||||
Write message then stop with Ctrl+d.
|
||||
|
||||
Get the message back out the file with:
|
||||
|
||||
```sh
|
||||
gpg -d passwords.txt
|
||||
```
|
||||
|
||||
# Circles of Trust
|
||||
|
||||
Search for a key at any key store:
|
||||
|
||||
```sh
|
||||
gpg --search-keys nestorv
|
||||
```
|
||||
|
||||
Once you've made a decision about someone:
|
||||
|
||||
```sh
|
||||
gpg --list-keys
|
||||
```
|
||||
|
||||
You get something like this:
|
||||
|
||||
```
|
||||
pub rsa3072 2021-08-15 [SC] [expires: 2023-08-15]
|
||||
CD30421FD825696BD95F1FF644C62C57B790D3CF
|
||||
uid [ultimate] Malin Freeborn <malinfreeborn@posteo.net>
|
||||
sub rsa3072 2021-08-15 [E] [expires: after-forever]
|
||||
|
||||
```
|
||||
|
||||
Notice the long, ugly, string - `CD30421FD825696BD95F1FF644C62C57B790D3CF` - and how horribly ugly it is.
|
||||
This is a fingerprint.
|
||||
|
||||
You can now decide the trust level (this stays on your computer).
|
||||
|
||||
```sh
|
||||
gpg --edit-key CD30421FD825696BD95F1FF644C62C57B790D3CF
|
||||
```
|
||||
|
||||
Once you're in the interface, type `trust`.
|
||||
|
||||
```sh
|
||||
gpg --sign-key alice@posteo.net
|
||||
```
|
||||
|
||||
# Swapping Keys
|
||||
|
||||
This system relies on a ring of people swapping key information.
|
||||
|
||||
## Sending
|
||||
|
||||
Send those trusted keys up to a server, so people can see you have verified them:
|
||||
|
||||
```sh
|
||||
gpg --send-keys 024C6B1C84449BD1CB4DF7A152295D2377F4D70F
|
||||
```
|
||||
|
||||
## Upload Your Keys
|
||||
|
||||
## Add More Key Servers
|
||||
|
||||
Key servers often swap keys, but it's best to just send to multiple places immediately.
|
||||
You can add key servers by adding this to `~/.gnupg/gpg.conf`.
|
||||
|
||||
```
|
||||
keyserver hkps://keys.openpgp.org
|
||||
keyserver hkps://mail-api.proton.me
|
||||
keyserver hkps://keys.mailvelope.com
|
||||
```
|
||||
|
||||
# Refresh Keys
|
||||
|
||||
Refreshing keys will tell you if some key you have contains a signature from someone you already trust, or if someone has published a revocation certificate (meaning their key should not be trusted any more).
|
||||
|
||||
```sh
|
||||
gpg --refresh-keys
|
||||
```
|
||||
|
||||
You can use the [crontab](system/cron.md) to refresh keys, but this will mostly fail, since keyservers often don't hold the right data.
|
||||
|
||||
# Export
|
||||
|
||||
Your public key:
|
||||
|
||||
```sh
|
||||
gpg --output me.gpg --armor --export
|
||||
```
|
||||
Alternatively:
|
||||
|
||||
```sh
|
||||
gpg --export -a person@email.tld > my_key.pub
|
||||
```
|
||||
|
||||
- [Setup](gpg/basics.md)
|
||||
- [Extras](gpg/extras.md)
|
||||
|
||||
146
data/gpg/basics.md
Normal file
146
data/gpg/basics.md
Normal file
@@ -0,0 +1,146 @@
|
||||
---
|
||||
title: "GPG Basics"
|
||||
tags: [ "Documentation", "data", "GPG" ]
|
||||
---
|
||||
# Making keys
|
||||
|
||||
Generate keys:
|
||||
|
||||
```bash
|
||||
gpg --full-generate-key
|
||||
```
|
||||
|
||||
Follow the guide.
|
||||
|
||||
# Encrypting a file
|
||||
|
||||
```bash
|
||||
gpg -r malinfreeborn@posteo.net -e file
|
||||
```
|
||||
|
||||
`-r` specifies the recipient.
|
||||
|
||||
Check you have an encrypted version of your file.
|
||||
|
||||
# Changing Expiration Dates
|
||||
|
||||
|
||||
```bash
|
||||
gpg --list-keys
|
||||
# or...
|
||||
gpg -k
|
||||
```
|
||||
|
||||
... and then use the second part of 'pub', which is the ID. But that's not appearing here so... on with gpg2?
|
||||
|
||||
# Making encrypted files with a local password
|
||||
|
||||
Make a password with a password (cypher encryption).
|
||||
|
||||
```bash
|
||||
gpg -c --output passwords.txt
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
gpg -c > passwords.txt
|
||||
```
|
||||
|
||||
Put in a password.
|
||||
|
||||
Write message then stop with Ctrl+d.
|
||||
|
||||
Get the message back out the file with:
|
||||
|
||||
```bash
|
||||
gpg -d passwords.txt
|
||||
```
|
||||
|
||||
# Circles of Trust
|
||||
|
||||
Search for a key at any key store:
|
||||
|
||||
```bash
|
||||
gpg --search-keys nestorv
|
||||
```
|
||||
|
||||
Once you've made a decision about someone:
|
||||
|
||||
```bash
|
||||
gpg --list-keys
|
||||
```
|
||||
|
||||
You get something like this:
|
||||
|
||||
```
|
||||
pub rsa3072 2021-08-15 [SC] [expires: 2023-08-15]
|
||||
CD30421FD825696BD95F1FF644C62C57B790D3CF
|
||||
uid [ultimate] Malin Freeborn <malinfreeborn@posteo.net>
|
||||
sub rsa3072 2021-08-15 [E] [expires: after-forever]
|
||||
|
||||
```
|
||||
|
||||
Notice the long, ugly, string - `CD30421FD825696BD95F1FF644C62C57B790D3CF` - and how horribly ugly it is.
|
||||
This is a fingerprint.
|
||||
|
||||
You can now decide the trust level (this stays on your computer).
|
||||
|
||||
```bash
|
||||
gpg --edit-key CD30421FD825696BD95F1FF644C62C57B790D3CF
|
||||
```
|
||||
|
||||
Once you're in the interface, type `trust`.
|
||||
|
||||
```bash
|
||||
gpg --sign-key alice@posteo.net
|
||||
```
|
||||
|
||||
# Swapping Keys
|
||||
|
||||
This system relies on a ring of people swapping key information.
|
||||
|
||||
## Sending
|
||||
|
||||
Send those trusted keys up to a server, so people can see you have verified them:
|
||||
|
||||
```bash
|
||||
gpg --send-keys 024C6B1C84449BD1CB4DF7A152295D2377F4D70F
|
||||
```
|
||||
|
||||
## Upload Your Keys
|
||||
|
||||
## Add More Key Servers
|
||||
|
||||
Key servers often swap keys, but it's best to just send to multiple places immediately.
|
||||
You can add key servers by adding this to `~/.gnupg/gpg.conf`.
|
||||
|
||||
```
|
||||
keyserver hkps://keys.openpgp.org
|
||||
keyserver hkps://mail-api.proton.me
|
||||
keyserver hkps://keys.mailvelope.com
|
||||
```
|
||||
|
||||
# Refresh Keys
|
||||
|
||||
Refreshing keys will tell you if some key you have contains a signature from someone you already trust, or if someone has published a revocation certificate (meaning their key should not be trusted any more).
|
||||
|
||||
```bash
|
||||
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.
|
||||
|
||||
# Export
|
||||
|
||||
Your public key:
|
||||
|
||||
```bash
|
||||
gpg --output me.gpg --armor --export
|
||||
```
|
||||
Alternatively:
|
||||
|
||||
```bash
|
||||
gpg --export -a person@email.tld > my_key.pub
|
||||
```
|
||||
|
||||
10
data/gpg/extras.md
Normal file
10
data/gpg/extras.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "gpg"
|
||||
tags: [ "Documentation", "vim", "data", "GPG" ]
|
||||
---
|
||||
|
||||
The `vim-gnupg` plugin lets vim edit gpg-encrypted files as if they were unencrypted.
|
||||
|
||||
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).
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
---
|
||||
title: GPG Password Entry
|
||||
tags:
|
||||
- vim
|
||||
- secrets
|
||||
- TUI
|
||||
requires:
|
||||
- data/gpg.md
|
||||
- writing/vim.md
|
||||
---
|
||||
|
||||
|
||||
Check your current gpg-agent configuration:
|
||||
|
||||
```sh
|
||||
gpgconf --list-options gpg-agent
|
||||
```
|
||||
|
||||
Create file, if it doesn't 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
|
||||
```
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
title: Edit gpg encrypted files with vim
|
||||
tags:
|
||||
- vim
|
||||
- data
|
||||
- gpg
|
||||
- comfy
|
||||
requires:
|
||||
- data/gpg.md
|
||||
- writing/vim.md
|
||||
---
|
||||
|
||||
The `vim-gnupg` plug-in lets vim edit gpg-encrypted files as if they were unencrypted.
|
||||
|
||||
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).
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
---
|
||||
title: groff
|
||||
tags:
|
||||
- documentation
|
||||
- typography
|
||||
- logic
|
||||
title: "groff"
|
||||
tags: [ "Documentation", "Data" ]
|
||||
---
|
||||
# Basic Documents
|
||||
|
||||
@@ -63,6 +60,8 @@ The equation shorthands are predictable:
|
||||
| Not equal | != |
|
||||
| Superscript | sup {thing} |
|
||||
|
||||
- [List of symbols](https://www.math-linux.com/man/man7/groff_char.7.html)
|
||||
|
||||
### Examples
|
||||
|
||||
The fraction 2/5ths:
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
---
|
||||
title: Interactive String Substitution
|
||||
tags:
|
||||
- data
|
||||
- vim
|
||||
- substitution
|
||||
- replace
|
||||
- TUI
|
||||
---
|
||||
|
||||
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'
|
||||
```
|
||||
16
data/json.md
16
data/json.md
@@ -1,16 +0,0 @@
|
||||
---
|
||||
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,53 +1,60 @@
|
||||
---
|
||||
title: khard
|
||||
tags:
|
||||
- data
|
||||
title: "khard"
|
||||
tags: [ "Documentation", "Data" ]
|
||||
---
|
||||
Get the basic config:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
mkdir ~/.config/khard
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
cp /usr/share/doc/khard/examples/khard/khard.conf.example ~/.config/khard.conf
|
||||
```
|
||||
|
||||
Short list
|
||||
|
||||
```sh
|
||||
```bash
|
||||
khard list
|
||||
```
|
||||
|
||||
Longer list
|
||||
|
||||
```sh
|
||||
```bash
|
||||
khard show
|
||||
```
|
||||
|
||||
Show from addressbook 'work'
|
||||
|
||||
```sh
|
||||
```bash
|
||||
khard list -a work
|
||||
```
|
||||
|
||||
Make a new contact in address book 'family'
|
||||
|
||||
```sh
|
||||
```bash
|
||||
khard new -a family
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
khard edit grampa
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
khard remove bob
|
||||
```
|
||||
|
||||
Move contact 'nina' from 'work' to 'home' address book.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
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]
|
||||
```
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
---
|
||||
title: newsboat
|
||||
tags:
|
||||
- RSS
|
||||
title: "newsboat"
|
||||
tags: [ "Documentation", "RSS" ]
|
||||
---
|
||||
Create the configuration directory before you start, and add at least 1 URL.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
mkdir ~/.config/newsboat
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
echo 'https://voidlinux.org/atom.xml foss tech' >> ~/.config/newsboat/urls
|
||||
```
|
||||
|
||||
Start `newsboat` and press `r` to load your feed.
|
||||
Start `newsobat` and press `r` to load your feed.
|
||||
|
||||
To add a feed, you can press `E` to edit that `urls` file.
|
||||
|
||||
@@ -29,7 +28,7 @@ You can input a Youtube channel by adding this, with the channel's ID at the end
|
||||
|
||||
To get the channel ID without hunting:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
curl *'https://www.youtube.com/@1minfilms'* | grep -oE 'browseId":"U\w+"' | tail | cut -d'"' -f3
|
||||
```
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
---
|
||||
title: Newsraft
|
||||
tags:
|
||||
- data
|
||||
- RSS
|
||||
---
|
||||
|
||||
# Setup
|
||||
|
||||
Install newsraft, then:
|
||||
|
||||
```sh
|
||||
mkdir ~/.config/newsraft
|
||||
echo 'https://codeberg.org/newsraft/newsraft.atom "Newsraft git"' >> ~/.config/newsraft/feeds
|
||||
newsraft
|
||||
```
|
||||
|
||||
# Commands
|
||||
|
||||
Copy the default config file:
|
||||
|
||||
```
|
||||
cp /usr/share/doc/newsraft/example/config ~/.config/newsraft/config
|
||||
|
||||
```
|
||||
|
||||
Add a line to check the man page while inside the program:
|
||||
|
||||
```
|
||||
bind M exec man newsraft
|
||||
```
|
||||
|
||||
This will fail, because the letter 'M' is taken by `mpv`.
|
||||
|
||||
Add this line to take the default link, and place it in a list of videos.
|
||||
|
||||
```
|
||||
bind V mark-read; exec echo "%l" >> ~/.cache/vidlist.txt
|
||||
```
|
||||
|
||||
# Videos
|
||||
|
||||
You can get an RSS feed from any YouTube video with this script:
|
||||
|
||||
```
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
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"
|
||||
```
|
||||
|
||||
|
||||
47
data/pass.md
47
data/pass.md
@@ -1,55 +1,42 @@
|
||||
---
|
||||
title: pass
|
||||
tags:
|
||||
- data
|
||||
- credentials
|
||||
- secrets
|
||||
requires:
|
||||
- data/gpg.md
|
||||
title: "pass"
|
||||
tags: [ "Documentation", "data" ]
|
||||
---
|
||||
[Video instructions](https://www.hooktube.com/watch?v=hlRQTj1D9LA)
|
||||
|
||||
Setup [gpg](data/gpg.md) keys.
|
||||
Setup [gpg](./gpg.md) keys.
|
||||
|
||||
Show your gpg secret it:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
gpg --list-secret-keys
|
||||
```
|
||||
|
||||
Then use the id number under `sec` to make a pass repo:
|
||||
|
||||
```sh
|
||||
key="$(gpg --list-secret-keys | grep -m 1 -A1 '^sec' | tail -n 1)"
|
||||
```bash
|
||||
KEY="$(gpg --list-secret-keys | grep -m 1 -A1 '^sec' | tail -n 1)"
|
||||
```
|
||||
|
||||
```sh
|
||||
pass init $key
|
||||
cat .password-store/.gpg-id
|
||||
```bash
|
||||
pass init $KEY
|
||||
```
|
||||
|
||||
To add a basic password, e.g. for `${website}`:
|
||||
To add a basic password, e.g. for `$WEBSITE`:
|
||||
|
||||
```sh
|
||||
pass ${website}
|
||||
```bash
|
||||
pass $WEBSITE
|
||||
```
|
||||
|
||||
To insert a multi-line password, e.g. with a login name:
|
||||
To insert a multiline password, e.g. with a login name:
|
||||
|
||||
```sh
|
||||
pass add -m ${website}
|
||||
```bash
|
||||
pass add -m $WEBSITE
|
||||
```
|
||||
|
||||
Remove a password:
|
||||
|
||||
```sh
|
||||
pass rm ${website}
|
||||
```bash
|
||||
pass rm $WEBSITE
|
||||
```
|
||||
|
||||
You can generate passwords with `xkcdpass`.
|
||||
|
||||
Automatically insert a password with `pass insert`:
|
||||
|
||||
|
||||
```sh
|
||||
xkcdpass | pass insert --echo ${website}
|
||||
```
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
---
|
||||
title: pass with otp
|
||||
tags:
|
||||
- data
|
||||
- credentials
|
||||
- secrets
|
||||
- 2fa
|
||||
- otp
|
||||
requires:
|
||||
- data/pass.md
|
||||
---
|
||||
|
||||
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}"
|
||||
```
|
||||
@@ -1,12 +1,8 @@
|
||||
---
|
||||
title: Convert a scanned pdf to text
|
||||
tags:
|
||||
- data
|
||||
- pdf
|
||||
- ocr
|
||||
title: "pdf to txt"
|
||||
tags: [ "Documentation", "data", "pdf", "ocr" ]
|
||||
---
|
||||
|
||||
How to translate pdfs to text (results are very poor, and will need lots of corrections).
|
||||
How to translate pdf book images to text (results are very poor, and will need lots of corrections).
|
||||
|
||||
## Dependencies
|
||||
|
||||
@@ -16,13 +12,13 @@ Arch: tesseract-data-eng and poppler-utils
|
||||
|
||||
## Script
|
||||
|
||||
```sh
|
||||
```bash
|
||||
pdftoppm -png *file*.pdf test
|
||||
```
|
||||
|
||||
```sh
|
||||
for x in *png; do
|
||||
tesseract -l eng "$x" - >> out.txt
|
||||
```bash
|
||||
for x in \*png; do
|
||||
tesseract -l eng "$x" - >> *out*.txt
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
25
data/pdf-to-txt.sh
Executable file
25
data/pdf-to-txt.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
pdftoppm -png input.pdf page
|
||||
|
||||
for x in *png; do
|
||||
tesseract -l eng "$x" - >> out.tex
|
||||
done
|
||||
|
||||
rm *png
|
||||
|
||||
sed -i -ze :a -e 's/\([a-z]\)\(-\)\n\+\([a-zA-Z]\)/\1\3/g' out.tex
|
||||
sed -i -ze :a -e 's/\([a-z]\)\n\+\([a-zA-Z]\)/\1 \2/g' out.tex
|
||||
sed -i -ze :a -e 's/\([A-Z]\){3}\+\n/\1 XYZ/g' out.tex
|
||||
sed -i -ze :a -e 's/\n\([A-Z]\{3\}\+\)\n/\\section{\1}\n/g' out.tex
|
||||
sed -i -ze :a -e 's/\([a-z]\)\. \([A-Z]\)/\1\.\n\2/g' out.tex
|
||||
|
||||
sed -i 's/“//g' out.tex
|
||||
sed -i "s/”/''/g" out.tex
|
||||
sed -i "s/’/'/g" out.tex
|
||||
sed -i "s/‘/'/g" out.tex
|
||||
sed -i "s/\.''/''\./g" out.tex
|
||||
sed -i "s/ — / -- /g" out.tex
|
||||
sed -i 's/\$/\\$/g' out.tex
|
||||
sed -i 's/%/\\%/g' out.tex
|
||||
sed -i 's/&/\\&/g' out.tex
|
||||
@@ -1,15 +1,8 @@
|
||||
---
|
||||
title: PDF Metadata Erasure
|
||||
tags:
|
||||
- metadata
|
||||
- ghost script
|
||||
- gs
|
||||
- pdf
|
||||
title: "PDF Metadata Erasure"
|
||||
tags: [ "Documentation", "Metadata", "Ghost Script" ]
|
||||
---
|
||||
|
||||
You cannot erase pdf metadata with `exiftool` (it only *appends* your changes).
|
||||
To delete pdf metadata, you'll need `gs`.
|
||||
|
||||
Make a text file called 'pdfmark.txt'.
|
||||
|
||||
|
||||
@@ -27,6 +20,6 @@ Make a text file called 'pdfmark.txt'.
|
||||
|
||||
Then run:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
gs -o output.pdf -sDEVICE=pdfwrite "$FILE".pdf pdfmark.txt
|
||||
```
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
---
|
||||
title: radicale and nginx
|
||||
tags:
|
||||
- data
|
||||
- calendar
|
||||
requires:
|
||||
- networking/nginx.md
|
||||
title: "radicale and nginx"
|
||||
tags: [ "data", "calendar" ]
|
||||
---
|
||||
|
||||
Check before you start:
|
||||
@@ -19,7 +15,7 @@ The standard `radicale` package should come with a nice `systemd` service file.
|
||||
|
||||
If the service comes already-started, stop it immediately:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo systemctl stop radicale
|
||||
```
|
||||
|
||||
@@ -43,12 +39,11 @@ You might get it in the `apache` package or similar.
|
||||
|
||||
`htpasswd` allows you to generate passwords for users, and place them in `/etc/radicale/users`.
|
||||
|
||||
```sh
|
||||
pass="$(xkcdpass)"
|
||||
username=alice
|
||||
htpasswd -nb ${username} "${pass}" | sudo tee -a /etc/radicale/users
|
||||
echo "Your username is ${username}"
|
||||
echo "Your password is ${pass}"
|
||||
```bash
|
||||
PASS="$(xkcdpass)"
|
||||
htpasswd -nb $USER "$PASS" | sudo tee -a /etc/radicale/users
|
||||
echo "Your username is $USER"
|
||||
echo "Your password is $PASS"
|
||||
```
|
||||
Right now, you can't sign into the server except through the localhost, which is pointless.
|
||||
So now we add a subdomain to `nginx`.
|
||||
@@ -97,27 +92,27 @@ sudo ln -s /etc/nginx/sites-available/radicale /etc/nginx/sites-enables/
|
||||
|
||||
Finally, replace the example `DOMAIN` with your actual domain name.
|
||||
|
||||
```sh
|
||||
domain=whatever.com
|
||||
sudo sed -i "s/DOMAIN/${domain}/g" /etc/nginx/sites-available/radicale
|
||||
```bash
|
||||
DOMAIN=whatever.com
|
||||
sudo sed -i "s/DOMAIN/$DOMAIN/g" /etc/nginx/sites-available/radicale
|
||||
```
|
||||
|
||||
(optional: replace that `cal.` prefix with anything else)
|
||||
|
||||
Check nginx is happy:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo nginx -t
|
||||
```
|
||||
You will almost certainly need a new SSL certificate for the site:
|
||||
|
||||
```sh
|
||||
sudo certbod -d cal.${domain}
|
||||
```bash
|
||||
sudo certbod -d cal.$DOMAIN
|
||||
```
|
||||
|
||||
Start or restart both services:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo systemctl start radicale
|
||||
sudo systemctl restart nginx
|
||||
```
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
---
|
||||
title: Recfiles
|
||||
tags:
|
||||
- data
|
||||
- database
|
||||
---
|
||||
|
||||
Create:
|
||||
|
||||
```sh
|
||||
database=games.rec
|
||||
touch $database
|
||||
for g in Vojvodina Saboter Carcassonne Chess; do
|
||||
recins -r "Name: $g" -r "Played: yes" $database
|
||||
done
|
||||
```
|
||||
|
||||
Read:
|
||||
|
||||
```sh
|
||||
recsel $database
|
||||
query=Carc
|
||||
recsel --quick=$query $database
|
||||
|
||||
game=Vojvodina
|
||||
recsel --expression="Name = '${game}'" $database
|
||||
```
|
||||
|
||||
Update:
|
||||
|
||||
```sh
|
||||
recset --expression="Name = '${game}'" -f Played --set="no" $database
|
||||
new_field=Played
|
||||
value=no
|
||||
recset -f "$new_field" --delete $database
|
||||
recset -f "$new_field" --set-add="$value" $database
|
||||
recsel $database
|
||||
```
|
||||
|
||||
Delete:
|
||||
|
||||
```sh
|
||||
recdel --expression="Name = '${game}'" $database
|
||||
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
|
||||
|
||||
- [Recfiles for gemini capsules](gemini://tilde.town/~dozens/gemlog/21.gmi)
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
---
|
||||
title: Recfile Bibliography for TeX
|
||||
tags:
|
||||
- data
|
||||
- database
|
||||
- recfiles
|
||||
- tex
|
||||
requires:
|
||||
- data/recfiles.md
|
||||
- writing/tex.md
|
||||
- system/makefiles.md
|
||||
---
|
||||
|
||||
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
|
||||
|
||||
```
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
---
|
||||
title: Board Games with Recfiles
|
||||
tags:
|
||||
- data
|
||||
- recfiles
|
||||
- games
|
||||
requires:
|
||||
- data/recfiles.md
|
||||
---
|
||||
|
||||
You can play with a board games database from boardgamegeek.com.
|
||||
|
||||
## Download the Database
|
||||
|
||||
```sh
|
||||
mkdir board_games
|
||||
cd board_games
|
||||
curl -Lo bg.zip 'https://www.kaggle.com/api/v1/datasets/download/threnjen/board-games-database-from-boardgamegeek'
|
||||
unzip bg.zip
|
||||
```
|
||||
|
||||
The header line shows fields with a bunch of colons, which will confused `recutils`, so we'll have to get rid of them.
|
||||
|
||||
```sh
|
||||
sed -i '1s/://g' *.csv
|
||||
```
|
||||
|
||||
Convert the games to `.rec` format.
|
||||
|
||||
```sh
|
||||
csv2rec games.csv > games.rec
|
||||
```
|
||||
|
||||
## Queries
|
||||
|
||||
If you try to look at older games, you'll find lots of results.
|
||||
|
||||
```sh
|
||||
recsel games.rec -e "YearPublished < 1800" -c
|
||||
recsel games.rec -e "YearPublished < 1800" -Cp Name
|
||||
```
|
||||
But most are wrong.
|
||||
The problem is games with a `YearPublished` date of `0`, probably because the year published is unknown.
|
||||
|
||||
```sh
|
||||
recsel games.rec -e "Name = 'The Goblin King is Angry'" -p YearPublished
|
||||
```
|
||||
|
||||
Fix the query by removing games published in '0 AD'.
|
||||
|
||||
```sh
|
||||
recsel games.rec -e "YearPublished < 1800 && YearPublished != 0" -R YearPublished,Name
|
||||
```
|
||||
|
||||
Or fix the database setting `YearPublished` to 'unknown':
|
||||
|
||||
```sh
|
||||
recsel games.rec -e "YearPublished = 0" -Cp Name
|
||||
recset games.rec -e "YearPublished = 0" -f "YearPublished" -S 'unknown'
|
||||
```
|
||||
|
||||
Strategic games which work best with 3 players, sorted by Average Rating:
|
||||
|
||||
```sh
|
||||
recsel games.rec -e "BestPlayers = 3 && CatStrategy = 1" -CR Name --sort=AvgRating
|
||||
```
|
||||
@@ -1,123 +0,0 @@
|
||||
---
|
||||
title: Recfiles Extended Example
|
||||
tags:
|
||||
- data
|
||||
- database
|
||||
- recfiles
|
||||
requires:
|
||||
- data/recfiles.md
|
||||
---
|
||||
|
||||
## Create
|
||||
|
||||
Make a database for your boardgames, specifying only one field and value:
|
||||
|
||||
```sh
|
||||
database=games.rec
|
||||
n=Name
|
||||
g=Vojvodina
|
||||
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}
|
||||
```
|
||||
|
||||
View all games, or select one by number:
|
||||
|
||||
```sh
|
||||
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`.
|
||||
|
||||
```sh
|
||||
f=played
|
||||
v=yes
|
||||
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}
|
||||
```
|
||||
|
||||
## Read
|
||||
|
||||
Check how many records the database has:
|
||||
|
||||
```sh
|
||||
recinf ${database}
|
||||
```
|
||||
|
||||
Look at just the games you've never played:
|
||||
|
||||
```sh
|
||||
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}
|
||||
```
|
||||
|
||||
## Update
|
||||
|
||||
To change a game's `Played` field from `no` to `yes`, use `recset` to specify the number, and change that field.
|
||||
|
||||
```sh
|
||||
num=0
|
||||
f=Played
|
||||
value=yes
|
||||
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`.
|
||||
|
||||
```sh
|
||||
recset -e "Playtime = 40" -f Max_Players --set 50 games.rec
|
||||
```
|
||||
|
||||
This doesn't work, because that field does not exist.
|
||||
You can `--set-add` the field, to add it wherever it does not exist.
|
||||
|
||||
```sh
|
||||
recset -e "Playtime = 40" -f Max_Players --set-add 50 games.rec
|
||||
```
|
||||
|
||||
## Delete
|
||||
|
||||
Remove `Played` record from first game:
|
||||
|
||||
```sh
|
||||
num=0
|
||||
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}
|
||||
```
|
||||
|
||||
Delete an entire record:
|
||||
|
||||
```sh
|
||||
num=2
|
||||
recdel --number=${num} ${database}
|
||||
```
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
title: IP Addresses with Recfiles
|
||||
tags:
|
||||
- data
|
||||
- recfiles
|
||||
- games
|
||||
requires:
|
||||
- data/recfiles.md
|
||||
---
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
---
|
||||
title: nginx logs with recfiles
|
||||
tags:
|
||||
- data
|
||||
- recfiles
|
||||
- logs
|
||||
requires:
|
||||
- data/recfiles.md
|
||||
- networking/nginx.md
|
||||
---
|
||||
|
||||
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
|
||||
```
|
||||
@@ -1,36 +0,0 @@
|
||||
---
|
||||
title: Recfixes
|
||||
tags:
|
||||
- data
|
||||
- recfiles
|
||||
requires:
|
||||
- data/recfiles.md
|
||||
---
|
||||
|
||||
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,14 +1,10 @@
|
||||
---
|
||||
title: sc-im
|
||||
tags:
|
||||
- TUI
|
||||
- data
|
||||
- spreadsheet
|
||||
- csv
|
||||
requires:
|
||||
- writing/vim.md
|
||||
title: "sc-im"
|
||||
tags: [ "Documentation", "TUI", "data" ]
|
||||
---
|
||||
|
||||
- [Sample file](sc-im/sample.sc)
|
||||
|
||||
# Basic Commands
|
||||
|
||||
## See Cells
|
||||
@@ -18,7 +14,7 @@ Change this with `:set autowrap`.
|
||||
|
||||
Make `sc-im` always autowrap:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
mkdir .config/sc-im/bash
|
||||
echo 'set autowrap' >> .config/sc-im/scimrc
|
||||
```
|
||||
@@ -51,6 +47,7 @@ echo 'set autowrap' >> .config/sc-im/scimrc
|
||||
|:----------------------|:---:|
|
||||
| text (left align) | < |
|
||||
| text (right align) | > |
|
||||
| text (right align) | `|` |
|
||||
| Edit existing text | E |
|
||||
|
||||
### Meta Actions
|
||||
@@ -65,6 +62,26 @@ echo 'set autowrap' >> .config/sc-im/scimrc
|
||||
| paste with format | Pc |
|
||||
| delete a cell | x |
|
||||
|
||||
# Movement
|
||||
|
||||
| Action | Key |
|
||||
|:-------------------------------:|:---:|
|
||||
| highest part | H |
|
||||
| lowest part | L |
|
||||
| top | gg |
|
||||
| move right | g$ |
|
||||
| move left | g0 |
|
||||
| insert middle | \ |
|
||||
| insert left | \> |
|
||||
| insert right | < |
|
||||
| to to cell b4 | b4 |
|
||||
| see all text in cells | aa |
|
||||
| format cells so you can see it. | f |
|
||||
| format wider right | fl |
|
||||
| format smaller left | fh |
|
||||
| format wider down | fj |
|
||||
| format smaller down | fk |
|
||||
|
||||
|
||||
### Functions
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
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
|
||||
```
|
||||
38
data/sc-im/sample.sc
Normal file
38
data/sc-im/sample.sc
Normal file
@@ -0,0 +1,38 @@
|
||||
# This data file was generated by the Spreadsheet Calculator Improvised (sc-im)
|
||||
# You almost certainly shouldn't edit it.
|
||||
|
||||
newsheet "Sheet1"
|
||||
movetosheet "Sheet1"
|
||||
offscr_sc_cols 0
|
||||
offscr_sc_rows 0
|
||||
nb_frozen_rows 1
|
||||
nb_frozen_cols 0
|
||||
nb_frozen_screenrows 2
|
||||
nb_frozen_screencols 0
|
||||
format A 14 1 0
|
||||
format B 18 2 0
|
||||
format 0 2
|
||||
freeze 0
|
||||
label A0 = "Food by Weight"
|
||||
leftstring B0 = "No. Meals"
|
||||
leftstring A1 = "Ajvar"
|
||||
let A1 = 5
|
||||
let B1 = A1*$A$10
|
||||
leftstring A2 = "Apples"
|
||||
let A2 = 3
|
||||
let B2 = A2*$A$10
|
||||
leftstring A3 = "Rocket"
|
||||
let A3 = 0.2
|
||||
let B3 = A3*$A$10
|
||||
leftstring A4 = "Beli Cheese"
|
||||
let A4 = 1
|
||||
let B4 = A4*$A$10
|
||||
leftstring A6 = "Total"
|
||||
let A6 = @sum(A1:A4)
|
||||
leftstring B6 = "Total"
|
||||
let B6 = @sum(B1:B4)
|
||||
leftstring A7 = "Average"
|
||||
let A7 = @avg(A1:A4)
|
||||
leftstring A10 = "Weight of Meal"
|
||||
let A10 = 0.3
|
||||
goto A0
|
||||
@@ -1,35 +0,0 @@
|
||||
---
|
||||
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"
|
||||
```
|
||||
@@ -1,16 +1,13 @@
|
||||
---
|
||||
title: Sharing Secrets
|
||||
tags:
|
||||
- data
|
||||
- death
|
||||
- secrets
|
||||
title: "Sharing Secrets"
|
||||
tags: [ "data", "death", "secrets", "ssss" ]
|
||||
---
|
||||
|
||||
You can share parts of a secret with multiple people, so only some of them need to agree to see the secret.
|
||||
|
||||
Install `ssss`, then decide on the total number of secrets (`N`), and the threshold of people who must share their shard of the secret in order to reveal the secret.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
N=5
|
||||
T=3
|
||||
FILE=secret.txt
|
||||
@@ -20,7 +17,7 @@ Each shard is a line inside secret.txt.
|
||||
|
||||
Check it's working:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
head -n $T $FILE | ssss-combine -t $T
|
||||
tail -n $T $FILE | ssss-combine -t $T
|
||||
```
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
title: Soft-Serve
|
||||
tags:
|
||||
- data
|
||||
- git server
|
||||
- lfs
|
||||
- TUI
|
||||
requires:
|
||||
- data/git.md
|
||||
- networking/nginx.md
|
||||
---
|
||||
|
||||
- [Soft-Serve with https](soft-serve/soft_https.md)
|
||||
- [Maintenance](soft-serve/soft_maintenance.md)
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
title: Soft Serve Maintenance
|
||||
tags:
|
||||
- data
|
||||
- git server
|
||||
- maintenance
|
||||
requires:
|
||||
- data/git.md
|
||||
- networking/nginx.md
|
||||
---
|
||||
|
||||
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,12 +1,6 @@
|
||||
---
|
||||
title: Soft Serve through https
|
||||
tags:
|
||||
- data
|
||||
- git server
|
||||
- lfs
|
||||
requires:
|
||||
- data/git.md
|
||||
- networking/nginx.md
|
||||
title: "Soft Serve through https"
|
||||
tags: [ "data", "git" ]
|
||||
---
|
||||
|
||||
## `http` Setup
|
||||
@@ -35,13 +29,13 @@ http:
|
||||
|
||||
Restart the `soft-serve` service, then check it's working by cloning from localhost:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
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/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).
|
||||
|
||||
@@ -73,4 +67,3 @@ Put this file at `/etc/nginx/sites-enabled/$DOMAIN.tld`, then set up standard ce
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
---
|
||||
title: sqlite
|
||||
tags:
|
||||
- data
|
||||
title: "sqlite"
|
||||
tags: [ "Documentation", "data" ]
|
||||
---
|
||||
|
||||
Work with a database:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sqlite3 "$FILE".sqlite3
|
||||
```
|
||||
Compress the database:
|
||||
|
||||
141
data/taskwarrior/task.md
Normal file
141
data/taskwarrior/task.md
Normal file
@@ -0,0 +1,141 @@
|
||||
---
|
||||
title: "task"
|
||||
tags: [ "Documentation", "Organization" ]
|
||||
---
|
||||
|
||||
Set up the configuration file:
|
||||
|
||||
```bash
|
||||
task
|
||||
```
|
||||
|
||||
Add a task:
|
||||
|
||||
```bash
|
||||
task add update linux
|
||||
```
|
||||
|
||||
See which task is next:
|
||||
|
||||
```bash
|
||||
task next
|
||||
```
|
||||
|
||||
Note the id number.
|
||||
|
||||
Mark a task as started:
|
||||
|
||||
```bash
|
||||
task start 1
|
||||
```
|
||||
|
||||
Once finished:
|
||||
|
||||
```bash
|
||||
task 1 done
|
||||
```
|
||||
|
||||
# Projects
|
||||
|
||||
Add a project:
|
||||
|
||||
```bash
|
||||
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
|
||||
```
|
||||
|
||||
## Summary
|
||||
|
||||
```bash
|
||||
task pro:house sum
|
||||
```
|
||||
|
||||
```bash
|
||||
task burndown.daily pro:house
|
||||
```
|
||||
|
||||
The summaries will show how fast a project is being completed, and when you can expect it to finish at the present rate.
|
||||
|
||||
# Tags
|
||||
|
||||
```bash
|
||||
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
|
||||
task end.after:today-1wk completed
|
||||
```
|
||||
|
||||
# User Defined Attributes
|
||||
|
||||
Make a UDA 'size'.
|
||||
|
||||
```bash
|
||||
task config uda.size.type string
|
||||
```
|
||||
|
||||
```bash
|
||||
task config uda.size.label Size
|
||||
```
|
||||
|
||||
```bash
|
||||
task config uda.size.values large,medium,small
|
||||
```
|
||||
|
||||
```bash
|
||||
uda.size.default=medium
|
||||
```
|
||||
|
||||
# Tricks
|
||||
|
||||
This command shows tasks I'm most interested in:
|
||||
|
||||
```bash
|
||||
task next +ACTIVE or +OVERDUE or due:today or scheduled:today or pri:H
|
||||
```
|
||||
|
||||
The command is long, so `alias` is your friend.
|
||||
|
||||
172
data/taskwarrior/timew.md
Normal file
172
data/taskwarrior/timew.md
Normal file
@@ -0,0 +1,172 @@
|
||||
---
|
||||
title: "timew"
|
||||
tags: [ "Documentation", "Data" ]
|
||||
---
|
||||
# Summaries
|
||||
|
||||
Try:
|
||||
|
||||
```bash
|
||||
timew summary :yesterday
|
||||
```
|
||||
|
||||
You can also use :week, :lastweek, :month, :quarter, :year, or a range such as:
|
||||
|
||||
```bash
|
||||
timew summary today to tomorrow
|
||||
timew today - tomorrow
|
||||
2018-10-15T06:00 - 2018-10-17T06:00
|
||||
```
|
||||
|
||||
Each of these can gain with the :ids tag.
|
||||
|
||||
# Basics
|
||||
|
||||
```bash
|
||||
timew start
|
||||
timew stop
|
||||
timew continue
|
||||
timew summary
|
||||
timew tags
|
||||
```
|
||||
|
||||
And add ids with:
|
||||
|
||||
```bash
|
||||
timew summary :ids
|
||||
timew track 10am - 1pm timewarrior
|
||||
timew track 1pm for 2h walk
|
||||
```
|
||||
|
||||
# Adjusting Timewarrior
|
||||
|
||||
First get ids.
|
||||
|
||||
```bash
|
||||
timew summary :ids
|
||||
```
|
||||
|
||||
Then if we're looking at task @2:
|
||||
|
||||
```bash
|
||||
timew move @2 12:00
|
||||
timew lengthen @2 3mins
|
||||
```
|
||||
|
||||
```bash
|
||||
time shorten @2 40mins
|
||||
```
|
||||
|
||||
# Forgetting
|
||||
|
||||
```bash
|
||||
timew start 1h ago @4
|
||||
```
|
||||
|
||||
Or if your action actually had a break:
|
||||
|
||||
```bash
|
||||
timew split @8
|
||||
```
|
||||
|
||||
Or maybe not?
|
||||
|
||||
```bash
|
||||
timew join @4 @8
|
||||
timew @8 delete
|
||||
```
|
||||
|
||||
Start at previous time
|
||||
|
||||
```bash
|
||||
timew start 3pm 'Read chapter 12'
|
||||
timew start 90mins ago 'Read chapter 12'
|
||||
```
|
||||
|
||||
Cancel currently tracked time.
|
||||
|
||||
```bash
|
||||
timew cancel
|
||||
```
|
||||
|
||||
# Backdated tracking
|
||||
|
||||
> timew untag @3
|
||||
|
||||
|
||||
# Hints
|
||||
|
||||
* :quit - for automation
|
||||
|
||||
* :yes
|
||||
|
||||
* :color
|
||||
|
||||
* :fill - expand the time to fill out available time
|
||||
|
||||
* :adjust - automatically correct overlaps
|
||||
|
||||
* :ids - show id numbers
|
||||
|
||||
|
||||
# Times
|
||||
|
||||
* :yesterday
|
||||
|
||||
* :day
|
||||
|
||||
* :week
|
||||
|
||||
* :month
|
||||
|
||||
* :quarter
|
||||
|
||||
* :lastweek
|
||||
|
||||
* :lastmonth
|
||||
|
||||
* :lastquarter
|
||||
|
||||
* :lastyear
|
||||
|
||||
|
||||
|
||||
# Mistakes
|
||||
|
||||
task end.after:2015-05-01 and end.before:2015-05-31 completed
|
||||
|
||||
task end.after:today-1wk completed
|
||||
|
||||
# Errors with Python3
|
||||
|
||||
Replace
|
||||
|
||||
> os.system('timew start ' + combined + ' :yes')
|
||||
|
||||
with:
|
||||
|
||||
> os.system('timew start ' + combined.decode() + ' :yes')
|
||||
|
||||
and
|
||||
|
||||
> os.system('timew stop ' + combined + ' :yes')
|
||||
|
||||
with:
|
||||
|
||||
> os.system('timew stop ' + combined.decode() + ' :yes')
|
||||
|
||||
# Fixing Errors
|
||||
|
||||
```bash
|
||||
curl -O https://taskwarrior.org/download/timew-dbcorrection.py
|
||||
```
|
||||
|
||||
```bash
|
||||
python timew-dbcorrections.py
|
||||
```
|
||||
|
||||
# Setup
|
||||
|
||||
With taskwarrior installed as well, `locate on-modify-time`, then add it to ~/.task/hooks and make it executable.
|
||||
This will track the time of any tasks used with [taskwarrior](task.md).
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
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,11 +1,10 @@
|
||||
---
|
||||
title: w3m
|
||||
tags:
|
||||
- browser
|
||||
title: "w3m"
|
||||
tags: [ "Documentation", "browsers" ]
|
||||
---
|
||||
Open a search tab:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
w3m ddg.gg
|
||||
```
|
||||
|
||||
@@ -20,3 +19,4 @@ w3m ddg.gg
|
||||
| T | new tab |
|
||||
| { / } | switch tabs |
|
||||
|
||||

|
||||
|
||||
43
data/w3m.tape
Normal file
43
data/w3m.tape
Normal file
@@ -0,0 +1,43 @@
|
||||
Require w3m
|
||||
|
||||
Sleep 1s
|
||||
Type "w3m ddg.gg"
|
||||
Sleep 500ms
|
||||
Enter
|
||||
Sleep 1.5s
|
||||
Tab
|
||||
Enter
|
||||
Type "cats"
|
||||
Enter
|
||||
Sleep 2s
|
||||
Tab
|
||||
Enter
|
||||
Sleep 2s
|
||||
Type "jjjjjjjjjjjj"
|
||||
Tab
|
||||
Enter
|
||||
Sleep 2s
|
||||
Type "U"
|
||||
Sleep 500ms
|
||||
Ctrl+U
|
||||
Sleep 500ms
|
||||
Type "dmz.rs"
|
||||
Sleep 500ms
|
||||
Enter
|
||||
Sleep 4.5s
|
||||
Type "jjjjjjjj"
|
||||
Tab
|
||||
Type "j"
|
||||
Sleep 500ms
|
||||
Enter
|
||||
Sleep 1s
|
||||
Type " "
|
||||
Sleep 2s
|
||||
Backspace
|
||||
Sleep 500ms
|
||||
Type " "
|
||||
Sleep 1.5s
|
||||
Type " "
|
||||
Sleep 2s
|
||||
Type "qy"
|
||||
Sleep 500ms
|
||||
@@ -1,9 +1,6 @@
|
||||
---
|
||||
title: ssh to phone
|
||||
tags:
|
||||
- networking
|
||||
- ssh
|
||||
- android
|
||||
title: "ssh to phone"
|
||||
tags: [ "networking", "ssh", "android" ]
|
||||
---
|
||||
|
||||
1. Install fdroid on phone.
|
||||
@@ -11,7 +8,7 @@ tags:
|
||||
3. Open fdroid, and run:
|
||||
|
||||
|
||||
```sh
|
||||
```bash
|
||||
pkg upgrade
|
||||
pkg install busybox termux-services openssh openssh-sftp-server
|
||||
source $PREFIX/etc/profile.d/start-services.sh
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
---
|
||||
title: Arch on a Raspberry Pi 4
|
||||
tags:
|
||||
- distros
|
||||
- raspberry pi
|
||||
- rpi
|
||||
title: "Arch on a Raspberry Pi 4"
|
||||
tags: [ "Documentation", "distros", "raspberry pi", "rpi" ]
|
||||
---
|
||||
|
||||
The [Official Instructions](https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4) for a Raspberry pi 4 do not allow for working sound from the headphone jack, unless you use the aarch64 Installation.
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
---
|
||||
title: autologin
|
||||
tags:
|
||||
- distros
|
||||
- arch
|
||||
title: "autologin"
|
||||
tags: [ "Documentation", "Distros", "Arch" ]
|
||||
---
|
||||
|
||||
# Automatic Login
|
||||
|
||||
Edit `/etc/systemd/system/getty@tty1.service.d/override.conf` by typing:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo systemctl edit getty@tty1
|
||||
```
|
||||
|
||||
The put in the following, changing `[ USER ]` to your username.
|
||||
|
||||
```
|
||||
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/usr/bin/agetty --autologin [ USER ] -s %I 115200,38400,9600 vt102
|
||||
@@ -26,22 +25,9 @@ ExecStart=-/usr/bin/agetty --autologin [ USER ] -s %I 115200,38400,9600 vt102
|
||||
|
||||
In `.bashrc`.
|
||||
|
||||
```sh
|
||||
```
|
||||
if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
|
||||
exec startx
|
||||
fi
|
||||
|
||||
```
|
||||
|
||||
# Faillock reset
|
||||
|
||||
After failing 3 times to enter the password, archlinux would ussualy lock entering the password for 10 minutes, not all apps and guis display this message, so sometimes it can be a bit confusing. To reset this lockdown, you can login as root and restart it manually with command
|
||||
|
||||
``` sh
|
||||
failock --reset
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
---
|
||||
title: Install Arch
|
||||
tags:
|
||||
- arch
|
||||
requires:
|
||||
- system/partitions.md
|
||||
title: "basic-install"
|
||||
tags: [ "Documentation", "arch" ]
|
||||
---
|
||||
Keyboard layout changed.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ls /usr/share/kbd/keymaps/**/*.map.gz
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
loadkeys uk.map.gz
|
||||
```
|
||||
|
||||
Check if boot mode is UEFI
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ls /sys/firmware/efi/efivars
|
||||
```
|
||||
|
||||
@@ -25,115 +22,115 @@ Without efivars, the system must boot with BIOS.
|
||||
|
||||
# Check network's up
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ping archlinux.org
|
||||
```
|
||||
|
||||
Set system clock properly
|
||||
|
||||
```sh
|
||||
```bash
|
||||
timedatectl set-ntp true
|
||||
```
|
||||
|
||||
Check disks
|
||||
|
||||
```sh
|
||||
```bash
|
||||
lsblk
|
||||
```
|
||||
|
||||
Make partition
|
||||
|
||||
```sh
|
||||
```bash
|
||||
parted -s /dev/sda mklabel gpt
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
parted -s /dev/sda mklabel msdos
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
parted -s /dev/sda mkpart primary ext4 512 100%
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
parted -s /dev/sda set 1 boot on
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
mkfs.ext4 /dev/sda1
|
||||
```
|
||||
|
||||
Use pacstrap to get the base install.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
mount /dev/sda1 /mnt/
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
pacstrap /mnt base base-devel vim linux linux-firmware
|
||||
```
|
||||
|
||||
Make fstab notes for new system.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
genfstab -U /mnt >> /mnt/etc/fstab
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
arch-chroot /mnt
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
echo 'en_GB.UTF-8' > /etc/default/locale
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
pacman -Sy networkmanager grub
|
||||
```
|
||||
|
||||
For legacy:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
grub-install --target=i386-pc /dev/sda
|
||||
```
|
||||
|
||||
For EFI:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman -S efibootmgr
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
mkdir /boot/efi
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --remmovable
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
```
|
||||
|
||||
set local time
|
||||
|
||||
```sh
|
||||
```bash
|
||||
ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
|
||||
```
|
||||
|
||||
Find the desired locale's and uncomment them.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
vi /etc/locale.gen
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
locale-gen
|
||||
```
|
||||
|
||||
Make your keyboard changes permanent with:
|
||||
Make your keyboard changes permenent with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
vi /etc/vconsole.conf
|
||||
```
|
||||
|
||||
@@ -142,13 +139,13 @@ unsure about this bit - is this name just for the loadkeys function?
|
||||
|
||||
Make a hostname
|
||||
|
||||
```sh
|
||||
```bash
|
||||
echo pc > /etc/hostname
|
||||
```
|
||||
|
||||
Set hostnames for network, or at least your own.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
vi /etc/hosts
|
||||
```
|
||||
|
||||
@@ -162,27 +159,27 @@ If the system has a permanent IP address, it should be used instead of localhost
|
||||
|
||||
Ping some sites to make sure the network's working
|
||||
|
||||
```sh
|
||||
```bash
|
||||
passwd
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
exit
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
umount -R /mnt
|
||||
```
|
||||
|
||||
Remove that awful beep sound:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
rmmod pcspkr
|
||||
```
|
||||
|
||||
...and make the change permanent:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo echo "blacklist pcspkr" >> /etc/modprobe.d/nobeep.conf
|
||||
```
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
---
|
||||
title: fonts
|
||||
tags:
|
||||
- distros
|
||||
title: "fonts"
|
||||
tags: [ "Documentation", "distros" ]
|
||||
---
|
||||
# Basics
|
||||
|
||||
Update font-cache:
|
||||
|
||||
```sh
|
||||
su root
|
||||
```bash
|
||||
fc-cache
|
||||
```
|
||||
|
||||
List fonts:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
fc-list
|
||||
```
|
||||
|
||||
Grab the part of the font name you need for Xresources:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
fc-list | cut -d: -f2
|
||||
```
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
---
|
||||
title: Arch Linux GPU Setup
|
||||
tags:
|
||||
- arch
|
||||
- GPU
|
||||
requires:
|
||||
- distros/arch/install_yay.md
|
||||
title: "fonts"
|
||||
tags: [ "Documentation", "distros" ]
|
||||
---
|
||||
# Step 1: Multilib
|
||||
|
||||
@@ -17,7 +13,7 @@ Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
And update:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman -Syu
|
||||
```
|
||||
|
||||
@@ -25,7 +21,7 @@ sudo pacman -Syu
|
||||
|
||||
Check your graphics card type:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
lspci | grep VGA
|
||||
```
|
||||
|
||||
@@ -35,7 +31,7 @@ lspci | grep VGA
|
||||
|
||||
If you see `Nvidia`, then install the intel drivers:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader
|
||||
```
|
||||
|
||||
@@ -43,7 +39,7 @@ sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-lo
|
||||
|
||||
If you see `Intel`, then install the intel drivers:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-intel
|
||||
```
|
||||
|
||||
@@ -51,16 +47,17 @@ sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-lo
|
||||
|
||||
If you see `AMD`, then check your card support `vulkan`:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
yay -S gpu-viewer
|
||||
```
|
||||
|
||||
```sh
|
||||
```bash
|
||||
vulkaninfo | grep 'VkPhysicalDeviceVulkanMemoryModelFeatures' -A 3
|
||||
```
|
||||
|
||||
You should see 'true' here.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman -S --needed lib32-mesa vulkan-radeon lib32-vulkan-radeon vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-amdgpu
|
||||
```
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
---
|
||||
title: Install yay
|
||||
tags:
|
||||
- distros
|
||||
- arch
|
||||
requires:
|
||||
- distros/arch/basic_install.md
|
||||
---
|
||||
|
||||
```sh
|
||||
pacman --sync --noconfirm --needed base-devel gcc git
|
||||
git clone https://aur.archlinux.org/yay.git
|
||||
cd yay
|
||||
makepkg -si
|
||||
```
|
||||
|
||||
The flags are mostly the same as in `pacman`.
|
||||
But running `yay` without flags will do the update like `yay -Syu` and with package name it will search packages in the AUR and `pacman` repos, and let you choose which to install.
|
||||
|
||||
```sh
|
||||
yay ${search_term}
|
||||
```
|
||||
|
||||
Building the package can usually take some time, and after the build it will ask for the `sudo` password.
|
||||
If you leave, the installation will fail.
|
||||
To avoid this, you can use the flag `--sudoloop` and enter the `sudo` password initially and it will loop it until the installation is finished.
|
||||
|
||||
```sh
|
||||
yay -S --noconfirm --sudoloop ${package_name}
|
||||
```
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
---
|
||||
title: Arch Maintenance
|
||||
tags:
|
||||
- arch
|
||||
requires:
|
||||
- pacman
|
||||
- vim
|
||||
---
|
||||
|
||||
# Package Cache
|
||||
|
||||
Clean the cache of old packages in `/var/cachepacman/pkg/`:
|
||||
|
||||
```sh
|
||||
ls /var/cache/pacman/pkg/ | wc -l
|
||||
sudo pacman -Sc
|
||||
ls /var/cache/pacman/pkg/ | wc -l
|
||||
```
|
||||
# New Configs
|
||||
|
||||
If you chance a configuration file, such as `/etc/environment`, and `pacman` wants to update the file, it will place `/etc/environment.pacnew`.
|
||||
|
||||
Check the new files, then look at the difference between the `pacman` version, and your version.
|
||||
|
||||
```sh
|
||||
sudo find /etc/ /var/ /usr/ -name "*.pacnew"
|
||||
diff /etc/pacman.d/mirrorlist*
|
||||
```
|
||||
|
||||
Either,
|
||||
|
||||
- Update the files manually,
|
||||
|
||||
```sh
|
||||
sudo -e /etc/pacman.d/mirrorlist
|
||||
sudo rm /etc/pacman.d/mirrorlist.pacnew
|
||||
```
|
||||
|
||||
Or use a tool like `pacdiff` to view the changes next to each other, and select them with `vim`.
|
||||
|
||||
```sh
|
||||
sudo pacman -S pacman-contrib
|
||||
sudo pacdiff
|
||||
```
|
||||
|
||||
@@ -1,65 +1,54 @@
|
||||
---
|
||||
title: pacman
|
||||
tags:
|
||||
- distros
|
||||
requires:
|
||||
- distros/arch/basic_install.md
|
||||
title: "pacman"
|
||||
tags: [ "Documentation", "distros" ]
|
||||
---
|
||||
|
||||
Packages are kept in /var/cache/pacman/pkg.
|
||||
|
||||
Delete unused old packages with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman -Sc
|
||||
```
|
||||
|
||||
Signatures are handled by the pacman-key, initially set up with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman-key --populate archlinux
|
||||
```
|
||||
|
||||
And refreshed with:
|
||||
|
||||
```sh
|
||||
sudo pacman-key --refresh-keys
|
||||
```
|
||||
|
||||
If you have usigned keys, you can refresh with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman -Sc
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman -Scc
|
||||
```
|
||||
|
||||
Reset all keys with:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo rm -r /etc/pacmand.d/gnupg/ && sudo pacman-key --init
|
||||
```
|
||||
|
||||
If you're constantly getting 'everything corrupted, nothing upgraded', try running:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
sudo pacman -S archlinux-keyring
|
||||
```
|
||||
|
||||
List all orphaned packages:
|
||||
|
||||
```sh
|
||||
pacman -Qtdq
|
||||
```
|
||||
|
||||
Removing a package:
|
||||
|
||||
```sh
|
||||
sudo pacman -Rn <package_name>
|
||||
```bash
|
||||
sudo pacman -Qtdq
|
||||
```
|
||||
|
||||
## Cleaning Config Files
|
||||
@@ -72,4 +61,3 @@ These changes must be merge manually.
|
||||
|
||||
Install the `pacdiff` tool to make this easier, from the `pacman-contrib` package, then simply run `sudo pacdiff` to sort through the various mergers.
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
---
|
||||
title: pacman - Extras
|
||||
tags:
|
||||
- distros
|
||||
requires:
|
||||
- distros/arch/pacman.md
|
||||
---
|
||||
|
||||
## Unattended Actions
|
||||
|
||||
```sh
|
||||
pacman -Syu --noconfirm
|
||||
```
|
||||
|
||||
## `pacman` and `yay` Text Colouring
|
||||
|
||||
Getting the colors is done by editing the `/etc/pacman.conf` and uncommenting the line `Color`.
|
||||
|
||||
By adding the line `ILoveCandy` you will unlock some terminal animations, like pacman eating dots while installing some package.
|
||||
|
||||
## Timid Installations
|
||||
|
||||
Want to try out software, but not sure if you want to keep it?
|
||||
You can tell `pacman` that this is a dependency for another package:
|
||||
|
||||
|
||||
```sh
|
||||
pacman -S --noconfirm --asdeps ${weird_music_player}
|
||||
```
|
||||
|
||||
When you [remove orphaned packages](pacman.md), the package will be automatically uninstalled.
|
||||
@@ -1,25 +0,0 @@
|
||||
---
|
||||
title: Arch maintenance with yay
|
||||
tags:
|
||||
- arch
|
||||
- maintenance
|
||||
requires:
|
||||
- distros/arch/maintenance.md
|
||||
---
|
||||
|
||||
# Package Cache
|
||||
|
||||
Just like `[pacman](distros/arch/pacman.md)` with a couple of extras.
|
||||
|
||||
```sh
|
||||
ls ~/.cache/yay/ | wc -l
|
||||
yay -Sc
|
||||
```
|
||||
|
||||
Use `-Yc` to remove old dependencies:
|
||||
|
||||
```sh
|
||||
yay -Yc
|
||||
ls ~/.cache/yay/ | wc -l
|
||||
```
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user