Skip to content

Instantly share code, notes, and snippets.

View shabda's full-sized avatar

Shabda Raaj shabda

View GitHub Profile
@shabda
shabda / .json
Last active September 2, 2015 12:25 — forked from kyogesh/.json
[{"bin":"0-2","grad_percentage_total":0,"grad_percentage_other_college":0,"n_total_students":0,"n_grad_this_college":0,"n_grad_this_major":0,"grad_percentage_this_major":0,"n_grad_other_college":0,"bin_sort_order":0,"n_grad_institution_wide":0,"n_grad_total":0,"grad_percentage_diff_between_total_and_institution":0,"grad_percentage_institution_wide":0,"grad_percentage_this_college":0},{"bin":"3-5","grad_percentage_total":0,"grad_percentage_other_college":0,"n_total_students":0,"n_grad_this_college":0,"n_grad_this_major":0,"grad_percentage_this_major":0,"n_grad_other_college":0,"bin_sort_order":1,"n_grad_institution_wide":5,"n_grad_total":0,"grad_percentage_diff_between_total_and_institution":0,"grad_percentage_institution_wide":0,"grad_percentage_this_college":0},{"bin":"6-8","grad_percentage_total":0,"grad_percentage_other_college":0,"n_total_students":0,"n_grad_this_college":0,"n_grad_this_major":0,"grad_percentage_this_major":0,"n_grad_other_college":0,"bin_sort_order":2,"n_grad_institution_wide":12,"n_grad
import functools
h = 100
b = range
r = functools.partial(b, 0)
yz = lambda y, z: dict(zip(r(h, y), [z]*h))
a = dict(zip(b(100), b(100)))
a.update(yz(3, "F"))
a.update(yz(5, "B"))
a.update(yz(15, "FB"))
print a.values()[1:]
path = "./" #Override this
dropbox_dirs = set([el[:10] for el in os.listdir(".")
if os.path.join(path, el) and not el.startswith(".")])
for el in dropbox_dirs:
if not os.path.exists(os.path.join(path, el)):
os.mkdir(os.path.join(path, el))
os.system("mv %s*.* %s"%(os.path.join(path, el), os.path.join(path, el)))
@shabda
shabda / gist:5317134
Last active December 15, 2015 20:18
import random
import string
def random_word_from_seed(seed, len):
random.seed(seed)
letters = string.ascii_lowercase
return ''.join([random.choice(letters) for i in range(len)])
print random_word_from_seed(1944062, 5) +" "+random_word_from_seed(2068527, 5)
{
"metadata": {
"name": "Versioning"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@shabda
shabda / binsearch.py
Created November 24, 2012 11:07 — forked from akshar-raaj/binsearch
Binary Search
not_found = -1
import unittest
class TestBinS(unittest.TestCase):
def test_empty(self):
lst = []
key = 0
self.assertEquals(binsearch(lst, 0,), -1)
def test_equal(self):
lst = [10, 10, 10, 10]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'bpcle.db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
'TEST NAME':'test_database.sqlite',
}
$.fn.toggleStuff = ->
$this = $(this)
anchorCss =
position: 'fixed'
top: '30px'
right: '10px'
'z-index': '999'
'font-size': '30px'
'font-weight': 'bold'
'text-decoration': 'none'
@shabda
shabda / default.coffee
Created December 12, 2011 09:07 — forked from dheerosaur/default.js
Hiding stuff, go directly to "My active tickets" in unfuddle
// Reusable extension for jQuery so that we can hide jQuery objects
// and hide them. We will show an arrow at the top-right corner which
// will toggle the display of these.
// Examples:
//
// For github.com.js:
// $("#header").toggleStuff();
//
// Some random site:
// $("#report_attachment").parent().next().toggleStuff()
shabda@jazzy ~> python repopular_project.py
set(['http://github.com/Sutto/barista', 'http://github.com/alunny/sleight', 'http://github.com/pypy/pypy', 'http://github.com/jacksonh/manos-spark', 'http://github.com/dysinger/apparatus', 'http://github.com/Yelp/mrjob', 'http://github.com/videlalvaro/Thumper'])
shabda@jazzy ~>