This file contains 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
import sys | |
import random | |
import threading | |
import time | |
from queue import Queue | |
from collections import Counter | |
from flask import Flask | |
from gevent.pywsgi import WSGIServer |
This file contains 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
# If you have a data lake, you will often want to be able to ask questions about what's in it, and prefix-based listings of | |
# objects, as provided by S3 and all S3-alikes, tightly constrain your ability to do so. Using a simple Lambda function like | |
# this (which can be adapted to the FaaS platform of your choice) together with an RDBMS gives you a much more flexible way of | |
# asking meta questions about what's in your lake. | |
# Relevant table schema, adjust names as you like... | |
# | |
# create table lake.inventory | |
# ( | |
# inventory_id bigserial primary key |
This file contains 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
/* | |
Replace "your_schema" with whatever schema is appropriate in your environment. | |
It is possible to use "public"... but you shouldn't! | |
*/ | |
/* | |
Function to stamp a "modified" timestamp. Adjust the name to suit your environment, | |
but that name is hard-coded so it is assumed that you only use _one_ such name. |
This file contains 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
import sys | |
import argparse | |
import networkx | |
# pydot is also required | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser(description='Tool for filtering Graphviz/DOT directed graphs. Pass the source graph on STDIN, the filtered graph will be sent to STDOUT.') | |
parser.add_argument('nodes', metavar='node', nargs='+', help='One or more nodes to use for filtering, according to the chosen mode') |
This file contains 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
package main | |
import ( | |
"github.com/docopt/docopt-go" | |
"math/rand" | |
"fmt" | |
"os" | |
"strings" | |
"strconv" | |
"time" |
This file contains 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
from datetime import datetime, timedelta | |
from airflow import DAG | |
from airflow.operators.bash_operator import BashOperator | |
default_args = { | |
'owner': 'noah.yetter', | |
'depends_on_past': False, | |
'start_date': datetime(2017, 5, 23), |
This file contains 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
var fs = require('fs'); | |
// Lambda knows what region it's in but a local execution doesn't, so preload the SDK and set the region | |
// This will only work if the same variable name is used in the Lambda function file | |
var AWS = require('aws-sdk'); | |
AWS.config.update({region: 'us-east-1'}); | |
// validate arguments | |
if(process.argv.length < 4) { |
This file contains 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
import re | |
import sys | |
if len(sys.argv) != 3: | |
print "usage: {0} sourcefile targetfile".format(sys.argv[0]) | |
sys.exit(1) | |
stage_first_filename = sys.argv[1] | |
stage_second_filename = sys.argv[2] |
This file contains 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
import boto | |
import sys | |
bucketname = sys.argv[1] | |
filename = sys.argv[2] | |
parts = sys.argv[3:] | |
print('target=s3://{0}/{1}'.format(bucketname, filename)) |