I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
| /* | |
| Written by: patpawlowski | |
| Created On: Oct 26, 2015 at 4:51:52 PM | |
| Description: This is a rough attempt to create a funciton to strip the markup from | |
| the Act TBL_NOTE.NOTETEXT field. It appears to work for what I need | |
| but could probably use some work with the escaped characters. | |
| It's not particularly fast but it is faster than other solutions I've come | |
| across. It takes about 4 seconds to parse 2700 records. |
| #!/usr/bin/env python3 | |
| import requests | |
| from flask import * | |
| import random | |
| from apscheduler.schedulers.background import BackgroundScheduler | |
| app = Flask(__name__) | |
| scheduler = BackgroundScheduler() | |
| url = "https://reddit.com/r/gonewild/comments.json?limit=200" |
Use Python to:
- send a plain text email
- send an email with attachment
- receive and filter emails according to some criteria
| a4b.amazonaws.com | |
| access-analyzer.amazonaws.com | |
| account.amazonaws.com | |
| acm-pca.amazonaws.com | |
| acm.amazonaws.com | |
| airflow-env.amazonaws.com | |
| airflow.amazonaws.com | |
| alexa-appkit.amazon.com | |
| alexa-connectedhome.amazon.com | |
| amazonmq.amazonaws.com |
AWS API Gateway has the ability to pre-authenticate connections prior to launching the endpoint, by passing the authorizationToken to a Lambda function. There are clear benefits for simplifying end point security and also a reduction in duplicated code by utilising this feature. However I found the AWS examples were excessively complicated for what should be a very simple task.
So here's my example.
The main concern is that AWS Lambda authentication expects a very specific response and if that response is not given it will throw a 500 error with x-amzn-ErrorType: AuthorizerConfigurationException in the response header if the response object is not exactly as expected.
I personally use to handle the publishing part of my Lambdas, but I'll include an image of the API Gateway config.
| #!/usr/bin/env python | |
| import json | |
| import copy | |
| import sys | |
| import argparse | |
| from datetime import datetime, timedelta | |
| from subprocess import Popen, PIPE | |
| # dictionary of partiton names to variable generating functions |
| import requests | |
| import logging | |
| logger = logging.getLogger() | |
| handler = logging.StreamHandler() | |
| formatter = logging.Formatter( | |
| '%(asctime)s %(name)-12s %(levelname)-8s %(message)s') | |
| handler.setFormatter(formatter) | |
| logger.addHandler(handler) | |
| logger.setLevel(logging.DEBUG) |
| # https://misc.flogisoft.com/bash/tip_colors_and_formatting | |
| RED="\\e[91m" | |
| GREEN="\\e[32m" | |
| BLUE="\\e[94m" | |
| YELLOW="\\e[33m" | |
| REGULAR="\\e[39m" | |
| REPORTS=".coverage-reports" | |
| SRC="app" | |
| VERSION=$(shell cat ${SRC}/__init__.py | head -n 1 | cut -d" " -f 3 | tr -d "'") |