Skip to content

Instantly share code, notes, and snippets.

@andrewjkerr
Created December 3, 2013 18:37
Show Gist options
  • Save andrewjkerr/7774946 to your computer and use it in GitHub Desktop.
Save andrewjkerr/7774946 to your computer and use it in GitHub Desktop.
Checks to see whether the grades for EEL4744c has been updated and emails TO@GMAIL.COM if it has :)
require 'net/http'
require 'net/smtp'
file = File.open("grades_current.html", "rb")
cur_source = file.read
message = <<MESSAGE_END
From: Andrew Kerr Updates <updates@andrewjkerr.com>
To: MicroP Peeps <microp@lists.ufl.edu>
Subject: MicroP Grades Updated!
The grades for Microprocessors have been updated! http://www.add.ece.ufl.edu/4744/grades.html
MESSAGE_END
updated = false
source = Net::HTTP.get('www.add.ece.ufl.edu', '/4744/grades.html')
while !updated
if cur_source != source
smtp = Net::SMTP.new 'smtp.gmail.com', 587
smtp.enable_starttls
smtp.start('gmail.com', 'GMAIL_EMAIL@GMAIL.COM', 'GMAIL_PASSWORD', :login)
smtp.send_message message, 'FROM@GMAIL.COM', 'TO@GMAIL.COM'
smtp.finish
updated = 1
end
sleep 600
end
@aortiz49
Copy link

aortiz49 commented Dec 3, 2013

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment