-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv
executable file
·103 lines (88 loc) · 2.84 KB
/
env
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
#!/bin/bash
# use neovim as editor
export VISUAL=nvim
export EDITOR=nvim
alias e='$EDITOR'
alias vi=nvim
alias vim=nvim
# Use most as pager, if available
if command -v most > /dev/null; then
export PAGER=most
fi
# utf-8 ftw!
export LC_ALL=en_US.UTF-8
# colorize listings (especially in `tree`)
export LS_COLORS="no=00:di=34:ln=35:so=33"
export LS_COLORS="ex=37;41:$LS_COLORS"
export LS_COLORS="*.zip=36:*.rar=36:*.tar=36:*.gz=36:*.tar.gz=36:*.7z=36:$LS_COLORS"
export LS_COLORS="*.c=32:*.cc=32:*.cpp=32:*.m=32:*.rb=32:*.pl=32:*.php=32:*.java=32:$LS_COLORS"
export LS_COLORS="*.h=33:*.hpp=33:$LS_COLORS"
export LS_COLORS="*.o=30:*.d=30:$LS_COLORS"
export LS_COLORS="*Makefile=35:*.mk=35:*Rakefile=35:$LS_COLORS"
# use 256 colors (fixes Vim colors inside Tmux)
export TERM="xterm-256color"
# highlight grep results
export GREP_COLOR="1;31"
# case insensitive matches in autojump
export AUTOJUMP_IGNORE_CASE=1
# Enable Erlang/Elixir shell history
export ERL_AFLAGS="-kernel shell_history enabled"
# aliases
alias cl=clear
alias emacs="emacsclient --alternate-editor '' -c"
alias tmk-flash="~/.tmk/flash.sh"
alias lla='ll -a'
alias o='open'
alias tf="terraform"
# https://github.com/koalaman/shellcheck/issues/2635
# shellcheck disable=SC2142
alias ts="awk '{print strftime(\"[%Y-%m-%d %H:%M:%S.%N]\"), \$0; fflush();}'"
pass() {
lynx -dump -force_html <(\
curl -fsL http://pass.telekom.de/home\?continue=true\
| xmllint --html --xpath '//div[contains(@class,"barTextBelow")]' - 2>/dev/null\
)\
| awk 'NF {print $1" "$2" of " $4" "$5" used" }'
}
# Docker
alias d=docker
alias dk=docker compose
alias dl='docker compose logs --tail=10 -f'
# shellcheck disable=SC2016
dsh() { docker compose exec "$1" sh -c 'if [ -x "$(command -v bash)" ]; then bash; else sh; fi'; }
alias dup='docker compose up -d --build --remove-orphans'
# shellcheck disable=SC2086
dkr() { docker compose stop $1 && dup $1; }
# Kubernetes
alias k=kubectl
# shellcheck disable=SC2016
ks () { kubectl -n "$1" exec -it "$(kubectl -n "$1" get pods --no-headers -o custom-columns=":metadata.name" | grep "$2" | head -n 1)" -- sh -c 'if [ -x "$(command -v bash)" ]; then bash; else sh; fi'; }
# Git
alias g='git'
alias ga='git add'
alias gci='git ci'
alias gco='git co'
alias gdf='git df'
alias gdfs='git df --staged'
alias gl='git l'
alias gr='git smart-rebase'
alias gst='git st'
alias pr='hub pr list -h $(git rev-parse --abbrev-ref HEAD) -L 1 -f pull/%I | xargs hub browse --'
# Elixir/Phoenix
alias mback='mix ecto.rollback'
alias mgen='mix ecto.gen.migration'
alias mmig='mix ecto.migrate'
poedit() {
app="Poedit.app"
osascript -e "quit app \"$app\""
sleep 1
open -a "$app" "$1"
osascript -e 'tell application "System Events" to key code 36 using command down'
}
# Ruby/Rails
alias be="bundle exec"
alias rback='rake db:rollback'
alias rmig='rake db:migrate'
# NodeJS
alias n="npm run"
alias y="yarn"