Compare commits

..

No commits in common. "65217b8673d344771ab3e7d482a3e3432a4f8474" and "2f328f3b7078aa53002532aec949a01b690011d5" have entirely different histories.

24 changed files with 167 additions and 343 deletions

View File

@ -40,8 +40,6 @@ $(databases): .dbs/%.rec: %/ | .dbs/
db.rec: $(databases) db.rec: $(databases)
printf '%s\n' '%rec: guide' > $@ printf '%s\n' '%rec: guide' > $@
printf '%s\n' '%key: title' >> $@ printf '%s\n' '%key: title' >> $@
printf '%s\n' '%type: requires rec guide' >> $@
printf '%s\n' '%type: provides rec guide' >> $@
printf '%s\n' '%type: wordcount int' >> $@ printf '%s\n' '%type: wordcount int' >> $@
printf '%s\n\n' '%sort: wordcount' >> $@ printf '%s\n\n' '%sort: wordcount' >> $@
cat $^ >> $@ cat $^ >> $@

View File

@ -4,29 +4,23 @@ title: "Linux Knowledge Base"
The Linux Knowledge-Base provides quick-start guides for working with terminal programs. The Linux Knowledge-Base provides quick-start guides for working with terminal programs.
If you like this style of short articles with a miniature database, then join me in my quest to remove the nausea of poorly-written documentation.
# Setup # Setup
Install `make`, `recutils`, and any fuzzy-finder (i.e. `sk`, `fzy`, or `fzf`). Install `make`, `recutils`, and any fuzzy-finder (i.e. `sk`, `fzy`, or `fzf`).
## Usage ## Usage
Set up the database and try a few queries:
```sh ```sh
make make
make database make database
recsel db.rec -m 3
recsel db.rec -q database recsel db.rec -q database
recsel db.rec -q gpg
recsel db.rec -e "title = 'ssh'" recsel db.rec -e "title = 'ssh'"
recsel db.rec -e "title ~ 'ssh'" recsel db.rec -e "title ~ 'ssh'"
recsel db.rec -e "title ~ 'bash'" -R title,wordcount recsel db.rec -e "title ~ 'bash'" -R title,wordcount
recsel db.rec -m 1 -P content | less -R
recsel db.rec -t guide -j provides -G title \
-e "title = 'ssh'" \
-p 'sum(provides_wordcount)'
``` ```
# Style # Style
@ -36,14 +30,6 @@ recsel db.rec -t guide -j provides -G title \
- Nobody cares about how the project started. - Nobody cares about how the project started.
- Nobody wants to read what `ffmpeg` is, because anyone who wants to use it already knows what it is. - Nobody wants to read what `ffmpeg` is, because anyone who wants to use it already knows what it is.
## State Knowledge Dependencies
Articles should state what you need to understand in order to read them *at the start*.
They should not assume the reader knows much beyond common terminal commands, and should not provide a link to some other resource half-way through an article.
People should be able to read an article from the beginning, then keep going until the end, and then stop.
Articles should not take a detour through a chain of other articles of unknown size.
## Be Opinionated ## Be Opinionated
- Guides should not ask the reader to select options half-way through. - Guides should not ask the reader to select options half-way through.
@ -88,11 +74,6 @@ grep ls --color=always $HISTFILE | $PAGER
Now we can see what can be changed. Now we can see what can be changed.
## Assume People Follow the Instructions
Articles should say what to type, not the output.
If the command is `ls`, users will see files once they try the command, but the article does not need to provide an example list of files unless an important point has to be made about output.
# What's Wrong with Everything Else? # What's Wrong with Everything Else?
## Man pages ## Man pages

View File

@ -142,3 +142,4 @@ You can ensure omemo automatcally turns on:
``` ```
--- ---
'OTR' encryption is mostly dead, but you can find the old instructions [here](profanity-otr).

View File

@ -6,40 +6,41 @@ tags: [ "data" ]
## New Machines ## New Machines
```sh ```bash
git config --global user.email "$YOUR_EMAIL" git config --global user.email "$YOUR_EMAIL"
``` ```
```sh ```bash
git config --global user.name "$YOUR_NAME" git config --global user.name "$YOUR_NAME"
``` ```
# New Git # New Git
Decide on algorithm: Start a git in directory `$DIR`:
- If you're scared of insecure hash-sums, go with `hash=sha256`. ```bash
- If you don't know what a hash sum is, go with `hash=sha1`. mkdir $DIR && cd $DIR
## 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: ```bash
git init
```
```sh Make a file explaining what the project does:
echo "I hereby solemnly swear never to commit a binary file." > README.md
```bash
vim README.md
```
Add this to the git:
```bash
git add README.md git add README.md
``` ```
Then make the initial commit, explaining the change you just made: Then make the initial commit, explaining the change you just made:
```sh ```bash
git commit git commit
``` ```
@ -47,17 +48,17 @@ git commit
Once you make a change to some file, add it and make a commit explaining it. Once you make a change to some file, add it and make a commit explaining it.
```sh ```bash
git add $FILE git add $FILE
``` ```
```sh ```bash
git commit -m"change $FILE" git commit -m"change $FILE"
``` ```
Check your history: Check your history:
```sh ```bash
git log git log
``` ```
@ -68,20 +69,20 @@ Give it the same name as the `$DIR` directory, above.
Add this as a remote: Add this as a remote:
```sh ```bash
REMOTE=gitlab REMOTE=gitlab
git remote add $REMOTE https://gitlab.com/$USERNAME/$DIR git remote add $REMOTE https://gitlab.com/$USERNAME/$DIR
``` ```
Tell git you're pushing the branch "master" to the remote repo "origin": Tell git you're pushing the branch "master" to the remote repo "origin":
```sh ```bash
git push -u master origin git push -u master origin
``` ```
If someone makes a change on the remote, pull it down with: If someone makes a change on the remote, pull it down with:
```sh ```bash
git pull git pull
``` ```
@ -90,31 +91,31 @@ git pull
A branch is a full copy of the project to test additional ideas. A branch is a full copy of the project to test additional ideas.
You can make a new branch called 'featurez' like this: You can make a new branch called 'featurez' like this:
```sh ```bash
git branch $FEATURE_BRANCH git branch $FEATURE_BRANCH
``` ```
Have a look at all your branches: Have a look at all your branches:
```sh ```bash
git branch git branch
``` ```
Switch to your new branch: Switch to your new branch:
```sh ```bash
git checkout $FEATURE_BRANCH git checkout $FEATURE_BRANCH
``` ```
And if your changes are rubbish, checkout the "master" branch again, then delete "featurez": And if your changes are rubbish, checkout the "master" branch again, then delete "featurez":
```sh ```bash
git branch -D $FEATURE_BRANCH git branch -D $FEATURE_BRANCH
``` ```
Or if it's a good branch, push it to the remote: Or if it's a good branch, push it to the remote:
```sh ```bash
remote=origin remote=origin
git push $remote $FEATURE_BRANCH git push $remote $FEATURE_BRANCH
``` ```
@ -123,13 +124,13 @@ git push $remote $FEATURE_BRANCH
Once you like the feature, merge it into the main branch. Switch to master then merge it: Once you like the feature, merge it into the main branch. Switch to master then merge it:
```sh ```bash
git merge $FEATURE_BRANCH git merge $FEATURE_BRANCH
``` ```
And delete the branch, as you've already merged it: And delete the branch, as you've already merged it:
```sh ```bash
git branch -d $FEATURE_BRANCH git branch -d $FEATURE_BRANCH
``` ```
@ -137,7 +138,7 @@ git branch -d $FEATURE_BRANCH
## Pulling another git repo into a subtree ## Pulling another git repo into a subtree
```sh ```bash
git subtree add -P config git@gitlab.com:bindrpg/config.git master git subtree add -P config git@gitlab.com:bindrpg/config.git master
``` ```
@ -145,27 +146,27 @@ git subtree add -P config git@gitlab.com:bindrpg/config.git master
## Delete All History ## Delete All History
```sh ```bash
git checkout --orphan temp git checkout --orphan temp
``` ```
```sh ```bash
git add -A git add -A
``` ```
```sh ```bash
git commit -am "release the commits!" git commit -am "release the commits!"
``` ```
```sh ```bash
git branch -D master git branch -D master
``` ```
```sh ```bash
git branch -m master git branch -m master
``` ```
```sh ```bash
git push -f origin master git push -f origin master
``` ```
@ -173,21 +174,21 @@ Gitlab requires more changes, such as going to `settings > repository` and switc
## Clean up Bloated Repo ## Clean up Bloated Repo
```sh ```bash
git fsck --full git fsck --full
``` ```
```sh ```bash
git gc --prune=now --aggressive git gc --prune=now --aggressive
``` ```
```sh ```bash
git repack git repack
``` ```
## Find Binary Blobs ## Find Binary Blobs
```sh ```bash
git rev-list --objects --all \ git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \ | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \ | sed -n 's/^blob //p' \

View File

@ -1,22 +0,0 @@
---
title: "Commit for Another"
tags: [ "data", "git" ]
---
You can make Alice the author, while you are still the commiter:
```sh
name="Alice Bobinson"
email="alice@email.com"
git add ${file}
git commit --author="${name} <${email}>"
```
Or, make Alice both the committer and the author:
```sh
git -c user.name="${name}" -c user.email="${email}" commit -m "${message}"
```

View File

@ -1,19 +0,0 @@
---
title: "Interactive String Substitution"
tags: [ "data", "vim", "substitution" ]
---
Want to find and replace, but also confirm each instance?
```sh
vim -c "%s/${pattern}/${replacement}/gc" -c 'wq' ${file}
```
Notice that double-quotes (`"`) in the first command (`-c`).
Alternatively, check with an example string:
```sh
sed "s/${pattern}/ARGLEBARGLE/g" ${file} | grep 'ARGLEBARGLE'
```

