Skip to content

Instantly share code, notes, and snippets.

View acdha's full-sized avatar

Chris Adams acdha

View GitHub Profile
@acdha
acdha / baseline.txt
Last active April 28, 2018 04:37 — forked from jmcnamara/bench_excel_writers.py
Benchmark of several Python Excel writing modules
Versions:
python : 2.7.1
openpyxl : 2.2.5
pyexcelerate: 0.6.6
xlsxwriter : 0.7.3
xlwt : 1.0.0
Dimensions:
Rows = 10000
@acdha
acdha / rewrite.py
Created December 14, 2012 16:44 — forked from edsu/rewrite.py
#!/usr/bin/env python
"""
A silly script to write a git filter-branch command to rewrite
various email addresses to be ALL OFFICIAL AND STUFF.
usage
=====
./rewrite.py > rewrite.sh
@acdha
acdha / random-lyrics.py
Created September 10, 2012 21:39 — forked from clarkware/lyrics.rb
Random Lyrics (Python3 port)
#!/usr/bin/env python3
# Based on https://gist.github.com/3693483, converted to Python 3 for a zero-install experience
# API Documentation at http://api.wikia.com/wiki/LyricWiki_API
from urllib.parse import urlencode
from urllib.request import urlopen
import json
import random
import sys
@acdha
acdha / alt-user-agents.txt
Created May 2, 2012 18:52 — forked from edsu/bots.py
Report the percentage of your site traffic generated by robots
'Mozilla/5.0 (compatible; BMC/1.0 (Y!J-AGENT))'
(compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR ; http://www.talktalk.co.uk/products/virus-alerts/)
(TalkTalk Virus Alerts Scanning Engine)
*/Nutch-0.9
*/Nutch-1.0
*/Nutch-1.0 (*; *; *)
*/Nutch-1.2
+http://hilfe.acont.de/bot.html ACONTBOT
-
- (larbin2.6.3@unspecified.mail)
@acdha
acdha / simple.vcl
Created April 12, 2012 15:38
Basic Varnish configuration
backend default {
.host = ".......";
.port = "8080";
.connect_timeout = 15s;
.first_byte_timeout = 120s;
.between_bytes_timeout = 120s;
}
sub vcl_fetch {
set beresp.grace = 1h;
@acdha
acdha / snip.py
Created August 31, 2011 13:38 — forked from edsu/snip.py
class EssayAdmin(VersionAdmin, ManyToManyAdmin):
form = EssayForm
# helper to put LCCNs mentioned in an essay into the list display
def lccns(obj):
links = []
for title in obj.subjects.all():
a = '<a href="http://chroniclingamerica.loc.gov/lccn/%s>%s</a>' % (title.lccn, title.lccn)
links.append(a)
return mark_safe(', '.join(links))
@acdha
acdha / srbee.py
Created February 16, 2011 19:51 — forked from edsu/srbee.py
from cts.srb import ServiceRequest, ServiceRequestList
from cts.client import get_http_client
http = get_http_client(endpoint=settings.CTS)
http.add_credentials(settings.CTS_USER, settings.CTS_PASSWORD)
try:
task = ServiceRequest.accept_next_from_queue(queue="sampler",
serviceType="bag.QualityReviewBag.review",
http=http)
@acdha
acdha / srbee.py
Created February 16, 2011 19:51 — forked from edsu/srbee.py
from cts.srb import ServiceRequest, ServiceRequestList
from cts.client import get_http_client
http = get_http_client(endpoint=settings.CTS)
http.add_credentials(settings.CTS_USER, settings.CTS_PASSWORD)
task = ServiceRequest.accept_next_from_queue(queue="sampler",
serviceType="bag.QualityReviewBag.review",
http=http)
print task
@acdha
acdha / pip.conf
Created March 16, 2010 17:23 — forked from jezdez/pip.conf
Fork of jezdez' pip.conf with PyPI mirrors and enforced virtualenv use
[global]
default-timeout = 60
require-virtualenv = true
download-cache = /tmp
log-file = /tmp/pip-log.txt
[install]
find-links =
http://pypi.python.org
http://pypi.pinaxproject.com