forked from jtgraphic/configurations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_profile
70 lines (53 loc) · 1.45 KB
/
.bash_profile
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
export EDITOR=/usr/bin/vim
export EC2_HOME=~/.ec2
export PATH=$PATH:$EC2_HOME/bin
export JAVA_HOME=$(/usr/libexec/java_home)
source ~/.bash_sensitive
alias l='ls -lhaG'
alias gits='git status;'
alias chef-roles='find roles -name "*.json" -or -name "*.rb" | xargs knife role from file'
alias chef-environments='find environments -name "*.json" -or -name "*.rb" | xargs knife environment from file'
alias chef-sync='knife cookbook upload -a; chef-roles; chef-environments;'
kpurge() {
knife client delete $1
knife node delete $1
}
RED="\[\e[0;31m\]"
YELLOW="\[\e[0;33m\]"
GREEN="\[\e[0;32m\]"
WHITE="\[\e[0;37m\]"
function cdc() {
cd ~/code/$1
}
function ref(){
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\[\1\]/' || return
}
function sha(){
git rev-parse --short HEAD 2> /dev/null | sed -e 's/\(.*\)/\[\1\]/' || return
}
function dateOut() {
date +%H:%M || return
}
PS1="$GREEN[\$(dateOut)]$YELLOW\$(ref)\$(sha)\[\e[0m\][\w]\$ "
kssh() {
IP=`knife node show $1 | grep "IP" | sed 's/IP: //g'`
ssh ubuntu@$IP
}
_kssh() {
local cur opts
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$(knife node list | tr '\n' ' ')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
}
complete -F _kssh kssh
complete -F _kssh kpurge
cdc() {
cd ~/code/$1
}
_cdc() {
local cur opts
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$(cd ~/code ; ls -d *)
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
}
complete -F _cdc cdc