Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Aaron Schlesinger arschles

🏠
Working from home
View GitHub Profile
@arschles
arschles / more-resources.md
Last active Aug 28, 2018
Tuning an HTTP Client for Great Good!
View more-resources.md

Other Go Libraries to Help With Doing HTTP Clients

  • ctxhttp - use HTTP clients but do requests timeouts with a context
    • httptrace - a good library to pair with ctxhttp; you can use this to trace requests up to the server. this is pretty advanced usage, so I recommend you go here once you have basic performance issues sorted out
  • fasthttp - slightly easier-to-use HTTP client. you still have to deal with connection pool details though. still useful if you like the API better
  • go-cleanhttp - battle-tested HTTP client. useful to compare against the above code
  • gorequest - nicer API, not as geared toward load testing. recommend against this for load tests, but for business logic it's good
@arschles
arschles / athens-tests.sh
Created Aug 15, 2018
Running athens tests
View athens-tests.sh
#!/bin/sh
make dev-teardown
export GO_BINARY_PATH=go1.11rc1
make alldeps
# sleep a little more
sleep 5
buffalo db create
buffalo db migrate up
make test-unit
@arschles
arschles / buffalo_actions_test.go
Last active Jul 10, 2018
Sample Buffalo Test
View buffalo_actions_test.go
package actions
// this is a test method. It needs to have the prefix "Test"
func (a *ActionSuite) TestSomething() {
// this gives you one of these: https://godoc.org/github.com/stretchr/testify/require#Assertions
//
// you can also use a.Assert() to get one of these: https://godoc.org/github.com/stretchr/testify/assert#Assertions
r := a.Require()
// this gets you a completely empty DB with all the schemas and migrations already run on it.
@arschles
arschles / demo.sh
Last active May 18, 2018
Cloud Native PDX May 17 2018 Demo Commands
View demo.sh
#!/bin/bash
echo "OSBA (the broker for Azure) and service-catalog (the adapter for Kubernetes) are installed:"
helm list
echo "we also have a cool catalog of services we can create and hook up to:"
kubectl get clusterserviceclasses
echo "that's lame ... let's use svcat to see a friendly version:"
svcat get classes
@arschles
arschles / retro.md
Created Aug 16, 2017
SIG-Service-Catalog LGTM Policy Retro 8/17/2017
View retro.md

This PR was merged on July 19, 2017: https://github.com/kubernetes-incubator/service-catalog/pull/1050.

In the thread on that PR, both jdumars and I suggested that we try the change out and then have a retrospective on how that change has affected:

  1. Our ability to actively get a PR merged
  2. The quality of the project over the month of the LGTM policy as of this PR

I'll be facilitating an initial 15 minute retrospective.

If you have opinions on either of those topics, please bring them to present at this meeting. I am going to focus this discussion on opinions backed up with data that show trends over the 7/19 - 8/17 time frame.

@arschles
arschles / binding-finalizer.md
Last active Dec 7, 2016
Finalizer Example for Binding Objects
View binding-finalizer.md
metadata:
  name: my-binding
  namespace: default
  finalizers:
    - kubernetes # a default
    - something.deis.io/a # custom
    - something.deis.io/b # custom
@arschles
arschles / for_select.go
Last active Oct 17, 2016
for/select loop for tickers & timers
View for_select.go
i := 0
for {
select {
case <- timer.C:
return
case <-ticker.C:
fn(i)
i++
}
}
@arschles
arschles / chan-over-chan.go
Created Sep 9, 2016
Sending a channel over a channel
View chan-over-chan.go
package main
import (
"log"
"time"
)
type acker struct {
ch chan time.Duration
}
@arschles
arschles / sample_claim.yaml
Last active Sep 1, 2016
Sample Steward manifest
View sample_claim.yaml
kind: ConfigMap
apiVersion: v1
metadata:
name: claim-1
namespace: default
labels:
type: service-plan-claim
data:
service-id: "helm-alpine"
plan-id: "standard"
@arschles
arschles / ctx.go
Created Aug 26, 2016
Golang 1.7 Contexts
View ctx.go
package main
import (
"context"
"log"
"net/http"
"sync"
"time"
)
You can’t perform that action at this time.