Skip to content

Instantly share code, notes, and snippets.

View kerinin's full-sized avatar

Ryan Michael kerinin

View GitHub Profile
def subnet_ids
# TODO: Changed `availability_zones` key to `subnets` for backwards compatibility.
# Need to change it back here and in the config after all components and stacks
# are ready.
availability_zones.map do |az|
subnet_id(az)
end.compact
end
# Basics - if you define an enumerable, you can evaluate it lazily
class Foo
include Enumerable
def each(&block)
(1..20).to_a.each do |i|
yield i
puts "yielded #{i}"
end
end
end
@kerinin
kerinin / api.rb
Created April 28, 2014 18:20
The API I want Assembler to provide
# This is for building a JSON request to the monitoring service
MonitorClient.group(name: 'my group') do |g|
g.add_watch(name: 'Something fragile') do |w|
w.description = 'information about watch'
w.docs = 'http://triage.com'
w.owners = ['ryan@example.com']
w.metric = MonitorClient::Metric::Graphite.new(target: 'foo.bar.baz')
w.policy = never_be_zero
w.add_action MonitorClient::Action::Email.new
-- This will need to be built and put on the machine you're running Hive from
add jar json-serde-1.1.9.3-SNAPSHOT-jar-with-dependencies.jar;
-- Creates the table based on the JSON schema
CREATE TABLE json_nested_test (
metadata struct<uuid:string,md5_email:string,received_at:string,message_id:string,from_domain:string,message_signature:string,provider:string>,
headers map<string,struct<length:string,match_counts:map<string,string>,text_hash_counts:array<array<string>>,address_hashes:array<string>>>,
parts array<struct<mime_type:string,length:string,stripped_length:string,match_counts:map<string,string>,urls:array<struct<domain:string,sha:string>>,images:array<struct<domain:string,sha:string,pixel_count:string>>,text_hash_counts:array<array<string>>>>,
attachments array<struct<mime_type:string,bytesize:string,filename_sha:string,filetype:string>>
)
@kerinin
kerinin / Gemfile
Last active August 29, 2015 14:07
CIO Ruby Lite
gem 'faraday'
gem 'faraday_middleware'
@kerinin
kerinin / foo.rs
Created October 8, 2014 21:02
Traits
pub trait Fooable {
pub fn foo();
}
pub impl Fooable for String {
pub fn foo() {
println!("Hello world");
}
}
@kerinin
kerinin / backend.md
Last active August 29, 2015 14:08
Parfait Backend API

Parfait API

Start scanning a new account

This assumes the account has already been connected to Context.IO. See http://context.io/docs/lite/users/email_accounts for the field definitions of :id and :label

POST /users/:id/email_accounts/:label

  • 200 - Account added and being scanned
def let_once(method, &block)
before(:all) do
@let_once ||= {}
@let_once[method] = block.call
end
let(method) do
@let_once[method]
end
end

Ryan Michael

I'm looking for a new set of challenges to take on. I want to address interesting problems and produce robust, elegant, composable solutions.

I'm interested in distributed systems, machine learning, and how to organize large volumes of data.

tl;dr

package event
// Events returns the set of events describing the change from prev -> next
//
// This is a fairly complex operation, and needs to handle the following
// edge cases:
// * A message could be copied from one folder to another, which we can only
// determine based on message ID (which isn't present in the snapshots)
// * A message coule be moved from one folder to another, which also relies on
// message ID