Created
August 5, 2013 17:39
-
-
Save tbnorth/6157834 to your computer and use it in GitHub Desktop.
Randomize letters and digits in a Leo (http://leoeditor.com/) subtree, best installed as a @button node.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WARNING - no undo | |
# randomize letters and digits in a subtree to allow sensitive | |
# information to be used in examples of Leo usage (http://leoeditor.com/) | |
from random import sample | |
from string import lowercase, uppercase, digits | |
def blur(s): | |
s = [sample(lowercase, 1)[0] if i in lowercase else | |
sample(uppercase, 1)[0] if i in uppercase else | |
sample(digits, 1)[0] if i in digits else i for i in s] | |
return ''.join(s) | |
for nd in p.self_and_subtree(): | |
nd.h = blur(nd.h) | |
nd.b = blur(nd.b) | |
c.redraw() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment