Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

cdzombak/cron_ebooks

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

cron_ebooks

No Maintenance Intended

This is a really simple adaptation of @harrisj's iron_ebooks to run on any server with cron.

A simple and hackish ruby script for pseudorandomly posting to a _ebooks account tweets derived from a regular twitter account.

Setup

  1. Signup for a Twitter account you want to use for ebooking things
  2. Sign into dev.twitter.com with the same credentials
  3. Create an application for your _ebooks account
  4. Set its permissions to read/write and generate OAuth credentials
  5. Create a file named twitter_init.rb in this directory with the OAuth credentials and the source account you want to use for seeding the markov process
  6. Upload to your server
  7. bundle install --path Vendor/bundle
  8. Run it with bundle exec ruby ebook.rb a few times
  9. Schedule it to run regularly with cron. I'd suggest once every 53 minutes or so: */53 * * * * cd /home/USER/scripts/USER_ebooks && /usr/local/bin/bundle exec /usr/bin/ruby /home/USER/scripts/USER_ebooks/ebook.rb > /dev/null 2>&1

Configuration

There are several parameters that control the behavior of the bot. You can override them by setting them in twitter_init.rb.

$rand_limit = 10

The bot does not run on every invocation. It runs in a pseudorandom fashion whenever rand($rand_limit) == 0. You can override it to make it more or less frequent. To make it run every time, you can set it to 0. You can also bypass it on a single invocation by passing -f.

$include_urls = false

By default, the bot ignores any tweets with URLs in them because those might just be headlines for articles and not text you've written. If you want to use them, you can set this parameter to true.

$markov_index = 2

The Markov index is a measure of associativity in the generated Markov chains. I'm not going to go into the theory, but 1 is generally more incoherent and 3 is more lucid.

Command-line options (debugging)

  • --no-tweet: Do not post anything to Twitter.
  • -f; --force: Run the algorithm this time (bypasses the once-every-n-times pseudorandom logic).

About

[UNMAINTAINED] a really simple adaptation of @harrisj's iron_ebooks to run on any server with cron

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages