Skip to content

Instantly share code, notes, and snippets.

@janetlee
janetlee / installing_cassandra.md
Created December 12, 2017 03:32 — forked from hkhamm/installing_cassandra.md
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
/**
* Write a function that, given two objects, returns whether or not the two
* are deeply equivalent--meaning the structure of the two objects is the
* same, and so is the structure of each of their corresponding descendants.
*
* Examples:
*
* deepEquals({a:1, b: {c:3}},{a:1, b: {c:3}}); // true
* deepEquals({a:1, b: {c:5}},{a:1, b: {c:6}}); // false
*
@janetlee
janetlee / latency.txt
Created January 11, 2018 01:06 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@janetlee
janetlee / convertjsoncsv.rb
Created May 4, 2021 18:31 — forked from jordan-thoms/convertjsoncsv.rb
Code to convert json to csv, with correct headings Usage: ruby convertjsoncsv.rb <input file> <output file>
require 'csv'
require 'json'
require "set"
json = JSON.parse(File.open(ARGV[0]).read)["results"]
# Pass 1: Collect headings
headings = SortedSet.new
json.each do |hash|
headings.merge(hash.keys)
end