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 dataclasses import dataclass | |
from .remappers import Alias, remapper # see module `remappers.py` below | |
@dataclass | |
class DiveSpot(metaclass=remapper): | |
id: str = Alias('_id') | |
name: str = Alias('divespot') | |
# stub to satisfy external linters and type checkers |
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
# Prerequisites: | |
# $ pip install pytest pytest-mock | |
from functools import cache | |
from unittest.mock import MagicMock, mock_open | |
import pytest | |
from pytest_mock import MockerFixture | |
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
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 |
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 { SSM } from 'aws-sdk'; | |
/** | |
* Get the value for a parameter in SSM Parameter Store. By default, decrypt | |
* the value as we assume it is stored as a "SecretString" | |
* | |
* Ref: https://gist.github.com/cbschuld/938190f81d00934f7a158ff223fb5e02 | |
* | |
* @param ssm The SSM client | |
* @param name Name of the parameter |
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 https://prettier.io/docs/en/options.html | |
printWidth: 70 | |
tabWidth: 4 | |
semi: true | |
singleQuote: true | |
trailingComma: 'es5' | |
bracketSpacing: true | |
arrowParens: 'always' | |
endOfLine: 'lf' |
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 __future__ import annotations | |
import builtins | |
from collections import deque | |
from dataclasses import field as dataclass_field, Field, MISSING | |
from logging import getLogger | |
log = getLogger(__name__) |
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 pathlib import Path # Optional | |
# Using CDK v2 | |
from aws_cdk import Duration | |
from aws_cdk.aws_lambda import Function, Runtime | |
from aws_cdk_lambda_asset.zip_asset_code import ZipAssetCode | |
# NOTE: Only example usage below (needs some modification) |