Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Staying home

Chris Adams acdha

🏡
Staying home
View GitHub Profile
@acdha
acdha / baseline.txt
Last active Apr 28, 2018 — forked from jmcnamara/bench_excel_writers.py
Benchmark of several Python Excel writing modules
View baseline.txt
Versions:
python : 2.7.1
openpyxl : 2.2.5
pyexcelerate: 0.6.6
xlsxwriter : 0.7.3
xlwt : 1.0.0
Dimensions:
Rows = 10000
View 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 Sep 10, 2012 — forked from clarkware/lyrics.rb
Random Lyrics (Python3 port)
View random-lyrics.py
#!/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 — forked from edsu/bots.py
Report the percentage of your site traffic generated by robots
View alt-user-agents.txt
'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 Apr 12, 2012
Basic Varnish configuration
View simple.vcl
backend default {
.host = ".......";
.port = "8080";
.connect_timeout = 15s;
.first_byte_timeout = 120s;
.between_bytes_timeout = 120s;
}
sub vcl_fetch {
set beresp.grace = 1h;
View 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))
View 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)
View 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 Mar 16, 2010 — forked from jezdez/pip.conf
Fork of jezdez' pip.conf with PyPI mirrors and enforced virtualenv use
View pip.conf
[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