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
import base64 | |
import cgi | |
import codecs | |
import io | |
import sys | |
from urllib.parse import urlencode | |
from wsgiref.util import FileWrapper | |
from .wsgi import application |
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
from PIL import Image | |
EXIF_ORIENTATION = 274 | |
EXIF_ORIENTATION_TRANSPOSE = [ | |
None, | |
None, | |
Image.FLIP_LEFT_RIGHT, |
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
import sys, re | |
class TerminalController: | |
""" | |
A class that can be used to portably generate formatted output to | |
a terminal. | |
`TerminalController` defines a set of instance variables whose | |
values are initialized to the control sequence necessary to | |
perform a given action. These can be simply included in normal |
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
function forceOpen() { | |
var url = "http://www.google.com"; | |
window.open(url) ? location.reload() : (location.href = url); | |
} | |
window.addEventListener("beforeprint", function (e) { e.preventDefault(), forceOpen() }) | |
window.matchMedia("print").addListener(function (e) { e.matches && forceOpen() }) |
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
import re | |
from xml.sax.saxutils import unescape | |
tags_pattern = re.compile(r"</(?P<close>\S+)>|<(?P<open>[^>!?/\s]+)(\s+(?P<attrs>.*?))?(?P<empty>/)?\s*>|<!--(?P<comment>.*?)-->|(?P<cdata><!\[CDATA\[)") | |
attrs_pattern = re.compile(r"\s*(?P<name>\S+)\s*=\s*(?P<quote>\"|')(?P<value>.*?)(?P=quote)") | |
cdata_close_pattern = re.compile(r"\]\]>") | |
escaped_entities = {""": '"', "'": "'"} |
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
""" | |
requirements: | |
jira<3 | |
elasticsearch<7 | |
elasticsearch-dsl<7 | |
raven<7 | |
python-dateutil<3 | |
jsonpointer<3 | |
""" |
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
import re | |
import sys | |
from collections import Mapping, Container | |
from itertools import chain | |
from array import array | |
def deep_getsizeof(o): | |
seen = set() | |
todo = {id(o): o} |
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
function forceOpen() { | |
var url = "http://www.google.com"; | |
window.open(url) ? location.reload() : (location.href = url); | |
} | |
window.addEventListener("beforeprint", function (e) { e.preventDefault(), forceOpen() }) | |
window.matchMedia('print').addListener(function (e) { e.matches && forceOpen() }) |
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
fnv1a_128_prime = 309485009821345068724781371 | |
fnv1a_128_offset = 144066263297769815596495629667062367629 | |
fnv1a_128_mask = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | |
def fnv1a_128(bs): | |
h = fnv1a_offset | |
for b in bs: | |
h ^= b | |
h *= fnv1a_prime |