Skip to content

Instantly share code, notes, and snippets.

@ryandotsmith
ryandotsmith / policy.json
Created September 20, 2013 23:10
AWS IAM Read Only
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"autoscaling:Describe*",
"cloudformation:DescribeStacks",
"cloudformation:DescribeStackEvents",
"cloudformation:DescribeStackResources",
"cloudformation:GetTemplate",
@ryandotsmith
ryandotsmith / process-partitioning.md
Created April 13, 2012 06:40
Process Partitioning

Process Partitioning

The Problem

When working with large, high volume, low latency systems, it is often the case that processing data sequentially becomes detrimental to the system's health. If we only allow 1 process to work on our data we run into several challenges:

  • Our process may fall behind resulting in a situation which it is impossible for our process to catch up.
  • Our singleton process could crash and leave our system in a degraded state.
  • The average latency of data processing could be dramatically affected by outlying cases.
@ryandotsmith
ryandotsmith / Dockerfile
Last active December 13, 2016 10:48
EC2 Docker Setup
FROM ubuntu
MAINTAINER "Bobby Wilson"
RUN apt-get update
RUN apt-get install curl -y
RUN cd /usr/local; curl -O http://nodejs.org/dist/v0.10.16/node-v0.10.16-linux-x64.tar.gz
RUN cd /usr/local; tar xzf node-v0.10.16-linux-x64.tar.gz
ENV PATH /usr/local/bin:/usr/sbin:/bin:/usr/local/node-v0.10.16-linux-x64/bin
ADD . /app
EXPOSE 8000:8000
ENV PORT 8000
@ryandotsmith
ryandotsmith / .vimrc
Created December 6, 2016 22:47
My Vim Config
syntax off
@ryandotsmith
ryandotsmith / webhooks.js
Last active June 20, 2016 08:17
Chain.com Webhooks Example
/*
Chain's Webhooks system will send an HTTP request
to our app with an event type of 'address-transaction'.
The body of the request will contain Chain's transaction
object. We can use this payload to do whatever we want!
*/
app.post('/', function (req, res) {
if (req.body['event'] == 'address-transaction') {
sendSMS(req.body.transaction)
res.send('OK\n');
@ryandotsmith
ryandotsmith / SimpleChainExample.java
Last active March 2, 2016 01:24
A simple example of Chain's Java SDK
import com.chain.*;
import java.math.BigInteger;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
public class Main {
private static String projectID = "proj0ACRX7YMG091G";
@ryandotsmith
ryandotsmith / chain-websockets.html
Created November 30, 2014 00:24
Chain jQuery Notifications Websockets Example
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
</head>
<body>
<ul id="thashlist"></ul>
</body>
<script type="text/javascript">
$(function() {
@ryandotsmith
ryandotsmith / crafty.patch
Created December 20, 2013 16:46
Crafty: remove listener which prevents touchmove events
From 3bfcdec1cfbf155fade70afbb0a8aee91a46d5e3 Mon Sep 17 00:00:00 2001
From: Eric Rykwalder <e.rykwalder@gmail.com>
Date: Thu, 19 Dec 2013 18:38:23 -0800
Subject: [PATCH] fix disableTouch issue on crafty
---
static/libs/crafty.js | 9 ++++++---
static/systems/home.js | 2 ++
2 files changed, 8 insertions(+), 3 deletions(-)
@ryandotsmith
ryandotsmith / gist:7835702
Created December 7, 2013 00:40
Snake to camel
def s2c(x)
case x
when Hash then Hash[*x.flatten(1).map{|x| s2s(x)}]
when Array then x.map{|x| s2s(x)}
when Symbol then String(x).camelcase
else x
end
end
require 'ostruct'
require 'minitest/autorun'
class P
attr_reader :x, :y
def initialize(x,y)
@x, @y = x, y
end
end