The aptly named.
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.

182 lines
5.9 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. export PATH=$HOME/bin:$PATH
  2. export EDITOR=vim
  3. set -o vi
  4. # If not running interactively, don't do anything
  5. [ -z "$PS1" ] && return
  6. #export HISTCONTROL='ignoreboth'
  7. #export HISTFILESIZE=2000000
  8. #export HISTIGNORE='&:ls:exit'
  9. #shopt -s histappend
  10. #set cmdhist
  11. # shopt -s checkwinsize
  12. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  13. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  14. debian_chroot=$(cat /etc/debian_chroot)
  15. fi
  16. # set a fancy prompt (non-color, unless we know we "want" color)
  17. case "$TERM" in
  18. xterm-color) color_prompt=yes;;
  19. esac
  20. # Get our git stuff
  21. source ~/.git-completion.sh
  22. source ~/.git-prompt.sh
  23. force_color_prompt=yes
  24. # Prompt colors
  25. BGREEN='\[\033[1;32m\]'
  26. GREEN='\[\033[0;32m\]'
  27. BRED='\[\033[1;31m\]'
  28. BPURPLE='\e[1;36m'
  29. PURPLE='\e[0;36m'
  30. RED='\[\033[0;31m\]'
  31. CYAN='\[\033[0;36m\]'
  32. LCYAN='\[\033[1;36m\]'
  33. BBLUE='\[\033[1;34m\]'
  34. BLUE='\[\033[0;34m\]'
  35. GREY='\[033[0;37m\]'
  36. DGREY='\[033[1;30m\]'
  37. NORMAL='\[\033[00m\]'
  38. # Prompt vars
  39. TIME="\@"
  40. HOST="\h"
  41. USER="\u"
  42. CWD="\w"
  43. PUID="\$"
  44. GIT="\$(__git_ps1)"
  45. if [ -n "$force_color_prompt" ]; then
  46. if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  47. color_prompt=yes
  48. else
  49. color_prompt=
  50. fi
  51. fi
  52. if [ "$color_prompt" = yes ]; then
  53. #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]-=[\u@\h]=-\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  54. PS1="${BLUE}(${GREEN}${CWD}${BLUE}) ${NORMAL}${HOST}${BRED}${GIT}${NORMAL} [$?${NORMAL}]${GREEN} ${PUID}${NORMAL} "
  55. else
  56. PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
  57. fi
  58. unset color_prompt force_color_prompt
  59. # If this is an xterm set the title to user@host:dir
  60. case "$TERM" in xterm*|rxvt*)
  61. PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
  62. ;; *)
  63. ;; esac
  64. # enable color support of ls and also add handy aliases
  65. if [ -x /usr/bin/dircolors ]; then
  66. test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  67. alias ls='ls -X --color=auto'
  68. #alias dir='dir --color=auto' alias vdir='vdir --color=auto'
  69. alias grep='grep --color=auto'
  70. alias fgrep='fgrep --color=auto'
  71. alias egrep='egrep --color=auto'
  72. fi
  73. # some more ls aliases
  74. alias ll='ls -alF'
  75. alias la='ls -A'
  76. alias l='ls -CF'
  77. #mah aliases, son
  78. alias atr0phy='ssh br4n@atr0phy.net'
  79. alias at0rphy='ssh -L 9050:127.0.0.1:9050 br4n@atr0phy.net'
  80. alias evoluent='xinput --set-button-map 12 3 1 1 4 5 7 8 9 0 10 11'
  81. alias cloudme='cd ~/Code/django-cloud/corvisacloud && source ~/Code/django-cloud/bin/activate'
  82. alias paybackme='cd ~/Code/payback && source ~/Code/payback/bin/activate'
  83. alias pb='python -m payback'
  84. alias wallaceme='cd ~/Code/wallace-io/ && node server.js -e ~/Code/wallace-sites -b redis'
  85. alias zeusme='cd ~/Code/zeus2 && source ~/Code/zeus2/bin/activate && ./start_zeus.sh'
  86. alias cls='clear && ls -X --color=auto'
  87. alias ack="~/bin/ack"
  88. alias ackpy="~/bin/ack -r --python --ignore-dir migrations"
  89. alias pbtest="py.test -v -c conf/pytest-integration.ini"
  90. alias pbtestdbg="py.test -sv -c conf/pytest-integration.ini"
  91. alias pbdroptestdb="su postgres -c 'dropdb test_payback'"
  92. alias notes="vim ~/Documents/Notes.txt"
  93. alias pgwatch="tail -f /var/log/postgresql/postgresql-9.4-main.log | ccze -A"
  94. alias postman="/opt/google/chrome/google-chrome \"--profile-directory=Profile 1\" --app-id=fhbjgbiflinjbdggehcddcbncdddomop"
  95. # Add an "alert" alias for long running commands. Use like so:
  96. # sleep 10; alert
  97. alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
  98. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  99. . /etc/bash_completion
  100. fi
  101. # add this configuration to ~/.bashrc
  102. export HH_CONFIG=hicolor # get more colors
  103. shopt -s histappend # append new history items to .bash_history
  104. export HISTCONTROL=ignorespace # leading space hides commands from history
  105. export HISTFILESIZE=10000 # increase history file size (default is 500)
  106. export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
  107. export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}" # mem/file sync
  108. # if this is interactive shell, then bind hh to Ctrl-r
  109. bind '"\C-r": "hh\n"'
  110. export NVM_DIR="/home/brandon.cornejo/.nvm"
  111. [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
  112. # Clipboard jazz
  113. # A shortcut function that simplifies usage of xclip.
  114. # - Accepts input from either stdin (pipe), or params.
  115. # ------------------------------------------------
  116. cb() {
  117. local _scs_col="\e[0;32m"; local _wrn_col='\e[1;31m'; local _trn_col='\e[0;33m'
  118. # Check that xclip is installed.
  119. if ! type xclip > /dev/null 2>&1; then
  120. echo -e "$_wrn_col""You must have the 'xclip' program installed.\e[0m"
  121. # Check user is not root (root doesn't have access to user xorg server)
  122. elif [[ "$USER" == "root" ]]; then
  123. echo -e "$_wrn_col""Must be regular user (not root) to copy a file to the clipboard.\e[0m"
  124. else
  125. # If no tty, data should be available on stdin
  126. if ! [[ "$( tty )" == /dev/* ]]; then
  127. input="$(< /dev/stdin)"
  128. # Else, fetch input from params
  129. else
  130. input="$*"
  131. fi
  132. if [ -z "$input" ]; then # If no input, print usage message.
  133. echo "Copies a string to the clipboard."
  134. echo "Usage: cb <string>"
  135. echo " echo <string> | cb"
  136. else
  137. # Copy input to clipboard
  138. echo -n "$input" | xclip -selection c
  139. # Truncate text for status
  140. if [ ${#input} -gt 80 ]; then input="$(echo $input | cut -c1-80)$_trn_col...\e[0m"; fi
  141. # Print status.
  142. echo -e "$_scs_col""Copied to clipboard:\e[0m $input"
  143. fi
  144. fi
  145. }
  146. # Aliases / functions leveraging the cb() function
  147. # ------------------------------------------------
  148. # Copy contents of a file
  149. function cbf() { cat "$1" | cb; }
  150. # Copy SSH public key
  151. alias cbssh="cbf ~/.ssh/id_rsa.pub"
  152. # Copy current working directory
  153. alias cbwd="pwd | cb"
  154. # Copy most recent command in bash history
  155. alias cbhs="cat $HISTFILE | tail -n 1 | cb"
  156. # ASCII ART GOODNESS
  157. echo -e "$(<~/.motd)"