Skip to content

Instantly share code, notes, and snippets.

Elizabeth Leddy eleddy

Block or report user

Report or block eleddy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9d2b899bea886c30f8f1
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
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]
View webserver.pp
...
$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 Jun 26, 2013
Noisebridge class - add your favorite game
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 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)
@eleddy
eleddy / list_troll.py
Created Jun 6, 2013
Get statistics on the health of plone mailing lists
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'):
@eleddy
eleddy / commit_stats.py
Created Jun 6, 2013
Get stats for plone commits from ohloh
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 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
@eleddy
eleddy / dictionaries.ipynb
Created Nov 29, 2012
Noisebridge Python class on dictionaries - ipython notebook export
View dictionaries.ipynb
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 Nov 8, 2012
Noisebridge PyClass Homework
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
You can’t perform that action at this time.