A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.
python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
#cloud-config | |
packages: | |
- nginx | |
#jq is a command-line json processor https://stedolan.github.io/jq/ | |
- jq | |
- unattended-upgrades | |
runcmd: | |
- export DOMAIN=your_domain_here.com | |
- export DO_API_TOKEN=PASTE_YOUR_DIGITALOCEAN_API_TOKEN_HERE | |
- export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address) |
#cloud-config | |
package_update: true | |
manage-resolv-conf: true | |
resolv_conf: | |
nameservers: | |
- '8.8.8.8' | |
- '8.8.4.4' | |
- '1.1.1.1' |
from collections import OrderedDict | |
# >>> import cache_dict | |
# >>> c = cache_dict.CacheDict(cache_len=2) | |
# >>> c[1] = 1 | |
# >>> c[2] = 2 | |
# >>> c[3] = 3 | |
# >>> c | |
# CacheDict([(2, 2), (3, 3)]) | |
# >>> c[2] |
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: myproject | |
name: myproject | |
namespace: default | |
spec: | |
progressDeadlineSeconds: 600 | |
replicas: 1 |
/** | |
* Retrieve the array key corresponding to the largest element in the array. | |
* | |
* @param {Array.<number>} array Input array | |
* @return {number} Index of array element with largest value | |
*/ | |
function argMax(array) { | |
return array.map((x, i) => [x, i]).reduce((r, a) => (a[0] > r[0] ? a : r))[1]; | |
} |
#!/usr/bin/nft -f | |
# ipv4/ipv6 Simple & Safe Firewall | |
# you can find examples in /usr/share/nftables/ | |
table inet filter { | |
chain input { | |
type filter hook input priority 0; | |
# allow established/related connections | |
ct state {established, related} accept |
from pyramid.security import NO_PERMISSION_REQUIRED | |
def includeme(config): | |
config.add_directive( | |
'add_cors_preflight_handler', add_cors_preflight_handler) | |
config.add_route_predicate('cors_preflight', CorsPreflightPredicate) | |
config.add_subscriber(add_cors_to_response, 'pyramid.events.NewResponse') | |
class CorsPreflightPredicate(object): |
State | State FIPS | County FIPS | IECC Climate Zone | IECC Moisture Regime | BA Climate Zone | County Name | |
---|---|---|---|---|---|---|---|
AK | 02 | 013 | 7 | N/A | Very Cold | Aleutians East | |
AK | 02 | 016 | 7 | N/A | Very Cold | Aleutians West | |
AK | 02 | 020 | 7 | N/A | Very Cold | Anchorage | |
AK | 02 | 050 | 8 | N/A | Subarctic | Bethel | |
AK | 02 | 060 | 7 | N/A | Very Cold | Bristol Bay | |
AK | 02 | 068 | 7 | N/A | Very Cold | Denali | |
AK | 02 | 070 | 8 | N/A | Subarctic | Dillingham | |
AK | 02 | 090 | 8 | N/A | Subarctic | Fairbanks North Star | |
AK | 02 | 100 | 7 | N/A | Very Cold | Haines |
A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.
python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
packer build packer.json 2>&1 | sudo tee output.txt | |
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt |