Skip to content

Instantly share code, notes, and snippets.

View treyhunner's full-sized avatar
🐍
💖

Trey Hunner treyhunner

🐍
💖
View GitHub Profile
@treyhunner
treyhunner / approach 1: hal with _embedded.json
Created February 18, 2012 02:19
Embedding links in HAL+JSON
{
"queue_status": "running",
"_embedded": {
"jobs": [
{
"_links": {
"self": { "href": "/queue/job1" },
}
"status": "queued"
},
@treyhunner
treyhunner / remove sopa overlay.js
Created January 18, 2012 06:02
Bookmarklet to Temporarily remove SOPA overlay from Wikipedia page
javascript:(function(){$('body').children('[id^=mw], #content, #footer').show().filter('#mw-sopaOverlay').hide();})()
@treyhunner
treyhunner / pycco pull request 45 error
Created January 2, 2012 18:48
Error caused by running `pycco *.py -a -p` on main pycco directory with code from pull request 45.
bender:pycco(laginha|…)% pycco *.py -a -p
pycco = setup.py -> docs/docs/./setup.html
pycco = test.py -> docs/docs/./test.html
Traceback (most recent call last):
File "/usr/local/bin/pycco", line 9, in <module>
load_entry_point('Pycco==0.2.0', 'console_scripts', 'pycco')()
File "/usr/local/lib/python2.6/dist-packages/Pycco-0.2.0-py2.6.egg/pycco/main.py", line 508, in main
@treyhunner
treyhunner / catalina.out
Created March 31, 2011 19:12
tomcat log and haystack-generated solr schema.xml
Mar 31, 2011 12:15:22 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/server:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-6-openjdk/jre/../lib/i386:/usr/java/packages/lib/i386:/usr/lib/jni:/lib:/usr/lib
Mar 31, 2011 12:15:22 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Mar 31, 2011 12:15:22 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 549 ms
Mar 31, 2011 12:15:22 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 31, 2011 12:15:22 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
@treyhunner
treyhunner / screenshot.sh
Created March 29, 2011 14:59
Grab a screenshot, give it a public dropbox URL, shorten the URL, and copy it to the clipboard
#!/bin/sh
# Ubuntu-specific modification of http://wiki.dropbox.com/TipsAndTricks/ShareScreenshots
# Change these
DB_USER_ID=YOURDBUSERID
BITLY_USERNAME=YOURBITLYUSERNAME
BITLY_API_KEY=YOURBITLYKEYHERE
DROPBOX_PUBLIC_DIR=~/Dropbox/Public
SCREENSHOT_DIR=screenshots
@treyhunner
treyhunner / models.py
Created December 10, 2010 06:16
Encrypt and decrypt Django model primary key values (useful for publicly viewable unique identifiers)
# This code is under the MIT license.
# Inspired by this StackOverflow question:
http://stackoverflow.com/questions/3295405/creating-django-objects-with-a-random-primary-key
import struct
from Crypto.Cipher import DES
from django.db import models
def base36encode(number):