-
Notifications
You must be signed in to change notification settings - Fork 10
/
.bash_profile
99 lines (78 loc) · 2.38 KB
/
.bash_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
# Do not remind me I prefer bash yo
export BASH_SILENCE_DEPRECATION_WARNING=1
#export path for homebrew if it exists
if [ -x "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# export path for ccache
export PATH="/usr/local/opt/ccache/libexec:$PATH"
# export node modules
export PATH="$PATH:node_modules/.bin"
# export vscode as editor
export EDITOR="code -w"
#enables color for iTerm
export TERM=xterm-color
#Add UTF-8 Support
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
# load fnm if it exists
if command -v fnm &> /dev/null; then
eval "$(fnm env --use-on-cd)"
fi
# give ls colors and make ll
alias ls='ls -G'
alias ll='ls -hl'
# open an ssh tunnel that you can pipe traffic too
# turn any box into a VPN!
alias tunnel='ssh -D 8080 -f -C -q -N'
# open a port on another box that you can
# pipe traffic from it back to you
alias reverse-shell='ssh -f -C -q -N -R 12345:localhost:22'
# afaik this flushes the dns cache on a mac
alias flushcache='sudo killall -HUP mDNSResponder'
# lazy
alias temp='cd $TMPDIR'
# osx has a built in ftp server :D
alias start-ftp='sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist'
alias stop-ftp='sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist'
# for some really quick and dirty c work
alias compile='gcc -Wall -g -c'
# run tests from last PR
alias gt='tools/test.py -J `git show --name-only --pretty="" | grep 'test/'`'
# Source all bash completions installed by homebrew
# need to run the following command to support this
# brew install bash-completion
[[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && . "/opt/homebrew/etc/profile.d/bash_completion.sh"
# Setting GIT prompt
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
branch_color ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
color=""
if git diff --quiet 2>/dev/null >&2
then
color=${c_green}
else
color=${c_red}
fi
else
return 0
fi
echo -n $color
}
parse_git_branch ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
gitver="["$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')"]"
else
return 0
fi
echo -e $gitver
}
#It's important to escape colors with \[ to indicate the length is 0
PS1='[\W\[]${c_sgr0}\]\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]$ '