View File

@ -1,13 +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
```

View File

@ -5,19 +5,19 @@ tags: [ "organization" ]
Set up the configuration file: Set up the configuration file:
```sh ```bash
task task
``` ```
Add a task: Add a task:
```sh ```bash
task add update linux task add update linux
``` ```
See which task is next: See which task is next:
```sh ```bash
task next task next
``` ```
@ -25,13 +25,13 @@ Note the id number.
Mark a task as started: Mark a task as started:
```sh ```bash
task start 1 task start 1
``` ```
Once finished: Once finished:
```sh ```bash
task 1 done task 1 done
``` ```
@ -39,7 +39,7 @@ task 1 done
Add a project: Add a project:
```sh ```bash
task add project:house buy potted plant task add project:house buy potted plant
task add proj:house.repair buy screwdriver task add proj:house.repair buy screwdriver
task add proj:house.repair buy shelf brackets task add proj:house.repair buy shelf brackets
@ -51,11 +51,11 @@ task add pro:house.paint buy brushes
## Summary ## Summary
```sh ```bash
task pro:house sum task pro:house sum
``` ```
```sh ```bash
task burndown.daily pro:house task burndown.daily pro:house
``` ```
@ -63,13 +63,13 @@ The summaries will show how fast a project is being completed, and when you can
# Tags # Tags
```sh ```bash
task add +buy toothbrush task add +buy toothbrush
``` ```
You can then see only tasks which involve buying something with: You can then see only tasks which involve buying something with:
```sh ```bash
task +buy task +buy
``` ```
@ -77,27 +77,27 @@ task +buy
Set three contexts by their tags: Set three contexts by their tags:
```sh ```bash
task context define work +sa or +hr task context define work +sa or +hr
``` ```
```sh ```bash
task context define study +ed or +void or +rat task context define study +ed or +void or +rat
``` ```
```sh ```bash
task context define home -sa -hr -ed -void -rat task context define home -sa -hr -ed -void -rat
``` ```
Change to the first context. Change to the first context.
```sh ```bash
task context work task context work
``` ```
Then stop. Then stop.
```sh ```bash
task context none task context none
``` ```
@ -105,7 +105,7 @@ task context none
View list of tasks completed in the last week: View list of tasks completed in the last week:
```sh ```bash
task end.after:today-1wk completed task end.after:today-1wk completed
``` ```
@ -113,19 +113,19 @@ task end.after:today-1wk completed
Make a UDA 'size'. Make a UDA 'size'.
```sh ```bash
task config uda.size.type string task config uda.size.type string
``` ```
```sh ```bash
task config uda.size.label Size task config uda.size.label Size
``` ```
```sh ```bash
task config uda.size.values large,medium,small task config uda.size.values large,medium,small
``` ```
```sh ```bash
uda.size.default=medium uda.size.default=medium
``` ```
@ -133,7 +133,7 @@ uda.size.default=medium
This command shows tasks I'm most interested in: This command shows tasks I'm most interested in:
```sh ```bash
task next +ACTIVE or +OVERDUE or due:today or scheduled:today or pri:H task next +ACTIVE or +OVERDUE or due:today or scheduled:today or pri:H
``` ```

View File

@ -6,13 +6,13 @@ tags: [ "data", "tracking", "time", "timew" ]
Try: Try:
```sh ```bash
timew summary :yesterday timew summary :yesterday
``` ```
You can also use :week, :lastweek, :month, :quarter, :year, or a range such as: You can also use :week, :lastweek, :month, :quarter, :year, or a range such as:
```sh ```bash
timew summary today to tomorrow timew summary today to tomorrow
timew today - tomorrow timew today - tomorrow
2018-10-15T06:00 - 2018-10-17T06:00 2018-10-15T06:00 - 2018-10-17T06:00
@ -22,7 +22,7 @@ Each of these can gain with the :ids tag.
# Basics # Basics
```sh ```bash
timew start timew start
timew stop timew stop
timew continue timew continue
@ -32,7 +32,7 @@ timew tags
And add ids with: And add ids with:
```sh ```bash
timew summary :ids timew summary :ids
timew track 10am - 1pm timewarrior timew track 10am - 1pm timewarrior
timew track 1pm for 2h walk timew track 1pm for 2h walk
@ -42,50 +42,50 @@ timew track 1pm for 2h walk
First get ids. First get ids.
```sh ```bash
timew summary :ids timew summary :ids
``` ```
Then if we're looking at task @2: Then if we're looking at task @2:
```sh ```bash
timew move @2 12:00 timew move @2 12:00
timew lengthen @2 3mins timew lengthen @2 3mins
``` ```
```sh ```bash
time shorten @2 40mins time shorten @2 40mins
``` ```
# Forgetting # Forgetting
```sh ```bash
timew start 1h ago @4 timew start 1h ago @4
``` ```
Or if your action actually had a break: Or if your action actually had a break:
```sh ```bash
timew split @8 timew split @8
``` ```
Or maybe not? Or maybe not?
```sh ```bash
timew join @4 @8 timew join @4 @8
timew @8 delete timew @8 delete
``` ```
Start at previous time Start at previous time
```sh ```bash
timew start 3pm 'Read chapter 12' timew start 3pm 'Read chapter 12'
timew start 90mins ago 'Read chapter 12' timew start 90mins ago 'Read chapter 12'
``` ```
Cancel currently tracked time. Cancel currently tracked time.
```sh ```bash
timew cancel timew cancel
``` ```
@ -157,11 +157,11 @@ with:
# Fixing Errors # Fixing Errors
```sh ```bash
curl -O https://taskwarrior.org/download/timew-dbcorrection.py curl -O https://taskwarrior.org/download/timew-dbcorrection.py
``` ```
```sh ```bash
python timew-dbcorrections.py python timew-dbcorrections.py
``` ```

View File

@ -1,11 +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.

View File

@ -57,5 +57,5 @@ brightnessctl s 10%+
- [autologin](autologin.md) - [autologin](autologin.md)
- [services](sv.md) - [services](sv.md)
- [wifi](../../networking/wpa_supplicant.md) - [wifi](wpa_cli.md)

View File

@ -1,20 +0,0 @@
---
title: "Mapping the Net"
tags: [ "networking", "graph", "fun" ]
---
Find the path to a domain:
```sh
domain=bad.horse
max_hops=50
tracepath -m $maximum_hops $domain
```
If you're on Debian, you can use `graph-easy` and `dothost` to make an instant diagram:
```sh
domain=dice.camp
dothost $domain | graph-easy --boxart
```

View File

@ -10,8 +10,7 @@ tags: [ "vim", "basic" ]
## Extras ## Extras
- [Navigation](vim/navigate.md) - [Navigation](navigate.md)
- [Completion](vim/completion.md) - [Completion](vim-completion.md)
- [Search](vim/search.md) - [Search](vim-search.md)
- [Window Splits](vim/windows.md) - [Window Splits](vim-windows.md)
- [Use vim bindings in bash](vim/vim_in_bash.md)

48
vim/navigate.md Normal file
View File

@ -0,0 +1,48 @@
---
title: "vim navigation"
tags: [ "vim" ]
---
| Move | Command |
|:-----|:-------------|
|Down page | C-f |
| Down half page | C-d |
| Up page | C-b |
| Up half page | C-u |
## Scroll
> C-e
> C-y
## Jumps
Go through your last jumps:
> C-I
> C-O
Go to the last and previous places you've changed:
> g;
> g,
Go to a filename, and type `gf` (Go-to-File).
For example, if you put your cursor over the `~/.vimrc` in this line, you can edit your vim configuration file.
`source ~/.vimrc`
# Project Structure
Make a 20 character 'visual split' in the current working directory ('`.`').
> :20vs .
Change the view for this:
> C-w x

View File

@ -1,17 +1,16 @@
--- ---
title: "vim completion" title: "vim completion"
tags: [ "vim", "completion" ] tags: [ "vim" ]
requires: [ "vim basics" ]
--- ---
Complete the word by searching for the *n*ext similar word: Complete the word by searching for the *n*ext similar word:
`C-n` > C-n
Complete the word by searching for a *p*revious similar word: Complete the word by searching for a *p*revious similar word:
`C-p` > C-p
Complete the full line: Complete the full line:
`C-x C-l` > C-x C-l

View File

@ -1,23 +1,22 @@
--- ---
title: "vim search" title: "vim search"
tags: [ "vim", "search" ] tags: [ "vim" ]
requires: [ "vim basics" ]
--- ---
Search for the next and or previous occurrence of the word under your cursor with `*` and `#`. Search for the next and or previous occurrence of the word under your cursor with `*` and `#`.
Search and replace the first 'one' found with 'two': Search and replace the first 'one' found with 'two':
`:%s/one/two/` > :%s/one/two/
Same, but replace 'one' globally: Same, but replace 'one' globally:
`:%s/one/two/g` > :%s/one/two/g
Put quotes around every occurrence of `$HOME`: Put quotes around every occurrence of `$HOME`:
`:%s/$HOME/"&"` > :%s/$HOME/"&"
Same, but add curly brackets around `$HOSTNAME`: Same, but add curly brackets around `$HOSTNAME`:
`:%s/$HOSTNAME/{&}` > :%s/$HOSTNAME/{&}

