Skip to content

Instantly share code, notes, and snippets.

View vinu76jsr's full-sized avatar

Vaibhav Mishra vinu76jsr

  • Visible Alpha
  • Delhi
View GitHub Profile
@vinu76jsr
vinu76jsr / anagram.py
Created August 26, 2012 02:21
A model for restaurent
"""
"""
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')]
@vinu76jsr
vinu76jsr / move_mp3.py
Created January 24, 2014 09:30
A Python script to move mp3 files from one directory to a flat structure in another directory, Uses path.py module
"""
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
# 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)
@vinu76jsr
vinu76jsr / 0_reuse_code.js
Last active September 8, 2015 20:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console