Skip to content

Instantly share code, notes, and snippets.

@kahunacohen
Last active May 26, 2021 12:47
Show Gist options
  • Save kahunacohen/142a4dfb66f0e2eab38cb68e0b69d95c to your computer and use it in GitHub Desktop.
Save kahunacohen/142a4dfb66f0e2eab38cb68e0b69d95c to your computer and use it in GitHub Desktop.
source ~/bash-utils/bu.sh
# General unix
export BASH_SILENCE_DEPRECATION_WARNING=1
# Remove safe, sends to trash.
# Removes items from the trash that are over
# 30 days old.
function rms {
mv "$1" ~/.Trash
find ~/.Trash -mtime +30 -exec rm -rf '{}' \;
}
function rn {
local finddir=$1
local findglob=$2
local findre=$3
local replace=$4
find $1 -type f -name "$findglob" | while read fname; do
dirname=`dirname "$fname"`
filename=`basename "$fname"`
newname=`echo "$filename" | sed -e "s/$findre/$replace/g"`
mv "${dirname}/$filename" "${dirname}/$newname"
done
}
#export PATH=$PATH:$HOME/.local/bin
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Prompt
PS1='\w\$ '
# git
alias latest_tag='git tag | sort -V | tail -n1'
alias diff_latest_tag='git diff `latest_tag`'
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
. $HOME/bin/delete-branches.sh
alias gd="git diff"
alias gs='git status'
alias gp='git push'
# git branch search
function gbs {
ret=$(git branch | grep $1)
if [ "$?" -ne 0 ]; then
>&2 echo "Search for $1 got > 1 branches:"
>&2 echo "$ret"
return 1
else
git branch $ret
fi
}
# Ruby
#rvm use system
#rvm use 2.6.4
#export GEM_HOME="$GEM_HOME:$HOME/.rvm/bin"
#export GEM_PATH="$GEM_PATH:$HOME/.rvm/bin"
# Android
export JAVA_HOME=/Application/Android Studio.app/Contents/jre/jdk/Contents/Home
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
# Mytzedakah
if [ -f '/Users/acohen/google-cloud-sdk/path.bash.inc' ]; then . '/Users/acohen/google-cloud-sdk/path.bash.inc'; fi
if [ -f '/Users/acohen/google-cloud-sdk/completion.bash.inc' ]; then . '/Users/acohen/google-cloud-sdk/completion.bash.inc'; fi
# Node
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# OurCrowd React Native
export PATH=/Users/acohen/projects/mobileapp-client/node_modules/.bin:$PATH
export GOPATH=$HOME/go
export PATH=$PATH:$(go env GOPATH)/bin
source "$HOME/.cargo/env"
# added by travis gem
[ ! -s /Users/acohen/.travis/travis.sh ] || source /Users/acohen/.travis/travis.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment