Created
March 1, 2011 16:06
-
-
Save padenot/849353 to your computer and use it in GitHub Desktop.
Wifi meter using Shoes
This file contains 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 characters
# A tiny wifi meter | |
# usage : shoes wifi.rb | |
Shoes.app(:title => "wifi meter", :width => 250, :height => 100) do | |
background gradient(rgb(0,0,0), rgb(40,40,40)) | |
header = { | |
:font => 'Georgia', | |
:size => '48px', | |
:stroke=>'#'+'E'*3, | |
:justify=>true , | |
:stroke => white, | |
:align => "center" | |
} | |
stack { | |
@label = para '', header | |
} | |
animate(1) do |frame| | |
begin | |
a=IO::popen("cat /proc/net/wireless | grep eth1 | tr -s ' ' | cut -d ' ' -f4") | |
value=a.readlines[0] | |
value=value.to_i*20 | |
@label.replace(value.to_s+' %') | |
rescue ArgumentError | |
@label.replace("?") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment