View Python's Pipenv.md

https://github.com/pypa/pipenv

Making sure you're using your system install of Python (likely 2.7.x)

pip install pipenv

For me this installed pipenv-2018.5.18.

View Admin create user and auto-confirm + change password.py
from warrant import Cognito, dict_to_cognito
user_pool_id = 'xxxx'
client_id = 'xxxx'
aws_application_access_key = 'xxxx'
aws_application_secret_key = 'xxxx'
cognito_user_pool_app_secret_key = 'xxxx'
username = 'foo'
email = 'foo@foo.com'
View Python Cookies.py
from datetime import datetime, timedelta
from http import cookies
cookie_expires = (datetime.now() + timedelta(days=30)).strftime('%a, %d %b %Y %H:%M:%S')
c = cookies.SimpleCookie()
c['buzzfeedauth'] = f'id_token={u.id_token};access_token={u.access_token};refresh_token={u.refresh_token}'
c['buzzfeedauth']['domain'] = 'buzzfeed.io'
c['buzzfeedauth']['secure'] = True
c['buzzfeedauth']['httponly'] = True
View Fastly VCL Boilerplate for handling mutliple subdomains.vcl
######################################################################################
#
# For details of VCL and how it works specifically with respect to Fastly's version
# http://www.integralist.co.uk/posts/fastly-varnish/
#
# Quick link to Varnish 2.1 default VCL logic (appended to this custom VCL)
# https://github.com/varnishcache/varnish-cache/blob/2.1/bin/varnishd/default.vcl
#
# Quick link to Fastly's custom VCL logic they add on-top of the default Varnish logic
# https://gist.github.com/Integralist/56cf991ae97551583d5a2f0d69f37788
View Tornado POST Request Handling.py
"""
curl -v -X POST https://buzzfeed-auth-api.dev.buzzfeed.io/verify -d 'foo=bar&baz=123'
"""
#!/usr/bin/env python
import logging
import tornado.escape
import tornado.httpserver
View AWS Amplify Tips.md

Enable debug log

window.LOG_LEVEL = 'DEBUG';

Disable analytics

The noise in the debug logs is insane:

View ElasticSearch.md
curl -XPUT 'localhost:9200/foo/bar/1?pretty' -d '{"name": "Elasticsearch Denver", "organizer": "Lee"}'

Response...

{
  "_index" : "foo",
  "_type" : "bar",
View Dockerfile
FROM node:9.11.1
ENV NPM_CONFIG_LOGLEVEL warn
ENV NODE_PATH=/node_modules
# Seems react drops path-expected binaries, so we just add node’s bin folder to the PATH
ENV PATH=$PATH:/node_modules/.bin
COPY app/package.json /
RUN cd /
View Generating stubs.md

You need to generate stubs that are missing, since dependencies such as boto3 doesn’t provide type hints (as do most packages unfortunately). Mostly we don’t really care about external packages, and type hinting is mostly useful as a documentation tool and can help with autocompletion tools.

So typically you'll run MyPy with: --ignore-missing-imports.

Consider the following code:

import boto3

from botocore.client import BaseClient