Skip to content

Instantly share code, notes, and snippets.

@masui
Created October 10, 2012 13:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masui/3865599 to your computer and use it in GitHub Desktop.
Save masui/3865599 to your computer and use it in GitHub Desktop.
dfをツイート
#!/usr/bin/env ruby
require 'rubygems'
require 'tw'
require 'json'
data = {}
data['type'] = 'df'
data['time'] = Time.now
percent = 0
s = `/bin/df -h`
s.each { |line|
a = line.split
if a[0] == '/dev/sda2' then
a[4] =~ /^(.*)%/
percent = $1.to_i
end
}
data['percent'] = percent
client = Tw::Client.new
client.auth 'pitecancom'
client.tweet data.to_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment