m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CGI.md11
-rw-r--r--android.md7
-rw-r--r--apt.md26
-rw-r--r--audio.md8
-rw-r--r--bash.md48
-rw-r--r--bluetooth.md14
-rw-r--r--date.md4
-rw-r--r--display.md23
-rw-r--r--ffmpeg.md23
-rw-r--r--git.md6
-rw-r--r--gpg.md12
-rw-r--r--grep.md3
-rw-r--r--html.md6
-rw-r--r--image-manipulation.md21
-rw-r--r--imagemagick.md10
-rw-r--r--java.md12
-rw-r--r--jellyfin.md13
-rw-r--r--keyboard.md5
-rw-r--r--latex.md17
-rw-r--r--lilypond.md35
-rw-r--r--makefile.md47
-rw-r--r--mariadb.md5
-rw-r--r--markdown.md8
-rw-r--r--mp3.md18
-rw-r--r--mpv.md9
-rw-r--r--mutt.md4
-rw-r--r--network.md28
-rw-r--r--nginx.md12
-rw-r--r--pacman.md49
-rw-r--r--pdf.md4
-rw-r--r--postgres.md24
-rw-r--r--python.md15
-rw-r--r--qutebrowser.md7
-rw-r--r--ranger.md19
-rw-r--r--raspberry-pi.md19
-rw-r--r--rss.md13
-rw-r--r--sc-im.md61
-rw-r--r--ssl.md3
-rw-r--r--system-utils.md9
-rw-r--r--systemd.md10
-rw-r--r--text-utils.md35
-rw-r--r--time.md5
-rw-r--r--tmux.md15
-rw-r--r--user-management.md16
-rw-r--r--vim.md10
-rw-r--r--xdg-open.md30
-rw-r--r--xrandr.md9
47 files changed, 781 insertions, 7 deletions
diff --git a/CGI.md b/CGI.md
new file mode 100644
index 0000000..219a4b0
--- /dev/null
+++ b/CGI.md
@@ -0,0 +1,11 @@
+# CGI scripting
+
+## Inputs
+
+GET requests: `$QUERY_STRING`
+
+POST requests: in standard input
+
+## Redirect
+
+ Location: <url to redirect to>
diff --git a/android.md b/android.md
new file mode 100644
index 0000000..c9fdefa
--- /dev/null
+++ b/android.md
@@ -0,0 +1,7 @@
+# For interacting with an Android device
+
+Mount on system:
+
+ aft-mtp-mount <mount directory>
+
+Later just `umount`.
diff --git a/apt.md b/apt.md
new file mode 100644
index 0000000..d5fa1d9
--- /dev/null
+++ b/apt.md
@@ -0,0 +1,26 @@
+# Apt package manager for Debian
+
+## List installed packages
+
+ apt list --installed
+
+By size
+
+ dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
+
+## Remove packages
+
+Only removes the binary, leaving behind configs, logs, etc. Does not remove
+dependencies.
+
+ apt remove <package>
+
+Remove orphaned dependencies:
+
+ apt autoremove
+
+Purge package (i.e. removes everything, including configs, etc.)
+
+ apt purge <package>
+ # or
+ apt remove --purge <package>
diff --git a/audio.md b/audio.md
new file mode 100644
index 0000000..abafcd2
--- /dev/null
+++ b/audio.md
@@ -0,0 +1,8 @@
+# Various audio-related utilities
+
+## CD ripping with `cdparanoia`
+
+ cdparanoia -w -B 1-<number of tracks>
+
+* `-w` for WAV output
+* `-B` for batch mode (output to one file per track)
diff --git a/bash.md b/bash.md
index 41e8f05..8877982 100644
--- a/bash.md
+++ b/bash.md
@@ -14,7 +14,7 @@ Remove longest from start
# e.g.
${FILEPATH##*/} # get only file name portion
-%% - longst from end, # - shortest from start
+%% - longest from end, # - shortest from start
## Control flow
@@ -53,3 +53,49 @@ Don't interpolate variables:
cat << 'EOF' > file
bla bla
EOF
+
+## Arrays
+
+Declaring indexed arrays:
+
+ declare -a name
+
+Associative arrays:
+
+ declare -A name
+
+Assignment:
+
+ array=([bla]=foo [ble]=bar...)
+
+All values:
+
+ ${array[*]} # one word, elements separated with first character of $IFS
+ ${array[@]} # separate words when double quoted
+
+All keys:
+
+ ${!array[*]}
+ ${!array[@]}
+
+## Commandline arguments
+
+* `$#`: number of arguments.
+
+## Getopts example
+
+ while getopts 'a:b:c' flag; do
+ case "${flag}" in
+ a) do_something $OPTARG ;;
+ b) b_option=$OPTARG ;;
+ c) c_flag=1 ;;
+ *) error "Unexpected option ${flag}" ;;
+ esac
+ done
+
+### With positional arguments
+
+Positional arguments will have to be supplied after flag options (`command
+[options] <args>`):
+
+ shift $((OPTIND-1))
diff --git a/bluetooth.md b/bluetooth.md
new file mode 100644
index 0000000..c6fb78b
--- /dev/null
+++ b/bluetooth.md
@@ -0,0 +1,14 @@
+# Using Bluetooth on Linux
+
+`bluez` and `bluez-utils` packages. `pulseaudio-blootooth` for audio.
+
+Start `bluetooth` service.
+
+## `bluetoothctl`
+
+* `scan on` to search for unpaired devices
+* `devices` to list known devices
+* `pair <MAC>` to pair with device
+* `connect <MAC>` to connect
+* `disconnect <MAC>` to disconnect
+* might need to `trust <MAC>`
diff --git a/date.md b/date.md
index f0b7dd7..86f14d5 100644
--- a/date.md
+++ b/date.md
@@ -5,3 +5,7 @@
## UNIX timestamp
date +%s
+
+From timestamp to human readable:
+
+ date -d @<timestamp>
diff --git a/display.md b/display.md
new file mode 100644
index 0000000..d66e07f
--- /dev/null
+++ b/display.md
@@ -0,0 +1,23 @@
+# Display management
+
+## DPMS
+
+Display Power Management Signaling controls power saving features on displays.
+
+Query current settings:
+
+ xset q
+
+Turn DPMS on/off:
+
+ xset -dpms # screen will not timeout
+ xset dpms
+
+Force screen poweroff:
+
+ xset dpms force off
+ xset dpms force standby
+ xset dpms force suspend
+
+Off/standby/suspend are different power-off modes. They have trade-offs in power
+consumption vs. time to restart.
diff --git a/ffmpeg.md b/ffmpeg.md
index 7495cb0..b87ab63 100644
--- a/ffmpeg.md
+++ b/ffmpeg.md
@@ -1,5 +1,11 @@
# ffmpeg tricks
+## Convert
+
+Works for audio, too.
+
+ ffmpeg -i in.EXT1 out.EXT2
+
## Cut
ffmpeg -i in.mp4 -codec:v copy -codec:a copy -ss START_TIME -t DURATION out.mp4
@@ -11,6 +17,15 @@
# -1 means to automatically preserve aspect ratio
ffmpeg -i in.mp4 -filter:v scale=720:-1 out.mp4
+## Audio/video delay
+
+ ffmpeg -i "$input" -itsoffset <offset in seconds> -i "$input" -map 1:v -map 0:a -c:a copy -c:v libx264 "$output"
+
+For reverse offset, swap 1 and 0.
+
+Basically, take the input once with an offset, once without. Take the audio from
+one of them, video from the other.
+
## Rotate
# 90 degrees clockwise
@@ -52,3 +67,11 @@ For the transpose parameter you can pass:
[in1] ... [ink] filter_name=option1=val1:...:optionn=valn [out1] ... [outm]
* Use `-filter_complex` if more than one input or output stream.
+
+## Video file info
+
+Just running
+
+ ffmpeg -i video.mp4
+
+will fail, but give a bunch of info about the file (including resolution, fps, etc)
diff --git a/git.md b/git.md
index 0c512d0..c18e88e 100644
--- a/git.md
+++ b/git.md
@@ -30,3 +30,9 @@ Outputs to stdout a tar archive of the index at the given commit. Make a
directory of just the code, not a repo:
git archive <commit> | tar --extract --directory <output dir>
+
+## Remotes
+
+Change remote url:
+
+ git remote set-url <remote> <new url>
diff --git a/gpg.md b/gpg.md
index b76bba3..d4d9fe5 100644
--- a/gpg.md
+++ b/gpg.md
@@ -29,6 +29,10 @@ Add `--armor` to make it readable-ASCII encoded.
gpg --import <key file>
+Receiving a key from key server:
+
+ gpg --recv-key "<key ID>"
+
## Asymmetric crypto
gpg --encrypt [--sign] [-u <signer>] [--recipient <receipient>] file
@@ -54,6 +58,14 @@ use in mutt:
# specify the signing key (by default it's your first one)
gpg --local-user <signing key> --edit-key <key to sign>
+## Key Fingerprint/ID
+
+The long hex fingerprint in `gpg --list-keys` is, as could be expected, a
+standardized hash of the key info.
+
+Sometimes a shorter ID is used -- this is actually a suffix of the full
+fingerprint.
+
## gpg-agent
`gpg-agent` is a daemon that e.g. provides a passphrase cache for GPG. Running
diff --git a/grep.md b/grep.md
new file mode 100644
index 0000000..3f8d2d6
--- /dev/null
+++ b/grep.md
@@ -0,0 +1,3 @@
+# Greppin' it up
+
+- `-o, --only-matching`: only print part of line that matches the expression
diff --git a/html.md b/html.md
index d075c4b..85e6911 100644
--- a/html.md
+++ b/html.md
@@ -46,3 +46,9 @@ To check by default:
By default pretty prints the full selected HTML elements. Setting display
function to `text{}` prints out just the inner text.
+
+### Extracting attributes
+
+Use the `attr` display function.
+
+ pup ... audio attr{src}
diff --git a/image-manipulation.md b/image-manipulation.md
new file mode 100644
index 0000000..ccee16e
--- /dev/null
+++ b/image-manipulation.md
@@ -0,0 +1,21 @@
+# Image manipulation (other than with Image Magick)
+
+## QR codes
+
+Decode:
+
+ zbarimg -q --raw qrcode.png
+
+Create:
+
+ qrencode -o <file.png> <string>
+
+## SVG
+
+Convert to PDF:
+
+ inkscape -D word.svg -o word.pdf
+
+Compatible with LaTeX (see also latex.md):
+
+ inkscape -D word.svg -o word.pdf --export-latex
diff --git a/imagemagick.md b/imagemagick.md
index 57261e9..f4783df 100644
--- a/imagemagick.md
+++ b/imagemagick.md
@@ -14,6 +14,16 @@ Force resize to be exactly the given geometry with `!`
convert in.jpg --resize 720x720\! out.jpg
+## Compress
+
+### JPG
+
+convert -strip -interlace Plane -gaussian-blur 0.05 -quality 85% source.jpg result.jpg
+
+## Convert PDF
+
+PDFs can be converted to images. Set `-density XxY` for better resolution.
+
## Options with enum arguments
List possible option values
diff --git a/java.md b/java.md
new file mode 100644
index 0000000..23f0f6b
--- /dev/null
+++ b/java.md
@@ -0,0 +1,12 @@
+# Using Java on Arch
+
+## Managing JDK versions
+
+ archlinux-java set java-11-openjdk # or other package
+
+## Android SDK
+
+Currently using [F-Droid's `sdkmanager`](https://gitlab.com/fdroid/sdkmanager)
+
+ sdkmanager --install
+ sdkmanager --licenses
diff --git a/jellyfin.md b/jellyfin.md
new file mode 100644
index 0000000..1bbd277
--- /dev/null
+++ b/jellyfin.md
@@ -0,0 +1,13 @@
+# Jellyfin media server
+
+## Setting up as jukebox with Mopidy
+
+Install `mopidy-jellyfin`, configure in `/etc/mopidy/mopidy.conf`, adding:
+
+ [jellyfin]
+ hostname = localhost:8096
+ username = username
+ password = password
+ libraries = Library1, Library2 (Optional: will default to "Music" if left undefined)
+ albumartistsort = False (Optional: will default to True if left undefined)
+ album_format = {ProductionYear} - {Name} (Optional: will default to "{Name}" if left undefined)
diff --git a/keyboard.md b/keyboard.md
new file mode 100644
index 0000000..9ecd548
--- /dev/null
+++ b/keyboard.md
@@ -0,0 +1,5 @@
+# Dealing with keyboards and their inputs
+
+Identifying keycodes:
+
+ xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'
diff --git a/latex.md b/latex.md
index 48b921f..fea77a5 100644
--- a/latex.md
+++ b/latex.md
@@ -29,3 +29,20 @@ Forward implication:
Backwards implication:
\impliedby
+
+## Figures
+
+ \begin{figure}
+ \centering
+ \def\svgwidth{\columnwidth}
+ \input{input.pdf_tex}
+ \caption{
+ Description
+ }\label{ref-label}
+ \end{figure}
+
+Note, `\label` comes after `\caption`.
+
+To embed an svg:
+
+ inkscape -D word.svg -o word.pdf --export-latex
diff --git a/lilypond.md b/lilypond.md
index a59c48d..993effc 100644
--- a/lilypond.md
+++ b/lilypond.md
@@ -16,6 +16,14 @@ Docs: `info LilyPond`.
tagline = ##f
}
+## Paper settings
+
+Indentation of first line:
+
+ \paper {
+ indent = 0
+ }
+
## Rhythm stuff
### Setting beat divisions
@@ -36,3 +44,30 @@ Docs: `info LilyPond`.
\time 3/4
\partial 8
e8 | a4 c8 b c4 |
+
+## Output formats
+
+### Images (PNG/SVG)
+
+ lilypond --svg file.ly
+ lilypond --png file.ly
+
+It's useful to have these cropped:
+
+ lilypond --svg -dcrop file.ly
+
+Will output both an A4-sized file.svg, and the cropped file.cropped.svg.
+Suppress the non-cropped output with `-dno-print-pages`.
+
+### MusicXML
+
+Not supported natively, but the `python-ly` package on `pip` has experimental
+support.
+
+ ly musicxml file.ly
+
+## Notation
+
+Tie:
+
+ a~ a
diff --git a/makefile.md b/makefile.md
new file mode 100644
index 0000000..50b5aae
--- /dev/null
+++ b/makefile.md
@@ -0,0 +1,47 @@
+# Writing Makefiles
+
+## Pattern rules
+
+In prerequesite, use exactly one `%`. Can then be used in requirements. E.g.
+
+ %.o: %.c
+ # compile .c file to .o
+
+Details: <https://www.gnu.org/software/make/manual/html_node/Pattern-Rules.html>
+
+## Automatic variables
+
+* `$@`: current target
+* `$<`: first prerequisite
+* `$^`: all prerequisites, separated by spaces
+* `$*`: target without extension
+* `$(@F)`: file-within-directory part of target path
+
+More: <https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html>
+
+## C-related flags
+
+* `CC`: C compiler
+* `CFLAGS`: flags for `CC`
+* `LDFLAGS`: flags for the linker
+
+## Text functions
+
+* `$(var:suffix=replacement)`, syntax sugar for
+ `$(patsubst %suffix, $replacement, $(var))`
+
+More: <https://www.gnu.org/software/make/manual/html_node/Text-Functions.html>
+
+## Filename functions
+
+<https://www.gnu.org/software/make/manual/html_node/File-Name-Functions.html>
+
+## Recipes
+
+* `@<command>`: don't print command ran
+* `-<command>`: don't exit on command failure
+
+## Arguments
+
+* `-B, --always-make`: force to make all targets
+
diff --git a/mariadb.md b/mariadb.md
new file mode 100644
index 0000000..24a144c
--- /dev/null
+++ b/mariadb.md
@@ -0,0 +1,5 @@
+# Managing and interacting with MariaDB
+
+* `SHOW DATABSES`
+* `USE <database>`
+* `SHOW TABLES`
diff --git a/markdown.md b/markdown.md
index 6df4493..88a6ee1 100644
--- a/markdown.md
+++ b/markdown.md
@@ -1,5 +1,9 @@
# Markdown/Pandoc tricks
+## Formatting
+
+Force a line break: empty line with `\`.
+
## Math
$\text{\LaTeX}$
@@ -27,6 +31,10 @@
[reference]: https://url.of/image.png
+Can place images side-by-side and control width:
+
+ ![](1.png){width=50%} ![](2.png){width=50%}
+
## Presentations
pandoc in.md -t beamer -o out.pdf
diff --git a/mp3.md b/mp3.md
new file mode 100644
index 0000000..e19ca51
--- /dev/null
+++ b/mp3.md
@@ -0,0 +1,18 @@
+# Manipulating mp3s
+
+## id3v2
+
+For editing/viewing mp3 tags.
+
+* `-a`, `--artist`
+* `-A`, `--album`
+* `-t`, `--song`
+* `-y`, `--year`
+* `-T`, `--track` (track number)
+
+E.g.
+
+ # Can pass multiple files
+ id3v2 --artist "Blind Guardian" --album "At the Edge of Time" --year 2010 *
+
+* `-l`, `--list`: lists all tags
diff --git a/mpv.md b/mpv.md
new file mode 100644
index 0000000..e3096b1
--- /dev/null
+++ b/mpv.md
@@ -0,0 +1,9 @@
+# Using MPV
+
+* `ctrl+/-`: A/V delay
+
+## Zoom/Pan
+
+* `alt+/-`: zoom in/out
+* `alt+arrow`: pan
+* `alt+backspace`: reset pan/zoom
diff --git a/mutt.md b/mutt.md
index 16ec0b2..f4e8bbc 100644
--- a/mutt.md
+++ b/mutt.md
@@ -9,3 +9,7 @@ Copy `/usr/share/doc/mutt/samples/gpg.rc` to config dir and source it.
On Arch, had to change `/usr/libexec/neomutt/pgpewrap` to `/usr/bin/pgpewrap`.
After composing message, press `p` to select crypto actions.
+
+## Search patterns
+
+- `~C`: search in TO and CC fields
diff --git a/network.md b/network.md
index 1f2945d..1720cb3 100644
--- a/network.md
+++ b/network.md
@@ -1,5 +1,9 @@
# Basic networking operations
+## Basic networking info
+
+ ifconfig
+
## Find process binding a port
# specifically tcp
@@ -17,3 +21,27 @@ DNS lookup:
So to lookup TXT records,
drill host.com TXT
+
+## Connecting to WIFI with iwctl
+
+ iwctl
+ device list
+
+Ensure device and adapter are turned on:
+
+ device <device> set-property Powered on
+ adapter <adapter> set-property Powered on
+
+Begin scan (no output), list networks, connect:
+
+ station <device> scan
+ station <device> get-networks
+ station <device> connect SSID
+
+## MAC spoofing
+
+ sudo ip link set dev eth0 down
+ sudo ip link set dev eth0 address 00:00:00:00:00:01
+ sudo ip link set dev eth0 up
+
+Or use `macchanger` utility, where you can specify the vendor, device type, etc.
diff --git a/nginx.md b/nginx.md
index 53e33cd..5f31206 100644
--- a/nginx.md
+++ b/nginx.md
@@ -1,5 +1,9 @@
# The Nginx HTTP server
+## Check config syntax
+
+ nginx -t
+
## Logs
Specify separate logging file for given server
@@ -10,3 +14,11 @@ To set up rotating/compressed logs, use `logrotate`. Config in
`/etc/logrotate.d/nginx`. Run the following to reload config:
logrotate -v -f /etc/logrotate.d/nginx
+
+## Enable website
+
+ ln -s /etc/nginx/sites-available/<config> /etc/nginx/sites-enabled/
+
+## SSL Certificate
+
+ certbot --nginx
diff --git a/pacman.md b/pacman.md
index 5c0350f..133adfd 100644
--- a/pacman.md
+++ b/pacman.md
@@ -4,7 +4,9 @@
pacman -U /var/cache/pacman/pkg/package-version...
-## Cleaning cache
+## Debloating
+
+### Cleaning cache
paccache -r
@@ -13,3 +15,48 @@
# remove all versions of uninstalled packages
paccache -ruk0
+
+### Removing orphaned packages
+
+ pacman -Qtdq | pacman -Rns -
+
+### List packages by size
+
+ LC_ALL=C pacman -Qi | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h
+
+## Troubleshooting failed installations
+
+Usually enough to update keyring:
+
+ pacman -Sy archlinux-keyring
+
+Might need to update mirrorlist first if outdated:
+
+ sudo pacman -Sy pacman-mirrorlist
+
+(this might put it in /etc/pacman.d/mirrorlist.pacnew, uncomment wanted mirrors
+there and remove the .pacnew suffix)
+
+## Query (-Q)
+
+By itself, outputs all installed packages.
+
+### Browsing installed packages with `fzf`
+
+ pacman -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'
+
+## Files (-F)
+
+Query the files database.
+
+Download/update database:
+
+ pacman -Fy
+
+Lists packages that contain `file`:
+
+ pacman -F <file>
+
+List files contained in `package`:
+
+ pacman -Fl <package>
diff --git a/pdf.md b/pdf.md
index f4e0931..2fc1295 100644
--- a/pdf.md
+++ b/pdf.md
@@ -11,3 +11,7 @@
## Extract pages
pdfjam --outfile out.pdf in.pdf 1,3,4-7
+
+## Images to pdf
+
+ convert in1.jpg in2.jpg out.pdf
diff --git a/postgres.md b/postgres.md
new file mode 100644
index 0000000..28a0043
--- /dev/null
+++ b/postgres.md
@@ -0,0 +1,24 @@
+# The PostgreSQL DBMS
+
+Default user, db: `postgres`
+
+## User management
+
+Everything should be done as user `postgres`.
+
+New user:
+
+ createuser --pwprompt mypguser
+
+Change password:
+
+ # in `psql`
+ ALTER ROLE user WITH PASSWORD 'xxx';
+
+## New database
+
+ sudo su postgres
+ createdb -O mypguser mypgdatabase
+
+ # delete db
+ dropdb mypgdatabase
diff --git a/python.md b/python.md
index 41b202e..0dca522 100644
--- a/python.md
+++ b/python.md
@@ -20,7 +20,13 @@ Install from requirements:
python -m pip install -r requirements.txt
-### Jupyter Notebook
+## Executing a package
+
+Create `./package/__main__.py` script you want to execute. Then
+
+ python -m package
+
+## Jupyter Notebook
Setting default browser:
@@ -28,3 +34,10 @@ Setting default browser:
jupyter notebook --generate-config
# edit the newly generated config
c.NotebookApp.browser = '<browser command> %s'
+
+Using a venv:
+
+ # once in venv
+ pip install ipykernel
+ python -m ipykernel install --user --name <name for the env in Jupyter>
+ # then select the new kernel in the web app
diff --git a/qutebrowser.md b/qutebrowser.md
index 3324252..fa67e81 100644
--- a/qutebrowser.md
+++ b/qutebrowser.md
@@ -5,3 +5,10 @@
By default bound to Alt+m.
:tab-mute
+
+## Cookies
+
+ :set content.cookies.accept no-3rdparty
+
+ Supposedly breaks gmail. Change to `no-unknown-3rdparty` or back to `all` if
+ it does.
diff --git a/ranger.md b/ranger.md
index afe6987..30a6308 100644
--- a/ranger.md
+++ b/ranger.md
@@ -1,5 +1,8 @@
# Ranger tricks
+[Official User Guide](https://github.com/ranger/ranger/wiki/Official-User-Guide)
+
+
## Bulkrename
:bulkrename
@@ -20,3 +23,19 @@ Like in vim
* `gc` - close
* `uq` - restore tab
* `M-<n>` - go to nth tab (create new if not exists)
+* `~` - multi-tab view
+
+## Tags
+
+Files can have a single arbitrary tag, persistent between restarts.
+
+* `t` toggles/sets `*` tag
+* `"<key>` toggles/sets `<key>` tag
+
+## Selection
+
+* `<space>` - toggle select on single file
+* `v` - invert selection
+* `uv` - deselect all
+ * Or `:unmark`
+ * Can also use `:unmark <regex>`
diff --git a/raspberry-pi.md b/raspberry-pi.md
new file mode 100644
index 0000000..dd5df21
--- /dev/null
+++ b/raspberry-pi.md
@@ -0,0 +1,19 @@
+# Info for running a Raspberry Pi system
+
+## Arch ARM
+
+Details on running Arch Linux ARM on a Pi
+
+### Sound
+
+`/boot/config.txt` needs the following to enable the audio card:
+
+ dtparam=audio=on
+
+(Source: https://archlinuxarm.org/forum/viewtopic.php?f=9&t=13463#p60706)
+
+And
+
+ dtoverlay=audremap,pins_12_13,enable_jack
+
+(Source: https://raspberrypi.stackexchange.com/questions/133199/no-audio-through-jack-despite-config-audio-on-raspi-config-also-fails/133200)
diff --git a/rss.md b/rss.md
new file mode 100644
index 0000000..00cc55d
--- /dev/null
+++ b/rss.md
@@ -0,0 +1,13 @@
+# On RSS feeds
+
+As per https://stackoverflow.com/a/11787940
+
+> The specification has lacked clarity regarding whether HTML is permitted in
+> elements other than an item's description, leading to wide variance in how
+> aggregators treat character data in other elements. This makes it especially
+> difficult for a publisher to determine how to encode the characters "&" and
+> "<", which must be encoded in XML.
+
+`&amp;`, `&mdash;`, etc won't work in XML title tags. This will break some feed
+readers entirely (e.g. Thunderbird). Fix by using hexcode (e.g. for mdash:
+`&#x2014;`)
diff --git a/sc-im.md b/sc-im.md
new file mode 100644
index 0000000..367122c
--- /dev/null
+++ b/sc-im.md
@@ -0,0 +1,61 @@
+# The TUI Spreadsheet
+
+Resources:
+
+* <https://github.com/groessler/scim/blob/master/src/doc>
+* <https://github.com/jonnieey/Sc-im-Tutorial>
+
+## Basic editing
+
+* `<`/`\`/`>`: insert left/center/right-aligned string
+* `=`: insert numeric expression
+* `e`: edit numeric
+ * If accidentally added to text field, can erase with `=<RET>` (inserting an
+ empty numeric value)
+* `E`: edit string
+* `ir`/`c`: insert row/column above/to the left
+* `or`/`c`: insert row/column below/to the right
+
+## Copying
+
+* `mc`: (where `c` is a lowercase character) marks cell or range with `c`
+* `cc`: (where the second `c` is a previous mark) copies content from mark into
+ current cell, preserving formatting and adjusting formula.
+* `yy`: copy current cell/selection
+* `Pv`: paste only the value
+* `Pf`: paste only the formatting
+* `yr`/`c`: yank row/column
+* `p`: paste below/on the left
+* `t`: paste above/on the right
+
+## Movement
+
+* `hjkl`
+* `^`/`#`: move to top/bottom of column (bottom is the last filled cell)
+* `0`/`$`: move to left/right of row (rightmost is the last filled cell)
+* `goc3`: go to cell C3
+* `g0`/`$`: move to left/rightmost visible column
+* `c-e`/`y`: scroll down/up maintaining cursor position
+* `zh`/`l`: scroll left/right maintaining cursor position
+* `c-f`/`b`: scroll page down/up
+
+## Hiding/unhiding
+
+"Z" for "zap" when hiding.
+
+* `Z[cr]`: zap current column/row.
+* `S[cr]`: shows hidden columns/rows in selected range (select with c-v)
+
+## Formatting
+
+* `c-j`: auto-fit column width
+* `{`/`|`/`}`: align text left/center/right
+* `f-`/`+`: decrease/increase decimal precision
+* `f<`/`>`: decrease/increase column width
+
+### Scientific notation
+
+ :format "#.##e-#"
+
+The two `#`s after the decimal point give precision. `e-` means scientific
+notation, with sign only if the exponent is negative.
diff --git a/ssl.md b/ssl.md
new file mode 100644
index 0000000..434b833
--- /dev/null
+++ b/ssl.md
@@ -0,0 +1,3 @@
+# SSL/TLS tools
+
+ openssl x509 -in <file.pem> -text
diff --git a/system-utils.md b/system-utils.md
new file mode 100644
index 0000000..24b9b02
--- /dev/null
+++ b/system-utils.md
@@ -0,0 +1,9 @@
+# For basic OS utilities
+
+* `mktemp`: creates a temporary file in /tmp and returns filename
+
+## `mount`
+
+Set file permissions of mounted drive at mount time:
+
+ mount /dev/foo /mnt/bar -o umask=000
diff --git a/systemd.md b/systemd.md
index 30ff0cd..3c1a1a8 100644
--- a/systemd.md
+++ b/systemd.md
@@ -9,3 +9,13 @@ Find unit file for given service:
After editing unit file, need to reload wih
systemctl daemon-reload
+
+### Drop-in editing
+
+Drop-ins will be in `/etc/systemd/system/<service>.d/`. Edit with
+
+ systemctl edit <service> --drop-in=<drop-in name>
+
+## Logs
+
+ journalctl -u <service>
diff --git a/text-utils.md b/text-utils.md
new file mode 100644
index 0000000..eb801e7
--- /dev/null
+++ b/text-utils.md
@@ -0,0 +1,35 @@
+# Various small text manipulation utilities
+
+## `cut`
+
+Select fields from each line based on some delimeter
+
+ cut -d <delimiter> -f <list of fields>
+
+Setting a different output delimiter:
+
+ --output-delimiter <delimiter>
+
+## `comm`
+
+ comm file1 file2
+
+Outputs three columns:
+
+1. Lines unique to `file1`
+2. Lines unique to `file2`
+3. Lines in both files
+
+Assumes files are sorted.
+
+Suppress a column with e.g. `-1`.
+
+So intersection of two files:
+
+ comm -12 file1 file2
+
+## `diff`
+
+Side by side:
+
+ diff -y
diff --git a/time.md b/time.md
new file mode 100644
index 0000000..1975f32
--- /dev/null
+++ b/time.md
@@ -0,0 +1,5 @@
+# System time on Linux
+
+## Use a time server to synchronize clocks
+
+ timedatectl set-ntp true
diff --git a/tmux.md b/tmux.md
index 4578ccb..1d08bc3 100644
--- a/tmux.md
+++ b/tmux.md
@@ -12,6 +12,7 @@
## Pane management
q display pane indices
+ :move-pane -t <session id>:<window id>
## Run command in new session
@@ -22,3 +23,17 @@
* `:setw synchronize-panes on`
turn off with `:setw synchronize-panes off`
+
+## Packages
+
+First clone TPM:
+
+ $ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
+
+Then in config:
+
+ set -g @plugin 'tmux-plugins/tpm'
+ set -g @plugin 'tmux-plugins/tmux-sensible'
+ run '~/.tmux/plugins/tpm/tpm'
+
+Then `<prefix>+I` to download listed plugins.
diff --git a/user-management.md b/user-management.md
new file mode 100644
index 0000000..09d5d15
--- /dev/null
+++ b/user-management.md
@@ -0,0 +1,16 @@
+# Managing Linux users
+
+## Adding a user
+
+ useradd [-m|--create-home] [-G|--groups <group,...>] -s <shell> <username>
+ passwd <username>
+ # as root, to add to sudoers
+ visudo
+
+## Adding user to a group
+
+ gpasswd -a user group
+
+## Listing users' groups
+
+ getent group
diff --git a/vim.md b/vim.md
index 2497e76..1799755 100644
--- a/vim.md
+++ b/vim.md
@@ -93,10 +93,12 @@ g<c-a/x> - increment/decrement by 1 more on each selected line
## Spellcheck
- :setlocal spell spelllang=en_us
- [/]s - previous/next marked word
- [/]S - previous/next bad word
- z= - replacement suggestions
+* `:setlocal spell spelllang=en_us`: start English spell checker in current pane
+* `[/]s`: previous/next marked word
+* `[/]S`: previous/next bad word
+* `z=`: replacement suggestions
+* `z[u]g`: add/remove from dictionary
+* `z[u]w`: add/remove from wrong word list
## Formatting
diff --git a/xdg-open.md b/xdg-open.md
new file mode 100644
index 0000000..a688517
--- /dev/null
+++ b/xdg-open.md
@@ -0,0 +1,30 @@
+# Opening files with specific programs
+
+`xdg-open` looks up a file's mimetype, then determines which application to use
+to open it.
+
+The local database for applications to use is in `~/.config/mimeapps.list`. Need
+a `.desktop` file, which can be created under `~/.local/share/applications/`.
+
+## Setting defaults
+
+Easiest to do with `mimeopen` (from `perl-file-mimeinfo` on Arch):
+
+ mimeopen -d <file>
+ # will prompt to select a program from a list
+
+## Default browser
+
+The relevant mime types are:
+
+ x-scheme-handler/http=
+ x-scheme-handler/https=
+
+For qutebrowser, just copied the `.desktop` from [the repo](https://github.com/qutebrowser/qutebrowser/blob/master/misc/org.qutebrowser.qutebrowser.desktop).
+
+## `ranger`
+
+`ranger` uses its own launcher, `rifle`. Copy the default config to
+`~/.config/ranger/rifle.conf`:
+
+ ranger --copy-config=rifle
diff --git a/xrandr.md b/xrandr.md
index 141e7a2..4172061 100644
--- a/xrandr.md
+++ b/xrandr.md
@@ -7,3 +7,12 @@
## Turn off second screen
xrandr --output HDMI1 --off
+
+## Profile loading
+
+Install `autorandr`.
+
+ # Save and name the current setup
+ autorandr --save <profile name>
+ # Load a previously saved setup
+ autorandr --load <profile name>