Skip to content

Instantly share code, notes, and snippets.

View marten's full-sized avatar

Marten Veldthuis marten

View GitHub Profile
class BalancerState
InvalidStatus = Class.new(StandardError)
def initialize(disk_access = File)
@disk_access = disk_access
end
def call(env)
if balancer_member?
[200, {'Content-Type' => 'application/json'}, ['{"status": "ok", "member": true}']]
import subprocess
import sys
import time
proc = subprocess.Popen(['/Users/marten/.rubies/ruby-2.1.1/bin/ruby', '/Users/marten/tmp/python-processes/slave.rb'],
stdin=subprocess.PIPE, stdout=sys.stdout)
for i in range(5):
print "Python preparing to send newline"
proc.stdin.write("\n")
source 'https://rubygems.org'
gem 'sqlite3'
gem 'rspec', '2.14'
gem 'activerecord'
@marten
marten / deploy.rb
Created November 13, 2014 10:26
Capistrano Flowdock integration
set :format, :capture
# rest of your deploy.rb goes here
after 'deploy:started', 'notify:flowdock:started' do
$flowdock_deploy_thread = Deployer::Flowdock::Deployment.new(application: fetch(:application),
environment: fetch(:rails_env) || fetch(:rack_env),
repo_name: fetch(:repo_url).gsub(/\[email protected]:(.*).git/, "\\1"),
require 'csv'
#prod
project = Project.find(593)
zoo_user = User.find(1)
subject_set = SubjectSet.find(681)
#staging
# project = Project.find(450)
# zoo_user = User.find(27)
We can't make this file beautiful and searchable because it's too large.
FileName,Gorongosa_id,camera,year,season,month,DateUTC,TimeUTC,time_period,distance_water,distance_human,vegetation_edu,ESId
http://zooniverse-export.s3-website-us-east-1.amazonaws.com/21484_1000_D09_Season%201_Set%201_EK001729.JPG,21484_1000_D09_Season 1_Set 1_EK001729,D09,2013,DryWet Oct-Dec,Dec,12/6/2013,12:07:57 PM,Day 0623-1709,3077.7,0.01,Mixed Savanna and Woodland,
http://zooniverse-export.s3-website-us-east-1.amazonaws.com/21484_1000_D09_Season%201_Set%201_EK001805.JPG,21484_1000_D09_Season 1_Set 1_EK001805,D09,2013,DryWet Oct-Dec,Dec,12/6/2013,12:06:43 PM,Day 0623-1709,3077.7,0.01,Mixed Savanna and Woodland,
http://zooniverse-export.s3-website-us-east-1.amazonaws.com/21484_1000_D09_Season%201_Set%201_EK001725.JPG,21484_1000_D09_Season 1_Set 1_EK001725,D09,2013,DryWet Oct-Dec,Dec,12/6/2013,12:04:55 PM,Day 0623-1709,3077.7,0.01,Mixed Savanna and Woodland,
http://zooniverse-export.s3-website-us-east-1.amazonaws.com/21484_1000_D09_Season%201_Set%201_EK001712.JPG,21484_1000_D09_Season 1_Set 1_EK001712,D09
require 'csv'
#prod
project = Project.find(593)
zoo_user = User.find(1)
subject_set = SubjectSet.find(681)
#staging
# project = Project.find(450)
# zoo_user = User.find(27)
require 'csv'
#prod
project = Project.find(593)
zoo_user = User.find(1)
subject_set = SubjectSet.find(681)
#staging
# project = Project.find(450)
# zoo_user = User.find(27)
require 'csv'
#prod
project = Project.find(593)
zoo_user = User.find(1)
subject_set = SubjectSet.find(681)
#staging
# project = Project.find(450)
# zoo_user = User.find(27)
require 'csv'
require 'json'
require 'time'
users = {}
CSV.new(ARGF, headers: true).each do |row|
STDERR.print '.'
user_id = row["user_id"]
metadata = JSON.parse(row["metadata"])