holman / spark

▁▂▃▅▂▇ in your shell.

Home Page:http://zachholman.com/spark/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wifi signal quality is a poor quality example

nkh opened this issue · comments

a='▂▄▆█'; s=$(iwconfig wlp61s0 | sed -E-n 's/[^0-9]=([0-9]{1,})/70.$/\1/p') ; : ${s:='-18'}; echo ${a:0:$(( ( $s / 18 ) + 1 ))}

call to spark is useless and code is unsightly (even for bash)

furthermore, sparks 0 1 2 3 4, and spark 1 2 3 4 0, differs from spark 1 2 3 4

Not sure how above linux script is supposed to work, and I'll update with script for linux and macos when I get a chance. But for now, below is a quick-and-very-dirty proof-of-concept of wifi signal strength, 0 to 100%, in windows.

Note: easiest way to get a bash shell in windows is to install https://gitforwindows.org/ or just choco install git, then create /usr/local/bin and put spark there (optionally along with roundup, etc).

$ cat wifi-sig.sh
echo "Note. To reset history do:  rm /tmp/wifi.txt  "

for i in {1..7}  
do
  netsh wlan show interfaces | grep Signal | cut -d":" -f2 | cut -d"%" -f1 | tee -a /tmp/wifi.txt
  sleep 1  # adjust to desired number of secs between samples 
done
cat /tmp/wifi.txt  | spark

$ bash wifi-sig.sh
Note. To reset history do:  rm /tmp/wifi.txt  
 63
 74
 88
 88
 88
 88
 88
█████▁▁▅▃▆▆▃▁▁▁▃▃▃▃▆▆▆▆▆▆▆▅▅▅▅▅▅▅▂▃▆▆▆▆▆