Skip to content

Instantly share code, notes, and snippets.

View bakercp's full-sized avatar

Christopher Baker bakercp

View GitHub Profile
bakercp /
Last active August 29, 2015 13:56
divvy php interface

GRANT ALL PRIVILEGES ON divvy_2013.* TO 'divvy@localhost';

NOTE, LOAD DATA INFILE requires that the csv file be in the same directory as the database. strange. very strange.

  • Steps to pre-process Divvy Data
  • There are some instances of #N/A in the station ids - search for all and replace with -1 (about 1900 of them)
  • In the trip duration column, there are occasionally values with commas and quotes - e.g. "1,123" representing 1123.
    • These are converted to a single number in excel.
  • Remove the text name columns for the station names. we'll use the databased to join that data on the other table.
  • All dates are converted to mysql format using the format yyyy-mm-dd hh:mm:ss
bakercp /
Created February 14, 2014 16:09
Emergency Pre-K Valentine's Day Cards

Happy Valentine's Day

bakercp / gist:9216583
Last active August 29, 2015 13:56
Divvy API Queries
// Get the most popular routes
SELECT count(*) AS CNT, from_station_id, to_station_id FROM `Divvy_Trips_2013` GROUP BY from_station_id, to_station_id ORDER BY CNT DESC
SELECT COUNT(*) AS CNT, from_station_id FROM `Divvy_Trips_2013` WHERE gender = 'F' AND birth_year > 1994 GROUP BY from_station_id ORDER BY CNT DESC
bakercp / dmsg.out
Last active August 29, 2015 14:02
0.997446] Advanced Linux Sound Architecture Driver Version 1.0.24.
[ 1.004682] Bluetooth: Core ver 2.16
[ 1.008388] NET: Registered protocol family 31
[ 1.012858] Bluetooth: HCI device and connection manager initialized
[ 1.019233] Bluetooth: HCI socket layer initialized
[ 1.024132] Bluetooth: L2CAP socket layer initialized
[ 1.029259] Bluetooth: SCO socket layer initialized
[ 1.034600] cfg80211: Calling CRDA to update world regulatory domain
[ 1.042032] i2c-core: driver [max17135] using legacy suspend method
[ 1.048319] i2c-core: driver [max17135] using legacy resume method
// =============================================================================
// Copyright (c) 2009-2013 Christopher Baker <>
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
bakercp / Output.txt
Last active August 29, 2015 14:05
PocoRegex Experiment.
Should print out:
bakercp / Clock.pde
Created September 12, 2014 22:23
color[] colors = new color[4];
PVector[] vertices = new PVector[4];
int colorIndexOffset = 0;
long lastTime = 0;
void setup()
bakercp / DelaunayExample
Created December 9, 2014 01:04
ofSketch ofxDelaunay Example
/// 1. Download the zip file here:
/// 2. Extract it into your data/openFrameworks/addons folder of ofSketch.
/// 3. Make sure that the folder is called ofxDelaunay, not ofxDelaunay-master or something.
/// 4. Open ofSketch and paste the following code into a new sketch.
/// 5. Using the "Addons" button (+ in a circle next to the paperclip), scroll down and make sure ofxDelaunay is checked.
/// 6. Run!
#include "ofxDelaunay.h"
ofxDelaunay triangulation;
bakercp / HelloGist.sketch
Created December 16, 2014 23:25
void setup() {
void draw() {
ofDrawBitmapStringHighlight("Hello Gist!", 105, 120, ofColor::white, ofColor::black);
bakercp / Ball.sketch
Created December 17, 2014 03:40
HelloWorld ofSketch Gist.
class Ball{
ofVec2f position;
ofVec2f velocity;
int radius;
ofColor color;