-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot-zsh_aliases
More file actions
143 lines (123 loc) · 4.03 KB
/
dot-zsh_aliases
File metadata and controls
143 lines (123 loc) · 4.03 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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/zsh
# Config bare repo management
alias dtf='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
# Generic
alias zshrc='$EDITOR ~/.zshrc'
alias r!='source ~/.zshrc'
alias zmv='noglob zmv -W'
alias watch='watch '
alias ssh='TERM=xterm-color ssh'
alias ic='invenio-cli'
alias sed='gsed'
alias htop='TERM=xterm htop'
alias vd='TERM=xterm vd'
alias ungron='gron -u'
alias md='f() { mkdir -p $1 && cd $1 }; f'
# Editors
alias c.='code-insiders .'
alias code='code-insiders '
alias v.='nvim .'
alias vim='nvim'
alias z.='zed .'
# Find
alias fd='find . -type d -iname'
alias ff='find . -type f -iname'
# pip
alias p='noglob pip'
alias pi='pip install'
alias pu='pip uninstall'
alias pia='noglob pip install .[all]'
alias pie='noglob pip install -e'
alias piea='noglob pip install -e .[all]'
alias pf='pip list | grep -i '
# uv pip equivalents, could possibly become the default
alias up='noglob uv pip'
alias upi='uv pip install'
alias upu='uv pip uninstall'
alias upia='noglob uv pip install .[all]'
alias upie='noglob uv pip install -e'
alias upiea='noglob uv pip install -e .[all]'
alias upf='uv pip list | grep -i '
uvdep () {
_pkg=$1;
shift;
uv pip tree --package=$_pkg --invert --show-version-specifiers $@
}
# Git
alias gs='git status'
alias gsh='git show --ext-diff'
alias gstash='git stash save --include-untracked'
alias gc='git commit -S'
alias gca='git commit --amend -S'
alias gcad='git commit --amend -S --date=now'
alias gr='git remote -v'
alias gru='git remote update'
alias glu='git pull upstream'
alias gd='git diff -w'
alias gdc='git diff -w --cached'
alias gbd='f() { git branch -D $1 }; f'
gbdr () {
git branch -D "$1" && git push origin :"$1"
}
__git_branch_names () {
local branches
branches=(${(f)"$(git branch --format='%(refname:short)' --sort=-committerdate)"})
_describe 'branch' branches
}
compdef __git_branch_names gbdr
alias gt='f() { git tag -a $1 -m "release: $1" }; f'
GIT_LOG_FORMAT="\
%C(auto,yellow)%h%C(auto)%d \
%C(auto,reset)%s \
[%C(auto,blue)%<(6,trunc)%an%x08%x08%C(auto,reset), \
%C(auto,cyan)%ar%C(auto,reset)]"
alias gl='noglob git log -25 --all --graph --date-order --pretty=format:$GIT_LOG_FORMAT'
alias gdel='f() { git branch -D $1 && git push ${2:-origin} :$1; }; f'
alias gsync='f() { git checkout master && git pull ${1:-upstream} master; }; f'
alias gdog='\
mkdir -p ~/tmp && \
rsync -a --delete `pwd` ~/tmp/ && \
cowsay -f `ls /opt/homebrew/Cellar/cowsay/3.04_1/share/cows | shuf -n 1` "You have my permission to git now..."'
alias ggmail='git config user.email a.ioannidis.pan@gmail.com'
alias gcern='git config user.email a.ioannidis@cern.ch'
# Docker
alias dl="docker ps -l -q"
alias dps="docker ps"
alias dpa="docker ps -a"
alias di="docker images"
# docker compose
alias dcup='docker compose up'
alias dcupd='docker compose up -d'
alias dcb='docker compose build'
alias dcrm='docker compose rm'
alias dcps='docker compose ps'
alias dcstop='docker compose stop'
alias dcrestart='docker compose restart'
# OpenShift
alias oc="TERM=xterm-color oc"
oct() {
TERMINAL_POD=$(oc get pods | grep terminal | awk '{print $1}')
oc rsh $TERMINAL_POD
}
# Virtualenv
alias v.cd='f() { cd ${VIRTUAL_ENV}/${1} }; f'
alias v.sp='cd $(python -c "import site; print(site.getsitepackages()[0])")'
# Invenio-specific
alias v.i='cd $VIRTUAL_ENV/var/instance'
alias dsc_up='eval "$(docker-services-cli up --db ${DB:-postgresql} --search ${SEARCH:-opensearch} --mq ${MQ:-rabbitmq} --cache ${CACHE:-redis} --env)"'
alias dsc_down='docker-services-cli down'
# Tunneling
alias sdc='sshuttle-daemon connect'
alias sdd='sshuttle-daemon disconnect'
# Other CLI apps
alias http='noglob http'
alias pg='f() { c=${1:-$(basename $(pwd))}; pgcli "postgresql://$c:$c@localhost:5432/$c"; }; f'
# WebM to GIF
function webm2gif() {
ffmpeg -y -i $1 -vf palettegen _tmp_palette.png
ffmpeg -y -i $1 -i _tmp_palette.png -filter_complex paletteuse -r 10 ${1%.webm}.gif
rm _tmp_palette.png
}
## FZF
# Select a line from a file and copy to clipboard
alias fzf_cc='f() { cat $1 | fzf --multi --tac --no-sort | clipcopy }; f'