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
# Note: | |
# Lock in build date on the tag (ex: 2023.03.29) - otherwise, we rebuild the | |
# entire Docker image each time a tag is updated (ex: python:3.9-x86_64) | |
# | |
# Refs: | |
# - https://github.com/peterheb/rembg-lambda/issues/1#issue-1621934443 | |
# - https://docs.aws.amazon.com/lambda/latest/dg/python-image.html | |
# - https://gallery.ecr.aws/lambda/python (-> Image tags) | |
# Date (Timestamp) of the Image to Build |
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
# delete and re-create the latest tag on remote | |
rmtag () { | |
export TAG=$(git describe --tags --abbrev=0) | |
git tag -d $TAG | |
git tag $TAG | |
git push origin :$TAG | |
git push origin $TAG | |
} |
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
// TypeScript code to programatically run the equivalent of `tsc` | |
// | |
// With Slight modifications, such as *Colorized* output being displayed. | |
// | |
// However, the nice one-line Error Summary that `tsc` gives you (e.g. Errors in X files) is currently missing. | |
// | |
// Refs: | |
// - https://github.com/microsoft/TypeScript-wiki/blob/main/Using-the-Compiler-API.md | |
// - https://github.com/Microsoft/TypeScript/issues/6387#issuecomment-169739615 |
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 { readdirSync, rmdirSync, statSync } from 'node:fs'; | |
import { basename, join } from 'node:path'; | |
export const cleanupEmptyFolders = ( | |
folder: string, | |
exclude: string[] = ['node_modules'] | |
) => { | |
if (!statSync(folder).isDirectory()) return; | |
const folderName = basename(folder); |
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
# See comment below for an explanation of what this script is testing! | |
from dataclasses import dataclass, is_dataclass | |
from timeit import timeit | |
@dataclass | |
class A: | |
a: int = 10 |
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 timeit import timeit | |
data = [ | |
{ | |
"eventStatus": "Failure", | |
"eventType": "Archive", | |
"objectName": "W12 BO Template", | |
"time": "2022-08-23T10:09:33.092Z" | |
}, | |
{ |
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
# Ref: | |
# - https://pythonspeed.com/articles/base-image-python-docker-images/ | |
# - https://github.com/FNNDSC/ubuntu-python3/blob/master/Dockerfile | |
# | |
# This Docker image uses the `ubuntu` base image for a slight performance | |
# improvement as mentioned in the article. At build time, you'll need to pass | |
# in the PyPI authentication info, as shown below: | |
# | |
# docker build -t ${image_tag_name} \ | |
# --build-arg PYPI_URL=${PYPI_URL} \ |
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 string | |
from time import time | |
def main(): | |
# Rust version run with `--release` (for reference), using `only_one_string` from here: | |
# https://stackoverflow.com/a/71864244/10237506 | |
# trim_whitespace: 30ms |
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
[alias] | |
d = "doc --no-deps --open" | |
rr = "run --release" |
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
module.exports = { | |
testEnvironment: 'node', | |
roots: ['<rootDir>/test'], | |
testMatch: ['**/*.test.ts'], | |
transform: { | |
'^.+\\.tsx?$': 'ts-jest', | |
}, | |
// Added so that jest prefer to run tests on files | |
// with the *.ts extension instead (see below). | |
// https://stackoverflow.com/a/50145833/10237506 |