Last active
June 1, 2020 11:07
-
-
Save apinstein/c5b0f7b0f498caea4ed0 to your computer and use it in GitHub Desktop.
Revisions
-
apinstein revised this gist
Dec 11, 2015 . No changes.There are no files selected for viewing
-
apinstein created this gist
Dec 11, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/bin/zsh # configure curl output format echo '%{url_effective},%{time_namelookup},%{time_connect},%{time_appconnect},%{time_pretransfer},%{time_redirect},%{time_starttransfer},%{time_total}' > curltime.format # configure postgres echo "create table wifi_data (ssid text,url_effective text,time_namelookup numeric(9,5),time_connect numeric(9,5),time_appconnect numeric(9,5),time_pretransfer numeric(9,5),time_redirect numeric(9,5),time_starttransfer numeric(9,5),time_total numeric(9,5));" echo "" echo "\\\\copy wifi_data from './wifi-data.csv' DELIMITER ',' CSV HEADER" echo "select ssid, count(*), avg(time_total), stddev(time_total), min(time_total), max(time_total) from wifi_data group by ssid having count(*) > 5;" echo "" echo "" # setup csv echo 'ssid,url_effective,time_namelookup,time_connect,time_appconnect,time_pretransfer,time_redirect,time_starttransfer,time_total' > './wifi-data.csv' while true; do echo ` /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | pcregrep -o1 '\bSSID: *(.*) *'` \ , \ `curl -w "@curltime.format" --silent -o /dev/null http://www.google.com` \ | tee -a './wifi-data.csv' sleep 1 done;