# Source other files [ -r ~/.prompt ] && . ~/.prompt [ -r ~/.devspec ] && . ~/.devspec [ -r ~/.config/isotope.dark ] && . ~/.config/isotope.dark [ "$TERM" == "screen.linux" ] && export TERM="screen" # 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 wv='swayhide mpv $($PASTE_COMMAND)' alias curl='curl -L' alias prof='profanity' # 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() { pushd ~/git/cobra.vern.cc local DIR="/home/cobra/git/cobra.vern.cc" rsync -rtvzP --exclude ".git" --exclude ".gitignore" --exclude 'README.md' --exclude 'LICENSE' $DIR/* vern.cc:~/public_html/ popd } upvweb() { pushd ~/git/website rsync --rsh='ssh -p1813' -rtvzP --exclude '.git' --exclude 'LICENSE' /home/cobra/git/website/ root@vern.cc:/var/www/website ssh vern chown -R www-data:www-data /var/www/website popd } upvgem() { pushd ~/git/gemini rsync --rsh='ssh -p1813' -rtvzP --exclude '.git' --exclude 'LICENSE' /home/cobra/git/gemini/ root@vern.cc:/home/gemini/gemini/vern.cc popd } pubdate() { date +'%a, %d %b %Y %T %z' } 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 }