-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser-defined.sh
40 lines (31 loc) · 1.06 KB
/
user-defined.sh
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
########### GITHUB SYNC DO NOT DELETE ###########
## Sync ```user-defined.sh``` with github.
function zupdate {
local current_dir=$(pwd)
cd ~/.zshrc-git
git pull origin main
source user-defined.sh
cd "$current_dir"
}
############ USER DEFINED PLAYGROUND ###########
## Play beep sound.
alias beep="tput bel"
## Python shortcut
alias p=python
## Start chromium-based browser with CORS disabled (i.e. ```google-chrome $NOCORS```).
export NOCORS="--args --profile-directory=Default --disable-web-security"
## Function that executes command until it succeeds.
function wfor {
until "$@"; do
echo "Command failed, retrying in 3 seconds..."
sleep 3
done
}
## Add currently staged files to last local commit.
alias gitup="git commit --amend --no-edit"
## Pull latest on target branch and rebase current branch on target branch.
function pullrebase() {
local initial_branch=$(git symbolic-ref --short HEAD)
local target_branch=$1
git checkout $target_branch && git pull && git checkout $initial_branch && git rebase origin/$target_branch
}