-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
105 lines (84 loc) · 2.06 KB
/
.aliases
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
alias ..='cd ..';
alias ...='cd ../..';
alias ....='cd ../../..';
alias .aliases='$EDITOR -n ~/.aliases'
alias .gitconfig='$EDITOR -n ~/.gitconfig'
alias cp='cp -v'
alias mv='mv -v'
alias rm='rm -i'
alias /='code .'
alias db="docker build ."
alias dcb="docker compose up --build --detach"
alias dcd="docker compose down"
alias dcr="dcd && dcu"
alias dcu="docker compose up --detach --wait"
alias dl='curl -O'
alias fs='du -sc * | sort -n | tail'
alias g="git"
alias ga='f() { git add $@; }; f'
alias gs="git st"
alias gc='f() { git commit -m "$1" }; f'
alias hs="npx http-server "
alias ll=ls -al
alias lt="npx localtunnel --allow-invalid-cert --port"
alias mkdir=mkdir -p
alias mute='m volume 0 >& /dev/null'
alias note='set_title'
alias npx="npx --silent --yes"
alias opon="op signin"
alias opoff="op signout"
alias phone="scrcpy &"
alias qlk='qlmanage -p "$@" >& /dev/null'
alias sc="shortcuts create"
alias tgz='tar -czf'
alias tldr='npx tldr'
alias untgz='tar -vzxf'
alias zx="npx zx"
alias vercel="npx vercel"
function sober_up() {
brew cleanup -s
rm -fr "$(brew --cache)"
brew up
brew update
brew upgrade
}
function find_in_files() {
grep -rn . -e $1
}
function dock_run() {
docker run -it $1 /bin/sh
}
function set_title() {
echo -en "\e]0;$@\a"
}
function foreground_process() {
fuser $1 2> /dev/null | awk '{print $2}'
}
function elapsed_time() {
ps -eo pid,etime | grep $1 | awk '{print $2}'
}
function tty_hanging() {
id=${1:-$(tty)}
pid=$(foreground_process $id)
if [ -n $pid ]; then
elapsed_time $pid
fi
}
function load_secrets() {
op whoami >> /dev/null 2>&1
[ "$?" -eq 1 ] && opon
secrets=""
vars=( NODE_AUTH_TOKEN=op://private/GH_PAT/password )
for var in "${vars[@]}"; do
secrets=${secrets}"export ${var%%=*}=$(op read ${var#*=});"
done
# load secrets
eval $secrets
if [[ "$1" == "--save" ]]; then
secrets=${secrets}"_success 'secrets loaded!' && _nl && _nl"
echo ${secrets} | sed -e s/\;/\\n/ > ~/.secrets
fi
}
function clear_secrets() {
echo -ne "_info 'no secrets loaded ' && _nl && _nl" > ~/.secrets
}