Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
@StevenACoffman
StevenACoffman / nginx.conf
Created December 6, 2017 14:09 — forked from sansmischevia/nginx.conf
nginx http proxy to s3 static websites
##
## This nginx.conf servers as the main config file for webflow reverse proxy
##
## RCS:
## https://gist.github.com/sansmischevia/5617402
##
## Hardening tips:
## http://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html
##
@StevenACoffman
StevenACoffman / curl.md
Created March 2, 2018 22:12 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@StevenACoffman
StevenACoffman / main.go
Created April 9, 2018 15:23 — forked from danehammer/main.go
Equilibrium indices in go
package equilib
// Indices returns any of the equilibrium indices, -1 if there is not one
func Indices(nums []int) int {
if len(nums) > 10 {
return -2
}
for i := 0; i < len(nums); i++ {
left := sum(nums[0:i])
right := sum(nums[i+1:])
@StevenACoffman
StevenACoffman / struct_generator.go
Created April 9, 2018 19:07 — forked from objectx/struct_generator.go
Q: How to construct a generator whose types are generated via `gopter/gen`
func genStruct() gopter.Gen {
return genStrucType().FlatMap(
func(arg interface{}) gopter.Gen {
// typ := arg.(reflect.Type)
// Q: How to construct a generator?
return nil
},
reflect.TypeOf((interface{})(nil)),
)
}
@StevenACoffman
StevenACoffman / kms_auth.go
Created April 17, 2018 11:03 — forked from alsmola/kms_auth.go
Confidant style KMS-based authentication in Go
/*
Copyright 2016 Alex Smolen (https://alexsmolen.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
#!/bin/bash -e
# Usage ./k8s-service-account-kubeconfig.sh ( namespace ) ( service account name )
TEMPDIR=$( mktemp -d )
trap "{ rm -rf $TEMPDIR ; exit 255; }" EXIT
SA_SECRET=$( kubectl get sa -n $1 $2 -o jsonpath='{.secrets[0].name}' )
package main
import (
"fmt"
"reflect"
)
func main() {
a := []int{1, 2, 3, 4}
@StevenACoffman
StevenACoffman / streams_to_firehose.go
Created May 9, 2018 00:09 — forked from harlow/streams_to_firehose.go
Golang lambda function to send Streams data to Firehose
package main
import (
"github.com/apex/go-apex"
"github.com/apex/go-apex/kinesis"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/firehose"
)
@StevenACoffman
StevenACoffman / golang_kinesis.go
Created May 9, 2018 00:16 — forked from coboshm/golang_kinesis.go
Golang + Kinesis firehose
package main
import (
"log"
"encoding/json"
"fmt"
"os"
"math/rand"