-
-
Save magicdude4eva/e780a1b6811970c94b555ed78f7abf69 to your computer and use it in GitHub Desktop.
| #!/usr/bin/env bash | |
| command -v bc > /dev/null || { echo "bc was not found. Please install bc."; exit 1; } | |
| { command -v drill > /dev/null && dig=drill; } || { command -v dig > /dev/null && dig=dig; } || { echo "dig was not found. Please install dnsutils."; exit 1; } | |
| NAMESERVERS=`cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f 2 | sed 's/\(.*\)/&#&/'` | |
| PROVIDERS=" | |
| 1.1.1.1#cloudflare | |
| 4.2.2.1#level3 | |
| 76.76.2.0#controld | |
| 8.8.8.8#google | |
| 9.9.9.9#quad9 | |
| 80.80.80.80#freenom | |
| 208.67.222.222#opendns | |
| 199.85.126.20#norton | |
| 185.228.168.9#cleanbrowsing | |
| 76.76.19.19#alternatedns | |
| 94.140.14.14#adguard | |
| 156.154.70.3#neustar | |
| 8.26.56.26#comodo | |
| " | |
| # Domains to test. Duplicated domains are ok | |
| DOMAINS2TEST="google.com amazon.com facebook.com youtube.com reddit.com wikipedia.org twitter.com whatsapp.com" | |
| totaldomains=0 | |
| printf "%-18s" "" | |
| for d in $(echo $DOMAINS2TEST | tr ' ' '\n' | sort -u); do | |
| totaldomains=$((totaldomains + 1)) | |
| domain=$(echo "$d" | awk -F"." '{print $(NF-1)}') | |
| printf "%-15s" "$d" | |
| done | |
| printf "%-15s" "Average" | |
| echo "" | |
| for p in $NAMESERVERS $(echo $PROVIDERS | tr ' ' '\n' | sort -u); do | |
| pip=${p%%#*} | |
| pname=${p##*#} | |
| ftime=0 | |
| printf "%-18s" "$pname" | |
| for d in $(echo $DOMAINS2TEST | tr ' ' '\n' | sort -u); do | |
| ttime=`$dig +tries=1 +time=2 +stats @$pip $d |grep "Query time:" | cut -d : -f 2- | cut -d " " -f 2` | |
| if [ -z "$ttime" ]; then | |
| #let's have time out be 1s = 1000ms | |
| ttime=1000 | |
| elif [ "x$ttime" = "x0" ]; then | |
| ttime=1 | |
| fi | |
| printf "%-15s" "$ttime ms" | |
| ftime=$((ftime + ttime)) | |
| done | |
| avg=`bc -lq <<< "scale=2; $ftime/$totaldomains"` | |
| echo " $avg" | |
| done | |
| exit 0; |
@magicdude4eva my Claude found your chrome extension :) However, I wanted to get your opinion on my own gomining service tap button, which doesn't require an open browser, but is done through a github scheduler. I'm not a coder, just an idiot with a claude code account. It seems to work though I've only been using it a few days. https://github.com/jdobbsclt/gomining-servicetap
I think your solution is a lot more elegant. I eventually build something similar as a cronjob using Python code but decided not to run it on Github as I did not want to expose my GoMining session cookie to Github, because it would then be quite easy to hijack your session. I have not read all your code/documentation, but aside from the TOS warning I would perhaps put a disclaimer up what risks it presents using storing a session cookie.
I appreciate your response and feedback. Yes, i was hesitant to have my session cookie on github as well. Do you believe i've exposed myself to unnecessary risk? I will add this to the github readme as well. Where are you hosting your cronjob? a home server?
@magicdude4eva my Claude found your chrome extension :) However, I wanted to get your opinion on my own gomining service tap button, which doesn't require an open browser, but is done through a github scheduler. I'm not a coder, just an idiot with a claude code account. It seems to work though I've only been using it a few days. https://github.com/jdobbsclt/gomining-servicetap