This file contains hidden or 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
#! /bin/bash | |
allocation_id=<ALLOCATION_ID> | |
metadata=169.254.169.254/latest/meta-data | |
get-region() { | |
curl -s http://$metadata/placement/availability-zone | awk '{ | |
print(substr($0, 0, length($0)-1)) | |
}' | |
} |
This file contains hidden or 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 boto3 | |
def get_account_id(session): | |
""" | |
Get Account Id. | |
Get the AWS account id for the current session user's credentials. | |
""" | |
client = session.client("sts") |
This file contains hidden or 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
AWSTemplateFormatVersion: 2010-09-09 | |
Description: The child template needs the Arn for the task role and the bucket name for the task. | |
Parameters: | |
InputS3BucketArn: | |
Description: Parameter containing the Arn of the S3 Bucket for input | |
Type: AWS::SSM::Parameter::Value<String> | |
Default: /Yolo/Development/InputS3BucketArn | |
OutputS3BucketArn: |
This file contains hidden or 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
'use strict'; | |
console.log('Loading function'); | |
exports.handler = async (event, context) => { | |
console.log('Received event:', JSON.stringify(event, null, 2)); | |
let responseBody = { | |
message: "This is a message", | |
input: event | |
}; |
This file contains hidden or 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
AWSTemplateFormatVersion: 2010-09-09 | |
Description: Cloudformation Template | |
Parameters: | |
S3BucketParameter: | |
Description: S3 Bucket | |
Type: String | |
AliasParameter: | |
Description: CNAME (alternate domain names) |
This file contains hidden or 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 unittest import mock | |
import thing | |
import pytest | |
@pytest.fixture() | |
def mock_client(monkeypatch, request): | |
"""Mock the client.""" |
This file contains hidden or 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
"""Playing with AWS Rekognition.""" | |
import argparse | |
import hashlib | |
import json | |
import logging | |
import boto3 | |
logging.basicConfig( |
This file contains hidden or 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
"""An example of procedurally generated music using FoxDot.""" | |
from atexit import register | |
from FoxDot import Clock, pluck, p1 | |
def fibonacci(n): | |
"""Get a list of numbers in the fibonacci sequence.""" | |
step = 1 if n >= 0 else -1 | |
seq = [0, 1] |
This file contains hidden or 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
"""Threading vs. Multiprocessing thread pools example.""" | |
import argparse | |
import logging | |
import multiprocessing.pool | |
import random | |
import threading | |
import time | |
logging.basicConfig( |
This file contains hidden or 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
""" | |
MRO (Method Resolution Order) with multiple inheritance is resolved via | |
a linearization algorithm that flattens a tree. In some cases, super() | |
is not bound to a classes superclass, but instead to a sibling depending | |
on the object's MRO. | |
""" | |
class Base: | |
def __init__(self, field, **kwargs): |
NewerOlder