Skip to content

Instantly share code, notes, and snippets.

@vrivellino
vrivellino / ProcessKinesisRecords.js
Last active December 30, 2017 15:35
Lambda: archive kinesis stream to S3
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));
#!/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)
@standyro
standyro / iab-categories.json
Created March 7, 2015 01:13
IAB Categories JSON
{
"Arts & Entertainment":[
"Books & Literature",
"Celebrity Fan/Gossip",
"Fine Art",
"Humor",
"Movies",
"Music",
"Television"
],
@gordlea
gordlea / jenkins-publish.sh
Last active September 9, 2019 18:49
Jenkins NPM Publish
#!/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
@ruckus
ruckus / rds_download_logfiles.rb
Created January 9, 2015 03:58
Ruby script to download log files from RDS and archive to S3.
=begin
This script uses the AWS v2 API
Gemfile:
source "https://rubygems.org"
gem "aws-sdk", "2.0.17.pre"
#!/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 = $<
@mikeclarke
mikeclarke / 01-migrate-db.config
Created November 4, 2014 01:52
.ebextension file for migrating a database with docker
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
@ccschmitz
ccschmitz / data_migrations_in_rails.md
Created August 19, 2014 13:10
Some tips for handling data migrations in Rails

Data Migrations in Rails Apps

If you need to manipulate existing data when your code is deployed, there are two main ways to do it:

  1. Create a rake task to migrate the data after the code is deployed. This is ideal for more complex data migrations.
  2. 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.

Data Migrations in Models

@akiatoji
akiatoji / GeoHex_checking.md
Last active August 25, 2016 15:35
Using PostGIS to determine DMA for a GeoHex

Decoding Nielsen DMA from GeoHex

  • 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.

How it works