This file contains hidden or 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
| console.log('Loading function'); | |
| var AWS = require('aws-sdk'), | |
| s3 = new AWS.S3(), | |
| s3Bucket = 'archive-bucket', | |
| s3Prefix = 'kinesis-archive-test', | |
| s3Partitions = 2; | |
| exports.handler = function (event, context) { | |
| //console.log(JSON.stringify(event, null, 2)); |
This file contains hidden or 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 bash | |
| # | |
| # Rails console script that can be run on AWS Elastic Beanstalk. | |
| # | |
| # Run this script from the app dir (/var/app/current) as root (sudo script/aws-console) | |
| # | |
| set -xe | |
| EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir) |
This file contains hidden or 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
| { | |
| "Arts & Entertainment":[ | |
| "Books & Literature", | |
| "Celebrity Fan/Gossip", | |
| "Fine Art", | |
| "Humor", | |
| "Movies", | |
| "Music", | |
| "Television" | |
| ], |
This file contains hidden or 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/sh | |
| echo `env` | |
| echo `ls` | |
| git fetch --tags | |
| git checkout master | |
| git pull origin master | |
| git branch release-$PROMOTED_GIT_COMMIT $PROMOTED_GIT_COMMIT | |
| git clean -f | |
| case $INCREMENT_VERSION in |
This file contains hidden or 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
| =begin | |
| This script uses the AWS v2 API | |
| Gemfile: | |
| source "https://rubygems.org" | |
| gem "aws-sdk", "2.0.17.pre" |
This file contains hidden or 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/tcsh | |
| # Grab user information. | |
| echo "PrivateInternetAccess OpenVPN Setup:" | |
| echo " https://www.privateinternetaccess.com/pages/client-control-panel" | |
| echo " -> PPTP/L2TP/SOCKS Username and Password" | |
| echo -n "User: " | |
| set user = $< | |
| echo -n "Pass: " | |
| set pass = $< |
This file contains hidden or 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
| container_commands: | |
| sync_db: | |
| command: "docker run --env DATABASE_URL=`/opt/elasticbeanstalk/bin/get-config environment | jq -r .DATABASE_URL` aws_beanstalk/current-app:latest lein lobos migrate" | |
| leader_only: true |
If you need to manipulate existing data when your code is deployed, there are two main ways to do it:
- Create a rake task to migrate the data after the code is deployed. This is ideal for more complex data migrations.
- Use ActiveRecord models in a migration. This is acceptable for smaller data manipulations.
Regardless of the method you use, make sure to test your migrations before submitting them.
-
Nielsen Designated Market Area (DMA) is a geographic region where the population can receive the same broadcasts (TV/Radio, Cable/Internet).
-
GeoHex is a world coordinate system expressed by hexagon of various sizes. It's often used in games due to its simple matching nature. It's also useful for proximity/coverage since a hexagon approximates a circular area.
This gist is an exercise in figuring out DMA from a geohex code using opensource tools and data.