(Create a symlink pytest for py.test)
pytest [options] [file_or_dir] [file_or_dir] ...
Help:
variable "env_level" { | |
description = "Environment level" | |
default = "dev" | |
} | |
module "eventbridge_price" { | |
source = "terraform-aws-modules/eventbridge/aws" | |
create_bus = false | |
create_connections = true | |
create_api_destinations = true |
import phonenumbers | |
from pydantic.validators import strict_str_validator | |
class PhoneNumber(str): | |
"""Phone Number Pydantic type, using google's phonenumbers""" | |
@classmethod | |
def __get_validators__(cls): | |
yield strict_str_validator | |
yield cls.validate |
from typing import Any | |
from typing import Dict | |
from typing import Set | |
from typing import Type | |
from pydantic import SecretStr | |
from pydantic.utils import update_not_none | |
class Password(SecretStr): |
# best practice: linux | |
nano ~/.pgpass | |
*:5432:*:username:password | |
chmod 0600 ~/.pgpass | |
# best practice: windows | |
edit %APPDATA%\postgresql\pgpass.conf | |
*:5432:*:username:password | |
# linux |
import asyncio | |
import aiohttp | |
import time | |
async def gather_with_concurrency(n, *tasks): | |
semaphore = asyncio.Semaphore(n) | |
async def sem_task(task): | |
async with semaphore: |
1) see re: increasing shmmax http://stackoverflow.com/a/10629164/1283020 | |
2) add to postgresql.conf: | |
shared_preload_libraries = 'pg_stat_statements' # (change requires restart) | |
136 pg_stat_statements.max = 1000 | |
137 pg_stat_statements.track = all | |
3) restart postgres | |
4) check it out in psql |
SELECT *
, Specify explicit column names (columnar store)import json | |
import os | |
import boto3 | |
def lambda_handler(event, context): | |
try: | |
s3 = boto3.client('s3') | |
"""Downlod video from private S3""" | |
s3.download_file('serverless-test-2020', 'Big_Buck_Bunny_1080_10s_1MB.mp4', '/tmp/test-video.mp4') | |