Skip to content

Instantly share code, notes, and snippets.

for state in FL PA TX NY MA VA MD; do
for market in small_group; do
for quarter in Q3 Q4;do
mkdir -p "./data/$market/$state/2016/$quarter";
aws s3 cp --recursive "s3://vericred-emr-workers/production/plans/$market/$state/2016/$quarter" "./data/$market/$state/2016/$quarter";
mkdir -p input "./data_out/$market/$state/2016/$quarter";
./bin/plan_etl -i "./data/$market/$state/2016/$quarter" \
-o "./data_out/$market/$state/2016/$quarter" \
alias
alias -='cd -'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias 1='pushd'
alias 2='pushd +2'
alias 3='pushd +3'
alias 4='pushd +4'
alias 5='pushd +5'
@chandeeland
chandeeland / gist:2cdc04f837c20f8567a1
Created January 22, 2016 18:10
how to curl part of large files
# check to see if the server supports RANGES
> curl -sI <url> |grep -i range
> Accept-Ranges: bytes
# see file size
> curl -sI <url> |grep -i length
> Content-Length: 2251775322
# curl a portion of file
@chandeeland
chandeeland / gist:0154709d18a0b38b498b
Created June 11, 2015 14:12
Time to make the donuts
#!/usr/bin/env ruby
percentage = ARGV[0].to_i
if percentage >= 75
stroke_color = '#00a651'
elsif percentage >= 50
stroke_color = '#fff200'
elsif percentage >= 25
stroke_color = '#ef9d26'
@chandeeland
chandeeland / dump_wineries.sql
Created January 7, 2015 19:07
Dirty SQL Data Migration Technique
--
-- how to populate locations table on db2 from wineries table on db1
--
-- SELECT "INSERT INTO locations( name, website, address, address2, city, state, zip, country, phone, created_at, updated_at, latitude, longitude, email, fax, winery_id ) VALUES (" || name ||", " || website || ", " || address || ", null , null, null, null, null, " || phone || ", " || created_at || ", " || modified_at || ",null, null, " || email || ", " || fax || ", " || winery_id || "); " FROM wineries
SELECT 'INSERT INTO locations( name, winery_id ) VALUES ("' || name || '", "' || winery_id || '"); ' FROM wineries
/**
* DateTimeWrapper
*
* This class exists because you cannot modify the microseconds of a native PHP 5.5
* DateTime Object without creating a whole new instance.
*
* Additionally, this class allows you to serialize Datetime Objects without losing
* the microseconds.
*
* @copyright 2014 Mshanken Communications
#! /usr/bin/perl
use 5.010;
use strict;
use warnings;
use Data::Dump qw/dd dump/;
use DBI;
use SVG;
use File::Temp qw/tempfile/;
use File::Copy qw/move/;
@chandeeland
chandeeland / DC21_Shepherd_Fleet_Script
Created August 5, 2013 14:37
Shepherd's DC21 schemaverse entry
--
-- Schemaverse Fleet Script for DefCon 21 (2013)
-- @author shepherd <chand@chandeeland.org>
--
-- Exploiting a missing constraint on insert/update to ship rules
--
UPDATE my_fleets SET
script_declarations = '
num_miners integer;