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
import flatdict | |
values = {'foo': {'bar': {'baz': 0, | |
'qux': 1, | |
'corge': 2}, | |
'grault': {'baz': 3, | |
'qux': 4, | |
'corge': 5}}, | |
'garply': {'foo': 0, 'bar': 1, 'baz': 2, 'qux': {'corge': 3}}} | |
flat = flatdict.FlatDict(values) |
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
import unittest | |
import os | |
from urllib.parse import urlparse | |
class S3Parse(object): | |
def __init__(self, uri): | |
self.uri = uri | |
self.parsed = urlparse(uri) |
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/bash | |
set -x | |
LOCAL_DIR=/home/hadoop/yarn_logs | |
mkdir $LOCAL_DIR | |
for row in $( yarn application -appStates ALL -list | awk '/application_/{print $1 "," $2}' ) | |
do | |
fields=($(echo $row | tr "," "\n")) | |
yarn logs -applicationId ${fields[0]} > $LOCAL_DIR/yarn_${fields[0]}_${fields[1]}.log |
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
# python spot_price.py g2.2xlarge | |
import sys | |
import boto3 | |
import datetime | |
def main(argv): | |
if len(argv) < 2: | |
print("No instance provided!") | |
sys.exit() |
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
# air on higher value squares will try to flow to lower value squares | |
# a square can only hold a certain amount of air ( Depends on square value | |
# ). If square is full, air will not flow into it. | |
import sys | |
import pygame | |
import random | |
from noise import pnoise2 | |
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
'use strict'; | |
// $ npm install knex objection sqlite3 | |
const {Model} = require('objection'); | |
const knex = require('knex')({ | |
client: 'sqlite3', | |
connection: { | |
filename: './db.sqlite' | |
}, |
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
import os | |
import json | |
import hashlib | |
import datetime | |
from database import db | |
from sqlalchemy import event | |
def literal_sql(context): |
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
{ | |
"AWSEBDockerrunVersion": "1", | |
"Authentication": { | |
"Bucket": "bucket_name", | |
"Key": "docker/dockercfg" | |
}, | |
"Image": { | |
"Name": "company/<image>" | |
}, | |
"Ports": [ |
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/bash | |
# https://gist.github.com/gcchaan/ad8fd83a68467503ec3e6392ebbd519a | |
set -ef -o pipefail | |
function message(){ | |
echo 🍣 "$1" | |
} | |
function help(){ |
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
from troposphere import \ | |
AWSHelperFn, Base64, Cidr, Condition, Equals, GetAtt, Join, Not, Output, Parameter, Ref, \ | |
Region, Select, Split, StackName, Sub, Tags, Template | |
from troposphere.autoscaling import \ | |
AutoScalingGroup, LaunchTemplateSpecification, LifecycleHookSpecification | |
from troposphere.awslambda import \ | |
Code, Function, Permission | |
from troposphere.ec2 import \ | |
CreditSpecification, IamInstanceProfile, InternetGateway, LaunchTemplate, LaunchTemplateData, \ | |
Route, RouteTable, SecurityGroup, SecurityGroupRule, Subnet, SubnetRouteTableAssociation, VPC, \ |