Skip to content

Instantly share code, notes, and snippets.

@pixyj
pixyj / django_log_sql.py
Created October 28, 2012 04:09
Log Sql queries in Django
#To get all sql queries sent by Django from py shell
import logging
l = logging.getLogger('django.db.backends')
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler())
#For more info, http://stackoverflow.com/questions/971667/django-orm-how-to-view-or-log-the-executed-query
@pixyj
pixyj / django_one_step.sh
Created October 27, 2012 10:11
Script to create django project with virtualenv
#!/bin/bash
#Take project name as input
if [ -z "$1" ]
then
echo "Enter project name"
read proj
else
proj="$1"
fi
@pixyj
pixyj / tree.py
Created October 6, 2012 16:06
Analysis of Binary Search Tree Insertion Time
class Node:
def __init__(self,val,parent=None):
self.val = val
self.parent = parent
self.left = None
self.right = None
def setLeft(self,node):
self.left = node