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
class Node: | |
def __init__(self, key, data = None): | |
self.left = None | |
self.right = None | |
self.bal = 0 | |
self.key = key | |
self.data = [] | |
if data: self.data.append(data) |
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
import sys, pyPdf | |
def addPage(opdf, ipdf, pg): | |
if pg>=len(pages): | |
opdf.addBlankPage(w, h) | |
else: | |
opdf.addPage(ipdf.getPage(pages[pg])) | |
try: | |
args = sys.argv[1:] |
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
// ==UserScript== | |
// @name Mobile FB Photo Tag Removal | |
// @namespace http://your.homepage/ | |
// @version 3.0 | |
// @description Remove photo tags using the FB Mobile Interface | |
// @author Metta Ong | |
// @match https://m.facebook.com/photo.php?* | |
// @grant none | |
// @run-at document-end | |
// ==/UserScript== |
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
import web | |
### Standard URL handling | |
urls = [ | |
'/', 'Index', | |
'k', 'Kill' | |
] | |
app = web.application(urls, globals()) | |
# Store the session someplace we can access from anywhere |
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
"""MangaReader downloader. | |
Usage: | |
dw.py <manga> [<chapter>] [<page>] | |
Options: | |
-h --help Show this screen | |
--version Show version | |
""" |
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
T = input() | |
grps = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
for t in range(T): | |
N = input() | |
P = map(int, raw_input().split()) | |
plans = [] | |
while sum(P)>0: | |
idx = P.index(max(P)) | |
P[idx] -= 1 |
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
T = input() | |
for t in range(T): | |
B, M = map(int, raw_input().split()) | |
fixed = [] | |
if M>2**(B-2): | |
print 'Case #%d: IMPOSSIBLE'%(t+1) | |
else: | |
config = bin(M-1)[2:] | |
if B==2: config='' |
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
T = input() | |
for t in range(T): | |
J, P, S, K = map(int, raw_input().split()) | |
poss = [] | |
for j in range(1, J+1): | |
for p in range(1, P+1): | |
if K>=S: | |
for s in range(1, S+1): poss.append('%d %d %d'%(j, p, s)) | |
else: |
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
import sqlite3 | |
def encode(string): | |
return string.encode("ascii", "xmlcharrefreplace") | |
def importData(db): | |
conn = sqlite3.connect(db) | |
cur = conn.cursor() | |
sep=unichr(183); br="\\n" |
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
.highlight { background: #1e2426; color: #babdb6} | |
.highlight .hll { background-color: #ffffcc } | |
.highlight .c { color: #656763} /* Comment */ | |
.highlight .err { color: #babdb6} /* Error */ | |
.highlight .g { color: #babdb6} /* Generic */ | |
.highlight .k { color: #729fcf} /* Keyword */ | |
.highlight .l { color: #babdb6} /* Literal */ | |
.highlight .n { color: #babdb6} /* Name */ | |
.highlight .o { color: #babdb6} /* Operator */ | |
.highlight .x { color: #babdb6} /* Other */ |
OlderNewer