-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwork_bash_profile
67 lines (50 loc) · 1.45 KB
/
work_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
# THIS SHOULD ACTUALLY BE APPENDED TO .BASHRC (in Linux machines)
# I'll need to exit the 'vagrant ssh' and re-ssh for it to take effect
# Commands to run on startup
[ -d /srv/www/<REPLACE ME> ] && cd /srv/www/<REPLACE ME> # for my <REPLACE ME> VM
# ALIASES
alias grep="grep --color=auto"
alias ll="ls -alF" # -a show hidden; -l show long desc; -F show / or *
alias ss="stopwatch_start"
alias st="stopwatch_stop"
alias n="nano"
alias et="emacs -nw" # run emacs in terminal; note that the function 'e' runs emacs in the background
alias gs="git status"
alias glg='git log --date-order --all --graph --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
alias rs="bin/rails server" # to be run inside the work app, which has a bin folder
alias rc="bin/rails console" # ditto
alias rce-em='rubocop --except Style/EmptyMethod' # accommodate method wishlists in Rubocop
alias rco="rubocop --format offenses"
alias rcfixit='rubocop -a' # let Rubocop auto-fix files
# FUNCTIONS
stopwatch_start () { # aliased as ss
export STOPWATCH_START_TIME=$(date +%s)
}
stopwatch_stop () { # aliased as st
if [ $STOPWATCH_START_TIME ]; then
echo $(($(date +%s ) -$STOPWATCH_START_TIME))
unset STOPWATCH_START_TIME
fi
}
e() {
emacs "$1" & # run emacs in background
}
grep. ()
{
grep -r $1 .
}
hist () {
history | tail -$1
}
mkcd ()
{
mkdir $1 && cd $1
}
cdls ()
{
cd $1 ; ls ;
}
to ()
{
touch $1 && open $1
}