Compare commits

..

No commits in common. "c95ad1076e545f02561614ef11cc99c6efd25f94" and "8f5298bc2fcf5d883d6e2179f192eab9f57c6ba8" have entirely different histories.

52 changed files with 328 additions and 343 deletions

View File

@ -1,6 +1,3 @@
MAKEFLAGS += -j
MAKEFLAGS += -s
EDITOR ?= vi
FZF != command -v sk || command -v fzy || command -v fzf || \ FZF != command -v sk || command -v fzy || command -v fzf || \
{ echo install a fuzzy finder && exit 1 ;} { echo install a fuzzy finder && exit 1 ;}
@ -11,38 +8,25 @@ help: ## Print the help message
articles != find * -type f -name "*.md" articles != find * -type f -name "*.md"
categories != ls -d */ db.rec: $(articles)
databases = $(patsubst %/, .dbs/%.rec, $(categories))
default += $(databases)
$(databases): .dbs/%.rec: %/ | .dbs/
$(info making $(@F))
mkdir -p $(@D)
for entry in $(shell find $< -type f -name "*.md") ; do \
sed -n '2,/^---$$/ {/^---$$/d; p}' "$$entry" |\
sed -e 's/\[ //' -e 's/ \]//' |\
tr -d '"' ;\
printf "wordcount: %s\n" "$$(wc -w < $$entry)" ;\
printf "file: %s\n\n" "$$entry" ;\
done >> $@
for entry in $(shell find $< -type f -name "*.md"); do \
recset $@ -e "file = '$${entry}'" -f wordcount --set-add="$$(wc -w < $${entry})" ;\
done
db.rec: $(databases)
printf '%s\n' '%rec: guide' > $@ printf '%s\n' '%rec: guide' > $@
printf '%s\n' '%type: wordcount int' >> $@ printf '%s\n' '%type: wordcount int' >> $@
printf '%s\n\n' '%sort: title' >> $@ printf '%s\n\n' '%sort: title' >> $@
cat $^ >> $@ for x in $^ ; do \
sed -n '2,/^---$$/ {/^---$$/d; p}' "$$x" |\
sed -e 's/\[ //' -e 's/ \]//' |\
tr -d '"' ;\
printf "file: %s\n\n" "$$x" ;\
done >> $@
for entry in $^; do \
recset $@ -e "file = '$${entry}'" -f wordcount --set-add="$$(wc -w < $${entry})" ;\
done
recsel $@ -e "requires != ''" -CR title,requires |\ recsel $@ -e "requires != ''" -CR title,requires |\
while read title requires; do \ while read title requires; do \
IFS=', ' && for provider in $$requires; do \ IFS=', ' && for provider in $$requires; do \
recset $@ -e "title = '$${provider}'" -f provides -a "$${title}" ;\ recset $@ -e "title = '$${provider}'" -f provides -a "$${title}" ;\
done ;\ done ;\
done done
$(info Created main database: $@)
recfix --sort $@ recfix --sort $@
default += db.rec default += db.rec
@ -57,14 +41,13 @@ database: $(default) ## Make a recfiles database
.PHONY: article .PHONY: article
article: ## Write an article article: ## Write an article
@path=$$(find $(categories) -type d | sort | uniq | $(FZF)) ;\ @path=$$(find . -type d -printf '%P\n' | $(FZF)); \
read -p "Title: " title ;\ read -p "Title: " title; \
filename="$$(echo "$$title" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')" ;\ printf '%s\n' '---' >> $$path/$$title.md ; \
printf '%s\n' '---' >> $$path/$$filename.md ;\ printf 'title: "%s"\n' "$$title" >> $$path/$$title.md ; \
printf 'title: "%s"\n' "$$title" >> $$path/$$filename.md ;\ printf 'tags: [ "%s" ]\n' "$$path" | sed 's#\/#", "#g' >> $$path/$$title.md ; \
printf 'tags: [ "%s" ]\n' "$$path" | sed 's#\/#", "#g' >> $$path/$$filename.md ;\ printf '%s\n\n' '---' >> $$path/$$title.md ;\
printf '%s\n\n' '---' >> $$path/$$filename.md ;\ $(EDITOR) +5 $$path/$$title.md
$(EDITOR) +5 "$$path/$$filename.md"
.PHONY: clean .PHONY: clean
clean: ## Remove all generated files clean: ## Remove all generated files

View File

@ -8,19 +8,7 @@ The Linux Knowledge-Base provides quick-start guides for working with terminal p
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: `make`
```sh
make
make 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 ~ 'bash'" -R title,wordcount
```
# Style # Style

View File

@ -6,20 +6,7 @@ tags: [ "fun" ]
- `asciiquarium` - `asciiquarium`
- `cbonsai -lim "$(fortune)"` - `cbonsai -lim "$(fortune)"`
```sh ```bash
cow=$(cowsay -l | sort -R | head -1) cow=$(cowsay -l | sort -R | head -1)
fortune -s | figlet | cowsay -nf $cow | lolcat fortune -s | figlet | cowsay -nf $cow | lolcat
``` ```
Watch the [Collatz Conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture) collapse:
```sh
x="$(du -sc ~/.cache | tr -d '[:alpha:]' | tail -1)"
until [ "$x" -eq "1" ]; do
test "$(( x % 2 ))" -eq 0 && x=$(( x / 2 )) || \
x=$(( x * 3 + 1 ))
clear -x
figlet "$x" | lolcat
sleep 1
done
```

