-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmybashrc
86 lines (64 loc) · 2.7 KB
/
mybashrc
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
## BASHRC
alias rebash='. ~/.bashrc'
alias bashedit='vi ~/setup/mybashrc; rebash'
alias update_setup='cd ~/setup; git pull; rebash; cd - > /dev/null'
export PATH="~/setup/scripts:$PATH"
## LS
alias l='ls -al'
alias ö='l'
#gohome
alias gohome='ssh [email protected]'
alias utv14='ssh berema@utv14'
alias odoo142='ssh odoo142'
alias azzar='ssh [email protected]'
alias saltmaster='ssh emanuel@saltmaster'
alias saltslave1='ssh emanuel@saltslave1'
alias hugo='ssh berema@hugo'
alias kubetest='ssh kubetest'
## CD
alias ..='cd ..'
alias -- ...='cd ../..'
alias -- ....='cd ../../..'
alias -- -='cd - > /dev/null'
## GIT
alias gg='git grep'
alias g='grep -inRIs'
alias gs='grep -iRIs'
alias g-='git checkout -'
alias gitbranches='for x in `echo /usr/share/odoo-*`;do cd $x; echo "`git rev-parse --abbrev-ref HEAD` - $x"; cd - > /dev/null; done | sort'
alias gitunsafe='for x in `echo /usr/share/odoo*`;do git config --global --add safe.directory $x; done'
## PS1
function __current_branch__ {
[ -d .git ] && git name-rev --name-only @
}
# stolen from https://askubuntu.com/questions/730754/how-do-i-show-the-git-branch-with-colours-in-bash-prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Stolen from default ubuntu
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[33m\]$(parse_git_branch)\[\033[00m\]\$ ' # TODO: fix this so it has (__git_branch__) in separate color if, and only if, in a git-rep
# ODOO-move
alias olog='cd /var/log/odoo/'
function ocd {
cd `find -L /usr/share/ -name $1`
}
function odoopsql {
sudo su odoo -c "psql $1"
}
function odoomodules {
[ ! -z "$1" ] && sudo su odoo -c "psql $1 -c \"select name from ir_module_module where state='installed' order by name asc\"" | tail -n +3 | head -n -2 | sed 's/^ //g' | less
[ -z "$1" ] && echo "Usage: odoomodules databasename"
}
function odoodbs {
sudo su odoo -c "psql -l" | grep -o "^ [^ ]*" | grep -o "[^ ]*" | sort
}
function modules_changed {
git diff "$*" --stat | grep -v "files changed" | grep -v "insertions(" | grep -o "^ [^/ ]*" | grep -v "^ ...$" | grep -o "[^ ].*" | grep -v ".gitignore" | sort | uniq
}
alias avail_modules='for x in `echo /usr/share/odoo-*/* /usr/share/odooext-*/* /usr/share/core-odoo/addons/*`; do [ -d $x ] && echo `basename $x`; done | sort'
alias avail_projects='for x in `echo /usr/share/odoo-*/* /usr/share/odooext-*/* /usr/share/core-odoo/addons/*`; do [ -d $x ] && echo `dirname $x`; done | sort'
alias skog_mailcatcher='echo "OPEN FIREFOX ON http://localhost:6113"; ssh [email protected] -L6113:10.16.110.13:1080'
alias python=python3
function manifest {
vi "$1/__manifest__.py"
}