-
Notifications
You must be signed in to change notification settings - Fork 4
/
dot_profile
235 lines (187 loc) · 8.28 KB
/
dot_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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# Amar Paul's .profile
# using this for sourcing external scripts, exports, PATH changes
#
#export EDITOR_LOOK="carot"
# ▏▎▍▌▋▊▉█
export EDITOR_LOOK="block"
# Keep path fixes here: source from .bashrc or .zshrc separately
# GPG_TTY should always be set
# https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html
# GPG_TTY=$(tty)
# powerlevel10k readme recommends doing this instead:?
export GPG_TTY=$TTY
# use pinentry-ncurses in terminal, pinentry-mac otherwise
export PINENTRY_USER_DATA='USE_TTY=1'
# (may have to reload gpg after updating pinentry programs)
# gpgconf --kill gpg-agent
# gpgconf --launch gpg-agent
# gpg-connect-agent updatestartuptty /bye > /dev/null
# gpg-connect-agent reloadagent /bye
export XDG_CONFIG_HOME="$HOME/.config"
# assign ls colors - set this just to make sure fd uses our colors
export LS_COLORS=""
# assign colors to man pages
export LESS="-R"
export LESS_TERMCAP_mb=$(printf '\e[01;31m') # enter blinking mode
export LESS_TERMCAP_md=$(printf '\e[01;38;5;2m') # enter double-bright mode
export LESS_TERMCAP_me=$(printf '\e[0m') # turn off all appearance modes (mb, md, so, us)
export LESS_TERMCAP_so=$(printf '\e[01;33m') # enter standout mode
export LESS_TERMCAP_se=$(printf '\e[0m') # leave standout mode
export LESS_TERMCAP_us=$(printf '\e[04;38;5;4m') # enter underline mode
export LESS_TERMCAP_ue=$(printf '\e[0m') # leave underline
####
## PATH changes
####
# use this to fix if the path gets weird?
#DEFAULT_PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
# https://gist.github.com/JohnArchieMckown/dfb8220faa8e45a167dc
pathmunge () {
if [ -e "$1" ]; then
if ! [[ "$PATH" = *"$1"* ]]; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
fi
}
# homebrew changes
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_BAT=1
if [[ $(uname) == 'Darwin' ]]; then
if [[ ! -r "$HOME/.brew" ]]; then
if ! /opt/homebrew/bin/brew shellenv > "$HOME/.brew" 2>/dev/null; then
if ! /usr/local/bin/brew shellenv > "$HOME/.brew" 2>/dev/null; then
echo "'brew' not found" >&2
fi
fi
fi
source "$HOME/.brew"
fi
# use pipx instead of pip for all cli tools
pathmunge "$HOME/.local/bin" "after"
# add snap path on ubuntu
[[ -d /snap/bin ]] && emulate sh -c 'source /etc/profile.d/apps-bin-path.sh'
# my changes
pathmunge "/opt/bin" "after"
pathmunge "/opt/prefix/bin" "after"
pathmunge "$HOME/.bin" "after"
# LLVM on mac
# (HOMEBREW_PREFIX defined in ~/.brew)
pathmunge "${HOMEBREW_PREFIX}/opt/llvm/bin" "after"
# add fzf (default bindings, and my own aliases)
[[ $SHELL == *"zsh" ]] && [[ -f "$XDG_CONFIG_HOME/fzf/.fzf.zsh" ]] && source "$XDG_CONFIG_HOME/fzf/.fzf.zsh"
[[ $SHELL == *"bash" ]] && [[ -f "$XDG_CONFIG_HOME/fzf/.fzf.bash" ]] && source "$XDG_CONFIG_HOME/fzf/.fzf.bash"
pathmunge "$XDG_CONFIG_HOME/fzf" "after"
[[ -r "$XDG_CONFIG_HOME/fzf/fzf_aliases" ]] && source "$XDG_CONFIG_HOME/fzf/fzf_aliases"
# Add cargo (Rust) stuff
pathmunge "$HOME/.cargo/bin" "after"
# use sccache to cache rust compilation objects
[[ -x $HOME/.cargo/bin/sccache ]] && export RUSTC_WRAPPER=$HOME/.cargo/bin/sccache
# $(rustc --print sysroot) -> "$HOME/.rustup/toolchains/nightly-x86_64-apple-darwin"
# export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
export RUST_SRC_PATH="$HOME/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src"
# go stuff
export GOPATH="${HOME}/.go"
export GOROOT=${HOMEBREW_PREFIX}/opt/go/libexec
pathmunge "${GOPATH}/bin" "after"
pathmunge "${GOROOT}/bin" "after"
# nix
# arch pkg: had to manually create user profile:
# ln -s /nix/var/nix/profiles/default/ /nix/var/nix/profiles/per-user/$USER/profile
if [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then
. ~/.nix-profile/etc/profile.d/nix.sh;
fi
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
pathmunge "$HOME/.rvm/bin" "after"
# add bundled gems
pathmunge "$HOME/.local/rubygems" "after"
# java helper script (manage sdks)
export SDKMAN_DIR="$HOME/.sdkman"
if [[ "$SHELL" =~ "zsh" ]] && command -v lazyload >/dev/null; then
lazyload sdk -- 'source "$SDKMAN_DIR/bin/sdkman-init.sh"'
fi
# add calibre cli
pathmunge "/Applications/calibre.app/Contents/MacOS/" "after"
# mypy lxml stubs (static type analysis for python)
export MYPYPATH="$HOME/.cache/mypy/lxml-stubs"
# theme spotify
export SPICETIFY_CONFIG="$HOME/.config/spicetify/"
# tabtab source for serverless package
# uninstall by removing these lines or running `tabtab uninstall serverless`
[[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.zsh ]] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.zsh
# tabtab source for sls package
# uninstall by removing these lines or running `tabtab uninstall sls`
[[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.zsh ]] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.zsh
# pyenv
if command -v pyenv &>/dev/null; then
export PYENV_ROOT="$HOME/.pyenv"
pathmunge "$PYENV_ROOT/bin"
eval "$(pyenv init -)"
fi
# luaver
if command -v luaver &>/dev/null; then
source "$(which luaver)"
fi
# use neovim provided by version manager "bob"
pathmunge "$HOME/.local/share/bob/nvim-bin" "after"
# ghidra
# if there's more than one dir here (there shouldn't be) assume the last one is valid
for f in /opt/homebrew/Caskroom/ghidra/*/ghidra_*_PUBLIC; do
export GHIDRA_HOME="$f"
done
export GHIDRA_INSTALL_DIR="$GHIDRA_HOME"
alias analyzeHeadless="$GHIDRA_INSTALL_DIR/support/analyzeHeadless"
# opam configuration
[[ ! -r "$HOME/.opam/opam-init/init.zsh" ]] || source "$HOME/.opam/opam-init/init.zsh" > /dev/null 2> /dev/null
# comment out the rest of this, but keep it around?
: << 'END'
# old path/dyld/etc stuff (from .bash_profile)
####
# PATH and DYLD stuff go here for launchctl stuff (and other things probably)
# PATH and DYLD exports (lots of fixes)
# Uncomment to use GNU utils without g prefix
# PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
# MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
# Virtualenv/VirtualenvWrapper
[[ -r /usr/local/bin/virtualenvwrapper.sh ]] && . /usr/local/bin/virtualenvwrapper.sh
# OpenCV 3.1.0 Support (Installed view homebrew, bound to Python 2.7)
if [[ -d /usr/local/Cellar/opencv3 ]]; then
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/Cellar/opencv3/3.1.0/lib:$DYLD_FALLBACK_LIBRARY_PATH
export PYTHONPATH=/usr/local/Cellar/opencv3/3.1.0/lib/python2.7/site-packages:$PYTHONPATH
fi
# For using matplotlib instide virtualenv
# Inside (env), run: $ frameworkpython
function frameworkpython {
if [[ ! -z "$VIRTUAL_ENV" ]]; then
PYTHONHOME=$VIRTUAL_ENV /usr/local/bin/python "$@"
else
/usr/local/bin/python "$@"
fi
}
# path for adb (Android Studio 1.0.xx)
if [[ -d $HOME/Library/Android/sdk/platform-tools ]]; then
export PATH="$PATH:""$HOME/Library/Android/sdk/platform-tools"
fi
# Geant/Root stuff (can we brew install them?)
if [[ -d /Users/Amar/Desktop/Projects/Coutu && 0 -eq 1 ]]; then
# Path modifications for Geant4
export G4INSTALL='/Users/Amar/Desktop/Projects/Coutu/geant4.10.2-install'
source $G4INSTALL/bin/geant4.sh
# Path modifications for Root
export ROOT='/Users/Amar/Desktop/Projects/Coutu/root'
export PATH=$PATH:"/Users/Amar/Desktop/Projects/Coutu/root/bin"
export LD_LIBRARY_PATH="/Users/Amar/Desktop/Projects/Coutu/root/lib"
source /Users/Amar/Desktop/Projects/Coutu/root/bin/thisroot.sh
fi
# Ubertooth stuff
# Paths for Ubertooth One dynamic libs (libbtbb and libubertooth)
if [[ -d /Users/Amar/Ubertooth && 0 -eq 1 ]]; then
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/Amar/Ubertooth/libbtbb-2015-10-R1/build/lib/src
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/Amar/Ubertooth/ubertooth-2015-10-R1/host/build/libubertooth/src
fi
END
# https://silvae86.github.io/sysadmin/mac/osx/mojave/beta/libxml2/2018/07/05/fixing-missing-headers-for-homebrew-in-mac-osx-mojave/
# fix missing headers on osx (e.g. libxml)
#sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /