Skip to content

Instantly share code, notes, and snippets.

View caevyn's full-sized avatar

Matt Murphy caevyn

  • Newcastle, Australia
View GitHub Profile
import boto3
import json
import csv
import io
def lambda_handler(event, context):
s3 = boto3.resource('s3')
content_object = s3.Object('src-bucket', 'src-file.json')
file_content = content_object.get()['Body'].read().decode('utf-8')
lines = file_content.splitlines()
#include <NewPing.h>
const int greenPin = 2;
const int redPin = 4;
const int bluePin = 3;
const int trigPin = 11;
const int echoPin = 12;
enum color {
red,
@caevyn
caevyn / ecs.json
Created November 17, 2015 10:38
ecs cloudformation
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Parameters" : {
"KeyName": {
"Type": "AWS::EC2::KeyPair::KeyName",
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the ECS instances"
},
"SubnetID": {
"Type": "List<AWS::EC2::Subnet::Id>",
"Description": "List of an existing subnet IDs to use for the load balancer and auto scaling group"
@caevyn
caevyn / Dockerfile
Last active October 20, 2015 04:00
docker openresty
# Dockerfile for openresty
FROM centos:7
MAINTAINER matt murphy
ENV http_proxy http://10.0.2.2:3128/
ENV https_proxy https://10.0.2.2:3128/
ENV PKG ngx_openresty-${openresty_version:-"1.7.10.1"}
RUN yum install -y readline-devel pcre-devel openssl-devel gcc wget perl make
RUN wget http://openresty.org/download/${PKG}.tar.gz \
set nocompatible
filetype off
set rtp+=%USERPROFILE%/_vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'kien/ctrlp.vim'
call vundle#end()
@caevyn
caevyn / ApiOperationDescriptionAttribute.cs
Created August 6, 2015 04:11
web api description filter
public class ApiOperationDescriptionAttribute : Attribute
{
public string Description { get; set; }
public ApiOperationDescriptionAttribute(string description)
{
Description = description;
}
}
public class LookupOperationFilter : IOperationFilter
@caevyn
caevyn / nginx
Last active August 29, 2015 14:22 — forked from vdel26/nginx
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx
# For Debian, run: update-rc.d -f nginx defaults
# For CentOS, run: chkconfig --add nginx
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
@caevyn
caevyn / cf.json
Last active August 29, 2015 14:22
empty vpc
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation demo thingy",
"Parameters": {
"Environment": {
"Description": "Environment",
"Type": "String",
"MinLength": "3",
"MaxLength": "4",
"Default": "DEV",
@caevyn
caevyn / gist:0d4e096655430a528c5e
Created May 27, 2015 03:45
nginx packer file
{
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "ap-southeast-2",
@caevyn
caevyn / ecs.json
Last active June 28, 2017 02:00
ecs definition
{
"taskDefinitionArn": "arn:aws:ecs:us-west-2:<scc number>:task-definition/build-blog:3",
"revision": 3,
"containerDefinitions": [
{
"volumesFrom": [],
"portMappings": [],
"command": [],
"environment": [
{