View debugger.py
import cProfile, logging, cStringIO, pstats
prof = cProfile.Profile()
score_list = prof.runcall(model.score, scoring_data)
prof.create_stats()
stream = cStringIO.StringIO()
stats = pstats.Stats(prof, stream=stream)
stats.strip_dirs().sort_stats('time').print_stats(20)
#print stream.getvalue()
logging.getLogger().info(stream.getvalue())
View import_mem.py
import gc
import os
import sys
import time
import imp
import ihooks
__PID = os.getpid()
def rss():
#gc.collect()
View gif.py
from struct import pack
from random import sample
dist = lambda a, b: (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2 + (a[2] - b[2]) ** 2
nn = lambda rgb, centers: min((dist(rgb, c), i) for i, c in enumerate(centers))[1]
class GIF(object):
def __init__(self, data, size):
self.size = size
self.data = data
View density.py
from multiprocessing.dummy import Pool
import os
import re
from subprocess import Popen, PIPE
from threading import RLock
DIR = 'go4go'
def parse(fn):
fh = open(fn, 'r')
View mysql_unicode_regex.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
start, end = u'가힝' # Korean
#start, end = u'あゟ' # Japanese
def esc(c):
if c in '[]\\\'\"':
return '\\' + c
return c
View eb.py
exec'i=0;A=.9987;R=range;C=[ord(x)-1\
12for x in"qppp~dp|zpy~pg~pczpadpdap\
|ap~dpzdpztpvupvjprkprppnqpnlpjmpjwp\
fxpfhpzdp~d"];D=lambda x,y:" E"[sum(\
(F4]-y)*(F7]-y)<0and F5]-x>(F5]-F8])\
*(F4]-y)/(F4]-F7])for j in R(22))&1]\
\nwhile 1:\n r=2-i/140%2\n for j in \
R(24):F0],Fr]=F0]*A-Fr]/20,F0]/20+Fr\
]*A\n Z="\\n".join("".join(D(x*.4-20\
,y*.91-20)for x in R(99))for y in R(\
View eb.c
float*F,S=20,C[72]={1},A=.9987,b,d,
x,y;r,i,j;main(s){for(j=23;j--;F[5]
="DZ^^ZDAADDTUJKPQLMWXHDD"[j]-80)4[
F=C+j*3]="^[YGCAD[^ZZVVRRNNJJFFZ^"[
j]-80;for(;puts("\e[2J");usleep(99*
99)){for(j=24;j--;F[r]=y)y=2[F=C+j*
3]/S+A*F[r=++i/4800%2],F[2]=A*F[2]-
F[r]/S;for(y=-S;y<S;y+=.9)for(x=-S,
printf("\e[38;5;%d66m\n",C[2]<0);x<
S;x+=.4,putchar("E "[s%2]))for(s=j=
View synth.pl
$SPS = 16000;
$PI = 3.14159265359;
$PITCH_ROLL = 1;
$BPM = 170;
%FREQS = (
A => 440.000,
B => 493.883,
C => 261.626,
View brainfuck.py
import sys,os;M=[0]*30000;A=[]
p=k=x=0;S=open(sys.argv[1]).read()
while x<len(S):exec"""M[p]+=1
M[p]-=1 M[p]=ord(os.read(0,1)or"\\0")
os.write(1,chr(M[p])) p-=p>0 p+=1
k=A.append(x)if+M[p]else+1 x=A.pop()-1
k+=1 0 k-=1 0""".split()['+-,.<>[][+]+'
.find(S[x]+'+'*(k>0))];M[p]&=255;x+=1
View server.sh
#!/bin/bash
:|((read f g h
[[ -f .$g&&$g != *..* ]]&&echo "$h 200 OK
"&&cat .$g)|nc -lp$1)>/dev/fd/0;$0 $1