Skip to content

Instantly share code, notes, and snippets.

View arschles's full-sized avatar
🎯
Focusing

Aaron Schlesinger arschles

🎯
Focusing
View GitHub Profile
@arschles
arschles / retro.md
Created August 16, 2017 16:38
SIG-Service-Catalog LGTM Policy Retro 8/17/2017

This PR was merged on July 19, 2017: kubernetes-retired/service-catalog#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 December 7, 2016 21:20
Finalizer Example for Binding Objects
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 October 17, 2016 20:02
for/select loop for tickers & timers
i := 0
for {
select {
case <- timer.C:
return
case <-ticker.C:
fn(i)
i++
}
}
@arschles
arschles / chan-over-chan.go
Created September 9, 2016 20:52
Sending a channel over a channel
package main
import (
"log"
"time"
)
type acker struct {
ch chan time.Duration
}
@arschles
arschles / sample_claim.yaml
Last active September 1, 2016 21:25
Sample Steward manifest
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 August 26, 2016 20:51
Golang 1.7 Contexts
package main
import (
"context"
"log"
"net/http"
"sync"
"time"
)
@arschles
arschles / logs.txt
Created April 25, 2016 21:47
Storage Logs
ENG000656:workflow-manager-api aaronschlesinger$ kd logs -f deis-database-sr5al
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
@arschles
arschles / auth_middleware.go
Last active April 21, 2016 23:29
rudimentary auth middleware
func WithAuth(tokenToCheck, tokenHeaderName string, next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Header.Get(tokenHeaderName) != tokenToCheck {
http.Error(w, "not authorized", http.StatusUnauthorized)
return
}
next.ServeHTTP(w, r)
})
}
@arschles
arschles / scalaFutureTimeout.scala
Created September 7, 2013 01:22
how to time out a scala future
val realFuture = Future(doRealStuff())
//timeoutFuture does a spin wait by sleeping on the thread on which it runs, so make sure the ExecutionContext
//on which it runs is multi-threaded. In an akka based environment, use a scheduler to fulfill a promise with a failure
//when the timeout duration is complete, and avoid the spin wait
val timeoutFuture = Future {
Thread.sleep(timeoutMilliseconds)
throw new TimeoutException("timeout")
}
Future.firstCompletedOf(realFuture :: timeoutFuture :: Nil)
@arschles
arschles / controller_logs.txt
Last active April 11, 2016 19:04
deis-controller flapping
ENG000656:workflow-e2e aaronschlesinger$ kd logs -f deis-controller-rbexd
system information:
Django Version: 1.9.3
Python 3.5.1
Django checks:
System check identified no issues (2 silenced).
Health Checks:
Checking if database is alive
Database is alive!
Database Migrations: