-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.shrc
More file actions
111 lines (89 loc) · 2.54 KB
/
.shrc
File metadata and controls
111 lines (89 loc) · 2.54 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
#!/bin/sh
GPG_TTY="$(tty)" && export GPG_TTY || unset GPG_TTY
# Disable the XON/XOFF feature
# https://unix.stackexchange.com/a/73499/222786
stty -ixon
# Disable blinking cursor if running in Windows Terminal
[ -n "$WT_SESSION" ] && printf '\e[2 q'
if [ -z "$EDITOR" ]
then
case "$TERM" in
xterm*|screen*|linux)
export EDITOR="$(command -v nvim 2>&1 >/dev/null && echo nvim || echo vim)"
;;
esac
fi
if [ -z "$CLICOLOR" ]
then
case "$TERM" in
xterm-*color|screen-*color|tmux-*color|xterm-ghostty)
export CLICOLOR=1
;;
esac
fi
# Shell config
HISTSIZE=10000
# Environment variables
# Misc aliases
alias la='ls -lhA'
alias ll='ls -lh'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias tree="tree -I '.git|.hg|.svn'"
command -v batcat >/dev/null && alias bat=batcat
# Neovim aliases
alias nvimconfig="nvim -c 'edit \$MYVIMRC'"
alias nvimsync='nvim --headless "+Lazy! sync" +qa'
# Shell aliases
alias shconfig='"$EDITOR" "$HOME"/.shrc'
alias bashconfig='"$EDITOR" "$HOME"/.bashrc'
alias zshconfig='"$EDITOR" "$HOME"/.zshrc'
# Git aliases
alias dot='git --git-dir="$HOME/.dotfiles.git" --work-tree="$HOME"'
alias gitconfig='git config --global -e'
# Tmux aliases
alias t=tmux
alias tt='tmux new -As "$(basename "$PWD" | LC_ALL=C.UTF-8 tr A-Z a-z)"'
alias ttd='tmux new -d -s'
alias tmuxconfig='"$EDITOR" "$XDG_CONFIG_HOME"/tmux/tmux.conf'
# Python aliases
alias activate-venv='. ./.venv/bin/activate'
alias create-venv='python3 -m venv ./.venv'
# Kubernetes aliases
command -v kubectl >/dev/null &&
alias k=kubectl
# Podman aliases
alias pcu='podman compose up'
alias pcd='podman compose down'
alias docker=podman
# Gradle aliaes
alias kill-all-gradle-daemons="pkill -f '.*GradleDaemon.*'"
# Podman dev containers
dnode() {
podman run -it --rm --init \
-e NPM_CONFIG_UPDATE_NOTIFIER=false \
"$@" \
node:18 \
bash
}
# Functions
source_aws_credentials_from_csv() {
if [ "$#" -lt 1 ]
then
echo fatal: no CSV file provided >&2
else
eval "$(awk -F, 'FNR==2 { printf "export AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s", $3, $4 }' "$1")"
fi
}
kns() {
kubectl create ns --dry-run=client -o yaml "$1" |
kubectl apply -f - &&
kubectl config set-context --current --namespace "$1"
}
load_dotenv() { export $(sed -e '/^[[:space:]]*#/d;/^$/d' "${1:-.env}" | paste -d ' ' -s -) ; }
show_crt() { openssl x509 -text -noout -in "$1" | less ; }
show_csr() { openssl req -text -noout -in "$1" | less ; }
# SSH Agent set-up
[ -z "$SSH_CONNECTION" ] &&
[ -S "$XDG_RUNTIME_DIR/ssh-agent.socket" ] &&
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"