Skip to content

Instantly share code, notes, and snippets.

Avatar

Doug Goodwin douglasgoodwin

View GitHub Profile
View A generic cache manager.
from django.db.models.query import QuerySet
from django.core.cache import cache
from django.db import models
import random
# douglas goodwin 4/2010
# eculver's code with a couple of fixes and instructions
#
# maybe not the nest way to do it but...
#
@douglasgoodwin
douglasgoodwin / loadall.py
Created Jan 12, 2012
This gist loads GTFS data into a sqlite table
View loadall.py
from datetime import date, datetime
import time
import numpy
from fish import ProgressFish
import gtfs
from gtfs import Schedule
from gtfs.types import TransitTime
from gtfs.entity import StopTime, Trip, Stop, Route, ServiceException, ServicePeriod, Agency
View shortlist.json
This file has been truncated, but you can view the full file.
[
{"ZIPCODE":"35010","PONAME":"ALEXANDER CITY","STATE":"AL","INCOME_CATEGORY":1},
{"ZIPCODE":"35020","PONAME":"BESSEMER","STATE":"AL","INCOME_CATEGORY":1},
{"ZIPCODE":"35023","PONAME":"BESSEMER","STATE":"AL","INCOME_CATEGORY":1},
{"ZIPCODE":"35053","PONAME":"CRANE HILL","STATE":"AL","INCOME_CATEGORY":1},
{"ZIPCODE":"35055","PONAME":"CULLMAN","STATE":"AL","INCOME_CATEGORY":1},
{"ZIPCODE":"35063","PONAME":"EMPIRE","STATE":"AL","INCOME_CATEGORY":1},
{"ZIPCODE":"35064","PONAME":"FAIRFIELD","STATE":"AL","INCOME_CATEGORY":1},
{"ZIPCODE":"35072","PONAME":"GOODWATER","STATE":"AL","INCOME_CATEGORY":1},
@douglasgoodwin
douglasgoodwin / error.txt
Created Mar 13, 2013
vagrant up error -- pip md5
View error.txt
dgoodwin-macpro:metro-app-server dgoodwin$ vagrant up
[default] VM already created. Booting if it's not already running...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[Berkshelf] installing cookbooks...
/Users/dgoodwin/.vagrant.d/gems/gems/berkshelf-1.2.0/lib/berkshelf/git.rb:124: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
[Berkshelf] Installing application (2.0.1) from git: 'git@github.com:douglasgoodwin/application.git' with branch: 'ca1b2ff0c1b88e1a5f7c692bf4af92ae1657d12f'
[Berkshelf] Using metro-app-server (0.1.0) at path: '/Users/dgoodwin/Workspace/cookbooks/metro-app-server'
[Berkshelf] Using hostsfile (0.2.5)
View E16PK26F794569.2013-05-10-22.0tqwzhuJ
#Version: 1.0
#Fields: date time x-edge-location sc-bytes c-ip cs-method cs(Host) cs-uri-stem sc-status cs(Referer) cs(User-Agent) cs-uri-query cs(Cookie) x-edge-result-type x-edge-request-id
2013-05-10 22:14:19 SFO5 794 69.163.48.214 GET d3da8gtxngrv8u.cloudfront.net /i 403 http://10.0.1.131:380/ Mozilla/5.0%20(Macintosh;%20Intel%20Mac%20OS%20X%2010.7;%20rv:20.0)%20Gecko/20100101%20Firefox/20.0 &e=ad&ad_ba=1&ad_ca=2&ad_ad=12&ad_uid=1&dtm=1368224038757&tid=016219&vp=1920x884&ds=1920x884&vid=4&duid=2d3353b4272270f9&p=web&tv=js-0.11.1&fp=1156021008&lang=en-US&cs=UTF-8&tz=America%252FLos_Angeles&f_pdf=1&f_qt=1&f_realp=0&f_wma=0&f_dir=0&f_fla=1&f_java=1&f_gears=0&f_ag=0&res=1920x1080&cd=24&cookie=1&url=http%253A%252F%252F10.0.1.131%253A380%252F - Error 44alQ_qANhQ6RTvRfQ-WSLKDUsN0XkyatjnpUDNd3eBOWg0fc0AEPg==
2013-05-10 22:14:19 SFO5 794 69.163.48.214 GET d3da8gtxngrv8u.cloudfront.net /i 403 http://10.0.1.131:380/ Mozilla/5.0%20(Macintosh;%20Intel%20Mac%20OS%20X%2010.7;%20rv:20.0)%20Gecko/20100101%20Firefox/20.0
View gist:5596863
<!-- Snowplow starts plowing -->
<script type="text/javascript">
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/0.11.2/sp.js';
document.write(unescape("%3Cscript src='" + spSrc + "' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var spTrackObj = function(){};
spTrackObj.prototype ={
@douglasgoodwin
douglasgoodwin / pop.html
Created May 17, 2013
here's an example of the javascript that's generated from the secret URL.
View pop.html
<script
data-banner-css="/static/css/dashboard.min.css"
data-userid="3"
data-campaignid="7"
data-advertiserid="4"
data-bannerid="3"
data-userid="3"
data-main="/static/js/configDashboard"
@douglasgoodwin
douglasgoodwin / bet.html
Created May 21, 2013
with Frank's tags
View bet.html
<!-- Snowplow starts plowing -->
<script type="text/javascript">
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/0.11.2/sp.js';
document.write(unescape("%3Cscript src='" + spSrc + "' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var spTrackObj = function(){};
spTrackObj.prototype ={
View nginx.conf
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
@douglasgoodwin
douglasgoodwin / Helium experiment.ipynb
Last active Dec 23, 2015
Experiment 1: All That Glitters @calarts.github.io
View Helium experiment.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.