Public snipts »
spider's
snipts
showing 1-15 of 15 snipts
-
∞ researchr
a, a:visited, a:active { color : #009; } h2 { font-size : 120%; line-height: 1.4em; margin-bottom : 1em; margin-top : 1em; font-weight : bold; text-transform: uppercase; color: #900; }
-
∞ mi3ch
Problem: _ _ _ _|_|_| |_|_|_| Solutions: _ _ _ _ _ _| _| _ _|_| | |_|_|_|_| |_|_|_ _| _ _ _ _ _ _ _| _|_| _|_| |_| |_|_|_| |_|_ _| -
∞ listings
\usepackage{float} \usepackage{tocloft} \newcommand{\listofsnippetname}{List of Listings} \newlistof{snippet}{lol}{\listofsnippetname} \floatstyle{boxed} \newfloat{snippet}{thp}{lol}[chapter] \floatname{snippet}{Listing} \newcommand{\snippetautorefname}{Listing} \renewcommand{\thesnippet}{\thechapter.\arabic{snippet}}
-
∞ dreampy6
DSL.Wrapper(bgffile).open('r').readlines().join('').strip()(lambda x:'<list>'+x+'</list>')(lambda x:ET.XML(x)).findall('*')
-
∞ dreampy5
bgffile.open('r').readlines().join('').strip().complete().parseXML().findall('*').copySubElement(rr)
-
∞ realpy3
for r in ET.XML('<list>'+''.join(open(bgffile,'r').readlines()).strip()+'</list>').findall('*'): x = ET.SubElement(rr,'root') x.text = r.text
-
∞ dreampy4
a = [(True,'x',20),(False,'y',3),(False,'z',-1)] if (_,n,_) in a: print 'Match!'
-
∞ dreampy3
a = [('x',20),('y',3),('z',-1)] if (n,_) in a: print 'Match!'
-
∞ dreampy2
a = ['x','y','z'] if n in a: print 'Match!'
-
∞ realpy2
def append_(x,y): z = x[:] z.append(y) return z def sort_(x): z = x[:] z.sort() return z
-
∞ realpy1
a.extend(b) a.sort() a.reverse() for i in a: doStuff(i)
-
∞ dreampy1
for i in a.extend(b).sort().reverse(): doStuff(i)
-
∞ beating @twitbrain on Twitter, guaranteed
#!/usr/bin/python import os, sys, urllib from elementtree import ElementTree as et whom = 'http://twitter.com/twitbrain' # whom are we beating email = 'spider.vz@gmail.com' # your email goes here passwd = 'obfuscated' # your password goes here # API recipe taken from http://twitter.com/radkat/status/1783742923 (@radkat via @shellfu) template = 'wget --keep-session-cookies --http-user='+email+' --http-password='+passwd+\ ' --post-data="status=@twitbrain NNN" http://twitter.com:80/statuses/update.xml' # twitbrain rules should've been more intricate replacepairs = ('+',''),('-',''),('*',''),('/',''),(' ',''),\ ('plus','+'),('minus','-'),('times','*') # some twitter html magic (last one is 0 for working mode, 1 for debugging) splitrules = ('<ol class="statuses" id="timeline">',1),('</ol>',0),('</li>',0) # damn you, python, for not being pure FP! def concat(car,cdr): lst = [car]; lst.extend(cdr); return lst if __name__ == "__main__": print 'Beat Twit Brain v 1.00' # started 29 May, 15:21 # finished 29 May, 16:04 # best time to beat @twitbrain: 4 seconds # prooflinks: http://twitter.com/twitbrain/status/1969162641 # http://twitter.com/twitbrain/status/1970038221 # http://twitter.com/twitbrain/status/1973465293 # http://twitter.com/twitbrain/status/1975133562 txt = '' while not txt: print 'Stalking...' txt = et.XML('<ol>'+\ reduce(lambda x,y:x.split(y[0])[y[1]],concat(urllib.urlopen(whom).read(),splitrules))+\ '</li></ol>').findtext('li/span/span') if not txt[0].isdigit(): txt = '' print 'Evaluating...' s = reduce(lambda x,y:apply(x.replace,y),concat(txt,replacepairs)) print s,'=',eval(s) # Stop here if you don't want anything posted!!! #sys.exit(1) print 'Posting...' os.system(template.replace('NNN',str(eval(s)))) print 'Done.' # clean up the update.xml created by wget
-
∞ pp_pp
#!/usr/bin/python import sys # post-processor for pretty-printer if len(sys.argv) > 1: maxLen = int(sys.argv[1]) else: maxLen = 70 mode = 0 for line in sys.stdin: if mode == 1: if line.find('\\end{lstlisting}\\end{graybox}')>-1: mode = 0 lline = line else: tokens = line.split(' ') lline = tokens[0] for token in tokens[1:]: if len(lline + ' ' + token)>maxLen: print lline lline = ' '*16 + token else: lline = lline + ' ' + token print lline, elif mode == 0: if line.find('\\begin{lstlisting}[language=pp]')>-1: mode = 1 print line,
-
∞ xbgfSlice
def main(xbgfFile): xbgfDir = '/'.join(xbgfFile.split('/')[:-1]) if xbgfDir == '': xbgfDir = './' elif xbgfDir[-1]!='/': xbgfDir += '/' print 'Slicing...' sliced = slicing.sliceFile(xbgfDir,xbgfDir,xbgfFile.split('/')[-1].replace('.xbgf','')) return



Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems