Created
October 18, 2011 06:48
-
-
Save oivoodoo/1294772 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
# Script for learning english by twitter eng_trainer bot. | |
require 'rubygems' | |
require 'net/http' | |
require 'uri' | |
require 'json' | |
fork do | |
loop do | |
response = Net::HTTP.get_response(URI.parse('http://api.twitter.com/1/statuses/user_timeline.json?user_id=177973554&count=1')) | |
json = JSON.parse response.body | |
@new_message = json.first['text'] | |
if @old_message != @new_message | |
system "notify-send \"New word\" \"#{@new_message}\"" | |
@old_message = @new_message | |
end | |
sleep 5 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment