Skip to content

Instantly share code, notes, and snippets.

Patrick Brandt patrickbrandt

Block or report user

Report or block patrickbrandt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@patrickbrandt
patrickbrandt / stream.go
Created Jan 15, 2019
My answer to rot13
View stream.go
// 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 Dec 16, 2018
Fibonacci in Go
View fib.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
View RiskMitigation.md
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.
View PointCriteria.md
Points Complexity The software developer’s perspective
1 XS
View DefectCriteria.md
Severity Type Description
Blocker
  • Blocks development, testing or content entry such that project milestones are jeopardized
View empty-s3-buckets.js
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 Mar 13, 2018
Restricting Lambda function by IP address
View handler.py
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 Nov 22, 2016
IAM Policy for read-only S3 bucket access
View S3-readonly-bucket.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUserToSeeBucketListInTheConsole",
"Action": [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
"Effect": "Allow",
@patrickbrandt
patrickbrandt / angularExample.js
Last active Mar 16, 2016
Network connectivity-check worker + angular 1 service wrapper
View angularExample.js
angular.module('example')
.controller('MainCtrl', ['connectivityService', function(connectivityService) {
connectivityService.onReconnect(function(){
console.log('back online');
});
connectivityService.onLostConnection(function(){
console.log('lost connection');
});
connectivityService.start();
}]);
You can’t perform that action at this time.