View creepy.py
import urllib2 | |
from lxml.html import fromstring | |
import json | |
def collate_data(): | |
print "beginning collating..." | |
# get the list of users from noisebridge wiki | |
# and put them in a dictionary with userid as key |
View dictionaries.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View sqla_intro.py
""" | |
Tutorial at http://docs.sqlalchemy.org/en/rel_0_8/orm/tutorial.html | |
Data at http://pastie.org/5659260 | |
Key Points: | |
- requires: sqlalchemy, psycopg2 | |
- Setting up new database and user | |
- Difference between sql, postgres, sqlite | |
- Sqlite and timezones | |
- Connecting to the DB and DSNs |
View commit_stats.py
#! /usr/bin/python | |
from lxml import html | |
import datetime | |
import requests | |
from collections import defaultdict | |
def parse(html_string, impact=None): | |
""" |
View list_troll.py
#! /bin/python | |
import urllib2 | |
import csv | |
import datetime | |
import math | |
class GmaneListStats(object): | |
def __init__(self, what_is_recent=30, group='gmane.comp.web.zope.plone.devel'): |
View superbeta_models.py
from django.db import models | |
from django.contrib.localflavor.us.models import USStateField, PhoneNumberField | |
def save_area(instance, file_name): | |
return "photos/%s/%s/%s" % (instance.area.state, instance.area.name, file_name) | |
# WAT is this? if this is about using nice urls then use url routing instead | |
def save_problem(instance, file_name): | |
return "photos/%s/%s/%s/%s" % (instance.problem.parent.state, instance.problem.parent.name, instance.problem.name, file_name) |
View inheritance.py
#!/usr/bin/python | |
class Toy(object): | |
inventory = 0 | |
def __init__(self, price, name, quantity): | |
self.price = price | |
self.name = name | |
self.quantity = quantity |
View mysite.conf
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] | |
RewriteRule ^(.*) https://%1$1 [R=301,L] | |
RewriteCond %{HTTP_HOST} ^mysubdomain\.mysite\.com | |
RewriteRule ^/(.*)$ http://127.0.0.1:9090/VirtualHostBase/https/%{SERVER_NAME}:%{SERVER_PORT}/subdomain/VirtualHostRoot/$1 [L,P] |
OlderNewer