SHOW:
|
|
- or go back to the newest paste.
| 1 | #!/usr/bin/env ruby | |
| 2 | ||
| 3 | - | # trivial twitter post time randomizer |
| 3 | + | # trivial twitter post time randomizer |
| 4 | - | # reads post from standard input |
| 4 | + | # reads post from standard input |
| 5 | - | # sleeps from 0sec to 24hr prior to posting |
| 5 | + | # sleeps from 0sec to 24hr prior to posting |
| 6 | - | # uses twitter4r rubygem http://twitter4r.rubyforge.org/ |
| 6 | + | # additional feature implementation left to the reader |
| 7 | - | # sudo gem install twitter4r |
| 7 | + | # (fork, variable delay, scheduling) |
| 8 | ||
| 9 | ||
| 10 | # uses twitter4r rubygem http://twitter4r.rubyforge.org/ | |
| 11 | # gem install twitter4r | |
| 12 | ||
| 13 | # you really want to be running tor http://www.torproject.org | |
| 14 | # this gem lets you work with it http://socksify.rubyforge.org | |
| 15 | - | # twitter.yml format ################################################# |
| 15 | + | # gem install socksify |
| 16 | ||
| 17 | - | # test: |
| 17 | + | |
| 18 | - | # login: test_user_screen_name_here |
| 18 | + | |
| 19 | - | # oauth_consumer: |
| 19 | + | #only work through TOR! |
| 20 | - | # key: ZZZZZZZZZZZZZZZZZ |
| 20 | + | require 'socksify' |
| 21 | - | # secret: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY |
| 21 | + | TCPSocket::socks_server = "127.0.0.1" |
| 22 | - | # oauth_access: |
| 22 | + | TCPSocket::socks_port = 9050 |
| 23 | - | # key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 23 | + | # if you really aren't using tor & really don't want to |
| 24 | - | # secret: WWWWWWWWWWWWWWWWWWWWWWWWWWW |
| 24 | + | # then comment out the 3 lines above above, but you reallly want to |
| 25 | - | # production: |
| 25 | + | |
| 26 | - | # login: prod_user_screen_name_here |
| 26 | + | |
| 27 | - | # oauth_consumer: |
| 27 | + | |
| 28 | - | # key: ZZZZZZZZZZZZZZZZZ |
| 28 | + | |
| 29 | - | # secret: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY |
| 29 | + | ###################################################################### |
| 30 | - | # oauth_access: |
| 30 | + | # twitter.yml format ################################################# |
| 31 | - | # key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 31 | + | ###################################################################### |
| 32 | - | # secret: WWWWWWWWWWWWWWWWWWWWWWWWWWW |
| 32 | + | # test: |
| 33 | # login: test_user_screen_name_here | |
| 34 | - | # see https://dev.twitter.com/docs/auth/oauth/single-user-with-examples |
| 34 | + | # oauth_consumer: |
| 35 | - | # for tutorial on how to get the OAuth keys you need ################# |
| 35 | + | # key: ZZZZZZZZZZZZZZZZZ |
| 36 | # secret: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY | |
| 37 | # oauth_access: | |
| 38 | - | #Random Delay (<= 24hr) |
| 38 | + | # key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 39 | # secret: WWWWWWWWWWWWWWWWWWWWWWWWWWW | |
| 40 | # production: | |
| 41 | # login: prod_user_screen_name_here | |
| 42 | # oauth_consumer: | |
| 43 | - | #Post STDIN |
| 43 | + | # key: ZZZZZZZZZZZZZZZZZ |
| 44 | # secret: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY | |
| 45 | # oauth_access: | |
| 46 | # key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
| 47 | # secret: WWWWWWWWWWWWWWWWWWWWWWWWWWW | |
| 48 | ###################################################################### | |
| 49 | # see https://dev.twitter.com/docs/auth/oauth/single-user-with-examples | |
| 50 | # for tutorial on how to get the OAuth keys you need ################# | |
| 51 | ###################################################################### | |
| 52 | ||
| 53 | #Random Delay (<= 24hr) | |
| 54 | delay=rand(86400) | |
| 55 | puts "Delaying " + delay.to_s() + " seconds" | |
| 56 | sleep delay | |
| 57 | ||
| 58 | #Post STDIN | |
| 59 | twitter.status(:post, ARGF.read) |