Skip to content

Instantly share code, notes, and snippets.

View jemerick's full-sized avatar

Jason Emerick jemerick

View GitHub Profile
"""
Some simple utilities to read the magic bytes from the beginning of a
file and determine whether the file meets certain criteria (e.g., contains
JPEG image data).
"""
import array
from operator import eq
IMAGE_MAGIC_DATA = (
======================================================
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10
======================================================
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu
8.10. The article is targeted at a production environment, but keep in mind
this is a more generalized environment. You may have different requirements,
but this article should at least provide the stepping stones.
The article will use distribution packages where nesscary. As of 8.10 the
# In-memory Cassandra-ish thingy... useful for unit tests. Maybe useful for other
# stuff too? No support for SuperColumns, but that should be easy enough to add.
import bisect
import copy
from cassandra.ttypes import NotFoundException, Column, ColumnPath, ColumnOrSuperColumn
class SSTable(object):
# Load custom template tags in all templates
# Custom template tags that you use all over your templates can be auto loaded. Just add the following in a module that is # loaded (i.e. your urlconf if you want the template tags to be loaded for the whole project)
from django import template
template.add_to_builtins('project.app.templatetags.custom_tag_module')
# relative paths
import os.path
TEMPLATE_DIRS = (
int mh = CodeModuleManager.getModuleHandle("GoogleMaps");
if (mh == 0) {
throw new ApplicationManagerException("GoogleMaps isn't installed");
}
URLEncodedPostData uepd = new URLEncodedPostData(null, false);
uepd.append("action","LOCN");
uepd.append("a", "@latlon:"+l.getLatitude()+","+l.getLongitude());
uepd.append("title", l.getName());
uepd.append("description", l.getDescription());
String[] args = { "http://gmm/x?"+uepd.toString() };
@jemerick
jemerick / spritzer.py
Created June 9, 2009 00:30
spritzer sample code
import urllib2
import base64
import threading
import Queue
import simplejson as json
from datetime import datetime
from dateutil import parser
# authentication stuff
username = 'username'
package org.hamberry.util;
import net.rim.device.api.servicebook.ServiceBook;
import net.rim.device.api.servicebook.ServiceRecord;
import net.rim.device.api.system.DeviceInfo;
import net.rim.device.api.system.EventLogger;
public class NetworkConfig
{
private static Logger log = Logger.getInstance();