annotate bin/colorize @ 2339:d693544a0ef5

<oerjan> sed -i "6ap=list(re.sub(\'C+\',\'C\',\'\'.join(p)))" bin/colorize
author HackBot
date Fri, 01 Mar 2013 03:37:10 +0000
parents a9994b1ad4ed
children be90d778a82d
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)
2339
d693544a0ef5 <oerjan> sed -i "6ap=list(re.sub(\'C+\',\'C\',\'\'.join(p)))" bin/colorize
HackBot
parents: 2338
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)