View File

@ -1,6 +1,6 @@
--- ---
title: "at" title: "at"
tags: [ "Basics", "time" ] tags: [ "Basics" ]
--- ---
Install with: Install with:

View File

@ -342,12 +342,11 @@ apt install $PROGRAM
Remove `lolcat`, because it's useless: Remove `lolcat`, because it's useless:
```sh ```bash
sudo apt remove lolcat sudo apt remove lolcat
``` ```
...and that's pretty much it. ... and that's pretty much it. You can move, create, destroy, install things, and look things up.
You can move, create, destroy, install things, and look things up.
# Review # Review

View File

@ -1,6 +1,6 @@
--- ---
title: "clock" title: "clock"
tags: [ "Basics", "time" ] tags: [ "Basics" ]
--- ---
Show system time: Show system time:

View File

@ -1,6 +1,6 @@
--- ---
title: "cron" title: "cron"
tags: [ "Basics", "time" ] tags: [ "Basics" ]
--- ---
# Cronie # Cronie

View File

@ -1,6 +1,6 @@
--- ---
title: "locale" title: "locale"
tags: [ "Basics", "time" ] tags: [ "Basics" ]
--- ---
Your locale tells the computer your location, preferred time-and-date format, standard language, papersize, et c. Your locale tells the computer your location, preferred time-and-date format, standard language, papersize, et c.

View File

@ -6,30 +6,59 @@ tags: [ "Basics" ]
`type` shows what kind of thing you're running, be it an alias, function, or binary program. `type` shows what kind of thing you're running, be it an alias, function, or binary program.
```sh ```bash
type cd type cmus
type ls
type -P ls
type -a cat
``` ```
![where is cmus?](/tapes/which.gif) ![where is cmus?](/tapes/which.gif)
# Whereis the Program # Whereis the Program
Where is `grep` and all its configuration files? Ask where the `angband` program is, along with all its configuration files:
```sh `whereis angband`
whereis grep
Also `which` shows where a binary file (the program) is,
```bash
which cmus
``` ```
Which one of these is the binary file which you actually use? # Search Instantly with `plocate`
```sh You can search every file on the computer instantly by installing `plocate`.
which grep
Once installed, run `sudo updatedb` to create the database of (nearly) every file on the computer.
Check how big the database is:
```bash
du -h /var/lib/plocate/plocate.db
``` ```
# More Once you have the database, you can find nearly any file instantly.
- [Search instantly with `plocate`](data/search_system.md) - Search for gifs: `locate .gif`
- Search for gifs in the `/usr/` directory: `locate /usr/ .gif`
- 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).
## Search More Places
`plocate` will not search `/tmp/`, because nobody cares about those files, and won't search inside `/mnt/`, because that's where USB sticks get mounted, so the files keep changing as USB sticks come and go.
Change where `plocate` searches by editing the configuration file at `/etc/updatedb.conf`.
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.
```bash
cat /etc/updatedb.conf
sudo sed 's#/mnt/##' /etc/updatedb.conf
sudo updatedb
plocate --regex '.mp4$|.mkv$|.wmv$|.webm$|.mov$|.avi$'
```

View File

@ -1,6 +1,6 @@
--- ---
title: "time" title: "time"
tags: [ "Basics", "time" ] tags: [ "Basics" ]
--- ---
# systemd # systemd

57
chat/profanity-otr.md Normal file
View File

