Instantly share code, notes, and snippets.

View managers.py
from geopy import units, distance
from mezzanine.core.managers import CurrentSiteManager
class GeoManager(CurrentSiteManager):
def near(self, latitude=None, longitude=None, distance_range=30):
queryset = super(GeoManager, self).get_query_set()
if not (latitude and longitude and distance_range):
return queryset.none()
View retirement calc.md

Retirement Calculator

  • ages are in years
  • contribution, and savings are in dollars
  • avg_annual_return is a ratio, so 1.07 is a 7% annual return

let's say I'm 25 years old, I am going to contribute $2000/yr in bonds (~5% return), and I've already invested $5700 in bonds

View gist:4064433
{
"metadata": {
"name": "Study #1 OU Group C"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
View a.js
page.includeJs("http://www.google.com/jsapi?key=AIzaSyA5m1Nc8ws2BbmPRwKu5gFradvD_hgq6G0", function() {
page.evaluate(function() {
google.load("feeds", "1");
var feed = new google.feeds.Feed("http://www.digg.com/rss/index.xml");
feed.includeHistoricalEntries(); // tell the API we want to have old entries too
feed.setNumEntries(250); // we want a maximum of 250 entries, if they exist
feed.load();
View xbee-config.py
#!/usr/bin/env python
import sys, serial, time #@UnresolvedImport
class XBeeConfig:
def __init__( self, port = '', baud = 19200 ):
self.err, self.__ser__ = '', None
self.openSerial( port, baud )
View gist:665532
#/usr/bin/python
#
# Script that pulls a reltime energy consumption feed from nº10 Downning street
# The data is processed and sent to an 8x8 dot matrix display to be visualised.
#
# Copyleft Gonzalo Garcia-Perate g.garcia-perate [at] ucl.ac.uk
# for more info visit http://makingsenseofspace.com, http://vimeo.com/16567491
#