Skip to content

Instantly share code, notes, and snippets.

@mhubig
Created August 19, 2013 16:07
Show Gist options
  • Save mhubig/6270823 to your computer and use it in GitHub Desktop.
Save mhubig/6270823 to your computer and use it in GitHub Desktop.
<span id="e116142240">[javascript protected email address]</span>
<script type="text/javascript">
var a="gqMjyw7lZCaKk6p0J3uAUYS1.dbIW2hXzDHmiVNotOPRe_Ev@c4Gs58+LBr-F9QTfxn";
var b=a.split("").sort().join("");
var c="F_-F6F_-FMe_";
var d="";
for(var e=0;e<c.length;e++)
d+=b.charAt(a.indexOf(c.charAt(e)));
document
.getElementById("e116142240")
.innerHTML="<a href=\"mailto:"+d+"\">"+d+"</a>";
</script>
<p><span id="e49237979">[javascript protected email address]</span>
<script type="text/javascript">
var a="[email protected]_s+H0N5E3naUWvfcyJ7oqBDO";
var b=a.split("").sort().join("");
var c="J+yJ4J+yJ@s+";
var d="";
for(var e=0;e<c.length;e++)
d+=b.charAt(a.indexOf(c.charAt(e)));
document
.getElementById("e49237979")
.innerHTML="<a href=\\"mailto:"+d+"\\">"+d+"</a>";
</script></p>
<p><span id="e186227798">[javascript protected email address]</span></p>
<script type="text/javascript">
var a="[email protected]+RzqLT_WyhKOZsGEY9pjB";
var b=a.split("").sort().join("");
var c="GCsGwGCsGM.C";
var d="";
for(var e=0;e<c.length;e++)
d+=b.charAt(a.indexOf(c.charAt(e)));
document
.getElementById("e186227798")
.innerHTML="<a href=\"mailto:"+d+"\">"+d+"</a>";
</script>
import markdown2
import markdown
import textwrap
import random
def protectfilter2(email):
character_set = (u"+-.0123456789@ABCDEFGHIJKLMNOPQRST"
"UVWXYZ_abcdefghijklmnopqrstuvwxyz")
# temp list, needed to shuffle
_list = list(character_set)
random.shuffle(_list)
key = ''.join(_list)
tag = 'e' + str(random.randrange(1, 999999999))
cipher = ''.join([key[character_set.find(char)] for char in email])
script = u'''\
<span id="{tag}">[javascript protected email address]</span>
<script type="text/javascript">
var a="{key}";
var b=a.split("").sort().join("");
var c="{cipher}";
var d="";
for(var e=0;e<c.length;e++)
d+=b.charAt(a.indexOf(c.charAt(e)));
document
.getElementById("{tag}")
.innerHTML="<a href=\\"mailto:"+d+"\\">"+d+"</a>";
</script>'''.format(tag=tag, key=key, cipher=cipher)
return textwrap.dedent(script)
print protectfilter2('[email protected]')
print markdown.markdown(protectfilter2('[email protected]'))
print markdown2.markdown(protectfilter2('[email protected]'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment