dotfiles

Dash Eclipse's dotfiles
git clone git://ezup.dev/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 3d09f12260f7419030a0e35f3f5c3ca62f96ffd7
parent 3c61fb94bc430f73a5723cc6050efdb3bf4f2e23
Author: Dash Eclipse <dash@ezup.dev>
Date:   Tue,  3 Nov 2020 12:28:07 +0000

Add grc.zsh

Diffstat:
A.local/share/grc/grc.zsh | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M.zshrc.local | 20+++++++++++++++++++-
2 files changed, 104 insertions(+), 1 deletion(-)

diff --git a/.local/share/grc/grc.zsh b/.local/share/grc/grc.zsh @@ -0,0 +1,85 @@ +if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then + + # Supported commands + cmds=( + as + ant + blkid + cc + configure + cvs + df + diff + dig + dnf + docker + docker-compose + docker-machine + du + env + fdisk + findmnt + free + g++ + gas + gcc + getfacl + getsebool + gmake + id + ifconfig + iostat + ip + iptables + iwconfig + journalctl + kubectl + last + ldap + lolcat + ld + lsattr + lsblk + lsmod + lsof + lspci + make + mount + mtr + mvn + netstat + nmap + ntpdate + php + ping + ping6 + proftpd + ps + sar + semanage + sensors + showmount + ss + stat + sysctl + systemctl + tcpdump + traceroute + traceroute6 + tune2fs + uptime + vmstat + wdiff + whois + ) + + # Set alias for available commands. + for cmd in $cmds ; do + if (( $+commands[$cmd] )) ; then + alias $cmd="grc /bin/$cmd" + fi + done + + # Clean up variables + unset cmds cmd +fi diff --git a/.zshrc.local b/.zshrc.local @@ -11,6 +11,7 @@ alias zh-TW="/usr/bin/trans -shell -brief -theme random :zh-TW -no-init" . /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh . /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh . /usr/share/zsh/site-functions/skim-key-bindings.zsh +#. $HOME/.local/share/grc/grc.zsh if [ ! -z ${DISPLAY+x} ] ; then . /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme @@ -33,8 +34,25 @@ fi ## functions # speedtest +speedtest-socks-connection() { + local URL="https://www.google.com/generate_204" + echo 'http_code\ttime_appconnect\ttime_connect\ttime_namelookup\ttime_total' + repeat 12 curl \ + -x socks5h://127.0.0.1:1080 --output /dev/null --silent \ + --write-out '%{http_code}\t\t%{time_appconnect}\t%{time_connect}\t%{time_namelookup}\t%{time_total}\n' \ + $URL +} +speedtest-socks-speed() { + curl \ + -x socks5h://127.0.0.1:1080 --silent \ + -o/dev/null --write-out '%{speed_download}' \ + http://speedtest-sgp1.digitalocean.com/10mb.test \ + | numfmt --to=iec-i --suffix=B/s +} speedtest-connection() { - time_seconds=$(curl -o/dev/null -sw '%{time_appconnect}' 'https://connectivitycheck.gstatic.com/generate_204') + #echo 'http_code\ttime_appconnect\ttime_connect\ttime_namelookup\ttime_total' + #repeat 7 curl --output /dev/null --silent --write-out '%{http_code}\t\t%{time_appconnect}\t%{time_connect}\t%{time_namelookup}\t%{time_pretransfer}\t\t%{time_redirect}\t%{time_starttransfer}\t\t%{time_total}\n' https://connectivitycheck.gstatic.com/generate_204 + local time_seconds=$(curl -o/dev/null -sw '%{time_appconnect}' 'https://connectivitycheck.gstatic.com/generate_204') printf "%.0fms\n" $((time_seconds * 1000)) }