-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.aliases
More file actions
71 lines (54 loc) · 1.98 KB
/
.aliases
File metadata and controls
71 lines (54 loc) · 1.98 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
alias rls=". /home/$USER/.zshrc && tmux source-file /home/$USER/.tmux.conf || true"
# ASCII characters
alias ascii="awk 'BEGIN{for(i=32;i<127;i++)printf \"%c\",i; print}'"
# AWS usable ASCII characters (do not include ''', '"', ' ', '@', '\', '/' )
alias asciiaws="awk 'BEGIN{for(i=32;i<127;i++)printf \"%c\",i; print}'|sed 's%[ @\"'\'']%%g'"
# Generate random AWS usable password, default 16 characters
randpwaws(){ < /dev/urandom tr -dc $(asciiaws) | head -c${1:-16};echo;}
# Generate random password
randpwnormal(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;}
# Format python code
alias fopy="autopep8 --in-place --recursive --recursive ."
# Get date for specific timezone
alias ntime="TZ=America/New_York date"
# Docker
alias up="docker compose up -d"
alias upb="docker compose up -d --build"
alias down="docker compose down"
# CDK
alias cdkn="cdk --require-approval never"
### Git ###
alias gdnew="for next in \$( git ls-files --others --exclude-standard ) ; do git --no-pager diff --no-index /dev/null \$next; done;"
alias gdn="git --no-pager diff; gdnew"
alias gfp="git push origin HEAD -f"
alias amen="git commit --amend --no-edit"
alias fpush="git add . && amen && gfp"
alias gpp="git push origin HEAD"
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
rok() {
echo "Running Ngrok at port ${1:-3000}"
# Your Ngrok stuff
}
noawsclipager() {
export AWS_PAGER=""
}
# Define the function
update_branch() {
if [ -z "$1" ]; then
echo "Usage: update_branch <branch_name>"
return 1
fi
local branch_name="$1"
echo "Fetching ..."
git fetch
echo "Switching to branch '$branch_name'..."
if git checkout "$branch_name"; then
echo "Resetting branch '$branch_name' to match origin/$branch_name..."
git reset --hard "origin/$branch_name"
echo "Branch '$branch_name' is now up-to-date."
else
echo "Failed to switch to branch '$branch_name'. Make sure it exists."
return 1
fi
}