Created
December 5, 2015 17:20
-
-
Save patmaddox/4220d9b301b009aa69fb to your computer and use it in GitHub Desktop.
scheduling auto-tweets for t
This file contains hidden or 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 | |
| require 'chronic' | |
| time = Chronic.parse ARGV[0] | |
| message = ARGV[1] | |
| File.open("#{time.to_i}_scheduled_tweet", 'w') do |file| | |
| file << message | |
| end | |
| puts "Scheduled tweet for #{time}" |
This file contains hidden or 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 | |
| dir = File.dirname(__FILE__) | |
| Dir["#{dir}/*_scheduled_tweet"].each do |file| | |
| if Time.now.to_i > file.to_i | |
| `t update "$(cat #{file})"` | |
| File.delete(file) | |
| end | |
| end |
This file contains hidden or 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
| # min (0-59) hr (0-23) day (1-31) month (1-12) dow (Sunday-Saturday) command | |
| * * * * * /usr/local/var/rbenv/shims/ruby ~/code/scheduled_tweet/auto.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment