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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
# get all the unmanaged models | |
from django.db import connection | |
tables = connection.introspection.table_names() | |
seen_models = connection.introspection.installed_models(tables) | |
managed_tables = set([m._meta.db_table for m in seen_models]) | |
extra_tables = set(tables) - managed_tables | |
cursor = connection.cursor() | |
for table in extra_tables: | |
try: | |
cursor.execute('DROP TABLE %s' % table) |
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
""" | |
A Python script to move mp3 files from one directory to a | |
flat structure in another directory | |
Uses path.py module | |
""" | |
import os | |
from path import path | |
DIRECTORY = '/Users/vaibhav/Desktop/msc' # music source Directory |
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
""" | |
""" | |
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101] | |
def _hash(s): | |
sum = 0 | |
for c in s: | |
sum+=prime[ord(c)-ord('a')] |