.zshrc
· 3.7 KiB · Bash
Raw
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export ZSH="/root/.oh-my-zsh"
PATH=/snap/bin:/usr/sbin:/sbin:/usr/local/sbin:$PATH
export LC_ALL="en_US.UTF-8"
ZSH_THEME="aussiegeek"
plugins=(
zsh-syntax-highlighting
zsh-autosuggestions
)
source $ZSH/oh-my-zsh.sh
alias sync="rsync -avz -e 'ssh -p1079'"
alias udemydl="youtube-dl -u malin@cenusa.me -o '%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s'"
alias clmac="find ./ -name '._*' -o -name '.DS_Store' -o -name '.apdisk' -o -name '.lyndisk' | sed 's/.*/\"&\"/' | xargs rm -rfv"
alias cpwp="cp -a /root/wordpress/* ."
alias fixow="chown -R nobody:nogroup ./"
alias wpht="cat /root/.htaccess >> ./.htaccess"
alias fixwp="cpwp && wpht && fixow"
alias goup="apt update && apt upgrade -y && apt autoremove && apt dist-upgrade -y"
alias flt="mkdir $1{files,tmp,log}"
alias wssl="wget --no-check-certificate"
alias wrip="wget -r -nc -np"
alias move="rsync -avz --remove-source-files --progress"
alias wbulk="wget --content-disposition -c -N --tries=0 --read-timeout=20 -q --show-progress"
alias mp3rip="youtube-dlc --restrict-filenames --extract-audio --audio-format mp3"
alias cleancrap="find ./ -type f -regex '.*\.exe\|.*\.diz\|.*\.nfo\|.*\.txt\|.*\.url\|.*\.nzb\|.*\.torrent' -exec rm -rfv {} \;"
alias license="/usr/local/cpanel/cpkeyclt"
editz() {
pdnsutil edit-zone $1
}
createz() {
pdnsutil create-zone $1
}
push() {
for i in {1..10}
do
pdnsutil increase-serial $1
pdns_control notify $1
done
}
sslcert() {
certbot certonly --webroot -w /home/www/$1/files -d $1 -d www.$1 -d cdn.$1
}
wban() {
fail2ban-client set wordpress banip $1
}
flickr() {
ruby flickr-photo-downloader.rb $1 -d /flickr/$2
}
weather() {
curl "wttr.in/${1:-vilafranca de bonany}?m"
}
resolve() {
dig +short $1 $2
}
ns12() {
echo -n 'NS1: '; dig +short $1 @ns1.palmasolutions.net
echo -n 'NS2: '; dig +short $1 @ns2.palmasolutions.net
}
ttfb() {
curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup} seconds\nConnect Time:\t\t%{time_connect} seconds\nAppCon Time:\t\t%{time_appconnect} seconds\nRedirect Time:\t\t%{time_redirect} seconds\nPre-transfer Time:\t%{time_pretransfer} seconds\nStart-transfer Time:\t%{time_starttransfer} seconds\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://$1
}
lcheck() {
latency=`ttfb $1 | grep Total | cut -f3-`
if (( $(bc -l <<< "$latency >= 1") ));
then
echo -n $1; echo -n ' > lag > '; echo $latency
else
echo -n $1; echo -n ' > no lag > '; echo $latency
fi
}
pwg() {
printf "%s" "$(tr -cd '[:graph:]' < /dev/urandom | tr -d '\-#&\+,\.\/\:\`\"'\' | head -c"${1:-32}")";
};
getpings() {
for i in $(cat /root/sites);
do lcheck $i;
done
}
alias dfd='df -h | grep -e "/dev/sd" -e "Filesystem" --color=never'
login() {
ssh root@$i -p 1079
}
wlfw() {
ufw allow from $1 to any port $2 proto $3 comment "$4"
}
inst() {
apt install $1 -y
}
ripw() {
wget -r -np -nc --tries=0 --reject iso,exe,html,htm,nfo,nzb,torrent --read-timeout=20 --no-check-certificate -q --show-progress $1
}
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
1 | # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. |
2 | # Initialization code that may require console input (password prompts, [y/n] |
3 | # confirmations, etc.) must go above this block; everything else may go below. |
4 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then |
5 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" |
6 | fi |
7 | |
8 | export ZSH="/root/.oh-my-zsh" |
9 | PATH=/snap/bin:/usr/sbin:/sbin:/usr/local/sbin:$PATH |
10 | export LC_ALL="en_US.UTF-8" |
11 | ZSH_THEME="aussiegeek" |
12 | plugins=( |
13 | zsh-syntax-highlighting |
14 | zsh-autosuggestions |
15 | ) |
16 | source $ZSH/oh-my-zsh.sh |
17 | alias sync="rsync -avz -e 'ssh -p1079'" |
18 | alias udemydl="youtube-dl -u malin@cenusa.me -o '%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s'" |
19 | alias clmac="find ./ -name '._*' -o -name '.DS_Store' -o -name '.apdisk' -o -name '.lyndisk' | sed 's/.*/\"&\"/' | xargs rm -rfv" |
20 | alias cpwp="cp -a /root/wordpress/* ." |
21 | alias fixow="chown -R nobody:nogroup ./" |
22 | alias wpht="cat /root/.htaccess >> ./.htaccess" |
23 | alias fixwp="cpwp && wpht && fixow" |
24 | alias goup="apt update && apt upgrade -y && apt autoremove && apt dist-upgrade -y" |
25 | alias flt="mkdir $1{files,tmp,log}" |
26 | alias wssl="wget --no-check-certificate" |
27 | alias wrip="wget -r -nc -np" |
28 | alias move="rsync -avz --remove-source-files --progress" |
29 | alias wbulk="wget --content-disposition -c -N --tries=0 --read-timeout=20 -q --show-progress" |
30 | alias mp3rip="youtube-dlc --restrict-filenames --extract-audio --audio-format mp3" |
31 | alias cleancrap="find ./ -type f -regex '.*\.exe\|.*\.diz\|.*\.nfo\|.*\.txt\|.*\.url\|.*\.nzb\|.*\.torrent' -exec rm -rfv {} \;" |
32 | alias license="/usr/local/cpanel/cpkeyclt" |
33 | |
34 | editz() { |
35 | pdnsutil edit-zone $1 |
36 | } |
37 | |
38 | createz() { |
39 | pdnsutil create-zone $1 |
40 | } |
41 | |
42 | push() { |
43 | for i in {1..10} |
44 | do |
45 | pdnsutil increase-serial $1 |
46 | pdns_control notify $1 |
47 | done |
48 | } |
49 | |
50 | sslcert() { |
51 | certbot certonly --webroot -w /home/www/$1/files -d $1 -d www.$1 -d cdn.$1 |
52 | } |
53 | |
54 | wban() { |
55 | fail2ban-client set wordpress banip $1 |
56 | } |
57 | |
58 | flickr() { |
59 | ruby flickr-photo-downloader.rb $1 -d /flickr/$2 |
60 | } |
61 | |
62 | weather() { |
63 | curl "wttr.in/${1:-vilafranca de bonany}?m" |
64 | } |
65 | |
66 | resolve() { |
67 | dig +short $1 $2 |
68 | } |
69 | |
70 | ns12() { |
71 | echo -n 'NS1: '; dig +short $1 @ns1.palmasolutions.net |
72 | echo -n 'NS2: '; dig +short $1 @ns2.palmasolutions.net |
73 | } |
74 | |
75 | ttfb() { |
76 | curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup} seconds\nConnect Time:\t\t%{time_connect} seconds\nAppCon Time:\t\t%{time_appconnect} seconds\nRedirect Time:\t\t%{time_redirect} seconds\nPre-transfer Time:\t%{time_pretransfer} seconds\nStart-transfer Time:\t%{time_starttransfer} seconds\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://$1 |
77 | } |
78 | |
79 | lcheck() { |
80 | latency=`ttfb $1 | grep Total | cut -f3-` |
81 | if (( $(bc -l <<< "$latency >= 1") )); |
82 | then |
83 | echo -n $1; echo -n ' > lag > '; echo $latency |
84 | else |
85 | echo -n $1; echo -n ' > no lag > '; echo $latency |
86 | fi |
87 | } |
88 | |
89 | pwg() { |
90 | printf "%s" "$(tr -cd '[:graph:]' < /dev/urandom | tr -d '\-#&\+,\.\/\:\`\"'\' | head -c"${1:-32}")"; |
91 | }; |
92 | |
93 | getpings() { |
94 | for i in $(cat /root/sites); |
95 | do lcheck $i; |
96 | done |
97 | } |
98 | |
99 | alias dfd='df -h | grep -e "/dev/sd" -e "Filesystem" --color=never' |
100 | |
101 | login() { |
102 | ssh root@$i -p 1079 |
103 | } |
104 | |
105 | wlfw() { |
106 | ufw allow from $1 to any port $2 proto $3 comment "$4" |
107 | } |
108 | |
109 | inst() { |
110 | apt install $1 -y |
111 | } |
112 | |
113 | ripw() { |
114 | wget -r -np -nc --tries=0 --reject iso,exe,html,htm,nfo,nzb,torrent --read-timeout=20 --no-check-certificate -q --show-progress $1 |
115 | } |
116 | |
117 | # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. |
118 | [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh |
119 |