-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases.sh
126 lines (114 loc) · 3.96 KB
/
.aliases.sh
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
##
## Author: Victor Calderon
##
## Last Updated: 2018-08-17
##
## This is a compilation of useful `aliases` to use in research.
############################## --- GENERAL --- ################################
if [[ "$OSTYPE" =~ ^darwin ]]; then
alias ls='ls -GFh'
else
alias ls='ls --color -GFh'
fi
alias lll='ls -lah'
alias LLL=lll
alias lla=lll
alias llh='ls -lh'
alias llt='ls -lahtr'
alias LS='ls'
alias sl='ls'
alias SL=ls
alias CLEAR='clear'
alias clc='clear'
alias CLC='clear'
alias en='emacs -nw'
alias pushd='cd -'
alias CD='cd'
alias tree='tree -C'
alias crone='crontab -e'
alias cronl='crontab -l'
alias jb='jupyter notebook'
alias timemachine='sudo sysctl debug.lowpri_throttle_enabled=0'
alias untar_file='tar -zxvf $1'
# Aliases for the `bashrc`/`bash_profile` files
if [[ -f "$OSTYPE" =~ ^darwin ]]; then
alias sb='source ~/.bash_profile'
alias sbr='opensub ~/.bash_profile'
else
alias sb='source ~/.bashrc'
alias sbr='opensub ~/.bashrc'
fi
####################### --- PROJECT STRUCTURE --- #############################
alias cookieproj='cookiecutter https://github.com/drivendata/cookiecutter-data-science'
alias cookieprojvc='cookiecutter https://github.com/vcalderon2009/cookiecutter-data-science-vc'
alias cookieprojastropy='cookiecutter gh:astropy/package-template --checkout cookiecutter'
####################### --- SCREEN AND TMUX --- ###############################
alias tmux_create='tmux new -s'
alias tmux_attach='tmux a -t'
alias tmux_ls='tmux ls'
# Screen-related commands
alias sckill='screen -S $1 -X quit'
alias sls='screen -ls'
alias slr='screen -r'
alias slss='screen -S'
####################### --- EXTRACTING FILES --- ##############################
## Extracting compressed files
## Taken from 'https://github.com/swincas/scripts/blob/master/extract.sh'
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
########################## --- GIT-RELATED --- ################################
#
# https://help.github.com/articles/configuring-a-remote-for-a-fork/
#
## Adding GIT remote repository to current GIT repository
git_add_remote(){
git remote -v
git remote add upstream $1
git remote -v
}
## Updating local GIT with respect to forked repository.
git_ref(){
git remote -v
git fetch upstream
git checkout master
git merge upstream/master
git merge upstream/master
}
## Other General commands
alias gp='git push origin master'
alias gcom='git commit -m'
alias gadd='git add'
alias gst='git status'
alias overleafgithub='git pull; git push github master'
alias git_update_upstream='git fetch upstream; git checkout master; git merge upstream/master; git merge upstream/master'
alias git_checkout_remote='git checkout --track'
alias gitclean='git clean -fxd'
########################## --- SSH-RELATED --- ################################
alias skeys='ssh-add -K ~/.ssh/ssh_keys/*'
alias ssho='ssh -o PubkeyAuthentication=no'
########################## --- ANACONDA-RELATED --- ###########################
alias sa='conda activate'
alias sd='conda deactivate'
alias py2env='conda activate py2'
alias py2deact='conda deactivate py2'
########################## --- SSH-LOGINS --- ################################
#
# This is where you add the aliases to your remote servers!!