Skip to content

Instantly share code, notes, and snippets.

@MurphyPone
Last active June 12, 2020 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MurphyPone/801e6a5f8759eb72ebc49990bc820e05 to your computer and use it in GitHub Desktop.
Save MurphyPone/801e6a5f8759eb72ebc49990bc820e05 to your computer and use it in GitHub Desktop.
# aliases
alias vi='vi "+set number"'
alias egrep='egrep --color=auto'
alias grep='grep --color=auto'
alias ls='ls -G'
alias kc='kubectl'
alias ahab="echo 'docker stop \$(docker ps -aq) && docker rm \$(docker ps -aq)' && docker stop \$(docker ps -aq) && docker rm \$(docker ps -aq)"
alias rm='rm -i'
alias history="history | grep"
alias python='/usr/local/bin/python3.7'
alias weather="curl v2.wttr.in"
alias moon="curl wttr.in/Moon"
alias cal="cal -3"
PS1="\[\e[1;33m\]\#\[\e[m\] \[\e[38;5;202m\][\t]\[\e[m\] \u:\h \[\e[0;36m\]\W\[\e[m\]\[\e[91m\]\$\[\e[m\] "
# converts decimal to binary
dtb() {
printf '%d in binary is \e[1;93m' "$1"
echo "obase=2;$1" | bc;
printf "\e[0m"
}
# converts decimal to hex
dth() {
printf '%s in decimal is \e[1;93m 0x' "$@"
echo "obase=16; ibase=10; $@"|bc
printf "\e[0m"
}
# converts binary to decimal
btd() {
printf '%d in decimal is \e[1;93m%d\n\e[0m' "$1" "$((2#$1))"
}
# converts binary to hex
bth() {
printf '%d in hex is \e[1;93m0x%X\n\e[0m' "$1" "$((2#$1))"
}
# converts hex to binary
htb() {
hex=$@
val=$(echo $hex | cut -d'x' -f 2)
printf '%s in binary is \e[1;93m' "$hex"
echo "obase=2; ibase=16; $val"|bc
printf "\e[0m"
}
# converts hex to decimal
htd() {
hex=$@
val=$(echo $hex | cut -d'x' -f 2)
printf '%s in decimal is \e[1;93m' "$hex"
echo "obase=10; ibase=16; $val"|bc
printf "\e[0m"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment