Skip to content

Instantly share code, notes, and snippets.

View bkonkle's full-sized avatar

Brandon Konkle bkonkle

View GitHub Profile
@bkonkle
bkonkle / share-with-google-reader.html
Created February 23, 2010 23:42
A quick snippet demonstrating how I got a "Share with Google Reader" button working on PegasusNews.com. This assumes that you are using jQuery.
<a href="http://www.google.com/reader" id="greader-share">Share with Google Reader</a>
<script type="text.javascript">
$('#greader-share').click(function() {
GR________bookmarklet_domain = 'http://www.google.com';
$.getScript('http://www.google.com/reader/ui/link-bookmarklet.js');
return false;
});
</script>
@bkonkle
bkonkle / collatz.py
Created March 7, 2010 16:24
XKCD inspired me to write a quick Collatz Conjecture script in Python
import random
def main():
start = n = round(random.random() * 100000)
i = 0
while not n == 1:
i += 1
if n % 2:
# The remainder isn't zero, so this evaluates to True
@bkonkle
bkonkle / prefixed.py
Created June 3, 2010 23:00
Jeremy Dunck wrote this cache backend for Pegasus News, and I've been given permission to open-source it. I'm going to create a full Github repository with a setup.py for easy pip install, and I also plan to contribute it to Django. For now though, I'm
import types
from django.conf import settings
from urllib import urlencode
from django.core.cache.backends.base import BaseCache
from django.utils.encoding import smart_str
#future-proofing against any Django upstream additions of new cache methods.
# If we didn't do this, we'd silently use the base class's methods, which wouldn't
# use the prefix as required.
_expected_methods = set(['__contains__', '__init__', 'add', 'close',
@bkonkle
bkonkle / com.danga.memcached.plist
Created June 22, 2010 18:54
On-demand launchd plists for common web development daemons
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.danga.memcached</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/memcached</string>
<string>-u</string>
@bkonkle
bkonkle / django.me.xml
Created May 4, 2011 14:36
Django.me search provider for Firefox
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Django.me</os:ShortName>
<os:Description>Search Django.me</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABWklEQVQ4jaWTvUtCYRSH+5/M24dFQ+q1D2kI2hrTawmB1NISgS4WRktDRYZEU1DQB1RDVBAFTQ1BwYXQGoog0pup1/d9WtQgM2924CzvOe8D55zfr2k6HsXmczaU0/EoTfWa7H43dr+7Zv1XQNtoD1JKhBAomkq+kMc0TRzBfmuA9rFeJCClRNFUhBQA1gDdoUHcE0OUQ9FUOoJeOoPe2iPYNTeL23GeX1/4HoqmkjYyZLIGjmDfz4CFzSUAzKLJ1ukeq/sbFIWoAIQoj1ADoD/eA7Cyu155yxXyX4B6O3gz0gBMLUcaA9yldAB2zg+rAC0BD0LK3wHhxHxlacmnB671G2TpU9f4QKXWOtpT+4wza3PcpXSKoghANvfBbVJnODIGgJF9t6bEZr+LloCnJGcXR1cnAJxdX1iXss3nRNFUDi6PARBSoMUm/wYoeyKciDEyG6o203/t/An332rBvCVygAAAAABJRU5ErkJggg==</os:Image>
<SearchForm>http://django.me/</SearchForm>
<os:Url type="text/html" method="GET" template="http://django.me/{searchTerms}"></os:Url>
</SearchPlugin>
@bkonkle
bkonkle / #oldjobs
Created June 28, 2011 18:00 — forked from gregnewman/#oldjobs
Old Jobs I've had...
Brickmasonry tender
Remodeler's assistant
Grocery cart attendant
Checkout clerk
Department store associate
Department manager
Delivery truck loader
Paint counter clerk/mixer
Bank teller
Financial ops service rep
@bkonkle
bkonkle / createurls.py
Created September 18, 2012 22:00
A script to create urls for Jmeter testing from your Apache access logs.
#!/usr/bin/env python
"""
Requires apachelog. `pip install apachelog`
"""
from __future__ import with_statement
import apachelog
import csv
import re
import sys
from optparse import OptionParser
@bkonkle
bkonkle / Essential Mac Apps.md
Last active December 14, 2015 01:39
This is my list of Mac apps that regularly make my life better.

Essential Mac Apps

@bkonkle
bkonkle / jenkins.sh
Created May 20, 2013 16:29
The Jenkins build script we use on one of our projects.
#!/bin/bash
cd $WORKSPACE
#Get our virtual env setup
virtualenv -q ve
source ./ve/bin/activate
export DJANGO_SETTINGS_MODULE=myproject.conf.jenkins.settings
pip install -q --log=$WORKSPACE/pip.log --exists-action=w -r requirements.pip
from datetime import datetime
from io import BytesIO
try:
from PIL import Image as PILImage
except ImportError:
try:
import Image as PILImage
except ImportError:
raise ImportError("The Python Imaging Library was not found.")