Update bashrc

Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2022-09-12 07:49:05 -04:00
parent bfcc5e6956
commit b5376ee86f
Signed by: cobra
GPG Key ID: 4FD8F812083FF6F9
1 changed files with 58 additions and 1 deletions

59
.bashrc
View File

@ -4,6 +4,7 @@
[ -r ~/.config/isotope.dark ] && . ~/.config/isotope.dark
[ -z "$EDITOR" ] && . ~/.profile
[ "$TERM" == "screen.linux" ] && export TERM="screen"
# History stuff
export HISTCONTROL=ignoredups:erasedups
@ -29,7 +30,6 @@ alias wv='mpv $($PASTE_COMMAND)'
alias lc='fc -nl $HISTCMD | xargs'
alias curl='curl -L'
alias prof='profanity'
alias playcd='mpv --start=00:00:00.0000000 av://libcdio:/dev/cdrom --cache=yes'
# Completions for elevation program (https://codeberg.org/Bowuigi/Unit21 in management/boas)
complete -cf boas
@ -93,6 +93,7 @@ uppweb() {
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
}
@ -105,3 +106,59 @@ upvgem() {
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 -- "$(</dev/stdin)"
L1="$(head -1 "$PERM")"
while read -r line; do
tr "${L1^^}${L1}" "${line^^}${line}" <<< "$*"
done < "$PERM" | \
while read -r line; do
for word in $line; do
[ $COLOR -eq 1 ] && grep="$(grep --color=always -xF "$word" /etc/dictionaries-common/words)"
printf %s "${grep:-$word} "
done
printf '\n'
done
}
playcd() {
mpv --start=00:00:00.0000000 av://libcdio:/dev/cdrom --cache=yes
}
gpginfo() {
gpg --with-colons --import-options show-only --import
}
baseto() {
local i="$1"
local o="$2"
shift 2
bc <<< "obase=$o;$(($i#$*))"
}