summaryrefslogtreecommitdiffstats
path: root/.bash_profile
blob: 48295941c4e4490c443093a762f33c995a87ad62 (plain) (blame)
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
# ==== Homebrew Apple M1/Intel fixing of $PATH
if [ -d /opt/homebrew ]; then
    eval "$(/opt/homebrew/bin/brew shellenv)"
elif [ -d /usr/local/Homebrew ]; then
    eval "$(/usr/local/Homebrew/bin/brew shellenv)"
fi

# defaultscheme "exfxcxdxbxegedabagacad"
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad

export HISTSIZE=2000 # History size
export IGNOREEOF=42 # Ignore Ctrl+D logout terminal session
export HISTCONTROL=erasedups # remove consecutive history entries
export EDITOR='vim'  # Default editor
export TERM="xterm-256color"
export GREP_OPTIONS="--color=auto"
export HOMEBREW_GITHUB_API_TOKEN="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"
export PS1="[a14m] \W \$ "
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export GPG_TTY=$(tty)
unset SSH_AGENT_PID
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export BASH_SILENCE_DEPRECATION_WARNING=1 # Silence new macOS warning about bash
export USE_GKE_GCLOUD_AUTH_PLUGIN=True

# ==== Aliases
alias wttr='curl http://wttr.in/berlin'
alias la='ls -a'
alias srv="python3 -m http.server" # start simple server
alias tagme='ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths)'
alias skipci='git commit --allow-empty -m "--skip-ci"'
alias k='kubectl'
complete -F __start_kubectl k
alias ktx='kubectx'
complete -F _kube_contexts ktx
alias kns='kubens'
complete -F _kube_namespaces kns

alias gpgkill='(
    pkill pinentry-tty
    pkill pinentry-curses
    gpg-connect-agent killagent /bye
    gpg-connect-agent updatestartuptty /bye
    gpg-connect-agent /bye
)'

# Fixes the pinentry-tty error https://github.com/neomutt/neomutt/issues/1014
alias mutt='PINENTRY_USER_DATA=curses neomutt $@'

# alias g='git'
# # look up the original completion command and replace the last with the alias
# complete -o bashdefault -o default -o nospace -F __git_wrap__git_main g

# ==== Functions
# get app ID to add to amethyst (apps have to be running)
function appid {
    lsappinfo info -only bundleid "$@" | cut -d '"' -f4
}

# ==== Aliased Directories
alias rc="cd ~/.rc"
alias spc="cd ~/Work/Space/"
alias mb="cd ~/Work/MBition/"
alias htb="cd ~/Work/HTB/"
alias otw="cd ~/Work/OTW/"
alias obs="cd ~/Library/Mobile\ Documents/iCloud~md~obsidian/Documents/Vault/Work/"

# ==== go config.
if command -v go 1>/dev/null 2>&1; then
    export PATH="$HOME/go/bin:$PATH"
fi

# ==== rbenv config.
if command -v rbenv 1>/dev/null 2>&1; then
    export PATH="$HOME/.rbenv/bin:$PATH"
    eval "$(rbenv init -)"
fi

# ==== pyenv config (and virtualenv)
if command -v pyenv 1>/dev/null 2>&1; then
    eval "$(pyenv init --path)"
    eval "$(pyenv init -)"
    export PIPENV_VENV_IN_PROJECT=1
    export PATH="$HOME/.local/bin:$PATH"
fi

# ==== Rust config
if [ -f $HOME/.cargo/env ]; then
    source "$HOME/.cargo/env"
fi

# ==== NVM config
# node version manager from homebrew ,the source line to move install location
# and prevent Node installs being lost upon upgrading nvm.
if [ -d $HOME/.nvm ]; then
    export NVM_DIR=~/.nvm
    source $(brew --prefix nvm)/nvm.sh
fi

# ==== MISC config
if command -v thefuck 1>/dev/null 2>&1; then
    # allow fuck to be alias of thefuck
    eval $(thefuck --alias)
fi

# ==== Vault completeion
if command -v vault 1>/dev/null 2>&1; then
    complete -C $(brew --prefix)/bin/vault vault
fi

# ==== Generate helm autocomplete stuff when it's not there
if command -v helm 1>/dev/null 2>&1; then
    if [ ! -f $(brew --prefix)/etc/bash_completion.d/helm ]; then
        helm completion bash > $(brew --prefix)/etc/bash_completion.d/helm
    fi
fi

# ==== load all bash completions
if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
fi

# ==== MISC CowSay
fortune | cowsay | lolcat

# ==== Work config ===========================================================
# ==== JAVA config
if command -v java 1>/dev/null 2>&1; then
    export PATH="/opt/homebrew/opt/openjdk@11/bin:$PATH"
    export PATH="/opt/homebrew/opt/gradle@6/bin:$PATH"
fi