Some Useful Commands

aptitude

Normalize package dependencies (aptitude)

aptitude markauto '~i !~M (~R~i | ~P~R~i)'
aptitude purge --purge-unused '!~E ~M !(~R~i | ~P~R~i)'

FFmpeg

Remove sequentially duplicated frames

ffmpeg -i INPUT_FILE -vf mpdecimate,setpts=N/FRAME_RATE/TB OUTPUT_FILE

pacman

Normalize package dependencies (pacman)

# For Bash.

comm -23 <(pacman -Qeq | sort) <(pacman -Qeqtt | sort) | xargs -r pacman -D --asdeps
# For Fish.

comm -23 (pacman -Qeq | sort | psub) (pacman -Qeqtt | sort | psub) | xargs -r pacman -D --asdeps

Find packages containing wallpapers

pacman -Fl | grep -oP '^\S+ (?=usr/share/(wallpapers|backgrounds)/)' | sort -u

OpenSSL

Generate self-signed certificate

openssl req \
     -out cert.pem \
     -newkey rsa:4096 \
     -keyout key.pem \
     -nodes \
     -subj /CN=localhost \
     -x509 \
     -days 36500 \
     -addext 'subjectAltName = DNS:localhost'

Create PKCS #12 file

openssl pkcs12 \
    -export \
    -out cert.pfx \
    -in cert.pem \
    -inkey key.pem

TeXmacs

Import external fonts

texmacs -x '(set-preference "imported fonts" "/usr/share/fonts/adobe-source-code-pro:/usr/share/fonts/adobe-source-han-sans:/usr/share/fonts/adobe-source-han-serif:/usr/share/fonts/adobe-source-sans-pro:/usr/share/fonts/adobe-source-serif-pro")
            (font-database-build-local)
            (quit-TeXmacs)'

Others

Bring swap memories back online

swapoff -a && swapon -a

Mirror a directory index website

wget -m -np -R 'index.html*'