Skip to content

Instantly share code, notes, and snippets.

@mmb
Created March 6, 2009 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmb/74780 to your computer and use it in GitHub Desktop.
Save mmb/74780 to your computer and use it in GitHub Desktop.
require 'pp'
temps = {}
temps['video'] = `aticonfig --od-gettemperature`.match(/Temperature - (\d+\.\d+) C/).captures.first.to_f
sensors_output = `sensors`
(['CPU', 'System'] + (0..3).to_a.map {|c| "Core #{c}"}).each do |x|
v = x.downcase.gsub(/\s+/, '')
temps[v] = sensors_output.match(/#{x}:\s+\+(\d+\.\d+)/).captures.first.to_f
end
pp temps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment