~hokiegeek/dotfiles

ref: bb95ccbbd653fccb856a24b2e0ac62fb1a9e6c86 dotfiles/aliases -rw-r--r-- 2.4 KiB
bb95ccbbHokieGeek This thing.... 2 years ago
                                                                                
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
## Random {{{
alias roll='echo $(($((RANDOM%20))+1))'
alias broadcast='script -qf | tee >(nc -kl 5000)'

alias iclip='xclip -i -sel clipboard'
alias oclip='xclip -o -sel clipboard'

vwhich() { vim $(which "$@"); }
mkcd() { mkdir -p "$1" && cd "$1"; }
cdl() { cd "$1" && ls; }
## }}}

## Development {{{
alias vi='vim'
alias view='vim -R'

vip() {
    vim --cmd 'profile start /tmp/vim.profile' --cmd 'profile func *' --cmd 'profile file *' $* && vi /tmp/vim.profile +/SORTED
}

alias make='make -j$(($(egrep -c "^processor" /proc/cpuinfo)+1))'
alias scons='scons -j$(($(egrep -c "^processor" /proc/cpuinfo)+1))'

alias gp='git pull --prune'
alias smgp='git pull --prune && git submodule foreach --recursive "git pull --prune || :"'

gimme() {
    repo=$1; shift
    git clone --recursive git@github.com:HokieGeek/${repo}.git $@
}

alias ts='awk "{ printf(\"[%s] %s\n\", strftime(\"%F %T\")); }"' #NOCSH
tsfmt() {
    echo $@ | awk 'BEGIN{ RS=" " } { printf("%s: %s\n", $1, strftime("%F %T", $1)); }'
}

alias scalac='docker run -it --rm -v $PWD:/app hokiegeek/scala scalac'
alias scala='docker run -it --rm -v $PWD:/app hokiegeek/scala scala'
alias amm='docker run -it --rm -v $PWD:/app hokiegeek/amm'
alias sbt='docker run -it --rm -v $PWD:/app hokiegeek/scala-sbt'
# alias jenkins='docker run -p 8888:8080 -p 50000:50000 jenkins'
# alias gradle='docker run --rm -v $PWD:/project -w /project --name gradle gradle:alpine gradle'
## }}}

## Search aliases {{{
`which g >/dev/null 2>&1` && {
    alias gq='g -q'
    alias f='g -f'
    alias fq='g -f -q'
} || {
    alias g='grep -rnIE'
    alias gq='g'
    alias f='find . -name'
    alias fq='f'
}
alias gi='g -i'
alias todo='g "(todo\|TODO\|fixme\|FIXME)"'
## }}}

## Color aliases {{{
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi
du() {
    du -h $@ | awk '$1 ~ /.*G/ { printf "\033[31m" } \
                    $1 ~ /.*M/ { printf "\033[33m" } \
                               { print $0"\033[0m" }'
}
alias du1='du --max-depth=1 -h'
## }}}

## Typo fixing {{{
alias emacs='echo "Correcting typos in command..."; sleep 1s; gvim'
alias xemacs='emacs'
alias :q='exit'
alias :qa='exit'
alias cd..='cd ..'
## }}}

# vim: set ft=sh foldmethod=marker: