Skip to content

Instantly share code, notes, and snippets.

View avinoamr's full-sized avatar

Roi Avinoam avinoamr

  • San Francisco
View GitHub Profile
@avinoamr
avinoamr / minheap.go
Last active May 19, 2016 12:50
Binary MinHeap exercise implementation in go using a slice to store the tree.
/**
* Binary Heap exercise implementation in go using a slice to store the tree.
*
* A heap is a balanced binary tree, with the invariant that each node is
* smaller then all of its children, thus making the root node the minimal
* value in the tree (MinHeap; in MaxHeap, it's exact reversed). Heaps are
* useful for sorting and priority queues.
* See: https://en.wikipedia.org/wiki/Binary_heap
*
* In order to remove overhead, the heap is represented as an array with the
@avinoamr
avinoamr / radix.go
Created May 19, 2016 23:34
Radix LSD sort implementation excercise written in Go.
/**
* Radix LSD sort implementation excercise written in Go.
*
* A Radix sort is a non-comparative integer sorting algorithm that sorts data
* with integer keys by grouping keys by the individual digits which share the
* same significant position and value. Instead of using complex logical
* comparison operations, which are relatively costly, the Radix sort uses
* binary operations to compare single keys in binary order. In this
* implementation, the keys are generated arbitrarly by the caller, and since
* they represent order-preserving binary characters, they can be converted to
/**
* External Map is a wrapper around Go's built-in map types to support growing
* the number of keys beyond the available memory by dumping parts of it to
* disk.
*
* It starts out as normal in-memory map, and a predefined threshold for
* its maximum capacity (Max), which is the maximum number of items the map will
* contain. When Max is reached, a Split operation takes place that cuts
* the map in half - keeping ~Max/2 items in-memory and saving the rest
* to disk. As a side-effect, the Split also maintains a small in-memory
const AWS_KEY = '';
const AWS_SECRET = '';
const S3_BUCKET = '';
const DATA_JSON_URL = 'https://data.cityofnewyork.us/api/views/jb7j-dtam/rows.json?accessType=DOWNLOAD';
const REDSHIFT_CLUSTERS = {
'2x.dc1.large': {} // host, user, password, database, port
'2x.dc1.8xlarge': {},
'2x.ds2.xlarge': {},
'2x.ds2.8xlarge': {},
}