holman / spark

▁▂▃▅▂▇ in your shell.
http://zachholman.com/spark/
MIT License
6.01k stars 290 forks source link

wifi signal quality is a poor quality example #100

Open nkh opened 5 years ago

nkh commented 5 years ago

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

dukechem commented 4 years ago

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
█████▁▁▅▃▆▆▃▁▁▁▃▃▃▃▆▆▆▆▆▆▆▅▅▅▅▅▅▅▂▃▆▆▆▆▆