This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CleanAndAnonymize | |
def initialize(connection_url, weeks: 2, vacuum_full: false, dry_run: true) | |
@connection_url = case connection_url | |
when URI | |
connection_url | |
else | |
URI.parse(connection_url) | |
end | |
@weeks = weeks | |
@vacuum_full = vacuum_full |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import collections | |
import ggplot | |
import json | |
from ggplot import * | |
def load_stations_json(json_file): | |
""" load station info from the JSON web API | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <Eigen/Eigen> | |
#include <limits> | |
#include <vector> | |
typedef Eigen::Vector3f Vector3; | |
typedef Vector3::Scalar Length; | |
enum class Normal {INTERIOR, EXTERIOR}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example showing how to create a circular history buffer in redis. This example stores a location | |
# history in a packed binary representation that can be sent to a browser to unpack with DavaView. | |
# If the browser has local storage, it can request to catch up to the history from where it left off. | |
# | |
# We use a string to store the history and setrange/getrange to manipulate individual records | |
# Another string serves as a counter to know where to insert the next record | |
# Finally, a sorted set is used to track the timestamp associated with each record to support | |
# the 'since' query | |
# | |
# Note, this doesn't support dynamically changing the capacity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extend = function(proto, properties) { | |
for (var key in properties) { | |
proto[key] = properties[key]; | |
} | |
return proto; | |
} | |
Object.getPrototypeOf(d3.map()).length = function() { | |
var length = 0; | |
this.forEach(function(key) {++length;}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.gists; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import com.vividsolutions.jts.geom.Geometry; | |
import com.vividsolutions.jts.geom.GeometryFactory; | |
import com.vividsolutions.jts.geom.Point; | |
import com.vividsolutions.jts.geom.prep.PreparedGeometry; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source('plot_crime.R') | |
city <- read.city_boundary('chicago/City_Boundary.shp') | |
crimes <- read.crimes('chicago/Crimes_-_2011.csv') | |
png('chicago/crimes_2011.png', width=835, height=1295) | |
plot_crime(crimes, city, max_rank=20, ncol=4) | |
dev.off() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fast auto-correlation | |
acf.II <- function(x) | |
{ | |
n <- length(x) | |
x <- c(x, rep.int(0, n)) | |
transform <- fft(x) | |
x <- fft(Conj(transform) * transform, inverse = TRUE) | |
Re(x)[1:n]/(2*n) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Almost just like ruby, lets you do the following: | |
// | |
// "".methods().grep(/__/) | |
// [ '__defineGetter__()', | |
// '__defineSetter__()', | |
// '__lookupGetter__()', | |
// '__lookupSetter__()' ] | |
// | |
// I would prefer to define this as getter, but node throws the following when I try | |
// TypeError: Property 'hasOwnProperty' of object #<error> is not a function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# postinstall.sh created from Mitchell's official lucid32/64 baseboxes | |
# | |
# Significant modifications: | |
# ruby 1.9.3 with libyaml and ffi | |
# no puppet | |
# g++ | |
# use existing guest additions iso instead of re-download | |
date > /etc/vagrant_box_build_time |
NewerOlder