14
vim/vim-windows.md Normal file
View File

@ -0,0 +1,14 @@
---
title: "vim windows"
tags: [ "vim" ]
---
| Command | Keys |
|:-----|:----:|
| split window | C-w s |
| split window vertically | C-w v |
| close window | C-q |
| change window | C-w w |
| rotate windows | C-w r |
| split open new file | :sf path/file |

View File

@ -1,14 +1,13 @@
--- ---
title: "vim in bash" title: "vim in bash"
tags: [ "vim", "bash", "inputrc" ] tags: [ "vim", "bash", "inputrc" ]
requires: [ "vim basics" ]
--- ---
Put bash in vim mode! Put bash in vim mode!
Place the following in your `~/.inputrc`: Place the following in your `~/.inputrc`:
``` ```bash
set editing-mode vi set editing-mode vi
set show-mode-in-prompt on set show-mode-in-prompt on
set vi-ins-mode-string \1\e[33;32m\2[>]=\1\e[0m\2 set vi-ins-mode-string \1\e[33;32m\2[>]=\1\e[0m\2

9
vim/vim_tricks.md Normal file
View File

@ -0,0 +1,9 @@
---
title: "Vim Tricks"
tags: [ "vim" ]
---
## Remote Editing
> vim scp://*user*@*myserver*[:*port*]//*path/to/file.txt*

View File

@ -1,78 +0,0 @@
---
title: "LaTeX Setup the Hard Way"
tags: [ "writing" ]
---
# Warm Up
1. Deep breath.
1. Cup of tea.
1. Remove the old LaTeX junk you've installed. Search for 'texlive' or 'latex' in your package manager's installed files.
1. Find `tlmgr` in your package manager.
# `tlmgr`
The LaTeX Package manager is known as `tlmgr`, and often resides in `/opt/texlive/${YEAR}/bin/x86_64-linux/tlmgr`.
Double-check the location:
```sh
ls -l /opt/texlive/${YEAR}/bin/x86_64-linux/tlmgr
ls /opt/texlive/${YEAR}/texmf-dist/scripts/texlive/tlmgr.pl
```
Double-check the year.
It should *not* match the real year, it should match the `texlive`.
## Problems along the Path
You can't use `tlmgr` unless it's in the `$PATH`.
Check if it *is* in the `$PATH` then if it *should* be in the path:
```sh
echo $PATH
grep texlive -r /etc/profile*
```
If `tlmgr` is where it should be, but not in the path, you can add it temporarily:
```sh
export PATH=${PATH}:/opt/texlive/${YEAR}/bin/x86_64-linux
```
...or just reboot.
## Usage
Search packages:
```sh
tlmgr search --global epstopdf
```
Can't find what you need?
Search for a specific file instead:
```sh
tlmgr search --global --file epstopdf-base.sty
sudo tlmgr install epstopdf-pkg
```
## Recommended Packages
```
latexmk
luatex
titletoc
titlesec
multicol
microtype
graphicx
fontspec
makeindex
imakeidx
```

View File

@ -1,36 +0,0 @@
---
title: "vim navigation"
tags: [ "vim", "navigation" ]
requires: [ "vim basics" ]
---
| Move | Command |
|:------------------------|:-------------|
| Down page | Ctl-f |
| Down half page | Ctl-d |
| Up page | Ctl-b |
| Up half page | Ctl-u |
| Scroll down | Ctl-e |
| Scroll up | Ctl-y |
| Jump to previous place | Ctl-i |
| Jump to back | Ctl-o |
| Jump to last change | g; |
| Jump to next change | g, |
| Go to current filename | gf |
Go to a filename, and type `gf` (Go-to-File).
For example, if you put your cursor over the `~/.vimrc` in this line, you can edit your vim configuration file.
`source ~/.vimrc`
# Project Structure
Make a 20 character 'visual split' in the current working directory ('`.`').
`:20vs .`
Swap buffer positions:
`C-w x`

View File

@ -1,15 +0,0 @@
---
title: "vim windows"
tags: [ "vim" ]
requires: [ "vim basics" ]
---
| Command | Keys |
|:--------------------------|:-------------------:|
| split window | `C-w s` |
| split window vertically | `C-w v` |
| close window | `C-q` |
| change window | `C-w w` |
| rotate windows | `C-w r` |
| split open new file | `:sf $filepath` |

View File

@ -1,10 +0,0 @@
---
title: "Vim Tricks"
tags: [ "vim" ]
requiered: [ "ssh" ]
---
## Remote Editing
`vim scp://*user*@*myserver*[:*port*]//*path/to/file.txt*`