-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc
More file actions
171 lines (140 loc) · 4.44 KB
/
Copy path.bashrc
File metadata and controls
171 lines (140 loc) · 4.44 KB
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
export TZ="America/New_York"
export IGNOREEOF=1
export PS1='[\u@\h \W]\$ '
export PATH=${PATH}:~/.local
# History options
export HISTCONTROL=ignoreboth
export HISTSIZE=50000
export HISTFILESIZE=100000
shopt -s histappend
export PYTHONSTARTUP=~/.pythonrc
#set -x
# Save history every time a command is run
export PROMPT_COMMAND='history -a'
case "$OSTYPE" in
darwin*)
BREW=/opt/homebrew/bin/brew
ONEP_SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock
;;
linux*)
BREW=/home/linuxbrew/.linuxbrew/bin/brew
ONEP_SSH_AUTH_SOCK=~/.1password/agent.sock
;;
*)
echo "UNKNOWN OS: $OSTYPE"
;;
esac
# If we're not coming in from a remote ssh and there's a local sock, set it
# This mostly handles system ssh agents like keychain on mac or linux
if [ -z "$SSH_TTY" -a -n "$SSH_AUTH_SOCK" -a -S $SSH_AUTH_SOCK ]; then
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/local_auth_sock
fi
# If the 1password agent is running, use that instead
if [ -n "$ONEP_SSH_AUTH_SOCK" -a -S "$ONEP_SSH_AUTH_SOCK" ]; then
ln -sf "$ONEP_SSH_AUTH_SOCK" ~/.ssh/local_auth_sock
fi
# If we're in a remote ssh session, and the previous ssh sock is invalid, update it
if [ -n "$SSH_TTY" -a -n "$SSH_AUTH_SOCK" -a ! -S ~/.ssh/remote_auth_sock -a -S $SSH_AUTH_SOCK ] ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/remote_auth_sock
fi
function fixssh() {
if [ -n "$SSH_TTY" -a -S ~/.ssh/remote_auth_sock ]; then
# We're in a remote session, use the remote auth sock
ln -sf ~/.ssh/remote_auth_sock ~/.ssh/ssh_auth_sock
elif [ -S ~/.ssh/local_auth_sock ]; then
# We're local, use the local auth sock
ln -sf ~/.ssh/local_auth_sock ~/.ssh/ssh_auth_sock
fi
}
fixssh
# This always points to the same place
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
if [ -e $BREW ]; then
eval "$($BREW shellenv)"
fi
if command -v nvim &> /dev/null; then
function _nvim() {
PYENV_VERSION="neovim" nvim $*
}
export EDITOR=nvim
alias vi='nvim'
alias vim='nvim'
alias vimdiff='vi -c CodeDiff'
else
export EDITOR=vim
alias vi='vim'
fi
# vi mode in the shell
set -o vi
bind -m vi-insert "\C-l":clear-screen
alias ls='ls --color=auto'
alias ll='ls -la'
# Random work aliases/functions
function storm() {
BASEDIR=`basename $PWD`
mkdir -p /tmp/v/$BASEDIR
echo "Connecting to cell:///tmp/v/$BASEDIR"
python -m synapse.tools.storm cell:///tmp/v/$BASEDIR $@
}
function cortex() {
BASEDIR=`basename $PWD`
mkdir -p /tmp/v/$BASEDIR
echo "Listening on /tmp/v/$BASEDIR"
python -m synapse.servers.cortex --health-sysctl-checks=false --https=0 --telepath tcp://0.0.0.0:0 /tmp/v/$BASEDIR $@
}
function changelog() {
if [ $# -ne 1 ]; then
echo "USAGE: changelog <type>"
return 1
fi
CHANGELOG_TMPFILE=`mktemp --suffix .rst`
$EDITOR $CHANGELOG_TMPFILE
if [ -s $CHANGELOG_TMPFILE ]; then
python -m synapse.tools.changelog gen -a -t $1 "`sed -z -e 's/\n$//' -e 's/\n/ /g' < $CHANGELOG_TMPFILE`"
fi
rm $CHANGELOG_TMPFILE
}
function pyserve() {
if [ $# -eq 1 ]; then
BASEDIR=$1
else
BASEDIR=.
fi
python -m http.server -d $BASEDIR 8000
}
# fzf config
export FZF_DEFAULT_COMMAND='rg --files'
if command -v fzf &> /dev/null; then
if command -v rg &> /dev/null; then
_fzf_compgen_path() { rg --files "$1"; }
else
echo "Could not find ripgrep, fzf using default compgen"
fi
eval "$(fzf --bash)"
fi
# Rust/cargo config
[ -e $HOME/.cargo/env ] && source "$HOME/.cargo/env"
[ -e $HOME/.cargo/bin ] && export PATH=$PATH:$HOME/.cargo/bin
# pyenv config
if [ -d $HOME/.pyenv ]; then
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv &> /dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi
# uv config
UV_DIR="${HOME}/.uv"
if [ -d $UV_DIR ]; then
export UV_CACHE_DIR="${UV_DIR}/cache"
# export UV_CONFIG_FILE="${UV_DIR}/uv.toml"
export UV_PYTHON_INSTALL_DIR="${UV_DIR}/python/versions"
export UV_PYTHON_BIN_DIR="${UV_DIR}/python/bin"
export PATH="${UV_PYTHON_BIN_DIR}:${PATH}"
export UV_PYTHON_DOWNLOADS=manual
export UV_PYTHON_PREFERENCE=only-managed
fi
export NVM_DIR="$HOME/.config/nvm"
if [ -e $NVM_DIR ]; then
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi