- https://aws.amazon.com/documentation/gettingstarted/
- https://aws.amazon.com/cli/
- https://www.terraform.io/
- https://blog.gruntwork.io/a-comprehensive-guide-to-terraform-b3d32832baca
- Read about ELB, VPC, subnets, EC2 instances on the AWS site e.g. https://aws.amazon.com/documentation/elastic-load-balancing/
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
# python3 test_grequests.py | |
2019-04-14 23:30:41,697 START | |
2019-04-14 23:30:41,721 Starting new HTTPS connection (1): localhost:8082 | |
2019-04-14 23:30:41,722 Starting new HTTPS connection (1): localhost:8082 | |
2019-04-14 23:30:41,723 Starting new HTTPS connection (1): localhost:8082 | |
2019-04-14 23:30:41,724 Starting new HTTPS connection (1): localhost:8082 | |
2019-04-14 23:30:41,725 Starting new HTTPS connection (1): localhost:8082 | |
2019-04-14 23:30:41,726 Starting new HTTPS connection (1): localhost:8082 | |
2019-04-14 23:30:41,727 Starting new HTTPS connection (1): localhost:8082 |
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
#!/usr/bin/env python | |
from __future__ import print_function | |
import gevent_openssl | |
gevent_openssl.monkey_patch() | |
import grequests | |
import logging | |
import urllib3 | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
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
#!/bin/bash | |
cn='example.com' | |
host="0.0.0.0" | |
port=8082 | |
openssl genrsa -out /tmp/$cn.key 2048 | |
openssl req -new -x509 -sha256 -key /tmp/$cn.key -out /tmp/$cn.crt -days 3650 \ | |
-subj "/CN=$cn\/emailAddress=admin@$cn/C=US/ST=Ohio/L=Columbus/O=Widgets Inc/OU=Some Unit" | |
docker run --rm -e HTTPS_CERT_FILE='/tmp/example.com.crt' -e HTTPS_KEY_FILE='/tmp/example.com.key' -e PORT=$port -p $port:$port -v /tmp:/tmp mccutchen/go-httpbin:v2.1.1 |
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 __future__ import print_function | |
import requests | |
url = "https://google.com" | |
url_count = 10 | |
for i in range(url_count): | |
print(requests.get(url, params={'page': i})) |
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 __future__ import print_function | |
import grequests | |
url = "https://google.com" | |
url_count = 10 | |
pending_requests = [] | |
for i in range(url_count): | |
pending_requests.append(grequests.get(url, params={'page': i})) |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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
def flatten(arr): | |
""" | |
Flatten a nested array | |
>>> flatten([1, 2, 3]) | |
[1, 2, 3] | |
>>> flatten([1,2,3,[1,2,3]]) | |
[1, 2, 3, 1, 2, 3] |
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
1. | |
- if 10 students took a test and scored the following: | |
10 20 30 40 50 60 70 80 90 100 | |
and the cutoff percentage for a college admission is 90% - how many students got in? | |
- average does not help - avg = (n * (n + 1)) / 2 = 55 |
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 sys | |
import json | |
import requests | |
# The following find function is a minor edit of the function posted here | |
# https://stackoverflow.com/questions/9807634/find-all-occurrences-of-a-key-in-nested-python-dictionaries-and-lists | |
def find(key, value): | |
for k, v in value.iteritems(): | |
if k == key and not isinstance(v, dict) and not isinstance(v, list): | |
yield v |