-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdot_bashrc
More file actions
159 lines (124 loc) · 3.85 KB
/
dot_bashrc
File metadata and controls
159 lines (124 loc) · 3.85 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
. ~/.bashrc.d/bash-history
. ~/.bashrc.d/homebrew
. ~/.bashrc.d/direnv
. ~/.bashrc.d/chezmoi
. ~/.bashrc.d/starship
. ~/.bashrc.d/directory-navigation
. ~/.bashrc.d/golang
. ~/.bashrc.d/k8s
[[ -f ~/.bashrc.d/guida ]] && . ~/.bashrc.d/guida
# Set env vars
export PATH=~/bin:~/.local/bin:~/go/bin:${PATH}
export EDITOR=vim
export LESS="--ignore-case --quit-if-one-screen --long-prompt --raw-control-chars"
# Force config home to be at .config, instead of "~/Library/Application Support/..."
# TODO: Make this conditionally based on OSX
export XDG_CONFIG_HOME=~/.config
# Tell Terraform to share the provider plugins, saves 20 gigs
export TF_PLUGIN_CACHE_DIR="$HOME/.terraform.d/plugin-cache"
# export DOTFILES_START_KUBIE_SUBSHELL_IMMEDIATELY=1
# Aliases
# aliases: general aliases
alias c='code .'
# aliases: linux sysadmin
alias l='ls -CF'
alias ls='ls -hFG --color=auto'
alias la='ls -A'
alias ll='ls -alF'
alias grep='grep --colour=auto'
alias df='df -h'
alias du='du -h'
alias dus='du -s'
alias du1='du --max-depth=1'
# aliases: bat pager
# Run ripgrep via the bat pager
# Seems to not work the same as ripgrep natively (keeps hanging). Check out why
# alias rg='batgrep'
# Use bat as pager
alias man='batman'
# aliases: meta: manage bash
alias eb='czew ~/.bashrc'
alias ek9s='czew ~/.config/k9s/hotkeys.yaml'
alias sb='. ~/.bashrc'
# aliases: git
alias gs='git status'
alias gb='git branch'
alias ga='git ca'
alias gd='git diff'
# aliases: gitlab
alias glrv='glab repo view -w'
# aliases: lazy*
alias lzd='lazydocker'
alias lzg='lazygit'
# aliases: tailscale
alias ts=tailscale
alias tss='tailscale status'
alias tsp='tailscale ping'
alias tsh='tailscale ssh'
alias ts-enable-dns='tailscale up --accept-dns=true --accept-routes'
alias ts-disable-dns='tailscale up --accept-dns=false --accept-routes'
# 1Password
alias ops='op signin'
# aliases: docker compose
alias dc='docker compose'
# aliases: terraform/opentofu
alias tf=tofu
# tfl => go to legacy terraform; tft => go to TF tofu
alias tfl='alias tf=terraform'
alias tft='alias tf=tofu'
alias tff='tf fmt'
alias tfv='tf validate'
alias tfr='tf refresh'
alias tfp='tf plan'
alias tfa='tf apply'
alias tfd='tf destroy'
alias tfyolo='tf apply -auto-approve'
alias tfi='tf init'
alias tfiu='tf init -upgrade'
alias tfsp='tf state pull'
alias tfspp='tf state pull |less'
alias tfspc='tf state pull |code - '
# aliases: azure
alias azl-set-default='az account set --subscription "$(az account list --query "[].name" --output tsv | fzf)"'
# aliases: minikube
alias mk=minikube
alias mks='minikube start'
alias mkd='minikube delete'
# aliases: personal projects
alias backup-golink='curl -s http://go/.export >~/tmp/backup/golink_`date +%F_%H-%M-%S`.jsonl'
alias ho='cd ~/src/private/homeops/'
alias tfc='cd ~/src/private/tfcleanup/'
# aliases: misc
alias r2='vlc ~/Documents/radio2.pls >/dev/null 2>&1 &'
# Completions
type talosctl &>/dev/null && . <(talosctl completion bash)
# Functions
# shellcheck disable=SC2164
mkcd() {
mkdir -p "$@" && cd "$@";
}
git-tag-and-push() {
git tag "$1"
git push origin "$1"
}
if [[ -n "${DOTFILES_START_KUBIE_SUBSHELL_IMMEDIATELY}" ]] && type kubie &>/dev/null
then
# Spawn a new kubie subshell, so there is no mixing between pre-and post kubie shell history.
# There doesn't seem to be a native way to do this [1]. The con of this is that you always need to
# exit twice, on leaving the shell.
# [1] https://github.com/sbstp/kubie/issues/371
kubie ctx jarvis
fi
if [[ -n $(chezmoi status) ]]
then
echo
echo DOTFILES: your dotfiles are NOT up to date, see below for the status
chezmoi status |pr -to 4
fi
if [[ -n $(git -C $(chezmoi source-path) status -s) ]]
then
echo
echo 'DOTFILES: your dotfiles (git repo) has pending changes, see below for the status'
git -C $(chezmoi source-path) status -s |pr -to 4
fi
builtin source "${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash"