#!/usr/bin/ruby URL = "http://0.0.0.0:3000/feed/text/Nathan/b0b2a7c81680d1a1920b199ecb6db0ad86e2e984" TEMP_DIR = "/Users/nathan/Desktop" today = `curl -s "#{URL}"?due=0`.split("\n").select{|line|line =~ /\s+\[Due:/ or line =~ /^\w/} tomorrow = `curl -s "#{URL}"?due=1`.split("\n").select{|line| line =~ /\s+\[Due:/ or line =~ /^\w/} this_week = `curl -s "#{URL}"?due=6`.split("\n").select{|line| line =~ /\s+\[Due:/ or line =~ /^\w/} tomorrow = tomorrow - today today_or_tomorrow = today + tomorrow this_week = this_week - today_or_tomorrow file = File.new("#{TEMP_DIR}/today.txt", "w") file.print "\nToday:\n" + today.join("\n") file.close file = File.new("#{TEMP_DIR}/tomorrow.txt", "w") file.print "\nTomorrow:\n" + tomorrow.join("\n") file.close file = File.new("#{TEMP_DIR}/later.txt", "w") file.print "\nLater:\n" + this_week.join("\n") file.close