Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
@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"
)
package main
import (
"fmt"
"reflect"
)
func main() {
a := []int{1, 2, 3, 4}
#!/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}' )
@StevenACoffman
StevenACoffman / keyfob.go
Created April 27, 2018 15:47
Add or remove SSH Certificate based on expiration and source ip
package main
import (
"os"
"io/ioutil"
"time"
"golang.org/x/crypto/ssh"
"net"
"golang.org/x/crypto/ssh/agent"
"crypto/rsa"
@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
@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 / 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 / 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