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 sanic import Blueprint | |
from sanic import Sanic | |
from sanic.response import text | |
bp1 = Blueprint('bp1', url_prefix='/bp1') | |
bp2 = Blueprint('bp2', url_prefix='/bp2') | |
@bp1.middleware('request') | |
async def bp1_only_middleware(request): |
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 concurrent.futures import ThreadPoolExecutor, as_completed | |
import boto3 | |
def process_object(bucket, key): | |
client = boto3.client('s3', region_name='eu-west-1') | |
response = client.get_object( | |
Bucket=bucket, |
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
#Prep | |
provider "aws" { | |
region = "eu-central-1" | |
} | |
resource "random_id" "alarm" { | |
byte_length = 8 | |
} | |
#IAM |
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 configparser | |
import os | |
from collections import OrderedDict | |
from uuid import uuid4 | |
from dateutil import tz | |
import boto3 | |
class Cli(): | |
def __init__(self): |
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 pprint import pprint | |
import boto3 | |
def batch_delete(bucket, prefix): | |
s3c = boto3.client('s3') | |
paginator = s3c.get_paginator('list_object_versions') | |
response = paginator.paginate( |
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 pprint import pprint | |
import boto3 | |
def batch_delete(bucket, prefix): | |
s3c = boto3.client('s3') | |
paginator = s3c.get_paginator('list_objects_v2') | |
response = paginator.paginate( |
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 datetime import datetime | |
from time import time | |
from uuid import uuid4 | |
import botocore | |
from awacs.aws import Allow, Statement, Principal, Policy | |
from awacs.sts import AssumeRole | |
from boto3 import Session | |
from troposphere import (Ref, Template, Tags) | |
from troposphere.ec2 import SecurityGroup, SecurityGroupRule |
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 string | |
import unittest | |
class UnitTests(unittest.TestCase): | |
def test_change_base_too_small(self): | |
with self.assertRaises(ValueError): | |
change_base(10, 1) | |
def test_change_base_too_big(self): |