Skip to content

Instantly share code, notes, and snippets.

View eleddy's full-sized avatar

Elizabeth Leddy eleddy

View GitHub Profile
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteRule ^ - [E=SERVER_NAME:${lowercase:%{SERVER_NAME}}]
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*) https://%1$1 [R=301,L]
ProxyPassInterpolateEnv On
ProxyRequests Off
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]
...
$custom_fragment_proxy_pass = '
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteRule ^ - [E=SERVER_NAME:${lowercase:%{SERVER_NAME}}]
ProxyPassInterpolateEnv On
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown'
@eleddy
eleddy / inheritance.py
Created June 26, 2013 04:15
Noisebridge class - add your favorite game
#!/usr/bin/python
class Toy(object):
inventory = 0
def __init__(self, price, name, quantity):
self.price = price
self.name = name
self.quantity = quantity
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)
@eleddy
eleddy / list_troll.py
Created June 6, 2013 16:43
Get statistics on the health of plone mailing lists
#! /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'):
@eleddy
eleddy / commit_stats.py
Created June 6, 2013 16:41
Get stats for plone commits from ohloh
#! /usr/bin/python
from lxml import html
import datetime
import requests
from collections import defaultdict
def parse(html_string, impact=None):
"""
"""
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
@eleddy
eleddy / dictionaries.ipynb
Created November 29, 2012 20:20
Noisebridge Python class on dictionaries - ipython notebook export
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eleddy
eleddy / creepy.py
Created November 8, 2012 20:58
Noisebridge PyClass Homework
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