Inspired by Rekka Bellum's spellbook, because I am forgetful.
Git
remote=origin
branch=master
# get current branch name only
git rev-parse --abbrev-ref HEAD
# discard all local work on the branch
git reset --hard $remote/$branch
# zip git archive based on current HEAD
git archive --format zip -o "archiveName.zip" HEAD # could be a commit ID too
# get absolute directory of repository root
git rev-parse --show-toplevel
# get current commit ID
git rev-parse HEAD
# "Squash" all changes on a branch, can be used with master
git checkout --orphan new-${branch} ${branch} # create orphan
git commit --message "squash" # commit it
git branch -M new-${branch} ${branch} # force-rename on top of old
JQ
# "..." is meant to indicate some source of valid json over stdin # Get a json list of all keys on an object ... | jq 'keys'
YQ
There's also a tool called "yq", there seem to be two variants floating around.
One is a simple python wrapper around jq
Another is a full-featured, generic configuration-format stream editor.
It's called go-yq in archlinux repos.
Connman
# connmanctl requires the connmand daemon to be running. # Any of these commands can be run from within the connmanctl shell, # which (incidentally); has nice things like autocomplete. # Get help. connmanctl help # summary list of "devices", the names of which are used for further commands connmanctl technologies # scan on device named "wifi". This gathers a list of access points connmanctl scan wifi # Actually list available access points, SSIDs, etc # SSIDs are given in hexadecimal encoded form, thus accommodating weird names connmanctl services # To connect to a protected access point: # 1. drop into interactive mode # 2. Enable the agent # 3. Initiate connection -- connmanctl will prompt you for passphrase connmanctl ... agent on ... connect wifi_abcdef0123456789_managed_psk
SSH
# Change default key password ssh-keygen -p
inotify
# continually watch a file, performing some action when it is modified inotifywait -q -e modify my_file.txt | while read DIRECTORY EVENT FILE; do ... done # continually watch an directory tree, fire when creating, modifying, deleting inotifywait -q -r -e modify,delete | while read DIRECTORY EVENT FILE; do ... done
Pacman
Of course there is the Pacman Rosetta