Skip to content

Instantly share code, notes, and snippets.

View dave-malone's full-sized avatar

Dave Malone dave-malone

  • Amazon Web Services
  • Tampa, FL
View GitHub Profile
'use strict'
/* This list may be incomplete or outdated! It may be best to integrate with an external service to obtain these values */
const eu_country_codes = ['BE','BG','CZ','DK','DE','EE','IE','EL','ES','FR','HR','IT','CY','LV','LT','LU','HU','MT','NL','AT','PL','PT','RO','SI','SK','FI','SE','UK']
const us_origin_domain = 'ec2-54-166-49-18.compute-1.amazonaws.com'
const eu_origin_domain = 'ec2-34-244-9-66.eu-west-1.compute.amazonaws.com'
/* This is an origin request function */
exports.handler = (event, context, callback) => {
@dave-malone
dave-malone / cloudformation_s3_serverside_encryption.yml
Created February 6, 2018 03:48
CloudFormation snippet to enable server side encryption by default on an s3 bucket
StaticAssetsS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: my-encrypted-bucket
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
VersioningConfiguration:
Status: Enabled
@dave-malone
dave-malone / aws_s3_presign.sh
Last active January 9, 2018 21:11
Bash function that wraps the AWS cli to help make it easier to generate presign urls
aws_s3_presign(){
if [ -z "$1" ]; then
echo "1st arg is the key for the s3 object to presign, and may not be empty"
return
fi
if [ -z "$2" ]; then
echo "2nd arg is the number of days that the presigned url is valid for, and may not be empty"
return
fi
/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills
* nodejs skill development kit.
* This sample supports multiple lauguages. (en-US, en-GB, de-DE).
* The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
* as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-fact
**/
'use strict'
console.log('Loading function')
const aws = require('aws-sdk')
const s3 = new aws.S3({ apiVersion: '2006-03-01' })
const elastictranscoder = new aws.ElasticTranscoder()
const config = {
pipeline_id: process.env.ELASTIC_TRANSCODER_PIPELINE_ID,

Check if a port is open: nc -z host.example.com 20-30

SSH tunneling: ssh -L 1234:vcsa-01.haas-43.pez.pivotal.io:443 [email protected]

Test ntp connectivity: ntpdate -d

cmd + , - open settings

cmd + shift + p - command palette while in command palette:

  • split right/left and move active item (to move current window into a side pane)

cmd + k, cmd + left/right arrow - switch between panes

cmd + n - new file

systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
#net:
# bindIp: 127.0.0.1
security:
authorization: enabled
@dave-malone
dave-malone / ops-manager.json
Created August 9, 2016 11:04
A copy of the Cloud Formation template for Pivotal Cloud Foundry on AWS with a Dedicated AWS instance tenancy setting
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Cloudformation template for configuring Pivotal Cloud Foundry on AWS",
"Conditions": {
"CreateRDS": {
"Fn::And":[
{ "Fn::Not": [ { "Fn::Equals": [ { "Ref": "04RdsDBName"}, "" ]}]},
{ "Fn::Not": [ { "Fn::Equals": [ { "Ref": "05RdsUsername"}, "" ]}]},
{ "Fn::Not": [ { "Fn::Equals": [ { "Ref": "06RdsPassword"}, "" ]}]}
]
@dave-malone
dave-malone / temp.cnf
Created May 16, 2016 18:15 — forked from dwallraff/temp.cnf
Temp openssl conf file for Multiple SAN Self-Signed Cert
[ req ]
distinguished_name = req_distinguished_name
req_extensions = server_req_extensions
prompt = no
[ req_distinguished_name ]
C = US
ST = CA
L = San Francisco
O = Pivotal