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
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer! | |
export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ " | |
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty! | |
# ~/code/web:beta_directory$ git checkout master | |
# Switched to branch "master" | |
# ~/code/web:master$ git checkout beta_directory | |
# Switched to branch "beta_directory" |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
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
Database machine | |
Install postgres and postgis | |
make sure you can log on via md5 in pg_hba.conf | |
check listen addresses in postgresql.conf | |
set kernel parameters in sysctl.conf to allow for larger shared memory - http://www.postgresql.org/docs/8.3/static/kernel-resources.html | |
kernel.shmmax=2684354560 | |
kernel.shmall=2097152 |
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
-- Gather the county geometries from the blocks | |
select b.id, b.name, st_union(a.geom) as geom into temp new_county_geoms from redistricting_geounit as a join redistricting_geounit as b on a.geom && b.geom where b.geolevel_id = 3 and a.geolevel_id = 1 and position(b.portable_id in a.portable_id) = 1 group by b.id, b.name; | |
-- Index the id column for a faster join when updating | |
create index new_county_id on new_county_geoms (id); | |
-- Update your counties | |
update redistricting_geounit as a set geom = multi(b.geom) from new_county_geoms as b where a.id = b.id; | |
-- Gather the place geometries from the blocks |
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
OH State Senate | |
District 23 - Block in wrong district in CSV at line 251513 | |
390351171011005,023 -> 390351171011005,025 | |
District 11 - Not quite touching the water block. Needs a contiguity override | |
390950097002036 connected to 390950097003000 | |
OH State House | |
District 49 - should be same override as Senate 11 |
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
Index: views.py | |
=================================================================== | |
--- views.py (revision 1402) | |
+++ views.py (working copy) | |
@@ -1143,6 +1143,8 @@ | |
A JSON HttpResponse that contains the number of districts modified, | |
or an error message if adding fails. | |
""" | |
+ start = datetime.now() | |
+ sys.stderr.write('Received request at %s\n' % start) |
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
(function () { | |
Backbone.syncWithoutUpload = Backbone.sync | |
Backbone.syncWithUpload = function(method, model, options) { | |
// Create iframe | |
var iframe_id = 'file_upload_iframe_' + Date.now() | |
, iframe = jQuery('<iframe id="' + iframe_id + '" name="' + iframe_id + '" ></iframe>').hide() | |
// Create an hidden form | |
var authToken = jQuery('meta[name=csrf-token]').attr('content') | |
, authParam = jQuery('meta[name=csrf-param]').attr('content') |
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
# Shamelessly stolen from https://github.com/newsapps/django-boundaryservice/blob/master/boundaryservice/tastyhacks.py | |
from django.contrib.gis.db.models import GeometryField | |
from django.utils import simplejson | |
from tastypie.bundle import Bundle | |
from tastypie.fields import ApiField, CharField | |
from tastypie.resources import ModelResource | |
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
from haystack import indexes | |
# The easiest, per-object approach. | |
class CustomSearchIndex(indexes.SearchIndex, indexes.Indexable): | |
# The usual fields. | |
def prepare(self, obj): | |
prepared = super(CustomSearchIndex, self).prepare(obj) |
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
#!/usr/bin/env python | |
## The equivalent of: | |
## "Working with the Skeleton" | |
## in the OpenNI user guide. | |
""" | |
This shows how to identify when a new user is detected, look for a pose for | |
that user, calibrate the users when they are in the pose, and track them, | |
sending updates about joint position over a websocket. |
OlderNewer