This file contains hidden or 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
| #!/usr/bin/env python | |
| class Empty(Exception): | |
| pass | |
| class ArrayStack: | |
| def __init__(self): |
This file contains hidden or 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
| #!/usr/bin/perl -w | |
| =begin | |
| cws2fws v 0.0.1 - Flash format 6+ decompressor | |
| Jose Melo de Assis Fonseca / JMAF | |
| http://zefonseca.com/ | |
| 2008-04-26 | |
| Usage: cws2fws <COMPRESSED_SWF_FILE.swf> |
This file contains hidden or 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
| # input.txt: blastlist format | |
| # https://github.com/jlhg/bdorpy/blob/master/docs/format/blastlist.txt | |
| awk -F'\t' '$1 ~ /^[0-9]/ { print $0 }' input.txt |sort -t$'\t' -k4d,4 -k18g,18 -k22gr,22 -k19gr,19 -k26gr,26 -k6gr |sort -t$'\t' -k4,4 -u >output.txt |
This file contains hidden or 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
| ls -l test1/* |awk '{print $9}' |xargs -i ln -s {} |
This file contains hidden or 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
| # http://notfaq.wordpress.com/2008/10/18/python-convert-string-to-htmlxml-entities/ | |
| def htmlentities(text): | |
| return ''.join(['&#%d;' % ord(ch) for ch in text]) |
This file contains hidden or 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
| # http://stackoverflow.com/questions/2831212/python-sets-vs-lists | |
| >>> import timeit | |
| >>> a = set(range(1000000)) | |
| >>> b = range(1000000) | |
| >>> def test_a(): | |
| ... '9999' in a | |
| ... | |
| >>> def test_b(): | |
| ... '9999' in b |
This file contains hidden or 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
| vardef FUNCTION = '[[:blank:]]([[:alpha:]]|_)[[:word:]]*(?=[[:blank:]]*\()' | |
| function = $FUNCTION | |
| keyword = "and|assert|break|class|continue|def|del|elif|else|except|exec", | |
| "finally|for|global|if|in|is|lambda|not|or|pass", | |
| "print|raise|return|try|while|self" |
This file contains hidden or 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
| # This is a standard python config file | |
| # Valid values can be True, False, integer numbers, strings | |
| # By default bpython will look for ~/.config/bpython/config or you | |
| # can specify a file with the --config option on the command line | |
| # General section tag | |
| [general] | |
| # Display the autocomplete list as you type (default: True). | |
| # When this is off, you can hit tab to see the suggestions. |
This file contains hidden or 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
| # http://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-camel-case | |
| def convert(name): | |
| s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) | |
| return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # http://marlonyao.iteye.com/blog/905313 | |
| # Usage: $ python sandbox.py <untrusted.py> | |
| _builtins = dict(__builtins__.__dict__) | |
| def _hook_import(name, *args, **kwargs): | |
| restricted_modules = [ | |
| 'os', |