Last active
July 17, 2020 03:13
-
-
Save davidkuster/3fee68db1516495ee8de to your computer and use it in GitHub Desktop.
OSX bash profile
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
# history tweaks (Setting HISTSIZE and HISTFILESIZE to something nonnumeric makes for no limits) | |
export HISTFILESIZE="SAVE_IT_ALL_YO" | |
export HISTSIZE="SAVE_IT_ALL_YO" | |
export HISTTIMEFORMAT='%Y-%m-%d %H:%M.%S | ' | |
export HISTIGNORE="ll:exit:history:[bf]g:jobs" | |
export HISTCONTROL=ignorespace | |
shopt -s histappend | |
# think about separating out history files | |
#export HISTFILE="${HOME}/.history/$(date -u +%Y/%m/%d.%H.%M.%S)_${HOSTNAME}_$$" | |
# from https://twitter.com/michaelhoffman/status/639178145673932800 | |
# Replaces ~/.bash_history with ~/.history/<year>/<month>/<session> | |
# <session> is day-of-month.time_your-hostname_PID | |
# hostname+PID stops collisions even if you open bash at same second on multiple machines in same cluster | |
# gradle | |
#export GRADLE_OPTS='-Dorg.gradle.daemon=true' | |
# java | |
export JAVA_OPTS='-Xms1024m -Xmx2048m -XX:-UseGCOverheadLimit' | |
# scala | |
export PATH="~/opt/scala-2.11.7/bin:$PATH" | |
# maven | |
export PATH="~/opt/apache-maven-3.3.3/bin:$PATH" | |
# minikube | |
export PATH="~/opt/minikube:$PATH" | |
# aws cli | |
export PATH="~/Library/Python/2.7/bin:$PATH" | |
# scripts | |
export PATH="~/opt/scripts:$PATH" | |
# terraform | |
#export PATH="~/projects/Sesame/deployment_devops/terraform:$PATH" | |
#export TF_VAR_AWS_ACCESS_KEY_ID="AKIA..." # TODO: not this next time | |
#export TF_VAR_AWS_SECRET_ACCESS_KEY="SP/vZ03S..." | |
#export TF_VAR_AWS_REGION="us-east-1" | |
# git/mercurial bash prompt | |
. ~/opt/scripts/git_hg_bash_prompt.sh | |
# git shortcuts | |
alias gdiff="git diff HEAD" | |
alias gstat="git status" | |
alias gout="git log origin/master..HEAD" | |
alias gin="git log HEAD..origin/master" | |
alias gfakemerge="git merge --no-commit --no-ff master" | |
alias gabortmerge="git merge --abort" | |
alias gfakeprune="git remote prune origin --dry-run" | |
alias gprune="git remote prune origin" | |
alias gshort="git log -1 --abbrev-commit" | |
alias gpullall="find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c \"cd '{}' && git pull\" \;" | |
alias gsubup="git submodule update --recursive" | |
alias gundolast="git reset HEAD~" | |
# gradle shortcuts | |
alias gw="./gradlew" | |
alias gwc="./gradlew clean classes" | |
alias gwtc="./gradlew testClasses" | |
alias gwt="./gradlew test" | |
alias gwct="./gradlew clean test" | |
alias gwtr="./gradlew jacocoTestReport" | |
alias gwttr="./gradlew clean test && ./gradlew jacocoTestReport" | |
# directory/file path aliases | |
alias ll="ls -l" | |
alias la="ls -la" | |
alias cls="clear" | |
alias work="cd ~/workspace" | |
alias home="cd ~" | |
alias proj="cd ~/projects" | |
alias docs="cd ~/Documents" | |
alias down="cd ~/Downloads" | |
alias data="cd ~/data" | |
alias showFiles="defaults write com.apple.finder AppleShowAllFiles true && killall Finder" | |
alias hideFiles="defaults write com.apple.finder AppleShowAllFiles false && killall Finder" | |
# control whether OSX repeats character keys or a long press shows accents for that letter | |
alias keyRepeatOn="defaults write -g ApplePressAndHoldEnabled -bool false" | |
alias keyRepeatOff="defaults write -g ApplePressAndHoldEnabled -bool true" | |
# directory navigation shortcuts | |
alias ..="cd .." | |
alias ..2="cd ../.." | |
alias ..3="cd ../../.." | |
alias ..4="cd ../../../.." | |
alias ..5="cd ../../../../.." | |
# grep with color | |
alias grep="grep --color" | |
alias egrep="egrep --color" | |
# netstat equivalent | |
ports() { lsof -i :$1; } | |
# check epoch timestamp of JWT token exp | |
#epoch() { ruby -e "puts Time.at \$1" } | |
# exclude timestamp from history and look for unique results | |
histUniq() { history | grep "$1" | cut -d ' ' -f6- | uniq; } | |
# checksum checking | |
alias checksum-sha256="openssl dgst -sha256" | |
alias checksum-sha512="openssl dgst -sha512" | |
# this has been superseeded by github.com/davidkuster/k8s-utils | |
# kubernetes env-specific shortcuts | |
#alias k8s-dev="kubectl --kubeconfig=${HOME}/.kube/config.dev" | |
#alias k8s-qa="kubectl --kubeconfig=${HOME}/.kube/config.qa" | |
#alias k8s-old-prod="kubectl --kubeconfig=${HOME}/.kube/config.prod" | |
#alias k8s-new-prod="kubectl --kubeconfig=${HOME}/.kube/config.new-prod" | |
# k8s system namespace | |
#alias k8s-dev-sys="kubectl --kubeconfig=${HOME}/.kube/config.dev --namespace=kube-system" | |
#alias k8s-qa-sys="kubectl --kubeconfig=${HOME}/.kube/config.qa --namespace=kube-system" | |
#alias k8s-old-prod-sys="kubectl --kubeconfig=${HOME}/.kube/config.prod --namespace=kube-system" | |
#alias k8s-new-prod-sys="kubectl --kubeconfig=${HOME}/.kube/config.new-prod --namespace=kube-system" | |
# aws shortcuts (original micro instance) | |
#alias aws_ssh="ssh -i ~/workspace/feed/dave_key.pem ubuntu@52.27.." | |
# defining a function as apparently bash aliases don't take parameters | |
#aws_scp_services() { scp -i ~/workspace/feed/dave_key.pem $1 ubuntu@52.27..:/home/ubuntu/app_services; } | |
#aws_scp_website() { scp -i ~/workspace/feed/dave_key.pem $1 ubuntu@52.27..:/home/ubuntu/app_website; } | |
# aws dev instance | |
#alias aws_ssh_dev="ssh -i ~/workspace/feed/dave_key.pem ubuntu@52.33.." | |
#aws_scp_services_dev() { scp -i ~/workspace/feed/dave_key.pem $1 ubuntu@52.33..:/home/ubuntu/app_services; } | |
#aws_scp_website_dev() { scp -i ~/workspace/feed/dave_key.pem $1 ubuntu@52.33..:/home/ubuntu/app_website; } | |
# aws beta instance | |
#alias aws_ssh_beta="ssh -i ~/workspace/feed/dave_key.pem ubuntu@52.32.." | |
#aws_scp_services_beta() { scp -i ~/workspace/feed/dave_key.pem $1 ubuntu@52.32..:/home/ubuntu/app_services; } | |
#aws_scp_website_beta() { scp -i ~/workspace/feed/dave_key.pem $1 ubuntu@52.32..:/home/ubuntu/app_website; } | |
# aws VPCs | |
#ssh-add ~/workspace/feed/_ops_v1.pem | |
#alias aws_ssh_jump="ssh -A -i ~/workspace/feed/_bastion_v1.pem ubuntu@52.34.." | |
# bash completion | |
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion | |
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! | |
export SDKMAN_DIR="/Users/davidkuster/.sdkman" | |
[[ -s "/Users/davidkuster/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/davidkuster/.sdkman/bin/sdkman-init.sh" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment