annotate bin/colorize @ 2337:2deb4597f9c9

<oerjan> sed -i \'6ap=list(re.sub(\'C+\',\'C\',\'\'.join(p)))\' bin/colorize
author HackBot
date Fri, 01 Mar 2013 03:36:40 +0000
parents 16603a34c6d2
children a9994b1ad4ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2335
16603a34c6d2 <oerjan> cat colorize.2 >bin/colorize
HackBot
parents: 2253
diff changeset
1 #!/usr/bin/env python
16603a34c6d2 <oerjan> cat colorize.2 >bin/colorize
HackBot
parents: 2253
diff changeset
2 import random
16603a34c6d2 <oerjan> cat colorize.2 >bin/colorize
HackBot
parents: 2253
diff changeset
3 import re
16603a34c6d2 <oerjan> cat colorize.2 >bin/colorize
HackBot
parents: 2253
diff changeset
4 w=raw_input()
16603a34c6d2 <oerjan> cat colorize.2 >bin/colorize
HackBot
parents: 2253
diff changeset
5 p=list('x'*len(w)+'C'*int((341-len(w))/3+1))
16603a34c6d2 <oerjan> cat colorize.2 >bin/colorize
HackBot
parents: 2253
diff changeset
6 random.shuffle(p)
2337
2deb4597f9c9 <oerjan> sed -i \'6ap=list(re.sub(\'C+\',\'C\',\'\'.join(p)))\' bin/colorize
HackBot
parents: 2335
diff changeset
7 p=list(re.sub(C+,C,.join(p)))
2335
16603a34c6d2 <oerjan> cat colorize.2 >bin/colorize
HackBot
parents: 2253
diff changeset
8 i=(c for c in w)
16603a34c6d2 <oerjan> cat colorize.2 >bin/colorize
HackBot
parents: 2253
diff changeset
9 print ''.join(i.next() if c=='x' else chr(3)+'%02d' % random.randrange(2,15) for c in ['C']+p)