Instantly share code, notes, and snippets.

View Makefile
# To build the application run `make install`.
#
# This target depends on the `node_modules` target.
install: node_modules
# This target depends on a file called `package.json`.
#
# If `package.json` doesn't exist, make complains that you need one! Run `npm init` to generate one.
#
# If `package.json` exists, but `node_modules/` doesn't, make will run `npm install`.
View multi-region.tf
condition {
name = "request_is_us"
statement = "req.http.X-Geoip-Continent ~ \"(NA|SA|OC|AS)\" || (!F_eu_origin.healthy && F_us_origin.healthy)"
type = "REQUEST"
priority = 100
}
condition {
name = "request_is_eu"
statement = "req.http.X-Geoip-Continent !~ \"(NA|SA|OC|AS)\" || (!F_us_origin.healthy && F_eu_origin.healthy)"
View config.yml
version: 2
jobs:
validate_terraform:
docker:
- image: hashicorp/terraform
steps:
- checkout
- run:
name: Validate Terraform Formatting
View caches-all-the-way-down.md

Caches all the way down

https://ldnwebperf.org/events/caches-all-the-way-down/

Layers of caching in the browser

(kind of Chromium specific here and there)

1. MemoryCache

  • same rendering process, short-lived
  • strict matching, same resource type, etc, CSP
  • everything (even no-cache, except for no-store)
View README.md
View 03-pdb-hello.py
#!/usr/bin/python
# import modules used here -- sys is a very standard one
import sys
# Gather our code in a main() function
def main():
print 'Hello there', sys.argv[1] if len(sys.argv) > 1 else 'Anon'
# Command line args are in sys.argv[1], sys.argv[2] ..
# sys.argv[0] is the script name itself and can be ignored
View 02-tdd-bdd.md
View launch-event.json
{
"Records": [
{
"EventSource": "aws:sns",
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:eu-west-1:371548805176:FT-App-API-UAT-AutoScalingEvents-1VA671X21ETS2:500fe343-1af7-4b98-a81c-2a91c32f3f05",
"Sns": {
"Type": "Notification",
"MessageId": "1decf081-3906-5ba1-a408-a1c886a6549e",
"TopicArn": "arn:aws:sns:eu-west-1:371548805176:FT-App-API-UAT-AutoScalingEvents-1VA671X21ETS2",
View example.py
#!/usr/bin/env python
import boto3
# Standard boilerplate to call the main() function to begin
# the program.
if __name__ == '__main__':
key = 'jif.gif'
body = open(filename, 'rb')
s3.Bucket('hello-world').put_object(Key=key, Body=body)
View mime.py
import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
mime_types = {}
file_names = []
count_mime_types = int(input()) # Number of elements which make up the association table.
count_file_names = int(input()) # Number of file names to be analyzed.