-
Notifications
You must be signed in to change notification settings - Fork 3
/
.bashrc
58 lines (46 loc) · 1.46 KB
/
.bashrc
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
# sourced on new screens, non-login shells.
host=`uname -n | sed -e 's/\.lan$//g' -e 's/\.local$//g'`;
platform=`uname`;
export HISTIGNORE="[ ]*:&:bg:fg:exit"
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
# do close spelling matches with cd
shopt -s cdspell
shopt -s nocaseglob
shopt -s checkwinsize
# handy aliases
alias ll='ls -l'
alias la='ls -hlA'
alias l='ls'
alias rm='rm -v'
alias df='df -h'
alias du='du -h'
alias grep="grep --color"
alias hist="history|tail"
alias psa="ps auxwww"
alias pry-watch='while clear && sleep 1; do pry-remote -w; done'
alias cdate="date '+%Y%m%d%H%M%S'"
rpg(){
size=${1:-12}; ruby -e "require 'securerandom'; puts SecureRandom.urlsafe_base64($size);"
}
git-rm-banch(){
git branch -D $1 && git push origin :$1
}
reset_known_host() {
if [ "$1" != "" ]; then
grep -v "$1" $HOME/.ssh/known_hosts > $HOME/.ssh/known_hosts.tmp
mv -v $HOME/.ssh/known_hosts.tmp $HOME/.ssh/known_hosts
else
echo "No pattern provided"
fi
}
source_if_exists() {
[[ -s "$1" ]] && source "$1"
}
source_if_exists "$HOME/.bashrc.${platform}"
source_if_exists "$HOME/.bashrc.${host}"
source_if_exists "$HOME/.local/.bashrc"