Skip to content

Instantly share code, notes, and snippets.

// Log Stream API
syntax = "proto3";
package google.devtools.logstream.v1alpha1;
// #### Introduction
//
// The Log Stream API manages LogStream resources which are used to stream
// writes and reads of an ordered sequence of bytes of unknown eventual length.
@EricBurnett
EricBurnett / d3.min.js
Created January 17, 2012 20:09
Marriage Sort Visualization
(function(){function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function f(a){return Array.prototype.slice.call(a)}function i(){return this}function j(a,b,c){return function(){var d=c.apply(b,arguments);return arguments.length?a:d}}function k(a){return a!=null&&!isNaN(a)}function l(a){return a.length}function m(a){return a==null}function n(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function q(){}function r(){function c(){var b=a,c=-1,d=b.length,e;while(++c<d)(e=b[c].on)&&e.apply(this,arguments)}var a=[],b={};return c.on=function(d,e){var f,g;if(arguments.length<2)return(f=b[d])&&f.on;if(f=b[d])f.on=null,a=a.slice(0,g=a.indexOf(f)).concat(a.slice(g+1)),delete b[d];return e&&a.push(b[d]={on:e}),c},c}function u(a,b){return b-(a?1+Math.floor(Math.log(a+Math.pow(10,1+Math.floor(Math.log(a)/Math.LN10)-b))/Math.LN10):1)}function v(a){return a+""}function w(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.rev
# Copyright 2010, Eric Burnett. All code released under the LGPL 2.1 except
# where noted.
# Uses matplotlib for charting.
import math
import random
from matplotlib import pyplot
# 'Array' is based on code taken from the demo file sortvisu.py from
@EricBurnett
EricBurnett / array1.py
Created March 3, 2010 03:21
Evolution of an implementation of the Sieve of Eratosthenes
import math
from time import clock
# Calculates all the primes from 0 to stop_at using a sieve on an array.
def primes(stop_at):
if stop_at is None:
print("This algorithm doesn't support unbounded ranges")
return []
if stop_at <= 2: return []
@EricBurnett
EricBurnett / allrgbify.py
Created February 10, 2010 20:01
Convert an image to all-RGB by colourizing from 3d hilbert line
import Image # Python Imaging Library (PIL)
import random
import math
import os
import sys
import getopt
# Main work function. Takes the path to a (square) image and the number of
# bits per colour channel desired. That value dictates the size of the output