Skip to content

Instantly share code, notes, and snippets.

View cageyjames's full-sized avatar

James Fee cageyjames

View GitHub Profile
@cageyjames
cageyjames / WeoGeo-Dataview
Created January 30, 2012 20:20
WeoGeo Dataset Embed Code
<iframe height="500" width="500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://market.weogeo.com/datasets/leaddog-guadeloupe/widget.html?zoom=2&lat=1824774.3815077&lon=-6835660.4521501"></iframe>
@cageyjames
cageyjames / clip.py
Created February 7, 2012 04:12
Clip with ArcPy
import arcpy
from arcpy import env
env.workspace = "c:/workspace"
# variables
in_features = "soils.shp"
clip_features = "study_boundary.shp"
@cageyjames
cageyjames / baseballruns
Created October 11, 2012 04:13
Run Differential
#!/usr/bin/python
from scipy import stats
from pylab import *
# Read in the data.
mlb = loadtxt('mlb.txt', dtype=[('team', 'S3'), ('w', 'i'), ('l', 'i'), ('pct', 'f'), ('rdiff', 'i')])
# Plot the data with invisible points.
scatter(mlb['rdiff'], mlb['w'], s=0)
@cageyjames
cageyjames / WeoGeoAPI
Created November 18, 2012 17:09
Get WeoGeoAPI from the Python Package Index
# Get the WeoGeo API from the Python Package Index
# http://pypi.python.org/pypi/WeoGeoAPI/
pip install WeoGeo API
@cageyjames
cageyjames / WeoGeoAPI_Test.py
Created November 18, 2012 17:13
Test the WeoGeoAPI.py
# Import Needed Libraries
import WeoGeoAPI
import getpass
# Get Password Without Echoing
PASSWORD = getpass.getpass()
# Build WeoGeo Connection with Library URL, Username and Password
@cageyjames
cageyjames / test_response.html
Created November 18, 2012 17:25
WeoGeoAPI.py response
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="/assets/new_ui.css?1313520076" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/jquery-ui-1.8.4.custom.css?1313597469" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/fonts.css?1312912173" media="screen" rel="stylesheet" type="text/css" />
<style type="text/css">
body, html {height: 100%; width: 100%; background: #CBDFEA;}
@cageyjames
cageyjames / gitinfo.sh
Created November 21, 2012 14:28
Git Info
#!/bin/bash
# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
pushd . >/dev/null
@cageyjames
cageyjames / parse_wordpress_xml.py
Created November 26, 2012 21:02
WordPress.xml to Markdown (Octopress)
""" parse_wordpress_xml.py
Takes a WordPress XML export file and converts it to Octopress flavored Markdown files.
Author: James Fee (http://github.com/cageyjames)
"""
import string
import sys
@cageyjames
cageyjames / gist:4178679
Created November 30, 2012 21:15
Sample Process for TileMill
Sampling process 9142 for 3 seconds with 1 millisecond of run time between samples
Client side error: Connection interrupted
Sampling completed, processing symbols...
Client side error: Connection interrupted
Analysis of sampling node (pid 9142) every 1 millisecond
Process: node [9142]
Path: /Applications/TileMill.app/Contents/Resources/node
Load Address: 0x100000000
Identifier: node
Version: ??? (???)
@cageyjames
cageyjames / gist:4178953
Created November 30, 2012 21:52
Possible TileMill Shapefile Problems
http://kml-store.s3.amazonaws.com/10m_cultural/ne_10m_railroads_north_america.zip
http://kml-store.s3.amazonaws.com/10m_cultural/ne_10m_railroads.zip
http://kml-store.s3.amazonaws.com/10m_cultural/ne_10m_roads_north_america.zip
http://kml-store.s3.amazonaws.com/10m_cultural/ne_10m_roads.zip
http://kml-store.s3.amazonaws.com/10m_physical/ne_10m_rivers_europe.zip
http://kml-store.s3.amazonaws.com/10m_physical/ne_10m_rivers_lake_centerlines_scale_rank.zip
http://kml-store.s3.amazonaws.com/10m_physical/ne_10m_rivers_north_america.zip
http://kml-store.s3.amazonaws.com/50m_physical/ne_50m_rivers_lake_centerlines_scale_rank.zip
http://kml-store.s3.amazonaws.com/110m_physical/ne_110m_rivers_lake_centerlines.zip
http://kml-store.s3.amazonaws.com/10m_cultural/ne_10m_admin_1_states_provinces_lines.zip