Skip to content

Instantly share code, notes, and snippets.

@padenot
Created March 1, 2011 16:06
Show Gist options
  • Save padenot/849353 to your computer and use it in GitHub Desktop.
Save padenot/849353 to your computer and use it in GitHub Desktop.
Wifi meter using Shoes
# 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