my dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.6 KiB

  1. echo bash_profile
  2. #SSH_ENV="$HOME/.ssh/environment"
  3. function ssh {
  4. /usr/bin/ssh $* || if [ "$?" -eq "255" ] ; then
  5. line=$(/usr/bin/ssh $* 2>&1 |grep Offending|cut -f2 -d:)
  6. sed -i -e "${line}d" ~/.ssh/known_hosts
  7. echo "Host key changed. Wiping from ~/.ssh/known_hosts." >&2
  8. /usr/bin/ssh $*
  9. fi
  10. }
  11. function start_agent {
  12. echo -n "Initialising new SSH agent..."
  13. /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
  14. echo succeeded
  15. chmod 600 "${SSH_ENV}"
  16. . "${SSH_ENV}" > /dev/null
  17. /usr/bin/ssh-add; /usr/bin/ssh-add ~/.ssh/id_github_rsa
  18. }
  19. # Source SSH settings, if applicable
  20. #if [ -f "${SSH_ENV}" ]; then
  21. # . "${SSH_ENV}" > /dev/null
  22. # ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
  23. # start_agent;
  24. # }
  25. #else
  26. # start_agent;
  27. #fi
  28. export PATH=$HOME/.pilot/shims:$HOME/.pilot/bin:$PATH:/usr/local/bin:~/Library/Python/2.7/bin
  29. eval $(export PATH=$PATH:/usr/local/bin pilot env)
  30. export GOPATH=$HOME/go
  31. export PATH=$GOPATH/bin:$PATH
  32. export NVM_DIR="$HOME/.nvm" ; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
  33. export INTERCOM_USER=john.looney
  34. #export GOPATH=/Users/johnlooney/src/mongodb/mongo-tools/vendor:/Users/johnlooney/go
  35. export PATH=$HOME/.pilot/shims:$HOME/.pilot/bin:$PATH:$HOME/bin/
  36. eval $(pilot env)
  37. export NVM_DIR="/Users/johnlooney/.nvm"
  38. [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
  39. alias ussh='ssh -l $USER'
  40. alias ber='docker exec -it pilot_intercom bundle exec rspec'
  41. # . /usr/local/opt/chruby/share/chruby/chruby.sh
  42. # chruby 2.3.3
  43. echo PATH=$PATH;
  44. [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
  45. # Set config variables first
  46. GIT_PROMPT_ONLY_IN_REPO=1
  47. GIT_PROMPT_FETCH_REMOTE_STATUS=1 # uncomment to avoid fetching remote status
  48. # GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch
  49. # GIT_PROMPT_SHOW_UNTRACKED_FILES=all # can be no, normal or all; determines counting of untracked files
  50. # GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=0 # uncomment to avoid printing the number of changed files
  51. # GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10
  52. # GIT_PROMPT_START=... # uncomment for custom prompt start sequence
  53. # GIT_PROMPT_END=... # uncomment for custom prompt end sequence
  54. # as last entry source the gitprompt script
  55. # GIT_PROMPT_THEME=Custom # use custom theme specified in file GIT_PROMPT_THEME_FILE (default ~/.git-prompt-colors.sh)
  56. # GIT_PROMPT_THEME_FILE=~/.git-prompt-colors.sh
  57. GIT_PROMPT_THEME=Solarized # use theme optimized for solarized color scheme
  58. if [ -f /usr/local/share/gitprompt.sh ]; then
  59. . /usr/local/share/gitprompt.sh
  60. fi
  61. source ~/src/scripts/bashrc/opsworks.sh
  62. export ATLAS_TOKEN=Q77xtYnJ4QqSFw.atlasv1.Xprdavl660mySqqKWxXhmaMrYBXESfg4nNNlydH8FHrgQLrC6b44TC83QZykyQcXZkg
  63. alias gr='git co master ; git pull ; git co - ; git rebase master'
  64. export NVM_DIR="/Users/johnlooney/.nvm"
  65. [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
  66. alias pilot_reload='launchctl unload ~/Library/LaunchAgents/com.github.intercom.pilot.daemon.plist ; launchctl load ~/Library/LaunchAgents/com.github.intercom.pilot.daemon.plist'
  67. export DATADOG_APP_KEY=2099956f2d2323d0b0669889134e79f8af926b96 DATADOG_API_KEY=aabf7912a1202c018dd14555706d2155 AWS_DEFAULT_REGION=us-east-1
  68. export PYTHONSTARTUP=~/.pythonrc
  69. eval "$(rbenv init -)"
  70. function circle () {
  71. curl -s -u $(cat ~/.circle_auth): 'https://circleci.com/api/v1.1/'$*
  72. }
  73. function hostname_from_instance() {
  74. echo $(aws ec2 describe-instances --instance-ids=$1 --query='Reservations[0].Instances[0].PublicDnsName' | tr -d '"')
  75. }
  76. function ip_from_instance() {
  77. echo $(aws ec2 describe-instances --instance-ids=$1 --query='Reservations[0].Instances[0].PublicIpAddress' | tr -d '"')
  78. }
  79. function assh() {
  80. ssh ec2-user@$(hostname_from_instance "$1")
  81. }
  82. function sdb() {
  83. case $(uname -s) in
  84. Darwin) timestamp=$(date -uj -f %s $(($(date +%s) - (5 * 60))) +"%FT%TZ" | sed s/:/%3A/g);;
  85. Linux) timestamp=$(date -u +"%FT%TZ" --date='5 min ago' | sed s/:/%3A/g);;
  86. esac
  87. params="AWSAccessKeyId=$ACCOUNT_KEY"
  88. params="$params&Action=$1"
  89. [ -z "$2" ] || params="$params&DomainName=$2"
  90. params="$params&SignatureMethod=HmacSHA256"
  91. params="$params&SignatureVersion=2"
  92. params="$params&Timestamp=$timestamp"
  93. params="$params&Version=2009-04-15"
  94. payload="GET\nsdb.amazonaws.com\n/\n$params"
  95. hash=$(echo -ne $payload | openssl dgst -sha256 -hmac "$SECRET_KEY" -binary | base64)
  96. curl -H application/x-www-form-urlencoded "https://sdb.amazonaws.com/?$params&Signature=$hash"
  97. }
  98. function git() {
  99. if [ "$1" = "commit" ] ; then
  100. ls *.tf > /dev/null 2>&1 && terraform fmt
  101. fi
  102. hub $*
  103. }