Skip to content

Instantly share code, notes, and snippets.

View douglasgoodwin's full-sized avatar

Doug Goodwin douglasgoodwin

View GitHub Profile
@douglasgoodwin
douglasgoodwin / config.txt
Last active August 29, 2015 14:10
Raspberry Pi configurations
# /boot/config.txt
# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details
# rotate Display
display_rotate=1
arm_freq=700
core_freq=250
@douglasgoodwin
douglasgoodwin / index.html
Last active August 29, 2015 14:15
commute cost calculator
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en-US"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en-US"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en-US">
<!--<![endif]-->
<head>
<title>Commute Cost Calculator</title>
@douglasgoodwin
douglasgoodwin / geojson_802.json
Created February 26, 2015 19:25
GeoJson sample
{
"features": [
{
"geometry": {
"coordinates": [
34.1685,
-118.377
],
"type": "Point"
},
{
"features": [
{
"geometry": {
"coordinates": [
[
34.1685,
-118.377
],
[
import string
import simplejson as json
"""
Run this code in an iPython console that has the stations available. ie:
python manage.py shell
//[0] = ID number for AutoComplete
//[1] = Station Name
//[2] = X-Coordinate
@douglasgoodwin
douglasgoodwin / stops.geojson
Last active August 29, 2015 14:16
bus stops geojson example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Ruby script to convert stops.txt and shapes.txt to GeoJSON.

@douglasgoodwin
douglasgoodwin / dominant_colorz.py
Last active August 29, 2015 14:17
Using python and k-means to find the dominant colors in images. "forked" from charlesleifer.com
"""
from: http://charlesleifer.com/blog/using-python-and-k-means-to-find-the-dominant-colors-in-images/
start with a bunch of data points. For simplicity let's say they're numbers on a number-line.
You want to group the numbers into "k" clusters, so pick "k" points randomly from the data to
use as your "clusters".
Now loop over every point in the data and calculate its distance to each of the "k" clusters.
Find the nearest cluster and associate that point with the cluster. When you've looped over
@douglasgoodwin
douglasgoodwin / color_kmeans.py
Created March 17, 2015 22:52
fast way to generate weighted bar palettes from images
# USAGE
# python color_kmeans.py --image images/jp.png --clusters 3
# or
# python color_kmeans.py -g "images/chase*.png" -c9
# import the necessary packages
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import argparse
import utils
@douglasgoodwin
douglasgoodwin / DSE-HG-DS.geojson
Created March 27, 2015 20:01
A couple of SHP --> GeoJSON tests
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.