Skip to content

Instantly share code, notes, and snippets.

@ppshein
ppshein / buckets.tf
Last active May 27, 2020 13:20 — forked from nagelflorian/buckets.tf
Terraform config for static website hosting on AWS
# AWS S3 bucket for static hosting
resource "aws_s3_bucket" "website" {
bucket = "${var.website_bucket_name}"
acl = "public-read"
tags {
Name = "Website"
Environment = "production"
}
@ppshein
ppshein / aws-ship-it-stack.yml
Created June 10, 2019 14:34 — forked from TheDeveloper/aws-ship-it-stack.yml
App deploy stack with ECS, CodeBuild & CodePipeline.
# App ship-it stack with ECS, CodeBuild & CodePipeline.
#
# aws cloudformation deploy \
# --stack-name myapp-prod \
# --template-file ./aws-ship-it-stack.yaml \
# --parameter-overrides \
# KeyName=<KEY_NAME> \
# GitHubAuthToken=<ACCESS_TOKEN> \
# RepoOwner=<OWNER_NAME> \
# RepoName=<REPO_NAME> \
@ppshein
ppshein / setup-awscli-codedeploy-agent.sh
Created June 6, 2019 09:50 — forked from craigvantonder/setup-awscli-codedeploy-agent.sh
How to install AWS Code Deploy agent in Ubuntu 14.04 / 16.04 / 18.04
#!/bin/bash
# AWS CLI
apt-get install zip -y;
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip";
unzip awscli-bundle.zip;
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws;
aws configure;
#AWS Access Key ID [None]: Obtained when creating user in AWS IAM
@ppshein
ppshein / Dockerfile
Last active June 6, 2019 07:37
SailsJS Docker Image
# Instructions from the app developer
# - you should use the 'node' official image, with the alpine 6.x branch
FROM node:latest
# - this app listens on port 3000, but the container should launch on port 80
# so it will respond to http://localhost:80 on your computer
EXPOSE 1337
# - then it should use alpine package manager to install tini: 'apk add --update tini'
# RUN apk add --update tini
# - then it should create directory /usr/src/app for app files with 'mkdir -p /usr/src/app'
RUN mkdir -p /usr/src/app
@ppshein
ppshein / aws-s3-multer-nodejs.js
Last active May 15, 2019 11:19
Upload files to AWS-S3 with NodeJS
var aws = require('aws-sdk')
var express = require('express')
var multer = require('multer')
var multerS3 = require('multer-s3')
var app = express()
var s3 = new aws.S3({
accessKeyId: '',
secretAccessKey: '',
region: 'ap-southeast-1'
@ppshein
ppshein / aws-codebuild-cross-account-image-push.yml
Created May 10, 2019 03:47 — forked from tvalletta/aws-codebuild-cross-account-image-push.yml
AWS CodeBuild buildspec.yml example for building a docker image and pushing it to a AWS ECS docker repo in another AWS account
version: 0.1
# REQUIRED ENVIRONMENT VARIABLES
# AWS_KEY - AWS Access Key ID
# AWS_SEC - AWS Secret Access Key
# AWS_REG - AWS Default Region (e.g. us-west-2)
# AWS_OUT - AWS Output Format (e.g. json)
# AWS_PROF - AWS Profile name (e.g. central-account)
# IMAGE_REPO_NAME - Name of the image repo (e.g. my-app)
# IMAGE_TAG - Tag for the image (e.g. latest)
@ppshein
ppshein / appspec.yml
Created April 10, 2019 10:56 — forked from moshest/appspec.yml
Node.js Project on AWS CodeDeploy CentOS
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/node
permissions:
- object: /home/ec2-user
owner: ec2-user
group: ec2-user
type:
@ppshein
ppshein / bobp-python.md
Created March 15, 2019 04:14 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
+-- app
| +-- bower.json
| +-- index.html
| +-- index.js
| +-- index.css
+-- gulpfile.js
+-- package.json
### STAGE 1: Build ###
@ppshein
ppshein / EMV QR
Last active January 9, 2019 10:59
0002010102112926000910091704805091009170485802MM64060002my54030.05303MMK6231010100209100917048100910091704863040956
/*
TagId
ValueLength
Value
*/
00 [Payload Format Indicator - M]