Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"net/http"
"sync"
)
// Max request limit. Gives all customers the same limit. Set to 1 so it is easy to test
// When the request count exceeds the limit a 429 is returned.
package main
import (
"fmt"
"net/http"
"sync"
)
// Max request limit. Gives all customers the same limit. Set to 1 so it is easy to test
// When the request count exceeds the limit a 429 is returned.
  1. Show me some code you've written that you're proud of. Tell me why it's cool, well written, and maintainable. Also share a link to your GitHub profile or similar if you haven't already.

    The public code that I am most proud of would be the provisioner I wrote for the Kubernetes InstanceGroup project. The provisoner I developed incorporated Amazon's EKS Fargate. I am most proud of it because Intuit (my current employer) uses to run their TurboTax and QuickBooks applications. Here is the final merge to master.

    Because it was open-source and to be used by so many people, the primary objectives throughout the development was functional clarity, adherence to K8s methods, strong encapsulation of AWS and incorporation of standard Golang idioms. I think the code is clean, well-factored and is easy to maintain. While it has been used in production for nearly 6 months, there have been no issues.

case "eks-cf":
err := r.ReconcileEKSCF(ig, finalizerName)
if err != nil {
log.Errorln(err)
}
currentState := ig.GetState()
if currentState == v1alpha.ReconcileErr {
log.Errorln("reconcile failed")
return ctrl.Result{}, nil
apiVersion: instancemgr.keikoproj.io/v1alpha1
kind: InstanceGroup
metadata:
creationTimestamp: "2020-02-28T20:48:40Z"
generation: 1
name: hello-world-fargate
namespace: instance-manager
resourceVersion: "268582"
selfLink: /apis/instancemgr.keikoproj.io/v1alpha1/namespaces/instance-manager/instancegroups/hello-world-fargate
uid: b339b681-5a6b-11ea-bd68-06a5020d85c4

Keybase proof

I hereby claim:

  • I am thomaswhitcomb on github.
  • I am thomaswhitcomb (https://keybase.io/thomaswhitcomb) on keybase.
  • I have a public key ASCoEGuDOsv90ZcKBTvk-vH0MQJdr7fo2X82SYGCY69PaQo

To claim this, I am signing this object:

@thomaswhitcomb
thomaswhitcomb / gist:9121624
Created February 20, 2014 19:42
Generalized "read access" wrapper
func wrapper(x interface{}) func() interface{} {
var xx = x
return func() interface{}{
return xx
}
}
@thomaswhitcomb
thomaswhitcomb / gist:9119570
Created February 20, 2014 17:56
Data hiding - the integer can only be modified/accessed through the get/set functions.
type obj_interface struct{
set func(y int)
get func() int
}
func instantiate() *obj_interface {
var x int
var o = new(obj_interface)
o.set = func(y int){
x = y
@thomaswhitcomb
thomaswhitcomb / gist:7937271
Created December 12, 2013 23:15
Functional play time
package main
import "fmt"
type II interface{}
func mapper (collection [] II,fn func(II) II) [] II {
mapped := make([] II,0)
for _,v := range(collection){
mapped = append(mapped,fn(v))