I hereby claim:
- I am dcwatson on github.
- I am dcwatson (https://keybase.io/dcwatson) on keybase.
- I have a public key whose fingerprint is AA86 8D19 A671 C0CA A346 DC45 080F 948B CCBC 3A3F
To claim this, I am signing this object:
| #!/usr/bin/env python | |
| import argparse | |
| import fnmatch | |
| import os | |
| import sys | |
| DEFAULT_EXTENSIONS = ['py', 'css', 'html', 'js', 'txt', 'json', 'sh', 'sql', 'yml', 'yaml', 'xml'] | |
| from django.http import StreamingHttpResponse | |
| from wsgiref.util import FileWrapper | |
| import mimetypes | |
| import os | |
| import re | |
| range_re = re.compile(r'bytes\s*=\s*(\d+)\s*-\s*(\d*)', re.I) | |
| class RangeFileWrapper (object): | |
| def __init__(self, filelike, blksize=8192, offset=0, length=None): | 
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env python | |
| # IMPORTANT! USAGE INSTRUCTIONS! | |
| # Drop this file in the top level of your project *after* you've added on_delete to all your ForeignKey and | |
| # OneToOneFields. Running it will rewrite your migration files to add whatever the current on_delete for each field is | |
| # to the past migrations. Make sure you have a clean working copy so you can easily review the differences before | |
| # committing. Assuming there were no pending migrations, running "makemigrations" should yield no new changes. | |
| import os | 
| import os | |
| import re | |
| fk = re.compile(r'\s*([^\s]+)\s*=\s*models\.?(ForeignKey|OneToOneField)\(([^\s,\)]+)') | |
| def fix(path, line): | |
| line = line.rstrip() | |
| # Weed out non-FKs, FKs with on_delete, or incomplete lines (will need to be done manually) | 
| FROM python:3-slim | |
| ENV LANG=C.UTF-8 \ | |
| PYTHONUNBUFFERED=1 \ | |
| DJANGO_SETTINGS_MODULE=project.settings.docker | |
| COPY requirements.txt /app/ | |
| RUN pip install --no-cache-dir -Ur /app/requirements.txt | |
| COPY . /app | 
| #!/usr/bin/env python3 | |
| # Parses out classic MacOS resource fork data into files | |
| # See https://developer.apple.com/library/archive/documentation/mac/pdf/MoreMacintoshToolbox.pdf | |
| import os | |
| import struct | |
| import sys | |
| def CharConst(n): | 
| func hkdf_sha256(_ seed: Data, salt: Data, info: Data, outputSize: Int = 32) -> Data? { | |
| // It would be nice to make this generic over <H: HashFunction> if HashFunction had byteCount instead of each hash | |
| // individually implementing it. | |
| let iterations = UInt8(ceil(Double(outputSize) / Double(SHA256.byteCount))) | |
| guard iterations <= 255 else { | |
| return nil | |
| } | |
| let prk = HMAC<SHA256>.authenticationCode(for: seed, using: SymmetricKey(data: salt)) | |
| let key = SymmetricKey(data: prk) | 
| from cryptography.hazmat.primitives.ciphers.aead import AESGCM | |
| import binascii | |
| import os | |
| class SealedBox: | |
| """ | |
| Basic Python implementation of CryptoKit's AES.GCM.SealedBox | |
| """ | 
| import re | |
| from datetime import timedelta | |
| format_specs = { | |
| "y": 31536000, | |
| "w": 604800, | |
| "d": 86400, | |
| "h": 3600, | |
| "m": 60, | |
| "s": 1, |