-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
55 lines (45 loc) · 1.53 KB
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
source /usr/local/bin/virtualenvwrapper.sh
export WORKON_HOME=~/.envs
# export FOOBAR_ENV=local
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
#export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
#export PATH=./node_modules/.bin:$PATH
export NVM_DIR="/Users/chrisgraffagnino/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# Include alias definitions
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
###########################################
# HOW MUCH RAM IS A PROCESS USING #
# #########################################
function ram() {
local sum
local items
local app="$1"
if [ -z "$app" ]; then
echo "First argument - pattern to grep from processes"
else
sum=0
for i in `ps aux | grep -i "$app" | grep -v "grep" | awk '{print $6}'`; do
sum=$(($i + $sum))
done
sum=$(echo "scale=2; $sum / 1024.0" | bc)
if [[ $sum != "0" ]]; then
echo "${fg[blue]}${app}${reset_color} uses ${fg[green]}${sum}${reset_color} MBs of RAM."
else
echo "There are no processes with pattern '${fg[blue]}${app}${reset_color}' are running."
fi
fi
}
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
echo "(${BRANCH})"
else
echo ""
fi
}
export PS1="\[\e[36m\]\w\[\e[m\]\[\e[35m\] \`parse_git_branch\`\[\e[m\] \[\e[36m\]:\[\e[m\] "
export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:usr/X11/bin"