Skip to content

Instantly share code, notes, and snippets.

View aaronlidman's full-sized avatar

Aaron Lidman aaronlidman

View GitHub Profile
from math import sqrt
from matplotlib import pyplot
from shapely.geometry import *
GM = (sqrt(5)-1.0)/2.0
W = 8.0
H = W*GM
SIZE = (W, H)
COLORS = ['#6699cc', '#ffcc33']
@springmeyer
springmeyer / osm.pbf to postgis
Created November 1, 2010 07:23
import a pbf file into postgis from geofabrik using osmosis and osm2pgsql
# note: there is work afoot to load pbf directly with osm2pgsql
# http://lists.openstreetmap.org/pipermail/dev/2010-October/020953.html
# but for now osmosis >= 0.37 works best
# install java/osmosis if you don't already have it
sudo apt-get install sun-java6-jre
wget http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-0.37.zip
unzip osmosis-0.37.zip
cd osmosis-0.37
chmod +x bin/osmosis
@emacsen
emacsen / mb2s3.py
Created May 1, 2011 21:16
First rough cut at an mbtiles to s3 uploader. Needs work
#!/usr/bin/env python
"""Script to upload contents of an mbtile to an s3 storage bucket"""
from boto.s3.connection import S3Connection
import sqlite3
import sys
import os
import progressbar
import threading
@xarg
xarg / dp.py
Created June 28, 2011 14:31
Douglas-Peucker
# pure-Python Douglas-Peucker line simplification/generalization
#
# this code was written by Schuyler Erle <schuyler@nocat.net> and is
# made available in the public domain.
#
# the code was ported from a freely-licensed example at
# http://www.3dsoftware.com/Cartography/Programming/PolyLineReduction/
#
# the original page is no longer available, but is mirrored at
# http://www.mappinghacks.com/code/PolyLineReduction/
@tkersey
tkersey / gist:1130675
Created August 7, 2011 19:16
Getting a Motorola SBG6580 into “Bridge” mode

found at: http://fascinated.fm/post/2379188731/getting-a-motorola-sbg6580-into-bridge-mode-on

Getting a Motorola SBG6580 into “Bridge” mode on TimeWarner Wideband

  1. Unplug coax cable from Motorola
  2. Hold down the white reset button on the back panel with a pen for 30s.  This resets all settings to factory defaults. The modem will be auto-reconfigured once you plug in the coax cable.
  3. When modem is back on plug in a computer with an Ethernet cable into the modem.
  4. Connect to http://192.168.0.1 and login with “admin” / “motorola”
  5. Now you will make some changes:
 
  • Wireless -> Primary Network -> Disabled
@olivierlacan
olivierlacan / launch_sublime_from_terminal.markdown
Created September 5, 2011 15:50
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@innotekservices
innotekservices / jquery.spin.js
Created October 16, 2011 02:39
jQuery Plugin for Spin.js
/*
You can now create a spinner using any of the variants below:
$("#el").spin(); // Produces default Spinner using the text color of #el.
$("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
$("#el").spin(false); // Kills the spinner.
@mikeyk
mikeyk / gist:1329319
Created October 31, 2011 22:56
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Simple script to create geojson from osm files.
Prints geojson features line by line.
Currently we don't support relations.
Requires (unmodified) imposm and imposm.parser
Inspired by https://github.com/emka/OSMCouch
'''