Skip to content

Instantly share code, notes, and snippets.

View johncmckim's full-sized avatar

John McKim johncmckim

View GitHub Profile
@johncmckim
johncmckim / garden-aid-iot-hub-serverless-dynamodb.yml
Last active June 2, 2017 13:34
Garden Aid - IoT Hub - DynamoDB Table
MoistureData:
Type: AWS::DynamoDB::Table
DeletionPolicy: Retain
Properties:
TableName: moisture-data-${{opt:stage}}
AttributeDefinitions:
-
AttributeName: ClientId
AttributeType: S
-
@johncmckim
johncmckim / garden-aid-iot-hub-serverless-iot.yml
Last active November 29, 2020 19:54
Garden Aid - IoT Hub - IoT Resources
SensorThing:
Type: AWS::IoT::Thing
Properties:
AttributePayload:
Attributes:
SensorType: soil
SensorThingPolicy:
Type: AWS::IoT::Policy
Properties:
@johncmckim
johncmckim / garden-aid-iot-hub-serverless.yml
Last active November 24, 2017 04:44
Garden Aid - IoT Hub - serverless.yml
service: garden-aid-iot-hub
provider:
name: aws
runtime: nodejs4.3
# custom variable syntax is needed to avoid conflits with aws cloudformation functions
variableSyntax: '\${{([\s\S]+?)}}'
# load custom variables from a file
custom: ${{file(./vars-${{opt:stage}}.yml)}}
@johncmckim
johncmckim / garden-aid-iot-device.js
Created September 19, 2016 10:05
Garden Aid - IoT Hub - Device
const awsIot = require('aws-iot-device-sdk');
const interval = 1000 * 60 * 1; // one minute
const device = awsIot.device({
keyPath: './path/to/your/private.pem.key',
certPath: './path/to/your/certificate.pem.crt',
caPath: './path/to/your/verisign-ca.pem',
clientId: 'garden-aid-client-test-js',
region: 'ap-southeast-2'
@johncmckim
johncmckim / keybase.md
Created December 16, 2016 03:05
keybase.md

Keybase proof

I hereby claim:

  • I am johncmckim on github.
  • I am johncmckim (https://keybase.io/johncmckim) on keybase.
  • I have a public key ASA3Auj6jyN4fFD4UjSQ2XJMWdfYLDiptLs-FWB23bkK6wo

To claim this, I am signing this object:

@johncmckim
johncmckim / serverless.yml
Created January 15, 2017 01:53
Emoticon Faceswap serverless.yml
service: serverless-emoticon-faceswap
provider:
name: aws
runtime: nodejs4.3
# Allow Lambda to access Rekognition and S3
iamRoleStatements:
- Effect: Allow
Action:
- rekognition:DetectFaces
Resource: '*'
@johncmckim
johncmckim / faceswap.js
Last active January 15, 2017 03:04
Emoticon Faceswap Handler
'use strict';
const BbPromise = require('bluebird');
const path = require('path');
const logger = require('./logger');
const processor = require('./processor');
const rekognition = require('./rekognition');
const BUCKET_NAME = process.env.BUCKET_NAME;
@johncmckim
johncmckim / package.json
Last active May 1, 2017 17:31
Prune Lambda Functions - PLEASE REVIEW AND USE AT YOUR OWN RISK
{
"dependencies": {
"aws-sdk": "^2.7.10",
"bluebird": "^3.4.6",
"lodash": "^4.17.2",
"moment": "^2.17.1"
}
}