-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.functions.zsh
62 lines (55 loc) · 1.12 KB
/
.functions.zsh
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
# Networking
abyss_vpn() {
if [ $# -eq 1 ]; then
sudo wg-quick $1 abyss
else
echo "usage: abyss_vpn <up/down>"
fi
}
# kill process in port
portkill() {
if [ $# -eq 1 ]; then
fuser -k $1/tcp
fi
}
venv() {
if [ $# -eq 1 ]; then
source ~/venvs/$1/bin/activate
fi
}
# interactive rebase all commits in feature branch from target branch
rebase() {
if [ $# -eq 1 ]; then
git rebase -i $(git merge-base ${1:-master} HEAD)
else
echo "Usage: rebase <target branch>"
fi
}
# decode bas64
b64decode() {
if [[ $# -ne 1 ]]; then
echo "Usage: b64decode <base64 encoded text>"
else
echo "$1" | base64 --decode
fi
}
# encode base64
b64encode() {
if [[ $# -ne 1 ]]; then
echo "Usage: b64encode <plain text>"
else
echo "$1" | base64 --encode
fi
}
# run git command on all subdirectories (depth 1)
git-all(){
if command -v fd &> /dev/null; then
fd -td -d1 -x git --git-dir={}/.git --work-tree=$PWD/{} "$@"
else
find . -type d -depth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} "$@" \;
fi
}
# pull all git subdirectories (depth 1)
git-pull-all() {
git-all pull
}