Useful spells for Unix systems

Because I always forget these one…

List all running processes in order to kill on, aka the killing curse

List running processes (I usually pipe it into grep or the silver searcher).

ps aux

Then kill a process by id.

kill 123

Where 123 is the process id.

Delete anything mentioned in `.gitignore` from a git repos entire history

git rm --cached `git ls-files -i -X .gitignore`

tmux cheatsheet

# split the screen vertically
CTRL+B %

# split the screen horizontal
CTRL+B “

# split the screen horizontally
CTRL+B "

# switch between screens
CTRL+B o

# detach from session
CTRL+B d

Convert all .flac files in a directory to .mp3 files

find -name "*.flac" -exec ffmpeg -i {} -acodec libmp3lame -ab 128k {}.mp3 \;

Convert all .mp4 files in a directory to .mp4 files

mkdir outputs
for f in *.mp4; do ffmpeg -i "$f" -c:a libmp3lame "outputs/${f%.mp4}.mp3"; done

Install fonts on Debian and Debian like systems

First, obtain 1 or more groovy @!(ref "coding-fonts" "groovy fonts")!@

Place those fonts into the correct directory,

mv some-cool-font.ttf ~/.local/share/fonts

Then clear and remake the font cache,

fc-cache -f -v

If that fails, you may need to install fontconfig.

To see all installed fonts,

fc-list

A simple bash script to handle http, gopher, and gemini requests

This is a simple script that, when given a string, checks to see if that string is either a web (http) URL, a gopher URI, or a gemini URI. The string is then passed to the correct application to open it.

Before this is useful you must define the referenced variables.

USER_INPUT="$@"

if [[ "$USER_INPUT" == http* ]]
then
    ${HTTP_BROWSER} ${USER_INPUT}
else
    if [[ "$USER_INPUT" == gemini* ]]
    then
        ${GEMINI_CLIENT} ${USER_INPUT}
    else
        if [[ "$USER_INPUT" == gopher* ]]
        then
            ${GOPHER_CLIENT} ${USER_INPUT}
        else
            echo "not a valid http, gemini, nor gopher request."
            exit 0
        fi
    fi
fi

"

Some gemini clients that I like.

Extract an archive

The tar utility's arguments totally befuddle me.

tar -xzvf archive.tar.gz