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 inspect | |
import pygraphviz as pgv | |
from django.conf import settings; settings.configure() | |
from django.views import generic | |
class GenericViewGraph(pgv.AGraph): | |
_ignore_types = (None, object) | |
def __init__(self, *args, **kwargs): |
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 django.db import models | |
from django.db.models import signals | |
class DeletingFileField(models.FileField): | |
""" | |
FileField subclass that deletes the refernced file when the model object | |
itself is deleted. | |
WARNING: Be careful using this class - it can cause data loss! This class | |
makes at attempt to see if the file's referenced elsewhere, but it can get |
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
sudo apt-get update | |
sudo apt-get install python-dev python-software-properties | |
sudo add-apt-repository ppa:pitti/postgresql | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update |
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
#http://blog.carduner.net/2010/05/26/authenticating-with-facebook-on-the-command-line-using-python/ | |
#!/usr/bin/python2.6 | |
import os.path | |
import json | |
import urllib2 | |
import urllib | |
import urlparse | |
import BaseHTTPServer | |
import webbrowser |
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 urllib | |
from django.http import HttpResponseRedirect | |
from django.conf import settings | |
from django.contrib.auth import login as auth_login | |
from django.contrib.auth import authenticate | |
from django.core.urlresolvers import reverse | |
# Step 1. when facebook login is clicked, this function is hit | |
# Things to know: we have an app_id and app_secret from facebook for out app / site |
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
#vi .ssh/config | |
# add the following, you can repeat the pattern for each of your hosts | |
Host web1 | |
HostName 192.168.15.129 | |
User val | |
Port 22 |
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 | |
/Library/Application\ Support/VMware\ Fusion/vmrun -T fusion start /Users/val/Documents/Virtual\ Machines.localized/db1.vmwarevm/db1.vmx nogui |
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
try: | |
import cPickle as pickle | |
except: | |
import pickle | |
import pprint | |
data1 = [ { 'a':'A', 'b':2, 'c':3.0 } ] | |
print 'BEFORE:', | |
pprint.pprint(data1) |
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
# Example how to add rich editor capabilities to your models in admin. | |
from django.contrib.admin import site, ModelAdmin | |
import models | |
# we define our resources to add to admin pages | |
class CommonMedia: | |
js = ( | |
'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js', |
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
To display the status of indexing | |
# mdutil -s / | |
To clear the metadata store | |
Turn indexing off for / | |
# mdutil -i off / | |
Clear the metadata store for / | |
# mdutil -E / | |
Turn indexing back on for / | |
# mdutil -i on / |