-
-
Save ikushaldave/09dea7aa15e4c16371d07e88cb7b7f30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH=$HOME/.bin:/usr/local/bin:$PATH | |
export ZSH=$HOME/.oh-my-zsh | |
ZSH_THEME="robbyrussell" | |
plugins=( | |
dotenv | |
git | |
urltools | |
) | |
source $ZSH/oh-my-zsh.sh | |
hash vim 2> /dev/null && export EDITOR="vim" | |
hash firefox 2> /dev/null && export BROWSER="firefox" | |
hash most 2> /dev/null && export PAGER="most" | |
export WORKSPACE="$HOME/workspace" | |
HISTSIZE=1000000 | |
SAVEHIST=$HISTSIZE | |
export LESS=RFX | |
# Aliases | |
alias glnp="git --no-pager log --oneline -n30" | |
alias sudo="sudo " | |
case $(uname) in | |
Darwin) | |
alias l="LC_COLLATE=C ls -Alh" | |
;; | |
Linux) | |
alias l="LC_COLLATE=C ls -Alh --group-directories-first" | |
;; | |
esac | |
alias ll="l" | |
alias h="fc -li 1" | |
alias histstats="history | awk '{CMD[\$2]++;count++;}END { for (a in CMD)print CMD[a] \" \" CMD[a]/count*100 \"% \" a;}' | grep -v './' | column -c3 -s ' ' -t | sort -nr | nl | head -n10" | |
alias ws='cd $WORKSPACE && ls' | |
zshrc() { | |
"$EDITOR" "$HOME/.zshrc" | |
echo 'Run exec zsh -l to reload the configuration' | |
} | |
mkcd() { | |
mkdir -p "$1" | |
cd "$1" | |
} | |
killport() { | |
lsof -n -i4TCP:"$1" | grep LISTEN | awk '{ print $2 }' | xargs kill | |
} | |
json_escape() { | |
< "$1" sed 's/^ *//' | tr -d '\n' | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | |
} | |
hibp() { | |
curl -fsS "https://haveibeenpwned.com/api/v2/breachedaccount/$1" \ | |
| jq -r 'sort_by(.BreachDate)[] | [.Title,.Domain,.BreachDate,.PwnCount] | @tsv' \ | |
| column -t -s$'\t' | |
} | |
# Add --json flag to curl | |
curl() { | |
args=() | |
for arg in "$@"; do | |
case $arg in | |
--json) args+=("-H" "Content-Type: application/json") ;; | |
*) args+=("$arg") ;; | |
esac | |
done | |
command curl "${args[@]}" | |
} | |
# Docker | |
docker() { | |
case "$1" in | |
"bash") | |
command docker exec -it "$2" bash | |
;; | |
"root") | |
command docker run -itv "${2:-/tmp}":/data --rm alpine sh | |
;; | |
*) | |
command docker "$@" | |
;; | |
esac | |
} | |
# Python | |
export VIRTUAL_ENV_DISABLE_PROMPT=1 | |
export PROMPT="\$([[ -v VIRTUAL_ENV ]] && echo '🐍 ')$PROMPT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment