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/python | |
| import os, re, urllib, time | |
| querystring = os.environ.get('QUERY_STRING', '') | |
| pattern = urllib.unquote(querystring) | |
| r_pattern = re.compile('(?i)' + pattern) | |
| os.chdir('logs') | |
| matches = [] |
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
| class LinkParser(HTMLParser.HTMLParser): | |
| def __init__(self, *args, **kargs): | |
| HTMLParser.HTMLParser.__init__(self, *args, **kargs) | |
| self.links = {} | |
| self.base = None | |
| def handle_starttag(self, tag, attrs): | |
| attrdict = dict(attrs) | |
| if tag != 'base': | |
| self.handle_link(attrdict) |
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
| >>> import html5lib | |
| >>> f = open('extreme.html') | |
| >>> doc = html5lib.parse(f) | |
| >>> for element in doc: | |
| ... print element | |
| ... | |
| <html> | |
| <head> | |
| <body> | |
| <meta-start> |
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 | |
| # coding=utf-8 | |
| import sys, re, random | |
| r_vowel = re.compile(r'[aeiou]') | |
| def rand(m): | |
| return random.choice(u'áéíóúâêîôûäëïöüáéíóúâêîôûäëïöüaeiou') |
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
| Copyright (c) 2005, Cody Woodard (d8uv.org), | |
| with Reserved Font Name Sansmotif. | |
| Copyright (c) 2011, Mark Shoulson (meson.org). | |
| This Font Software is licensed under the SIL Open Font License, Version 1.1. | |
| This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL | |
| SIL OPEN FONT LICENSE |
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 | |
| import re, glob, email.parser | |
| def message_body(message): | |
| maintype = message.get_content_maintype() | |
| if maintype == 'text': | |
| return message.get_payload(decode=True) |
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
| def colour(cq): | |
| rating = abs(cq - 100) | |
| base = math.pow(10, 1./111) # i.e. 0.5 * 1/(255 - 32 - 1) | |
| LOG = math.log(rating + 1, base) / 2 | |
| LIN = rating * 2.23 / 2 # i.e. 255 - 32 / 100 (/ 2) | |
| red, green, blue = 32, 32, 32 | |
| if cq > 100: | |
| blue += int(LOG + LIN) | |
| elif cq < 100: |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset='utf-8'> |
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
| from itertools import groupby | |
| from operator import itemgetter | |
| def first(length): return itemgetter(slice(None, length)) | |
| def remove_indent(group, n): return (line[n:] for line in group) | |
| def combine(lines, sep): return sep.join(lines) + sep | |
| def indented_sections(text): | |
| """ | |
| >>> example = 'One:\n abc\n def\nTwo:\n ghi' |
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
| #!/bin/bash | |
| find . -type f -exec cp -pf {} ~/web \; |