# Source other files [ -r ~/.prompt ] && . ~/.prompt [ -r ~/.devspec ] && . ~/.devspec [ -r ~/.config/colorscheme ] && . ~/.config/colorscheme [ "$TERM" == "screen.linux" ] && export TERM="screen" export EDITOR="vim" export TERM=xterm-256color # History stuff export HISTCONTROL=ignoredups:erasedups export HISTFILESIZE=1000 export HISTSIZE=1000 export GPG_TTY=$(tty) clear() { printf '\033c' # faster than ncurses clear by a lot } # Other aliases alias c='clear' alias ls='ls --color=auto -FAh' alias ll='ls -l' alias nf='neofetch' alias ga='git add' alias gc='git commit -sS' alias gp='git push' alias mpv='mpv --no-audio-display' alias wv='swayhide mpv $($PASTE_COMMAND)' alias curl='curl -L' alias prof='profanity' alias gomuks="http_proxy='socks5://127.0.0.1:9050' gomuks" alias tut="http_proxy='socks5://127.0.0.1:9050' tut" # Random string (passwords) randstr() { tr -cd '[:graph:]' >($COPY_COMMAND) } # URL-encode stdin urlencode() { LC_COLLATE_OLD=$LC_COLLATE LC_COLLATE=C local TEXT="$( /dev/null \;; } fixdh() { diffhome | while read -r _ SRC _ DEST _; do cp $SRC $DEST; done; } strlen() { N=$(wc -c <<< "$*") ((N--)) printf '%u\n' "$N" } uppweb() { ssh vern.cc 'cd ~/public_html; git pull' } caption() { [ -z "$3" ] && { echo "Usage: caption [input] [output] [text...]" return 1 } local FILE="$1" local OUT="$2" shift 2 local TEXT="$*" local WIDTH="$(identify -format "%[w]" "$FILE")" local HEIGHT="$(identify -format "%[h]" "$FILE")" local FONT_SIZE="$(((HEIGHT+WIDTH)/20))" convert -gravity north \( -size "${WIDTH}x" -pointsize "$FONT_SIZE" -font 'Liberation-Sans-Bold' caption:"$TEXT" -gravity Center -extent "${WIDTH}x" \) "$FILE" -append "$OUT" } subcipher() { local COLOR PERM L1 line grep word if [ $# -lt 3 ]; then if [ $# -lt 2 ] || [[ "$1" != "0" && "$1" != "1" ]]; then printf "Usage: [0|1] subcipher file [string...]\n" return 1 fi fi COLOR="$1" shift PERM="$1" shift [ -z "$*" ] && set -- "$( ${1:-$(date -u -I)}.svg } vnplot() { ssh vern "${1:-/opt/gnuplot/net/gnuplot.sh}; cat /opt/gnuplot/net/${1:-$(date -u -I)}.svg" > ${1:-$(date -u -I)}.svg } vpplot() { ssh vern "${1:-/opt/gnuplot/power/gnuplot.sh}; cat /opt/gnuplot/power/${1:-$(date -u -I)}.svg" > ${1:-$(date -u -I)}.svg } inplot() { ssh iceberg "${1:-~/gnuplot/gnuplot.sh}; cat ~/gnuplot/${1:-$(date -u -I)}.svg" > ${1:-$(date -u -I)}.svg } cnplot() { ssh crescent "${1:-/opt/gnuplot/net/gnuplot.sh}; cat /opt/gnuplot/net/${1:-$(date -u -I)}.svg" > ${1:-$(date -u -I)}.svg } cpplot() { ssh crescent "${1:-/opt/gnuplot/power/gnuplot.sh}; cat /opt/gnuplot/power/${1:-$(date -u -I)}.svg" > ${1:-$(date -u -I)}.svg } reconf-sys () { $PRIV su - -c 'guix system reconfigure /etc/config.scm' } reconf-home () { guix home reconfigure ~/.config/guix/home.scm }