Skip to content

Instantly share code, notes, and snippets.

View jemerick's full-sized avatar

Jason Emerick jemerick

View GitHub Profile
#!/bin/bash
east=1
while [ 1 -eq 1 ]
do
echo "toggle"
if [ $east -eq 1 ] ; then
curl "http://tracks.emerick.org/api/broadcast?token=7d0bc705c04c4c6ebd4cfcc29e18eca5&lat=37.648387&long=-77.619488"
east=0
### Appending URL to SQL query for logging
via http://chris-lamb.co.uk/2010/06/01/appending-request-url-sql-statements-django/
Now your SQL statements look like:
SELECT "auth_user"."id", [..] WHERE "auth_user"."id" = 1 -- /login
This allows you to quickly go from a misbehaving query in your production environment to the view that is executing it.
{
"id": "16231442",
"created": "2008-06-18T01:27:55Z",
"modified": "2008-07-01T00:26:16Z",
"name": "Upper Lofts at Canal Walk",
"source": "js",
"url": "",
"location_id": "",
"tags": [
import os, sys
sys.path.append('/var/django/ihome')
# redirect print statements to the apache log
sys.stdout = sys.stderr
os.environ['DJANGO_SETTINGS_MODULE'] = 'ihome.settings'
import django.core.handlers.wsgi
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# from http://www.last.fm/robots.txt
User-Agent: *
Disallow: /music?
Disallow: /widgets/radio?
Disallow: /show_ads.php
Disallow: /affiliate/
Disallow: /affiliate_redirect.php
Disallow: /affiliate_sendto.php
Environment:
Request Method: GET
Request URL: http://ihomeaudio.biz/iH22LV/
Django Version: 1.2.3
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
@jemerick
jemerick / Folder Preferences
Created October 2, 2011 20:07 — forked from chrisyour/Folder Preferences
Show hidden files and hidden folders (except .git) in your TextMate project drawer
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences.
# Instructions:
# Go to TextMate > Preferences...
# Click Advanced
# Select Folder References
# Replace the following:
# File Pattern
@jemerick
jemerick / json-response.py
Created October 6, 2011 18:11 — forked from leah/json-response.py
JSONResponse classes
import re
import simplejson
from django.http import HttpResponse
from django.conf import settings
class JSONResponse(HttpResponse):
def __init__(self, request, data):
indent = 2 if settings.DEBUG else None
#!/bin/bash
# note: this won't work too well with filenames/directories with spaces in them
compressresource() {
gzip -c9 "$1" > "$1.gz"
touch -c --reference="$1" "$1.gz"
echo "Compressed: $1 > $1.gz"
}