A Machine for Gifs
- Need an excuse to show a gif to your coworkers?
- Need a use for that Raspberry Pi that isn't doing anything useful?
- Need a web-scale solution to your animated gif needs?
Presenting the newest GMaaS (Gif Machine as a Service) solution for your tech company with a startup culture: gifmachine
- gifmachine is a Ruby Sinatra app that provides a dirty interface for enjoying gifs with your coworkers. gifmachine provides a HTTP API for posting gifs and meme text to overlay.
- gifmachine allows your coworkers to complain about
company_x
's broken API when it goes down and laugh as the internet catches fire. - gifmachine is designed to be run in kiosk mode on an unused computer and monitor, it's just a webpage that puts the gif meme in fullscreen.
It mostly does! When it is working well...
- gifmachine uses WebSockets to send out updates to connected clients.
- gifmachine stores everything in a database (developed with Postgres, but it shouldn't be too hard to change that).
- gifmachine uses ActiveRecord to save the developer time and calories.
- Get RVM
- Using RVM, install Ruby 2.1.2
rvm install 2.1.2
- Run
bundle install
- Get Postgres 9.1 or newer
sudo apt-get install postgresql postgresql-contrib
- If using Ubuntu Server 14.04 you might need to install
libpq-dev
for bundler to work sudo -u postgres createuser -D -A -P gifmachine
and enter in a good passwordsudo -u postgres createdb -O gifmachine gifmachine
- Change
config/database.yml
to reflect the username and password of your gifmachine database - Set your RACK_ENV (e.g.
export RACK_ENV='development'
) rake db:schema:load
to load the database schema into the database- Change the API password (:gifmachine_password) in app.rb to something else
rackup
- Enjoy.
Here's a relevant snippet of Ruby code that might help you interface with gifmachine's API:
EventMachine::HttpRequest.new("#{@config.base_url}/gif", options).post :body => {
:url => gif_url,
:who => username,
:meme_top => meme_top,
:meme_bottom => meme_bottom,
:seekrit => @config.password # Minimal security lololol
}
Alternatively, here's a simple curl:
curl --data 'url=http://www.example.com/somegif.gif&who=thatAmazingPerson&meme_top=herp&meme_bottom=derp&seekrit=yourSuperSecretPasswordFromAppRb' 'http://yourGifMachineUrl/gif'