Skip to content

Instantly share code, notes, and snippets.

View aishfenton's full-sized avatar

Aish aishfenton

  • Netflix
  • San Francisco
View GitHub Profile
require 'rubygems'
require "builder"
require "benchmark"
require 'nokogiri'
require 'erb'
require 'erubis'
ITERATIONS = 1_000
ERB_TEMPLATE = <<-EOL
@aishfenton
aishfenton / serializer_benchmarks.rb
Created July 18, 2010 02:32 — forked from visfleet/performance_of_yaml_vs_marshal.rb
Performance comparison of different ruby serializer methods
# sudo gem install bson
# sudo gem install bson_ext
# sudo gem install yajl-ruby
# sudo gem install json
# sudo gem install msgpack
require 'rubygems'
require 'benchmark'
require 'yaml'
require 'bson'
ACCOUNT_ID = 2
NUMBER_OF_JOBS = 1_000
class PopulateJobs
def create_job(index)
job = @account.intervals.new(:name => "Job #{index}")
location = Location.new(:formatted_address => "12 Heather Street, Auckland, Parnell, New Zealand", :lat => 123.2342, :lng => 37.234232)
@aishfenton
aishfenton / populate_jobs.rb
Created July 18, 2010 23:51
Populate 1000 load of vWork jobs for performance testing
ACCOUNT_ID = 2
NUMBER_OF_JOBS = 1_000
class PopulateJobs
def create_job(index)
job = @account.intervals.new(:name => "Job #{index}")
location = Location.new(:formatted_address => "12 Heather Street, Auckland, Parnell, New Zealand", :lat => 123.2342, :lng => 37.234232)
job.milestones.build({:location => location, :milestone_type => "Start", :sequence_order => 0, :planned_duration => 0})
@aishfenton
aishfenton / octane2_protocol.md
Created August 10, 2010 23:58
Starting to sketch our Octane2 protocol
@aishfenton
aishfenton / Our encrypt method
Created February 22, 2011 01:41
Thinking behind possible way to encrypt info for vWork Customer Portal
require 'openssl'
require 'digest/sha1'
ENCRYPT_METHOD = "aes-256-cbc"
API_KEY = "YOUR_VWORKAPP_API_KEY"
# What you have to do
c = OpenSSL::Cipher::Cipher.new(ENCRYPT_METHOD)
c.encrypt
# your pass is what is used to encrypt/decrypt
@aishfenton
aishfenton / broken_ssl.rb
Created June 14, 2011 00:27
evma_httpserver broken with SSL
require 'eventmachine'
require 'evma_httpserver'
class MyHttpServer < EventMachine::Connection
include EventMachine::HttpServer
def post_init
super
ssl_dir = File.join(File.dirname(__FILE__), "ssl")
server_key = File.join(ssl_dir, "server.key")
@aishfenton
aishfenton / vworkapp.js
Created September 5, 2011 04:32
vWorkApp Javascript Script
// ------------------------------------------------------------------------------------------------------------------//
// vWorkApp Core Library
// ------------------------------------------------------------------------------------------------------------------//
var vWorkAppScript = vWorkAppScript || {};
vWorkAppScript.host = "api.vworkapp.com";
vWorkAppScript.apiToken = "PUT YOUR API KEY HERE"
(function() {
@aishfenton
aishfenton / benchmark_bloomfilter.rb
Created December 5, 2012 23:59
Benchmark BloomFilter serialization
require "benchmark"
require "mongoid"
require "bloomfilter-rb"
module BloomFilter
class Native
def self.unpack(str)
bitstring = str.unpack("B*").first
bytes = []
@aishfenton
aishfenton / main.css
Last active December 18, 2015 03:08
Knitr Stylesheet
body {
font-family: sans serif;
background-color: white;
font-family: georgia;
font-size: 15px;
margin: 20px;
}
ul {
list-style-type: square;