This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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": [ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" | |
} |