-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_custom
124 lines (100 loc) · 3.54 KB
/
.bash_custom
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
# Set the default editor to vim.
export EDITOR=micro
# Bash history size
export HISTSIZE=-1
export HISTFILESIZE=-1
# Avoid succesive duplicates in the bash command history.
export HISTCONTROL=ignoreboth:erasedups
# Ignoring these commands in the history so you don't accidentally use them twice.
export HISTIGNORE='git stash pop:git reset HEAD~1'
# Append commands to the bash command history file (~/.bash_history)
# instead of overwriting it.
shopt -s histappend
# Append commands to the history every time a prompt is shown,
# instead of after closing the session.
PROMPT_COMMAND='history -a'
# Bash primary prompt
export PS1='\[\e[32m\]\u:\W\[\e[m\] || '
######################
### Bash title bar ###
######################
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# Show the currently running command in the terminal title:
# http://www.davidpashley.com/articles/xterm-titles-with-bash.html
show_command_in_title_bar()
{
case "$BASH_COMMAND" in
*\033]0*)
# The command is trying to set the title bar as well;
# this is most likely the execution of $PROMPT_COMMAND.
# In any case nested escapes confuse the terminal, so don't
# output them.
;;
*)
echo -ne "\033]0;${BASH_COMMAND}\007"
;;
esac
}
trap show_command_in_title_bar DEBUG
;;
*)
;;
esac
# eval "$(starship init bash)"
###############
### Aliases ###
###############
# Tools
alias clear_logs="sudo rm -v /var/log/*.log* /var/log/syslog*"
# Python shortcuts
alias pipr="pip install -r requirements.txt"
# Django Shortcuts
alias src="source env/bin/activate"
alias rs="python manage.py runserver"
alias rw="python manage.py rqworker high default low"
alias migrate="python manage.py migrate"
alias lsh="python manage.py shell_plus"
alias hsh="heroku run python manage.py shell_plus"
# TC2 Shorcuts
alias AA="cd ~/repos/TutorCruncher2/ && source env/bin/activate"
alias rdcd="./manage.py reset_database --create-demo-agency --su-password testing"
alias hrrdcd="heroku run --app angrypenguin ./manage.py reset_database --create-demo-agency"
alias piprr="make install-dev"
alias yw="yarn head && yarn main-watch"
alias deployap="./extra/tools/deploy.py --force-push --dont-migrate --app angrypenguin"
alias deployapmigs="./extra/tools/deploy.py --force-push --app angrypenguin"
# TC2 Heroku backup Shortcuts
alias res="make reset-db && time pg_restore --clean --no-acl --no-owner -j12 -h localhost -U postgres -d tutorcruncher2 ./a"
# Appollo shortcuts
alias APP="cd ~/repos/Appollo-backend/ && source env/bin/activate"
alias fg="foxglove"
alias fgw="foxglove web"
# SV Shortcuts
alias SV="cd ~/repos/salsa-verde/ && source env/bin/activate"
# Git shortcuts
alias gl="git log2"
alias gs="git status"
alias gp="git pull"
alias gc="git checkout "
# Script shortcuts
alias gm="python3 ~/repos/checkout_master_check_dumps.py"
alias gb="python3 ~/repos/branch_checkout.py"
alias pt="python3 ~/repos/run_test.py"
alias lint="python3 ~/repos/run_linter.py"
alias litn="python3 ~/repos/run_linter.py"
alias clean-local-branches="~/repos/clean_branches.sh"
alias uuu="sudo apt update && sudo apt upgrade"
alias pip="pip3"
alias python="python3"
# TC Variables
export ASYNC_RQ="TRUE"
export DJ_DEBUG="TRUE"
export DJDB="TRUE"
export PATH="~/.local/bin:$PATH"
export PY_DEVTOOLS_HIGHLIGHT=1
if [ -f ~/repos/.bash_secrets ]; then
. ~/repos/.bash_secrets
fi