@@ -26,7 +26,6 @@ pathrm() {
2626 PATH=" $( echo $PATH | sed -e " s;\(^\|:\)${1%/ } \(:\|\$ \);\1\2;g" -e ' s;^:\|:$;;g' -e ' s;::;:;g' ) "
2727}
2828
29-
3029# Configuration for the command line tool "hh" (history searcher to replace ctrl-r, brew install hh)
3130export HH_CONFIG=hicolor,rawhistory,favorites # get more colors
3231shopt -s histappend # append new history items to .bash_history
@@ -267,6 +266,8 @@ if [ -f ~/.git-completion.bash ]; then
267266fi
268267
269268alias here=' open .'
269+
270+ # ln -s /Applications/MacVim.app/Contents/bin/mvim /usr/local/bin/mvim
270271alias vim=' mvim'
271272
272273# Hack to show the version of an installed perl module.
@@ -897,23 +898,53 @@ function gr_banana() {
897898
898899PS1=" \n\[$COLOR_YELLOW \]\u\[\$ (error_test)\]@\[$COLOR_GREEN \]\w\$ (${dvcs_function} )\[$COLOR_RESET \] \$ "
899900
901+ # make sound good
902+ function ding() {
903+ afplay /System/Library/Sounds/Glass.aiff
904+ }
905+
900906# Grand rounds stuff
901907export GR_HOME=${HOME} /dev
902908export GR_USERNAME=andrew.ray
903909
910+ function gr_locked_gpg() {
911+ if pgrep -f " gpg --use-agent --no-tty --quiet -o" > /dev/null
912+ then
913+ echo 1
914+ else
915+ echo 0
916+ fi
917+ }
918+
919+ sleep_rand () {
920+ rand=${RANDOM: 0: 1} # 0 - 9 https://stackoverflow.com/questions/1194882/how-to-generate-random-number-in-bash
921+ sleep " 0.${rand} "
922+ }
923+
904924if [ -d " $GR_HOME " ]; then
905925
906- if [ -n " $LOGIN_WAIT " ]; then
907- echo " waiting ${LOGIN_WAIT} "
926+ sleep_rand
927+ locked=$( gr_locked_gpg)
928+ if [ " $locked " == " 1" ]; then
929+ echo ' Someone else is using the gpg agent, waitng...'
930+ bail=0
931+
932+ while [ " $locked " == " 1" ] && [ $bail != 100 ]
933+ do
934+ sleep_rand
935+ locked=$( gr_locked_gpg)
936+ let bail+=1
937+ done
908938 fi
939+
909940 for file in ${GR_HOME} /engineering/bash/* .sh; do
910- source $file ;
941+ source " $file "
911942 done
912943
913944 pathadd " ${GR_HOME} /engineering/bin"
914945
915946 # default to aws env
916- aws-environment development
947+ aws-environment || aws-environment development
917948
918949 # allow for pivotal prme command
919950 tracker-environment
@@ -966,7 +997,8 @@ if [[ $(command -v pyenv) ]]; then
966997 fi
967998fi
968999
969- export IPSEC_SECRETS_FILE=/etc/ipsec.secrets
1000+ # legacy line? testing removing for new laptop setup and not linux
1001+ # export IPSEC_SECRETS_FILE=/etc/ipsec.secrets
9701002export KEY_SUFFIX=grandrounds.com
9711003
9721004# GR
10111043
10121044[[ -s /Users/andrewray/.rsvm/rsvm.sh ]] && . /Users/andrewray/.rsvm/rsvm.sh # This loads RSVM
10131045
1046+ alias cat=' bat --theme=TwoDark'
1047+
10141048# aliased to "sw"
10151049# Easily checkout git branches, listed from a dialog menu
10161050# dialog settings may be set in ~/.dialogrc
@@ -1101,6 +1135,15 @@ if [ -d "$TRACKER_FLOW_PATH" ]; then
11011135 . " $TRACKER_FLOW_PATH /tracker_completion.bash"
11021136fi
11031137
1104- function ding() {
1105- afplay /System/Library/Sounds/Glass.aiff
1106- }
1138+ # Chruby
1139+ CHRUBY_PATH=" /usr/local/share/chruby/"
1140+ if [ -d " $CHRUBY_PATh " ]; then
1141+ source " ${CHRUBY_PATH} chruby.sh"
1142+ source " ${CHRUBY_PATH} auto.sh"
1143+
1144+ # set default chruby https://github.com/postmodern/chruby#default-ruby
1145+ chruby 2.5.1
1146+ fi
1147+
1148+ # loads nvm bash_completion
1149+ [ -s " $NVM_DIR /bash_completion" ] && \. " $NVM_DIR /bash_completion"
0 commit comments