Skip to content

Instantly share code, notes, and snippets.

View moofish32's full-sized avatar

Mike Cowgill moofish32

View GitHub Profile
// Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Generated from the AWS CloudFormation Resource Specification
// See: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html
// @cfn2ts:meta@ {"generated":"2019-06-17T20:08:49.014Z","fingerprint":"Y9UchU9pctC6/xWTm7rE/XBp8d05mvBX9wvFf2MixrM="}
// tslint:disable:max-line-length | This is generated code - line lengths are difficult to control
import cdk = require('@aws-cdk/cdk');
/**
// Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Generated from the AWS CloudFormation Resource Specification
// See: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html
// @cfn2ts:meta@ {"generated":"2019-06-17T20:08:04.438Z","fingerprint":"RRaQrKXriTRnT5GDKdzJRqLngFMESa0HgUFjHJUl2rM="}
// tslint:disable:max-line-length | This is generated code - line lengths are difficult to control
import cdk = require('@aws-cdk/cdk');
/**
@moofish32
moofish32 / ingress-control-check.ts
Created April 15, 2019 04:22
cdk aspect for checking for an ingress control issue
import cdk = require('@aws-cdk/cdk');
import ec2 = require('@aws-cdk/aws-ec2');
export class IngressControlCheck implements cdk.IAspect {
constructor(private readonly cidr: string, private readonly port: number) { }
public visit(construct: cdk.Construct) {
if (cdk.CfnResource.isCfnResource(construct) && this.isCfnSecurityGroup(construct)) {
this.check(construct);
@moofish32
moofish32 / app-delivery-example.ts
Last active November 15, 2018 17:27
Simple App Delivery Example
import codebuild = require('@aws-cdk/aws-codebuild');
import codepipeline = require('@aws-cdk/aws-codepipeline');
import s3 = require('@aws-cdk/aws-s3');
import iam = require('@aws-cdk/aws-iam');
import ec2 = require('@aws-cdk/aws-ec2');
import cdk = require('@aws-cdk/cdk');
import cicd = require('@aws-cdk/app-delivery');
const app = new cdk.App();
import dyn = require('@aws-cdk/aws-dynamodb');
import cdk = require('@aws-cdk/cdk');
export class DynamoExport extends cdk.Stack {
public readonly tableNameOutput: cdk.Output;
public readonly tableArnOutput: cdk.Output;
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
super(parent, name, props);
export class Helper {
public help(): string {
return 'your welcome for the help';
}
}
export interface Helpable {
help: Helper;
}
Adding the above rm command to the end of the script will result in cleaning up the PID file after a successful execution. If the script exits any other places this step should be included before the exit command.
Summary of Changes
Now that we have made our changes let's take another look at this script.
#!/bin/bash
PIDFILE=/home/vagrant/forever.pid
if [ -f $PIDFILE ]
then
@moofish32
moofish32 / keybase.md
Created March 7, 2017 08:40
github proof

Keybase proof

I hereby claim:

  • I am moofish32 on github.
  • I am moofish32 (https://keybase.io/moofish32) on keybase.
  • I have a public key ASBl4zn7ZSZKszjGuc7vW97e0-GlyuUtSmKYUHm49fSTGAo

To claim this, I am signing this object:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: GPGTools - https://gpgtools.org
mQINBFYwAecBEADa6rlfrN6hLwJXeIjuRGj+E8KknKCIRo6rymlOmh9x9lHCDGPY
OVVzVj/+ETD52ZdPEwg8oQvwmy53dAbQJgVyFnMdE71dkBYrYkKf7HpKf40eu26O
vbx8QC0ZOY52HipwnIm1lgs3lYxo1lXoPNvjFkPkkLgur+Wr59q5rI+cTks9n8Y9
ymHyHgulSyA+RDz/rXeaCt5AiwN5JJHoQgRW/QvsMxmVSOTM0uBMg23P69kr6/Vl
ypW37KkanLTcvDDEfckbeJvrxFAtmUROGCoWwZWSVnFTMRjAxOJSfrUurZp0Af0G
xGhjy9htP5cUgAk1VtSdBS976w0hRz3jM4Ag7U4EPJ5GCNOo3RW7jc5ac5ldpXjW
PhYiM9TO/3uyFTsljz9B/wlgirq5kcWzpCPc8Ker2Pg22yjEZcI1oSXD4aZ98rDG
@moofish32
moofish32 / ubuntu_init.sh
Created October 13, 2015 16:41
init script for an ubuntu box
fancy_echo() {
printf "\n%b\n" "$1"
}
install_if_needed() {
local package="$1"
if [ $(dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
sudo aptitude install -y "$package";