I hereby claim:
- I am jasonbartz on github.
- I am jasonbartz (https://keybase.io/jasonbartz) on keybase.
- I have a public key ASDeA2DP_ksxd-RWZjq1xADBcsbZXdaJ70ctNh7so2KevQo
To claim this, I am signing this object:
| """ | |
| Waiter Lambda | |
| This lambda waits indefinitely for an action, sleeping every n seconds | |
| until it succeeds, fails or times out. | |
| """ | |
| import json | |
| import os | |
| import time | |
| import boto3 | 
I hereby claim:
To claim this, I am signing this object:
| #!/bin/bash | |
| PROFILE="" | |
| if [ -z "$AWS_PROFILE" ]; then | |
| PROFILE="--profile $AWS_PROFILE" | |
| fi | |
| case $1 in | |
| encrypt) | |
| aws kms encrypt ${PROFILE} --key-id $2 --plaintext $3 --output text --query CiphertextBlob | 
| """ | |
| Inspired by https://t37.net/how-to-fix-your-elasticsearch-cluster-stuck-in-initializing-shards-mode.html | |
| 3 node cluster, when 2 nodes have been terminated simultaneously | |
| Not guaranteed to prevent data loss or fully recover lost data | |
| """ | |
| import requests | |
| import json | 
| """ | |
| A simple decorator to redirect stdout somewhere else | |
| # Example usage | |
| ``` | |
| def my_write_func(text, **kwargs): | |
| // do something with text | |
| pass | 
| function objectIdWithTimestamp(timestamp) { | |
| // Convert string date to Date object (otherwise assume timestamp is a date) | |
| if (typeof(timestamp) == 'string') { | |
| timestamp = new Date(timestamp); | |
| } | |
| // Convert date object to hex seconds since Unix epoch | |
| var hexSeconds = Math.floor(timestamp/1000).toString(16); | |
| // Create an ObjectId with that hex timestamp | 
Instructions are kind of sporadic around the internet, so I thought I would gather them all in one place. The following example uses a Flask app as the thing deployed. You should only have to this once, and then you can pass the bin around.
| import datetime | |
| import tornado.ioloop | |
| import tornado.web | |
| import motor | |
| from tornado import gen | |
| db = motor.MotorClient().open_sync().test | |
| from django.contrib.gis.gdal import DataSource | |
| from django.contrib.gis.gdal.geometries import Point | |
| # Get the DC voting districts shape (from the Census Bureau) | |
| ds = DataSource('/path/to/my/shapefiles/tl_2012_11_vtd10/tl_2012_11_vtd10.shp') | |
| # Grab the layer that contains all of the shape data | |
| layer = ds[0] | |
| def get_shape_contains(layer, geometry): | |
| # Iterate over every shape | 
| <html> | |
| <head> | |
| <title>raising the roof!</title> | |
| <style type="text/css"> | |
| body { | |
| background:url('http://28.media.tumblr.com/tumblr_lr4652g4zX1qhuxd0o1_250.gif') repeat; | |
| } | |
| </style> | |
| </head> |