Skip to content

Instantly share code, notes, and snippets.

View patrickbrandt's full-sized avatar

Patrick Brandt patrickbrandt

View GitHub Profile
@patrickbrandt
patrickbrandt / stream.go
Created January 15, 2019 11:43
My answer to rot13
// my answer: https://tour.golang.org/methods/23
// their answer: https://github.com/golang/tour/blob/master/solutions/rot13.go
package main
import (
"io"
"os"
"strings"
"bytes"
@patrickbrandt
patrickbrandt / fib.go
Created December 16, 2018 20:34
Fibonacci in Go
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
// this is my solve to https://tour.golang.org/moretypes/26
func fibonacci() func() int {
next := -1
@patrickbrandt
patrickbrandt / RiskMitigation.md
Created August 5, 2018 21:54
PBP-RiskMitigation
Risk Mitigation
The inability to get stories “Ready” The customer's product owner is responsible for ensuring that stories have proper acceptance criteria. The delivery team is responsible for other artifacts like wireframes and design comps.

The contract could include a stipulation that a dedicated delivery team will be maintained only if the product owner is able to fulfill their obligation to provide acceptance criteria in a timely manner. Otherwise, the supplier is responsible for ensuring any other supporting documentation is provided so that coders can build the application.
@patrickbrandt
patrickbrandt / PointCriteria.md
Created August 5, 2018 21:54
PBP-PointCriteria
Points Complexity The software developer’s perspective
1 XS
@patrickbrandt
patrickbrandt / DefectCriteria.md
Created August 5, 2018 21:53
PBP-DefectCriteria
Severity Type Description
Blocker
    Blocks development, testing or content entry such that project milestones are jeopardized
const bb = require('bluebird');
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const removeObject = (bucketName, obj) => {
const params = {
Bucket: bucketName,
Key: obj.Key,
};
@patrickbrandt
patrickbrandt / handler.py
Last active March 13, 2018 04:38
Restricting Lambda function by IP address
import json
import os
def ping(event, context):
ip1 = event['headers']['X-Forwarded-For'].split(',')[0]
ip2 = event['requestContext']['identity']['sourceIp']
print('two different referring IP address parsing techniques ip1: %s and ip2: %s') % (ip1, ip2)
referringIP = event['requestContext']['identity']['sourceIp']
#TODO: use a comma-delimited string to store multiple IP address values in the environment variable
@patrickbrandt
patrickbrandt / S3-readonly-bucket.json
Created November 22, 2016 18:21
IAM Policy for read-only S3 bucket access
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUserToSeeBucketListInTheConsole",
"Action": [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
"Effect": "Allow",
@patrickbrandt
patrickbrandt / angularExample.js
Last active March 16, 2016 17:37
Network connectivity-check worker + angular 1 service wrapper
angular.module('example')
.controller('MainCtrl', ['connectivityService', function(connectivityService) {
connectivityService.onReconnect(function(){
console.log('back online');
});
connectivityService.onLostConnection(function(){
console.log('lost connection');
});
connectivityService.start();
}]);