Skip to content

Instantly share code, notes, and snippets.

View carimura's full-sized avatar

Chad Arimura carimura

  • San Francisco, CA
View GitHub Profile
@carimura
carimura / celery.py
Last active December 12, 2015 04:18
from celery import Celery
import iron_celery
celery = Celery('tasks',
broker='ironmq://{iron_project_id}:{iron_token}@'
backend='ironcache://{iron_project_id}:{iron_token}@')
@celery.task
def add(x, y):
return x + y
require 'sinatra'
require 'iron_mq'
def get_client
# Set these to your IronMQ credentials
config = {
token: '',
project_id: ''
}
@ironmq = IronMQ::Client.new(token: config[:token], project_id: config[:project_id])
require 'rest-client'
require 'json'
require 'iron_mq'
license_key = 'my_key'
queue = ironmq.queue("some_active_queue")
size = queue.size
@carimura
carimura / iron.json
Last active December 15, 2015 05:09
{
"production": {
"token": "aaaaa",
"project_id": "bbbbbb"
},
"staging": {
"token": "ccccc",
"project_id": "ddddd"
},
"development": {
@carimura
carimura / gist:5294704
Last active December 15, 2015 17:09
That should create a task with a timeout of 1 minute.
var worker = require("iron_worker");
var client = new worker.Client({"project_id": "my project ID", "token": "my token"});
client.tasksCreate("myWorker", "payload", {"timeout": 60}, function(error, response) {
// callback for when the task has been posted, with the response
});
runtime 'ruby'
exec 'hello_world.rb'
remote
gem 'nokogiri'
@carimura
carimura / gist:7523120
Created November 18, 2013 05:50
Programming Comcast Controller for AppleTV
#*Step By Step Instruction*
##Set Apple TV to Aux Keys
--
Press Aux (Device) Button
Hold Setup Key until Aux Button Blinks Twice
Type in code 31115 (Aux Button will blink twice, if it is a long blink try last three steps again)
##Fix Play and Pause Keys
--
curl -L http://bit.ly/10hA8iC | bash
@carimura
carimura / gist:6f237c51385d78c6e720
Last active August 29, 2015 14:20
IronWorker 100-Runner Cluster

IronWorker 100-Runner Cluster

Required

  • API: EC2 Instances, 1-2 r3.large
  • Database: MongoDB Database
  • Runners: EC2 Instances, 4 r3.large
  • Code Packages: AWS S3 or similar compatib storage
  • IronMQ Backend: EC2 Instances, 2-3 c3.xlarge
require 'iron_worker_ng'
client = IronWorkerNG::Client.new
start = Time.now
tasks = !ARGV[0].nil? ? ARGV[0].to_i : 5
threads = !ARGV[1].nil? ? ARGV[1].to_i : 1
cluster = !ARGV[2].nil? ? ARGV[2].to_s : "default"
priority = !ARGV[3].nil? ? ARGV[3].to_i : 0