@ -0,0 +1,57 @@
---
title: "profanity"
tags: [ "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
```

View File

@ -5,25 +5,25 @@ tags: [ "Chat" ]
See available pastebins: See available pastebins:
```sh ```bash
wgetpaste -S wgetpaste -S
``` ```
Upload script.sh to bpaste: Upload script.sh to bpaste:
```sh ```bash
wgetpaste -s bpaste script.sh wgetpaste -s bpaste script.sh
``` ```
Input clipboard to dpaste with the heading "Title" Input clipboard to dpaste with the heading "Title"
```sh ```bash
wgetpaste -s dpaste -d Title -x wgetpaste -s dpaste -d Title -x
``` ```
Paste in the file then load the result to the right-hand clipboard: Paste in the file then load the result to the right-hand clipboard:
```sh ```bash
wgetpaste -s dpaste -X wgetpaste -s dpaste -X
``` ```

View File

@ -1,6 +1,6 @@
--- ---
title: "Archives" title: "Archives"
tags: [ "tar", "backups", ".tgz", "tar.gz" ] tags: [ "tar", "backups" ]
--- ---
# `tar` # `tar`

View File

@ -1,6 +1,6 @@
--- ---
title: "unison" title: "unison"
tags: [ "Backups", "synch" ] tags: [ "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). 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).

View File

@ -1,7 +1,6 @@
--- ---
title: "gpg" title: "gpg"
tags: [ "vim", "data", "GPG" ] tags: [ "vim", "data", "GPG" ]
requires: [ "GPG Basics", "vim basics" ]
--- ---
The `vim-gnupg` plugin lets vim edit gpg-encrypted files as if they were unencrypted. The `vim-gnupg` plugin lets vim edit gpg-encrypted files as if they were unencrypted.

View File

@ -1,11 +1,8 @@
--- ---
title: "PDF Metadata Erasure" title: "PDF Metadata Erasure"
tags: [ "Metadata", "Ghost Script", "gs", ".pdf" ] tags: [ "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'. Make a text file called 'pdfmark.txt'.

View File

@ -1,7 +1,6 @@
--- ---
title: "Board Games with Recfiles" title: "Board Games"
tags: [ "data", "recfiles", "games" ] tags: [ "data", "recfiles", "games" ]
requires: "Recfiles"
--- ---
You can play with a board games database from boardgamegeek.com. You can play with a board games database from boardgamegeek.com.

View File

@ -1,6 +1,6 @@
--- ---
title: "sc-im" title: "sc-im"
tags: [ "TUI", "data", "spreadsheet", ".csv" ] tags: [ "TUI", "data" ]
--- ---
- [Sample file](sc-im/sample.sc) - [Sample file](sc-im/sample.sc)

View File

@ -1,49 +0,0 @@
---
title: "Search System"
tags: [ "data", "search", "locate", "plocate" ]
requires: "cron"
---
You can search every file on the computer instantly by installing `plocate`.
Once installed, run `sudo updatedb` to create the database of (nearly) every file on the computer.
Check how big the database is:
```sh
du -h /var/lib/plocate/plocate.db
```
Once you have the database, you can find nearly any file instantly.
- Search for gifs: `locate .gif`
- Search for gifs in the `/usr/` directory: `locate /usr/ .gif`
- 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).
## Search More Places
`plocate` will not search `/tmp/`, because nobody cares about those files, and won't search inside `/mnt/`, because that's where USB sticks get mounted, so the files keep changing as USB sticks come and go.
Change where `plocate` searches by editing the configuration file at `/etc/updatedb.conf`.
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.
```bash
su root
cat /etc/updatedb.conf
sed -i 's#/mnt/##' /etc/updatedb.conf
updatedb
exit
```
Now you can search in `/mnt` for films:
```sh
plocate --regex '.mp4$|.mkv$|.wmv$|.webm$|.mov$|.avi$'
```

View File

@ -1,6 +1,6 @@
--- ---
title: "Soft Serve through https" title: "Soft Serve through https"
tags: [ "data", "git server", "lfs" ] tags: [ "data", "git", "lfs" ]
--- ---
## `http` Setup ## `http` Setup

View File

@ -1,6 +1,6 @@
--- ---
title: "timewarrior" title: "timew"
tags: [ "Data", "tracking", "time", "timew" ] tags: [ "Data" ]
--- ---
# Summaries # Summaries

View File

@ -8,7 +8,7 @@ tags: [ "networking", "ssh", "android" ]
3. Open fdroid, and run: 3. Open fdroid, and run:
```sh ```bash
pkg upgrade pkg upgrade
pkg install busybox termux-services openssh openssh-sftp-server pkg install busybox termux-services openssh openssh-sftp-server
source $PREFIX/etc/profile.d/start-services.sh source $PREFIX/etc/profile.d/start-services.sh

View File

@ -6,20 +6,19 @@ tags: [ "distros" ]
Update font-cache: Update font-cache:
```sh ```bash
su root
fc-cache fc-cache
``` ```
List fonts: List fonts:
```sh ```bash
fc-list fc-list
``` ```
Grab the part of the font name you need for Xresources: Grab the part of the font name you need for Xresources:
```sh ```bash
fc-list | cut -d: -f2 fc-list | cut -d: -f2
``` ```

View File

@ -8,27 +8,27 @@ tags: [ "distros" ]
Messed up a package's configuration files? Messed up a package's configuration files?
```sh ```bash
sudo apt-get purge [thing] sudo apt-get purge [thing]
``` ```
```sh ```bash
sudo apt autoremove sudo apt autoremove
``` ```
Check if you still have related things: Check if you still have related things:
```sh ```bash
apt search [thing] apt search [thing]
``` ```
```sh ```bash
sudo apt-get install [ thing ] sudo apt-get install [ thing ]
``` ```
Still have problems? Still have problems?
```sh ```bash
sudo dpgk --force-confmiss -i /var/cache/apt/archives/[thing] sudo dpgk --force-confmiss -i /var/cache/apt/archives/[thing]
``` ```

View File

@ -4,21 +4,15 @@ tags: [ "Void" ]
--- ---
Put your device in 'aeroplane' mode (e.g. where no trace of signal leaves it) by turning off Wi-Fi and blue-tooth. Put your device in 'aeroplane' mode (e.g. where no trace of signal leaves it) by turning off Wi-Fi and blue-tooth.
```sh > sudo sv stop wpa_supplicant bluetoothd
su root
sv stop wpa_supplicant bluetoothd
```
Find your device's name with `ip a`. Find your device's name with `ip a`.
If unsure, try this: If unsure, try this:
```sh > name=$(ip a | grep -Eo 'wlp\w{3}')
name=$(ip a | grep -Eo 'wlp\w{3}')
echo $name > echo $name
```
Then set that device down: Then set that device down:
```sh > sudo ip link set $name down
ip link set $name down
```

View File

@ -4,19 +4,19 @@ tags: [ "Void" ]
--- ---
Monitor all processes: Monitor all processes:
```sh ```bash
extrace extrace
``` ```
Monitor one process: Monitor one process:
```sh ```bash
extrace ls extrace ls
``` ```
Monitor a script: Monitor a script:
```sh ```bash
./script.sh | extrace ./script.sh | extrace
``` ```

View File

@ -9,17 +9,16 @@ Jenkins is janky.
## Start ## Start
Start the service file. Start the service file.
```sh ```bash
su root sudo ln -s /etc/sv/jenkins /var/service
ln -s /etc/sv/jenkins /var/service sudo sv start jenkins
sv start jenkins
``` ```
Then visit the web interface with `$BROWSER localhost:8080`. Then visit the web interface with `$BROWSER localhost:8080`.
If it's not working, try running the command from the run file the first time: If it's not working, try running the command from the run file the first time:
```sh ```bash
chpst -u jenkins java -jar /opt/jenkins/jenkins.war chpst -u jenkins java -jar /opt/jenkins/jenkins.war
``` ```

View File

@ -6,13 +6,13 @@ tags: [ "void", "locale" ]
Check the current locales: Check the current locales:
```sh ```bash
locale -a locale -a
``` ```
Add the languages you want by editing `/etc/default/libc-locales`, and uncommenting your choice: Add the languages you want by editing `/etc/default/libc-locales`, and uncommenting your choice:
```sh ```bash
#en_DK.UTF-8 UTF-8 #en_DK.UTF-8 UTF-8
#en_DK ISO-8859-1 #en_DK ISO-8859-1
en_GB.UTF-8 UTF-8 en_GB.UTF-8 UTF-8
@ -25,14 +25,13 @@ Now you can generate what you need for those languages.
However, instead of generating what you need, you're going to generate everything which needs updating: However, instead of generating what you need, you're going to generate everything which needs updating:
```sh ```bash
su root sudo xbps-reconfigure glibc-locales
xbps-reconfigure glibc-locales
``` ```
Finally, select your chosen locale by placing it in `/etc/locale.conf`. Finally, select your chosen locale by placing it in `/etc/locale.conf`.
```sh ```bash
echo "LC_ALL=en_GB.UTF-8 echo "LC_ALL=en_GB.UTF-8
LANG=en_GB.UTF-8 LANG=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8" > /etc/locale.conf LANGUAGE=en_GB.UTF-8" > /etc/locale.conf
@ -49,7 +48,7 @@ en_GB ISO-8859-1
Check your new locales are available: Check your new locales are available:
```sh ```bash
locale -a locale -a
``` ```

View File

@ -1,6 +1,6 @@
--- ---
title: "brightness" title: "brightness"
tags: [ "hardware", "laptop" ] tags: [ "hardware" ]
--- ---
# Brightness # Brightness

View File

@ -4,13 +4,9 @@ tags: [ "hardware" ]
--- ---
See screen size See screen size
```sh > xrandr -q
xrandr -q
```
Automatically configure: Automatically configure:
```sh > xrandr --auto
xrandr --auto
```

View File

@ -6,11 +6,11 @@ tags: [ "Sound" ]
Add your user to the audio group, and install `festival-english`. Add your user to the audio group, and install `festival-english`.
```sh ```bash
echo "(Parameter.set 'Audio_Method 'Audio_Command)" >> /usr/share/festival/voices.scm echo "(Parameter.set 'Audio_Method 'Audio_Command)" >> /usr/share/festival/voices.scm
``` ```
```sh ```bash
echo "(Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")" /usr/share/festival/voices.scm echo "(Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")" /usr/share/festival/voices.scm
``` ```

View File

@ -1,6 +1,6 @@
--- ---
title: "Makefiles" title: "Makefiles"
tags: [ "system", "make" ] tags: [ "system", "makefiles" ]
--- ---
The `make` system wants to know: The `make` system wants to know:
@ -11,7 +11,7 @@ The `make` system wants to know:
Start with a basic test-area. Start with a basic test-area.
```sh ```bash
mkdir make_test ; cd $_ mkdir make_test ; cd $_
printf "%s:\n" README.md > Makefile printf "%s:\n" README.md > Makefile
printf "\t%s\n" 'echo "Basic makefile example." > $@' >> Makefile printf "\t%s\n" 'echo "Basic makefile example." > $@' >> Makefile
@ -32,6 +32,8 @@ README.md: Makefile
echo '```' >> $@ echo '```' >> $@
cat $< >> $@ cat $< >> $@
echo '```' >> $@ echo '```' >> $@
``` ```
Note the order: Note the order:
@ -90,7 +92,7 @@ $(storage_directory)/README.md: README.md
Now you can tell `make` to create the backup: Now you can tell `make` to create the backup:
```sh ```bash
make backups/README.md make backups/README.md
``` ```

View File

@ -1,6 +1,6 @@
--- ---
title: "Makefile Graphs" title: "Makefile Graphs"
tags: [ "system", "make", "graph" ] tags: [ "system", "makefiles", "graph" ]
--- ---
If you have `graph-easy` (often in the package `perl-graph-easy` or similar), you can make a graph from the makefile with `make2graph` (the package is often called `makefile2graph`). If you have `graph-easy` (often in the package `perl-graph-easy` or similar), you can make a graph from the makefile with `make2graph` (the package is often called `makefile2graph`).

View File

@ -1,6 +1,6 @@
--- ---
title: "Makefiles" title: "Makefiles"
tags: [ "system", "make", "help" ] tags: [ "system", "makefiles", "help" ]
--- ---
Make your first target 'help' to give an overview of the main targets. Make your first target 'help' to give an overview of the main targets.

View File

@ -1,7 +1,7 @@
--- ---
title: "Makefile Patterns" title: "Makefile Patterns"
tags: [ "system", "make" ] tags: [ "system", "makefiles" ]
--- ---
Using the [basic example](../Makefile.md), you can make a complete backup of all backup files. Using the [basic example](../Makefile.md), you can make a complete backup of all backup files.
@ -27,6 +27,7 @@ backups/backup.tgz: backups/backup_29.md backups/backup_30.md
tar czf backups/backup.tgz backups/backup_29.md backups/backup_30.md tar czf backups/backup.tgz backups/backup_29.md backups/backup_30.md
``` ```
The phony `backup` target should now point to this tar backup. The phony `backup` target should now point to this tar backup.

View File

@ -1,6 +1,6 @@
--- ---
title: "awk" title: "awk"
tags: [ "System", ".csv" ] tags: [ "System" ]
--- ---
# Basics # Basics

View File

@ -30,7 +30,7 @@ There are a bunch of files:
Goal: swap the word "Column" for "Alice" in all files. Goal: swap the word "Column" for "Alice" in all files.
```sh ```
IFS=$'\n' IFS=$'\n'
for f in $(find . -name "Col*"); do for f in $(find . -name "Col*"); do
mv "$f" $(echo "$f" | sed s/Column/Alice/) mv "$f" $(echo "$f" | sed s/Column/Alice/)

View File

@ -1,24 +1,26 @@
--- ---
title: "character-encoding" title: "character-encoding"
tags: [ "System", "encoding" ] tags: [ "System" ]
--- ---
Convert a text file from one encoding type to another with: Convert a text file from one encoding type to another with:
```sh ```bash
iconv -f ascii -t utf8 oldfilename > newfilename iconv -f ascii -t utf8 oldfilename > newfilename
``` ```
Available options are: Available options are:
- ISO-8859-15 * ISO-8859-15
- UTF-8
- ASCII * UTF-8
- Lots more
* ASCII
* Lots more
Generate a full list of encoding types available with: Generate a full list of encoding types available with:
```sh ```bash
iconv -l iconv -l
``` ```

View File

@ -1,6 +1,6 @@
--- ---
title: "deduplicate" title: "deduplicate"
tags: [ "system", "deduplicate", "maintenance", "storage" ] tags: [ "system", "deduplicate", "duplicates", "maintenance" ]
--- ---
`rdfind`: find duplicate files, then delete them, or turn them into links. `rdfind`: find duplicate files, then delete them, or turn them into links.

View File

@ -1,24 +1,27 @@
--- ---
title: "$EDITOR" title: "$EDITOR"
tags: [ "system" ] tags: [ "System" ]
--- ---
The System's default text editor can be defined within /etc/profile. It's given the variable `EDITOR`. The System's default text editor can be defined within /etc/profile. It's given the variable `EDITOR`.
Add these lines to `/etc/profile.d/custom.sh`: Add these lines to `/etc/profile.d/local.sh`:
```
export EDITOR=vim
export VISUAL=$EDITOR
```sh
echo 'export EDITOR=vim' >> /etc/profile.d/custom.sh
echo 'export VISUAL=$EDITOR' >> /etc/profile.d/custom.sh
``` ```
Then reload that profile with: Then reload that profile with:
```sh ```bash
source /etc/profile source /etc/profile
``` ```
If you want to ensure `nano` never appears again: If you want to ensure `nano` never appears again:
```sh ```bash
sudo ln -sf $(which vim) $(which nano) sudo ln -sf $(which vim) $(which nano)
``` ```

View File

@ -1,6 +1,6 @@
--- ---
title: "fstab" title: "fstab"
tags: [ "system", "disk" ] tags: [ "System" ]
--- ---
# Basics # Basics
@ -29,7 +29,7 @@ Ignore this obsolete option.
## 6: Pass ## 6: Pass
| Number | Meaning | | Number | Meaning |
|:------:|:---------------------:| | | |
| 0 | Swap (or not mounted) | | 0 | Swap (or not mounted) |
| 1 | Mount at / | | 1 | Mount at / |
| 2 | Mount somewhere else | | 2 | Mount somewhere else |
@ -37,5 +37,5 @@ Ignore this obsolete option.
## Options ## Options
- `nofail` means the computer will not fail to boot, even if the drive fails, or is unplugged. It's a good option for everything except `/`. - `nofail` means the computer will not fail to boot, even if the drive fails, or is unplugged. It's a good option for everything except `/`.
- `noauto` means 'don't mount on boot' (but you can still mount with `mount -a`). - noauto means 'don't mount on boot' (but you can still mount with `mount -a`).

View File

@ -1,41 +1,41 @@
--- ---
title: "kernel" title: "kernel"
tags: [ "system" ] tags: [ "System" ]
--- ---
Check which kernet modules are loaded into memory
Check which kernel modules are loaded into memory: ```bash
sudo /sbin/lsmod
```sh
su root
/sbin/lsmod
``` ```
Check which virtual box modules are loaded into memory Check which virtual box modules are loaded into memory
```sh ```bash
/sbin/lsmod | grep vbox sudo /sbin/lsmod | grep vbox
``` ```
Virtual box is using vboxpci, vboxnetadp, vboxnetflt, vboxdr. Virtual box is using vboxpci, vboxnetadp, vboxnetflt, vboxdr.
Look at what's claiming wifi: Look at what's claiming wifi:
```sh ```bash
lshw -C network sudo lshw -C network
``` ```
If this shows that the device is 'unclaimed' then it's time to add a module, e.g. ath9k. If this shows that the device is 'unclaimed' then it's time to add a module, e.g. ath9k.
```sh ```bash
modprobe ath9k sudo modprobe ath9k
``` ```
Modules can also be 'restarted' by removing and adding them, e.g. the video module, 'uvcvideo': Modules can also be 'restarted' by removing and adding them, e.g. the video module, 'uvcvideo':
```sh ```bash
rmmod uvcvideo sudo rmmod uvcvideo
``` ```
```sh ```bash
modprobe uvcvideo sudo modprobe uvcvideo
``` ```

View File

@ -1,6 +1,6 @@
--- ---
title: "lf - The Light File Manager" title: "lf - The Light File Manager"
tags: [ "File Browser", "TUI" ] tags: [ "File Browser" ]
--- ---
![lf](/tapes/lf.gif) ![lf](/tapes/lf.gif)

View File

@ -1,6 +1,6 @@
--- ---
title: "mdadm" title: "mdadm"
tags: [ "RAID", "disk" ] tags: [ "RAID" ]
--- ---
# RAID5 # RAID5

View File

@ -15,7 +15,6 @@ Show memory usage in Gibitytes.
```bash ```bash
free -g free -g
``` ```
Show low and high gigibtye usage on a *l*ine, and repeat the measurement every 5 seconds: Show low and high gigibtye usage on a *l*ine, and repeat the measurement every 5 seconds:
```bash ```bash

View File

@ -2,12 +2,10 @@
title: "partitions" title: "partitions"
tags: [ "System" ] tags: [ "System" ]
--- ---
# FDisk Basics # FDisk Basics
```sh ```bash
su root sudo fdisk /dev/sda
fdisk /dev/sda
``` ```
- m for help. - m for help.
@ -33,20 +31,20 @@ fdisk will not help with a GPT formatted drive. For this, use gdisk, which is m
Now that we have a partition, we can make it into a fileSystem. Most will use: Now that we have a partition, we can make it into a fileSystem. Most will use:
```sh ```bash
mkfs -t ext4 /dev/sdc1 sudo mkfs -t ext4 /dev/sdc1
``` ```
or if you're making a swap partition, you can use: or if you're making a swap partition, you can use:
```sh ```bash
mkswap /dev/sdb2 sudo mkswap /dev/sdb2
``` ```
or for the reiser fileSystem, we can use: or for the reiser fileSystem, we can use:
```sh ```bash
mkreiserfs /dev/sdc2 sudo mkreiserfs /dev/sdc2
``` ```
# File System Types # File System Types
@ -63,86 +61,86 @@ mkreiserfs /dev/sdc2
# Parted # Parted
```sh ```bash
parted /dev/sdb sudo parted /dev/sdb
``` ```
# Monitoring # Monitoring
Look at physical and virtual partitions: Look at physical and virtual partitions:
```sh ```bash
df -h df -h
``` ```
or divide things by inode - the thing which records where files are? or divide things by inode - the thing which records where files are?
```sh ```bash
df -i df -i
``` ```
Examine a fileSystem with: Examine a fileSystem with:
```sh ```bash
dumpe2fs /dev/sda1 | less sudo dumpe2fs /dev/sda1 | less
``` ```
# Prevention # Prevention
There are multiple programs which work mostly the same way. There are multiple programs which work mostly the same way.
```sh ```bash
tune2fs -c 30 /dev/sda1 sudo tune2fs -c 30 /dev/sda1
``` ```
This will check sda1 every 30 boots. It can also be checked every month. This will check sda1 every 30 boots. It can also be checked every month.
```sh ```bash
tune2fs -i 1m /dev/sda1 sudo tune2fs -i 1m /dev/sda1
``` ```
This thing can also make a new label for the System: This thing can also make a new label for the System:
```sh ```bash
tune2fs -L new_name /dev/sdb3 sudo tune2fs -L new_name /dev/sdb3
``` ```
# Repair # Repair
Start by unmounting the fileSystem. Start by unmounting the fileSystem.
```sh ```bash
umount /dev/sdc1 sudo umount /dev/sdc1
``` ```
Then it's time to check. Then it's time to check.
```sh ```bash
fsck /dev/sdc1 sudo fsck /dev/sdc1
``` ```
And possibly repair damage: And possibly repair damage:
```sh ```bash
e2fsck -p /dev/sdc1 e2fsck -p /dev/sdc1
``` ```
or the same with: or the same with:
```sh ```bash
debugfs /dev/sdc1 sudo debugfs /dev/sdc1
``` ```
# Mounting # Mounting
You can mount with a specified filetype with: You can mount with a specified filetype with:
```sh ```bash
mount -t ext3 /dev/sdc2 /mnt/stick sudo mount -t ext3 /dev/sdc2 /mnt/stick
``` ```
or if you don't know the type, just try the lot: or if you don't know the type, just try the lot:
```sh ```bash
mount -a /dev/sdc1 /mnt/stick sudo mount -a /dev/sdc1 /mnt/stick
``` ```
# File Systems # File Systems
@ -154,35 +152,35 @@ NB: When I followed these instructions, the process destroyed my data. Seemed fi
Check the fileSystem's health: Check the fileSystem's health:
```sh ```bash
e2fsck -f /dev/sdb1 sudo e2fsck -f /dev/sdb1
``` ```
Resize the file System to something smaller than what you want, so here I want 500G and so I resize to 450 G. Resize the file System to something smaller than what you want, so here I want 500G and so I resize to 450 G.
```sh ```bash
resize2fs /dev/sdb1 450G resize2fs /dev/sdb1 450G
``` ```
Then delete the partition with either gdisk or fdisk, depending upon the layout. Then delete the partition with either gdisk or fdisk, depending upon the layout.
```sh ```bash
fdisk /dev/sdb sudo fdisk /dev/sdb
``` ```
```sh ```bash
d d
``` ```
Then make a new fileSystem of the desired type with: Then make a new fileSystem of the desired type with:
```sh ```bash
n n
``` ```
And finally resize to the full size you want: And finally resize to the full size you want:
resize2fs /dev/sdb1 sudo resize2fs /dev/sdb1
And then check your disk again with e2fsck. And then check your disk again with e2fsck.
@ -195,18 +193,20 @@ Let's start with names. PV = 'Physical Volume', VG = 'Volume Group', and LV = '
Now we can create a volume group out of sdb2 and sdc3: Now we can create a volume group out of sdb2 and sdc3:
```sh ```bash
vgcreate my-new-vg /dev/sdb2 /dev/sdc3 sudo vgcreate my-new-vg /dev/sdb2 /dev/sdc3
``` ```
Then make a new logical volume out of the volume group: Then make a new logical volume out of the volume group:
```sh ```bash
lvcreate -n my-new-lv my-new-vg sudo lvcreate -n my-new-lv my-new-vg
``` ```
Then have a look at all logical volumes: Then have a look at all logical volumes:
```sh ```bash
lvscan sudo lvscan
``` ```

View File

@ -4,47 +4,49 @@ tags: [ "basics" ]
--- ---
# Making a Swap File # Making a Swap File
```sh ```bash
su root
cd /var/cache/ cd /var/cache/
dd if=/dev/zero of=swapfile bs=1K count=4M ```
```bash
sudo dd if=/dev/zero of=swapfile bs=1K count=4M
``` ```
This creates a swapfile of (1k x 4M) 4 Gigs. This creates a swapfile of (1k x 4M) 4 Gigs.
Change 4M to XM for an XGig swap. Change 4M to XM for an XGig swap.
```sh ```bash
chmod 600 swapfile sudo chmod 600 swapfile
``` ```
```sh ```bash
mkswap swapfile sudo mkswap swapfile
``` ```
```sh ```bash
swapon swapfile sudo swapon swapfile
``` ```
Test it's working with top Test it's working with top
```sh ```bash
top -bn1 | grep -i swap top -bn1 | grep -i swap
``` ```
or: or:
```sh ```bash
echo "/var/cache/swapfile none swap sw 0 0" | tee -a /etc/fstab echo "/var/cache/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
``` ```
Test it'll work at boot with: Test it'll work at boot with:
```sh ```bash
swapoff swapfile sudo swapoff swapfile
``` ```
```sh ```bash
swapon -va sudo swapon -va
``` ```
# Partition Swaps # Partition Swaps
@ -55,13 +57,13 @@ Put this in /etc/fstab:
Then test it works with: Then test it works with:
```sh ```bash
swapon -va sudo swapon -va
``` ```
Test other partitions in fstab with: Test other partitions in fstab with:
```sh ```bash
mount -a sudo mount -a
``` ```

View File

@ -1,10 +1,10 @@
--- ---
title: "tmux" title: "tmux"
tags: [ "system" ] tags: [ "System" ]
--- ---
Start with: Start with:
```sh ```bash
tmux tmux
``` ```
@ -34,21 +34,21 @@ In addition to Windows, there are panes.
Crate a new session with the name 'backup'. Crate a new session with the name 'backup'.
```sh ```bash
tmux new -s backup tmux new -s backup
``` ```
List sessions: List sessions:
```sh ```bash
tmux list-sessions tmux list-sessions
``` ```
```sh ```bash
tmux kill-session -t 2 tmux kill-session -t 2
``` ```
```sh ```bash
tmux attach -t backup tmux attach -t backup
``` ```

View File

@ -2,21 +2,21 @@
title: "Docker" title: "Docker"
tags: [ "documentation", "Virtualization" ] tags: [ "documentation", "Virtualization" ]
--- ---
```sh ```bash
sudo pacman -S docker sudo pacman -S docker
``` ```
```sh ```bash
sudo usermod -aG docker $USER sudo usermod -aG docker $USER
``` ```
```sh ```bash
sudo systemctl start docker sudo systemctl start docker
``` ```
You need to either log out and back in again to be in the docker group, or run everything as root. You need to either log out and back in again to be in the docker group, or run everything as root.
```sh ```bash
# docker info # docker info
``` ```
@ -24,19 +24,19 @@ This should show you things are working.
Search for a distro you want Search for a distro you want
```sh ```bash
docker search debian docker search debian
``` ```
If you get a hit, pull it. If you get a hit, pull it.
```sh ```bash
docker pull debian docker pull debian
``` ```
Then run a live image: Then run a live image:
```sh ```bash
docker run -it debian docker run -it debian
``` ```
@ -44,13 +44,13 @@ docker run -it debian
Check currently running containers with Check currently running containers with
```sh ```bash
docker ps docker ps
``` ```
Check all containers with Check all containers with
```sh ```bash
docker ps -a docker ps -a
``` ```
@ -58,7 +58,7 @@ Now we can get a list of all containers.
To delete one, take the id, e.g. '97796727e883', and run: To delete one, take the id, e.g. '97796727e883', and run:
```sh ```bash
docker rm 97796727e883 docker rm 97796727e883
``` ```
@ -66,7 +66,7 @@ docker rm 97796727e883
Get a list of docker container ips Get a list of docker container ips
```sh ```bash
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' *container_name_or_id* docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' *container_name_or_id*
``` ```

View File

@ -6,27 +6,27 @@ tags: [ "System" ]
## Arch Linux ## Arch Linux
```sh ```bash
sudo pacman -S virtualbox-host-modules-arch virtualbox-guest-iso sudo pacman -S virtualbox-host-modules-arch virtualbox-guest-iso
``` ```
```sh ```bash
sudo modprobe vboxdrv sudo modprobe vboxdrv
``` ```
```sh ```bash
# vboxreload # vboxreload
``` ```
Make dd image into vdi Make dd image into vdi
```sh ```bash
VBoxManage convertdd base.dd output.vdi --format VDI VBoxManage convertdd base.dd output.vdi --format VDI
``` ```
If this doesn't work, try to make a new bite size with just If this doesn't work, try to make a new bite size with just
```sh ```bash
sudo dd if=image.dd of=image2.dd bs=512 conv=sync sudo dd if=image.dd of=image2.dd bs=512 conv=sync
``` ```
@ -34,19 +34,19 @@ sudo dd if=image.dd of=image2.dd bs=512 conv=sync
List boxes: List boxes:
```sh ```bash
VBoxManage list vms VBoxManage list vms
``` ```
Start a headless instance Start a headless instance
```sh ```bash
VBoxManage startvm "rata" --type headless VBoxManage startvm "rata" --type headless
``` ```
To pause the machine: To pause the machine:
```sh ```bash
VBoxManage controlvm "rata" pause --type headless VBoxManage controlvm "rata" pause --type headless
``` ```
@ -64,15 +64,15 @@ You can do a number of things to virtualboxes this way:
Creating a VM requires registering it: Creating a VM requires registering it:
```sh ```bash
VBoxManage createvm --name Ubuntu19.04 --register --ostype Ubuntu VBoxManage createvm --name Ubuntu19.04 --register --ostype Ubuntu
``` ```
```sh ```bash
VBoxManage modifyvm Ubuntu19.04 --memory 1042 VBoxManage modifyvm Ubuntu19.04 --memory 1042
``` ```
```sh ```bash
VBoxManage storagectl Ubuntu19.04 -name IDE --add ide --controller PIIX4 --bootable on VBoxManage storagectl Ubuntu19.04 -name IDE --add ide --controller PIIX4 --bootable on
``` ```

View File

@ -5,15 +5,15 @@ tags: [ "xe", "virtualization", "volume" ]
# Make a local iso repository # Make a local iso repository
```sh ```bash
STORE_PATH=/var/opt/xen/ISO_Store STORE_PATH=/var/opt/xen/ISO_Store
``` ```
```sh ```bash
mkdir -p $STORE_PATH mkdir -p $STORE_PATH
``` ```
```sh ```bash
xe sr-create name-label="$STORAGE_NAME" type=iso device-config:location=$STORE_PATH device-config:legacy_mode=true content-type=iso xe sr-create name-label="$STORAGE_NAME" type=iso device-config:location=$STORE_PATH device-config:legacy_mode=true content-type=iso
``` ```
@ -23,7 +23,7 @@ This creates a UUID for the new directory:
# Main Console # Main Console
```sh ```bash
xsconsole xsconsole
``` ```
@ -31,13 +31,13 @@ xsconsole
List volumes: List volumes:
```sh ```bash
lvs lvs
``` ```
List groups: List groups:
```sh ```bash
vgs vgs
``` ```

View File

@ -5,21 +5,21 @@ tags: [ "Markdown", "PDF", "Vision" ]
Turn a markdown file into a pdf: Turn a markdown file into a pdf:
```sh ```bash
lowdown -stms "$FILE".md | pdfroff -itk -mspdf > "$FILE".pdf lowdown -stms "$FILE".md | pdfroff -itk -mspdf > "$FILE".pdf
``` ```
*Example:* put [this Makefile](lowdown/example.txt) in a directory, rename it `Makefile`, then do: *Example:* put [this Makefile](lowdown/example.txt) in a directory, rename it `Makefile`, then do:
```sh ```bash
make example make example
make make
``` ```
To give the document a title, put that title in the metadata: To give the document a title, put that title in the metadata:
```sh ```bash
sed -i "1 i---" "$FILE".md sed -i "1 i---" "$FILE".md
sed -i "1 ititle: $TITLE" "$FILE".md sed -i "1 ititle: $TITLE" "$FILE".md
sed -i "1 i---" "$FILE".md sed -i "1 i---" "$FILE".md