I hereby claim:
- I am mmatuson on github.
- I am mmatuson (https://keybase.io/mmatuson) on keybase.
- I have a public key ASBZi77yCbURxNmQbo0w6KF9_kM-qicWp1YfB2ZZdF9Y-Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import re | |
email_regexp = re.compile( r'(?P<email>[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6})', re.I ) | |
def auto_link(s=''): | |
"""auto hyperlink email addresses in a string""" | |
try: | |
s = email_regexp.sub(r'<a href="mailto:\g<email>">\g<email>', s) | |
except re.error: | |
pass |
""" | |
Instead of using a variable-time algorithm for comparing secrets, | |
you should be using constant-time algorithms. | |
via http://codahale.com/a-lesson-in-timing-attacks/ | |
""" | |
def is_equal(a, b): | |
if len(a) != len(b): | |
return False; | |
/** | |
* Dynamically get the path for any script in an HTML document. | |
*/ | |
var script_path = function(jsfile) | |
{ | |
var src, path, scripts, re, i; | |
scripts = document.getElementsByTagName("script"); | |
for (i = 0; i < scripts.length; i++) | |
{ |
class OrderedDict(dict): | |
""" | |
A simple dictionary that retains order in which the elements were added when you iterate over it | |
""" | |
def __init__(self): | |
self._list = [] | |
self._current = 0 | |
super(OrderedDict,self).__init__() | |
def __setitem__(self, item, value): |
""" | |
increment a file name | |
""" | |
import os | |
import re | |
import glob | |
#regex to find the counter in a filename | |
RE_FILE_COUNTER = re.compile("\_(?P<i>[0-9]+)\.") |