-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.commonrc
97 lines (78 loc) · 2.56 KB
/
.commonrc
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
##
## Common shell options b/w bashrc/zshrc
##
#
# Envariables
#
export LANG=en_US.UTF-8
export DEFAULT_USER=jpr5
export TMPDIR=/tmp
export LESS="-RFX"
export LSCOLORS="ExfxcxdxbxEgedabagacad"
#export WORDCHARS='/~!#$%^&*(){}[]<>?.+;-'
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH
export PATH=/opt/homebrew/sbin:/opt/homebrew/bin:/usr/local/homebrew/sbin:/usr/local/homebrew/bin:$PATH
export RBENV_ROOT=/usr/local/rbenv
export PATH=$RBENV_ROOT/bin:$PATH
test -x /usr/local/rbenv/bin/rbenv && eval "$(rbenv init -)"
case `uname` in
Darwin)
export EDITOR="code -w"
alias emacs="$EDITOR -n"
alias e='open -a Emacs'
alias ls='ls -FG'
alias audiorestart="sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod"
alias tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale"
;;
Linux)
export EDITOR=vim
alias ls='ls -F --color'
;;
esac
export CVS_EDITOR=$EDITOR SVN_EDITOR=$EDITOR GIT_EDITOR=$EDITOR
#
# Aliases
#
alias su='sudo -s'
alias df='df -klH '
alias grep='grep --line-buffered --color=auto'
alias less='less -R'
alias lsof='lsof -nP'
alias diff='diff -u'
alias lmongo='mongo "mongodb://root:[email protected]:27017/augment_dev?authSource=admin"'
alias cdgems='cd /usr/local/rbenv/versions/*/lib/ruby/gems/3.2.0/gems'
[[ -n "`which gfind`" ]] && alias find=gfind
#
# Functions
#
function field { s=""; c=""; for a in $*; do s="$s$c\$$a"; c=","; done; awk "{ print $s }"; }
function fcount {
field $1 | sort | uniq -c | sort -rn | head $2
}
alias f=field
function avg() {
awk 'NR == 1 { max=$1; min=$1; sum=0 }
{ if ($1>max) max=$1; if ($1<min) min=$1; sum+=$1;}
END {printf "Min: %d\tMax: %d\tSum: %d\tAvg: %f\n", min, max, sum, sum/NR}'
}
alias num=avg
function reset_gems() {
for gem in `gem list --no-versions`; do gem uninstall $gem -aIx; done
gem install bundler:2.4.21
}
function netkill() {
kill -9 `lsof -i tcp:$1 | f 1 2 | uniq | tail -1`
}
[[ -x /usr/bin/lesspipe ]] && eval "$(SHELL=/bin/sh lesspipe)"
[[ -f $EDITOR ]] && [[ -n "$(emacs -e '(frames-on-display-list)' | grep F1)" ]] && emacs -ce '(make-frame-invisible (selected-frame))' >/dev/null || true
#
# Load supplementary RCs
#
test -f ~/.config/op/plugins.sh && source ~/.config/op/plugins.sh
test -f ~/.aws/augment.sh && source ~/.aws/augment.sh
#
# Last: load all keys into the agent
#
#ssh-add -l &>/dev/null && [[ $? = 1 ]] && ssh-add -A &>/dev/null || true
/usr/bin/ssh-add -l &>/dev/null || /usr/bin/ssh-add --apple-load-keychain &>/dev/null