Skip to content

Instantly share code, notes, and snippets.

Utkarsh Upadhyay musically-ut

Block or report user

Report or block musically-ut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rickshaw-node.js
function classListShim(view) {
"use strict";
if (!('HTMLElement' in view) && !('Element' in view)) return;
var
classListProp = "classList"
, protoProp = "prototype"
, elemCtrProto = (view.HTMLElement || view.Element)[protoProp]
View keybase.md

Keybase proof

I hereby claim:

  • I am musically-ut on github.
  • I am musicallyut (https://keybase.io/musicallyut) on keybase.
  • I have a public key whose fingerprint is 8709 ADBA 5F02 32DF 0378 6521 88FC 244A C09F F3C1

To claim this, I am signing this object:

@musically-ut
musically-ut / collective-deck-import.py
Created Mar 4, 2015
Process raw Wikipedia data and create Anki deck for collective nouns
View collective-deck-import.py
import sys
import csv
###################################################################
# Handling inputs
###################################################################
def getInput(csvFileName):
with file(csvFileName) as f:
reader = csv.DictReader(f, fieldnames=['Subject', 'CollectiveNoun', 'Notes', 'Source'])
@musically-ut
musically-ut / adverts.jl
Last active Aug 29, 2015
Simulation designed for solving "Mining Massive Datasets MOOC@Coursera" exercise
View adverts.jl
typealias Slot Int
typealias Bidder Int
immutable BidderRoundData
numSlots :: Int
ctr :: Dict{(Bidder, Slot), Float64}
bids :: Vector{Float64}
budgets :: Vector{Float64}
clickThroughs :: Int
end
@musically-ut
musically-ut / set-cover.py
Created Mar 18, 2015
Implementation of various approximation algorithms for set cover problem.
View set-cover.py
# There are many greedy algorithms that could be used to pick a collection of sets that is close to as small as possible. Here are some that you will consider in this problem.
def isCovered(cover, allElems):
coverElems = set()
for s in cover:
coverElems.update(s)
return len(coverElems) == len(allElems)
def getAllElems(sets):
elems = set()
@musically-ut
musically-ut / notes.txt
Created Apr 28, 2015
Anki slides import example notes.
View notes.txt
Slide 3:
What percentage of Indians are vegetarians?
Why are they vegetarian?
Slide 4:
What are the things that a lacto-vegetarian can eat?
Slide 6:
What does veg lunch in New Delhi look like?
View gist:1301261
try:
(r, w, e) = zmq.select([in_hb, in_cmd], [], [], timeout=end_time - time.time())
for sock in r:
msg = sock.recv()
# ...
if sock == in_cmd:
print '[monitor] Order to execute'
all_is_well = False
View gist:1301233
retcode = p.poll() # Check on the application
if retcode is not None: # The application exited
break
View gist:1301248
end_time = time.time() + 2 * g_TO
all_is_well = True
missed_TO = 0
while True:
try:
(r, w, e) = zmq.select([in_hb, in_cmd], [], [], timeout=end_time - time.time())
for sock in r:
msg = sock.recv()
@musically-ut
musically-ut / lolprogram_reliable.py
Created Oct 21, 2011
Restarting 'lolprogram' on restarts (by Nirbheek)
View lolprogram_reliable.py
retcode = 1
while retcode:
retcode = subprocess.call(["lolprogram", "arg1", "arg2"])
print("Exiting with return code 0")
You can’t perform that action at this time.