-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.aliases
175 lines (160 loc) · 4.7 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/sh
#functiosn
function cd {
builtin cd "$@"
pwd > ~/.zsh/lastdir
}
if [ -f ~/.zsh/lastdir ]
then cd "$(cat ~/.zsh/lastdir)"
fi
swap(){
mv "$1" "$1.swp"; mv "$2" "$1"; mv "$1.swp" "$2"
}
e(){
fuzz=$(sudo rg --files /etc/ /var/log/ /opt/ | fzf --reverse --height 40)
if [ -z $fuzz ]
then
return 0
elif [ -d $fuzz ]
then
echo "$fuzz" | xargs -o vim && echo "done"
fi
}
l(){
fuzz=$(sudo rg --files /etc/ /var/log/ /opt/ | fzf --reverse --height 20)
if [ -z $fuzz ]
then
return 0
elif [ -d $fuzz ]
then
less $fuzz
fi
}
j(){
fuzz=$(fdfind -t d . $HOME /etc/ /var/log/ /var/www/ /opt/ | fzf --reverse --height 20)
if [ -z $fuzz ]
then
return 0
elif [ -d $fuzz ]
then
cd "$fuzz" && reset
fi
}
o(){
fuzz=$(rg --files ~/ | fzf --reverse --height 20%)
if [ -z $fuzz ]
then
return 0
elif [ -f $fuzz ]
then
echo "$fuzz" | xargs -o vim && echo "done"
fi
}
ol(){
fuzz=`rg --files | fzf --reverse --height 40%`
if [ -z $fuzz ]
then
return 0
elif [ -f $fuzz ]
then
filetype=`xdg-mime query filetype $fuzz | awk -F/ '{print $1}'`
case $filetype in
text )
echo "$fuzz" | xargs -o vim ;;
audio )
mpv $fuzz & disown ;;
application )
echo "$fuzz" | xargs -o vim ;;
* )
xdg-open $fuzz & disown
esac
fi
}
ngenable(){
sudo ln -s /etc/nginx/sites-available/"$1" /etc/nginx/sites-enabled/"$1"
}
ngdisable(){
sudo rm /etc/nginx/sites-enabled/"$1"
}
olog(){
sudo less $(rg --files --no-messages /var/log/ | grep -vE ".gz|journal|.1" | fzf )
}
py(){
$VIRTUAL_ENV/bin/python "$@"
}
# aliases
alias fzf="fzf --layout=reverse --height=20%"
alias zz="vim ~/.zprofile"
alias cp="cp -i" # confirm before overwriting something
alias vi="vim"
alias df='df -h' # human-readable sizes
alias update="sudo apt update && sudo apt upgrade"
alias get="sudo apt install"
alias search="sudo apt serach"
alias kick="sudo apt remove && sudo apt autoremove"
alias mv="mv -v"
alias c="clear"
alias wget="wget -U Mozilla/5.0 -c"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias sudo='sudo '
alias restart="sudo systemctl restart"
alias status="sudo systemctl status"
alias al="vim ~/.aliases && clear && source ~/.zshrc"
alias dd='dd status=progress'
alias python="python3"
alias copy="xclip -sel c < $1"
alias v="vim ~/.vim/vimrc"
alias z="vim ~/.zshrc && exec ${SHELL} && clear"
alias aports="sudo vim /etc/apache2/ports.conf"
alias ng="sudo vim /etc/nginx/sites-available/"
alias ap="sudo vim /etc/apache2/sites-available"
alias ls="eza"
alias la="eza -a"
alias ll="eza -lga"
alias stop="sudo systemctl stop"
alias start="sudo systemctl start"
alias ngt="sudo nginx -t"
alias ngr="sudo systemctl restart nginx"
alias nga="sudo less /var/log/nginx/access.log"
alias nge="sudo less /var/log/nginx/error.log"
alias rna="sudo systemctl restart nginx apache2"
alias apc="sudo apachectl configtest";
alias dcd="docker-compose down"
alias dcu="docker-compose up -d"
alias reload="exec ${SHELL} && clear"
alias ls2p="sudo ls /var/log/apache2/"
alias a2less='sudo less /var/log/apache2/"$@"'
alias tibaup='sudo systemctl start emperor-uwsgi'
alias tibadown='sudo systemctl stop emperor-uwsgi'
alias gst='git status'
alias mkmigrate="python manage.py makemigrations && python manage.py migrate"
alias jnl="sudo journalctl"
alias eza="ls"
alias sup="python manage.py createsuperuser"
alias cpass="python manage.py changepassword"
alias runserver="python manage.py runserver 0.0.0.0:8000"
alias dup="sudo docker-compose up"
alias ddown="sudo docker-compose down"
alias searx="sudo -H -u searx -i"
alias pc="sudo netstat -tulnp | grep $1"
alias crontab="export EDITOR=vim;crontab"
alias mail='neomutt'
alias ga="git add -u"
alias qh="awk '/$(date '+%d\/%b')/ && /headless/' access.log| wc -l"
alias qa="grep -i $(date '+%d/%b') 'access.log' | wc -l"
alias qs="awk '/$(date '+%d\/%b')/ && /search/' access.log| wc -l"
alias qd="cat $1 | wc -l"
alias ufws="sudo ufw status numbered | grep 'DENY'"
alias rewire="sudo docker-compose down && sudo docker-compose up -d"
alias venv="source $VIRTUAL_ENV/bin/activate"
alias hits="grep -E -v 'headless|403|499|404|styles|images|scripts|bot|504' ~/linkastream/access.log | grep '/$1'| awk '{print $1}' | wc -l"
alias td="transmission-daemon"
alias tr="transmission-remote"