Sinatra application to seed files to Twitter through byte string, Base64 encode, or plain text tweets. Great for transmitting text files, images, and other important files.
Why Twitter Fileshare
Governments and private organizations continue to lock down legitimate file sharing through raids, law suits, and “consumer protection” laws & treaties, mainly targeting those who pirate movies, music, and software through BitTorrent and other underground distribution methods. But anyone that knows just a little bit about technology knows file sharing can be done through any medium. This began with Usenet groups, where the binary data was converted to text characters and reprocessed for download. This began one of the first methods of photo sharing. Facsimile machines follow a similar method of dissemination of binary data. And even ham radio used teletype to transmit photos across long distances by converting photos to ASCII before transmission.
Today, we have advanced systems built for sharing files: websites, FTP, BitTorrent, email, CD/DVDs, hard drives. We also have many systems today that mirror prior technology of Usenet newsgroups, paging devices, IRC chat rooms, and IM status messages, of which the largest modern equivalent today is Twitter.
If Twitter is today’s Usenet and Usenet was used for file sharing years ago, why can’t Twitter be utilized today for file sharing?
How to Install
Installation of Twitter Fileshare is straightforward by following the instructions below.
- Grab the repo:
- Install bundler via
gem install bundler
- Make your tmp and log folders:
mkdir tmp log
- Make your tweetable files folder and Base64 temp folders (outside of the repo folder). Ensure your temp folder has full (777) permissions.
- Copy config.sample.ru to config.ru (
cp config.sample.ru config.ru) and customize as desired.
- Copy settings.yml.default to settings.yml (
cp settings.yml.default settings.yml) and customize your settings, install path, database connection, and more.
- NB: If using other than mysql, update your Gemfile for the required adapter.
bundle installto install all required gems.
How to Run
- Create a new Twitter account. http://twitter.com/signup
- Create a Twitter application. http://twitter.com/apps/new
- Set Application Type to “Browser”.
- Callback URL is http://yourdomain.com/admin/auth
- Access Type is “Read & Write Access”
- Check the box for using Twitter for login.
- Update the settings.yml file’s Twitter oAuth token and secret with the one Twitter created for your new app.
- Be sure to create a different launch code and replace that code in the cron job below!
- Restart your app using
- Sync your Twitter account to the application by going to the admin section (http://yourdomain.com/admin)
- Create folder specified for files in your settings.yml and add files.
- Setup a cron job to run every minute.
*/1 * * * * wget -q http://yourdomain.com/run/YOUR-LAUNCH-CODE >/dev/null 2>&1
- Go into the admin section and queue up the file you want sent via the Twitter account(s) you have synced.
- Watch the Twitter fileshare magic happen!
- Make script for fetching contents from Twitter.
- Twitter allows a max of 1,000 tweets per account per day. Don’t be alarmed if your account stops tweeting during certain parts of the day.
- With DataMapper > 0.10.0, you may get a NoMethodError on ‘find_by_sql’. To fix, install the dm-ar-finders gem.