add functions

This commit is contained in:
James Dixon 2021-05-29 22:16:05 -04:00
parent df2be7cd42
commit 28bea7e715

View File

@ -47,6 +47,8 @@ alias egrep="egrep ${GREP_OPTS}"
alias treel="tree -C | less -R" alias treel="tree -C | less -R"
alias lsmnt="mount | column -t" alias lsmnt="mount | column -t"
alias pathls='printf "%b\n" "${PATH//:/\\n}"'
# git - vim - tmux # git - vim - tmux
alias g="git" alias g="git"
alias groot="cd $(git rev-parse --show-toplevel 2> /dev/null || echo -n ".")" alias groot="cd $(git rev-parse --show-toplevel 2> /dev/null || echo -n ".")"
@ -222,10 +224,36 @@ bkup() {
fi fi
} }
datauri() {
local mimeType=""
if [ -f "$1" ]; then
mimeType=$(file -b --mime-type "$1")
if [[ $mimeType == text/* ]]; then
mimeType="$mimeType;charset=utf-8"
fi
printf "data:%s;base64,%s" \
"$mimeType" \
"$(openssl base64 -in "$1" | tr -d "\n")"
else
printf "%s is not a file.\n" "$1"
fi
}
grepless(){
grep -ir --color=always "$*" --exclude-dir=".git" --exclude-dir="node_modules" . | less -RX
}
cheatsh() { cheatsh() {
curl cheat.sh/"$1" curl cheat.sh/"$1"
} }
watip() {
curl ifconfig.co
# dig +short myip.opendns.com @resolver1.opendns.com
}
## prompt stuff ## ## prompt stuff ##
# git prompt function # git prompt function