-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc.work.dev
126 lines (101 loc) · 2.8 KB
/
.bashrc.work.dev
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# misc aliases and functions
alias la="ls -a"
alias vp="vim -p"
alias np="nvim -p"
# work specific aliases and functions
### python specific
alias aa="source ./venv/bin/activate"
alias da="deactivate"
alias py3="/opt/python3.10/bin/python3"
alias py310="/opt/python3.10/bin/python3"
alias py39="/opt/python3.9/bin/python3"
alias py38="/opt/python3.8/bin/python3"
alias py37="/opt/python3.7/bin/python3"
alias vpy="venv/bin/python"
function pt() {
declare -a test_dirs
[ -d "./test" ] && test_dirs+=("test")
[ -d "./tests" ] && test_dirs+=("tests")
if [ $# -eq 0 ]
then
withenv venv/bin/py.test "${test_dirs[@]}"
else
withenv venv/bin/py.test "${test_dirs[@]}" -k "$@"
fi
}
function bb() {
curr_dir=$(basename "$PWD")
venv/bin/bandit -ll -r "$curr_dir"
}
function flk() {
dirs=("$(basename "$PWD")")
[ -d "./test" ] && dirs+=("test")
[ -d "./tests" ] && dirs+=("tests")
[ -d "./scripts" ] && dirs+=("scripts")
venv/bin/flake8 "${dirs[@]}"
}
### ruby specific
alias be="withenv vendor/bundle/bundle exec"
alias rails="withenv vendor/bundle/bundle exec rails s"
function rspec() {
# TODO will need to check for other ruby services, invoke rspec differently
withenv vendor/bundle/bundle exec rspec "$@"
}
function cop() {
withenv vendor/bundle/bundle exec rake easycop:phab "$@"
}
function cln() {
be rails runner script/vcr_cassette_cleaner.rb --clean-yaml-binary --no-dry-run "$@"
}
function drycln() {
be rails runner script/vcr_cassette_cleaner.rb --clean-yaml-binary "$@"
}
### git specific
alias gb="git branch"
alias gc="git commit"
alias gca="git commit --amend"
alias gco="git checkout"
alias gcb="git checkout -b"
alias gd="git diff"
alias gr="git grep"
alias gs="git status"
alias gp="git pull"
alias gpm="git pull origin master"
# directory aliases
alias gg="cd ~/gits"
alias ep="cd ~/gits/easy_post"
alias trk="cd ~/gits/tracking"
alias ec="cd ~/gits/easycarrier"
alias sp="cd ~/gits/easycarrier_schemas_pydantic"
alias sc="cd ~/gits/easycarrier_schemas_colander"
alias cif="cd ~/gits/python_carrier_integrations"
alias dots="cd ~/gits/dofiles"
# friendlier find command
#
# ex: ff some_code*
function ff {
find . -name "*$@*";
}
# friendlier tar command
function utar {
tar xvzf "$1";
}
if command -v nvim &> /dev/null
then
export EDITOR=nvim
else
export EDITOR=vim
fi
GIT_COMPL_FILE=/etc/bash_completion.d/git
if [[ -f $GIT_COMPL_FILE ]]; then
source $GIT_COMPL_FILE
fi
# rEP update alias, bc partitioning command fails sometimes
function epup {
make config/environments/development.rb vendor/bundle ~/.bundle/easy_post/installed_gems test-db
withenv vendor/bundle/bundle exec rake db:migrate
}
# helping w/ request comparisons
function rc {
py39 -c "import base64, zlib, sys; print( zlib.decompress(base64.b64decode(sys.stdin.read())).decode() )" <<< "$1"
}