Skip to content

Instantly share code, notes, and snippets.

View bengolder's full-sized avatar

Ben Golder bengolder

  • Oakland, CA, USA
  • 00:54 (UTC -08:00)
View GitHub Profile
@bengolder
bengolder / test_mobile.md
Last active August 29, 2015 14:06
viewing a computer's localhost from an iPhone

References:

  1. Find the ip address of the computer running the dev server. You can use ipconfig on windows or go to Preferences > Network on a Mac.

  2. start the Django server on the computer's ip (the ip below is just an example):

     python manage.py runserver 11.111.1.111:8000
    
  3. Open that address on the browser of your phone

@bengolder
bengolder / setup.sh
Created July 17, 2014 04:02
A series of steps to setup a bare Ubuntu server with nginx, supervisor, Gunicorn, and an existing Django app
#############################################################################
## ##
## LT-VIZ INITIAL SERVER SETUP ------------------------------------------ ##
## ##
## This is a list of bash commands that are used to setup a Ubuntu ##
## 14.04 server with nginx, gunicorn, and a Django app. ##
## ##
#############################################################################
#############################################################################
@jamesbarnett
jamesbarnett / gist:9106565
Created February 20, 2014 03:23
First stab at a Makefile for building libcinder apps on Mavericks
CC=g++
CFLAGS=-g -Wall -std=c++11 -I/usr/local/include -I/Users/jbarnett/cinder/include
LIBPATH += -L"/System/Library/Frameworks/CoreLocation.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/Accelerate.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/ApplicationServices.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/QuickTime.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/Carbon.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/Cocoa.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/OpenGL.framework/Libraries"
@nicerobot
nicerobot / install.sh
Last active January 16, 2024 07:34
Whew! QGIS 2 on Mavericks built using only Homebrew packages (i.e. without KyngChaos) \o/ -- WARNING: A _major_ assumption here is that your Homebrew PREFIX is /usr/local . -- DISCLAIMER: It worked for me. YMMV
#!/bin/bash
# Run this:
#
# curl https://gist.github.com/nicerobot/7664605/raw/install.sh | bash -s do-sudo
#
# which will run:
[ -f qgis2-homebrew-build.sh ] || {
curl -O https://gist.github.com/nicerobot/7664605/raw/qgis2-homebrew-build.sh
@urschrei
urschrei / jenks_zero.py
Created September 22, 2013 17:45
Calculate Jenks natural breaks on a dataset containing zero values, using Pandas and Pysal
import pandas as pd
import numpy as np
from pysal.esda.mapclassify import Natural_Breaks as nb
df = pd.DataFrame({'density': np.random.randint(0, 10, 500)})
# replace zero values with NaN
df.replace(to_replace={'density': {0: np.nan}}, inplace=True)
breaks = nb(df[df['density'].notnull()].density.values, k=5)
# this index will allow us to perform the join correctly
@max-mapper
max-mapper / helloworld.js
Created November 27, 2012 06:55
droneduino
var serialport = require('node-serialport')
var sp = new serialport.SerialPort("/dev/ttyO3", {
parser: serialport.parsers.raw,
baud: 9600
})
sp.on('data', function(chunk) {
console.log(chunk.toString('hex'), chunk.toString(), chunk)
})
@danielsokolowski
danielsokolowski / geojson_serializer.py
Created May 12, 2011 16:42
GeoJSON Serializer for GeoDjango (gis)
'''
Created on 2011-05-12
@author: Daniel Sokolowski
Extends django's built in JSON serializer to support GEOJSON encoding
Requirements:
Install and setup geodjango (django.contrib.gis)