Skip to content

Instantly share code, notes, and snippets.

View Jaaromy's full-sized avatar

Jaaromy Zierse Jaaromy

View GitHub Profile
@Jaaromy
Jaaromy / buildspec.yml
Last active September 25, 2018 18:51
Respond to CloudFormation WaitCondition in a repository buildspec.yml
version: 0.2
phases:
install:
commands:
- npm install
build:
commands:
- npm test
post_build:
@Jaaromy
Jaaromy / simplevpc.tf
Last active July 12, 2018 22:06
Terraform template for VPC, NAT Gateway, Multiple Instances, latest Amazon Linux 2, SSM RunCommand enabled, Node.js, Git
provider "aws" {
region = "${var.region}"
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
name = "EastWSingleNAT"
cidr = "10.0.0.0/16"
@Jaaromy
Jaaromy / index.js
Created April 23, 2018 18:27
Recursive Get from the AWS Parameters Store using Node.js and promises
const rg = require('./recursiveGetParametersByPath.js');
rg.recursiveGet('/', 'us-east-1')
.then(parameters => {
console.log(JSON.stringify(parameters));
})
.catch(err => {
console.error(err, err.stack);
});
@Jaaromy
Jaaromy / buildspec.yml
Created February 16, 2018 19:41
Buildspec for Jekyll site hosted in S3 with CloudFront invalidation
version: 0.2
env:
parameter-store:
DIST_ID : "/cloudfront/offcoding/distid"
phases:
install:
commands:
- gem install bundler
@Jaaromy
Jaaromy / aws_cloudformation_launchconfig.json
Created February 16, 2018 18:00
AWS CloudFormation Launch Configuration
"Resources": {
"LaunchConfig": {
"Type": "AWS::AutoScaling::LaunchConfiguration",
"Properties": {
"InstanceMonitoring": false,
"InstanceType": {
"Fn::FindInMap": ["EnvMap", {
"Ref": "EnvType"
}, "InstanceType"]
},
@Jaaromy
Jaaromy / aws_cloudformation_userdata.json
Last active February 16, 2018 17:40
Define the User Data section of an AWS CloudFormation to be CodeDeploy ready
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"", [
"#!/bin/bash -ex\n",
"yum update -y\n",
"yum -y install ruby\n",
"yum -y install wget\n",
"yum -y install libcurl-devel\n",
"yum -y install zlib-devel\n",
@Jaaromy
Jaaromy / redisscan.js
Last active September 26, 2022 06:06
Recursive Redis SCAN for Node.js using promises
const bluebird = require('bluebird');
const redis = require('redis');
bluebird.promisifyAll(redis.RedisClient.prototype);
bluebird.promisifyAll(redis.Multi.prototype);
const redisClient = redis.createClient({
host: process.env.CACHE_HOST
});
let cacheFail = false;
const mylib = require(`${process.cwd()}/lib/mylib`);
const mylib = require('../../lib/mylib'); // Wait...is it two or three directories up?
@Jaaromy
Jaaromy / PollyWaitAndRetry.cs
Last active December 12, 2016 16:27
Polly WaitAndRetry
var policy = Policy
.Handle<Exception>()
.WaitAndRetry(5, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
(exception, timeSpan, retryCount, context) =>
{
Console.WriteLine($"{exception} == {timeSpan} == {retryCount} == {context}");
})
.ExecuteAndCapture(() =>
{
throw new InvalidOperationException("This is the exception message");