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
| function getRandomBase64String(length) { | |
| var array = new Uint8Array(Math.ceil(length * 3 / 4)); | |
| crypto.getRandomValues(array); | |
| return btoa(String.fromCharCode.apply(null, array)).slice(0, length); | |
| } | |
| function getRandomHexString(length) { | |
| var array = new Uint32Array(Math.ceil(length / 8)); | |
| crypto.getRandomValues(array); | |
| return Array.prototype.map.call(array, i => i.toString(16).padStart(2, '0')).join('').slice(0, length); |
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 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 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 PIL import Image | |
| EXIF_ORIENTATION = 274 | |
| EXIF_ORIENTATION_TRANSPOSE = [ | |
| None, | |
| None, | |
| Image.FLIP_LEFT_RIGHT, |
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 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 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
| 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 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 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 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
| """ | |
| requirements: | |
| jira<3 | |
| elasticsearch<7 | |
| elasticsearch-dsl<7 | |
| raven<7 | |
| python-dateutil<3 | |
| jsonpointer<3 | |
| """ |
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 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 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 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 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
| 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() }) |