martes, junio 01, 2010

El comic perdido de XKCD


Dibujado por el mismo Randall Munroe, creador de XKCD. Acá está el post original de donde lo saqué.

jueves, abril 22, 2010

acelerando firefox/iceweasel

Despues de un tiempo firefox/iceweasel empiezan a andar muy lento. Ejecutando este comando vuelvo todo a la normalidad:

for f in $(find ~/.mozilla -iname '*.sqlite' -print); do sqlite3 $f "vacuum;"; done

Solo funciona en Linux teniendo instalado el paquete sqlite3. No se como hacerlo en Windows ya que no tengo uno a mano ahora.

viernes, abril 09, 2010

python: 70's

Para cerrarlo apretar Control-C en la terminal.

import pygame,math,itertools,random
for x in itertools.chain(itertools.islice(itertools.imap(lambda x: x(), [lambda: pygame.init(), lambda: pygame.display.set_mode((320,240))]),2,2), itertools.count()): (pygame.draw.circle(pygame.display.get_surface(),(random.randint(0,255),random.randint(0,255),random.randint(0,255)),(160,120),x%200+2,1), [pygame.display.get_surface().set_at((random.randint(0,319),random.randint(0,239)), (random.randint(0,255),random.randint(0,255),random.randint(0,255))) for y in xrange(1000)], pygame.display.flip()) and None

jueves, abril 08, 2010

creativo

Si no estas dispuesto a equivocarte, nunca vas a ser creativo.
Ken Robinson

python: wave or wave

import itertools, math, time
for x in itertools.count(0): print "".join([time.sleep(0.003)][0:0] + [y in [int(math.cos(x*3.14/(50 + 25*math.cos((x/50.0)*3.14/50)))*37 + 37), int(math.sin(x*3.14/(50 + 25*math.sin((x/50.0)*3.14/50)))*37 + 37)] and '#' or ' ' for y in xrange(75)])

miércoles, abril 07, 2010

python: wave

import itertools, math, time
for x in itertools.count(0): print "".join([time.sleep(0.005)][0:0] + [int(math.sin(x*3.14/(50))*37 + 37) == y and '#' or ' ' for y in xrange(75)])

martes, abril 06, 2010

python: 60's

import itertools,math,time
for z,w in itertools.imap(lambda x: (x % 12, (x / 12) % 5), itertools.count(0)): print ''.join(map(lambda x: x, ["\n".join([''.join([(math.hypot(x-10,y-10) < z and (math.hypot(x-10,y-10) > z/2 and '#$%&!'[w] or ' @'[(z/2)%2]) or ('.,:;+'[z%5])) for x in xrange(21)]) for y in xrange(21)]), time.sleep(0.05) or '']))

lunes, abril 05, 2010

python: ping pong

[actualizado] en una sola linea:

while 1: print str('d' not in globals() and globals().__setitem__('d', [__import__('random').randint(1,8),6,1,1]))[0:0] + "\n".join(['-'*12] + ['|' + ''.join([((x,y) == (d[0], d[1])) and '#' or ' ' for x in xrange(10)]) + '|' for y in xrange(10)] + ['-'*12]) + str((lambda: (d.__setitem__(0, d[0]+d[2]), d.__setitem__(1, d[1]+d[3]), d[0] not in range(1,9) and d.__setitem__(2, d[2] * -1), d[1] not in range(1,9) and d.__setitem__(3, d[3] * -1)))())[0:0] + str(__import__('time').sleep(0.2))[0:0]

domingo, abril 04, 2010

python: otra silueta

print "\n".join(["|" + "".join([int(10*(((x-10)**2)/float(10**2) + ((y-10)**2)/float(10**2))) in [10,11] and '#' or (((y == 10) and (x in range(3,18))) and '66656c696365732070617363756173'.decode('hex')[x-3] or ' ') for x in xrange(21)]) + "|" for y in xrange(21)])

python: silueta

import math;print "\n".join([''.join([int(math.cos(x * 3.14 / 19) * 5 + 2) == (y -2) and (abs(math.sin(x * 3.14 / 19)) < 0.05 and '*' or '#') or ' ' for x in xrange(78)]) for y in xrange(11)])