Skip to content

Instantly share code, notes, and snippets.

View iDVB's full-sized avatar
💭
Work'n

Dan Van Brunt iDVB

💭
Work'n
View GitHub Profile
@iDVB
iDVB / Dockerfile
Last active December 14, 2018 21:21
FROM amazonlinux:1
WORKDIR /tmp
#install the dependencies
RUN yum -y install gcc-c++ && yum -y install findutils
RUN touch ~/.bashrc && chmod +x ~/.bashrc
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
@iDVB
iDVB / docker-compose.yml
Last active October 24, 2018 00:51
WebPageTest local
version: "2"
services:
server:
image: webpagetest/server:latest
volumes:
- ./server/locations.ini:/var/www/html/settings/locations.ini
agent:
image: webpagetest/agent:latest
environment:
@iDVB
iDVB / lambda.js
Created March 1, 2018 04:51
Custom Resource for AWS Transcoder Pipelines
var AWS = require('aws-sdk');
var elastictranscoder = new AWS.ElasticTranscoder();
var Create = function(params, reply) {
elastictranscoder.createPipeline(params, function(err, data) {
if (err) {
console.error(err);
reply(err);
} else {
@iDVB
iDVB / serverless.yml
Created March 1, 2018 04:33
WAF Rules
Resources:
WebACL:
Type: "AWS::WAF::WebACL"
Properties:
DefaultAction:
Type: BLOCK
MetricName: "TrustedIPs"
Name: "TrustedIPs"
Rules:
- Action:
const path = require('path');
const { STATUS_CODES } = require('http');
exports.rewriteHandler = (evt, ctx, cb) => {
const { request } = evt.Records[0].cf;
const htmlExtRegex = /(.*)\.html?$/;
if (htmlExtRegex.test(request.uri)) {
const uri = request.uri.replace(htmlExtRegex, '$1');
return cb(null, redirect(uri));
}
service: service-name
provider:
name: aws
runtime: nodejs6.10
region: us-east-1
functions:
hello:
handler: handler.hello
@iDVB
iDVB / lambda.js
Last active April 8, 2019 16:11
Lambda Using SSM
const AWS = require('aws-sdk');
const ssm = new AWS.SSM({ apiVersion: '2014-11-06' });
exports.handler = (event, context, cb) => {
ssm
.getParameter({ Name: 'awesomeParam' })
.promise()
.then(resp => {
const value = resp.Parameter.Value;
cb(null, `Success: the param value is ${value}`);
@iDVB
iDVB / ssm-param.yml
Last active March 1, 2018 17:24
SSM Param
---
Type: "AWS::SSM::Parameter"
Properties:
Name: awesomeParam
Description: A Great Param
Type: String
Value: {Ref: SomeResourceID}
@iDVB
iDVB / TranscriptTextHighlighter.js
Last active February 3, 2017 02:33
TranscriptTextHighlighter Component
import React, { PropTypes } from 'react';
import cx from 'classnames';
class TranscriptTextHighlighter extends React.Component {
constructor() {
super();
this.state = {
activeIndex: 3,
<div class="interaction">
<div>BobSmith:</div>
<div class="spoke">
<p><span class="caption">aadfasdfalkja</span> <span class="caption">kjadslk akldf klasj</span></p>
<p><span class="caption">aadfasdfalkj</span></p>
<p><span class="caption">aadfasdfalkj</span></p>
</div>
</div>