Skip to content

Instantly share code, notes, and snippets.

View p4tin's full-sized avatar
💭
GO GO GO!!!

Paul Fortin p4tin

💭
GO GO GO!!!
View GitHub Profile
package main
import (
"fmt"
"math/rand"
"time"
)
type State struct {
name string
@p4tin
p4tin / gitkins-light.go
Last active August 16, 2016 23:01
Gitkins Light
package main
import (
"log"
"time"
"net/http"
"encoding/json"
"golang.org/x/oauth2"
"github.com/google/go-github/github"
)
package main
import (
"log"
"time"
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/engine/fasthttp"
)
func main() {
a := NewAuthorizer()
h := WithAuth(a, http.HandlerFunc(Handle))
http.ListenAndServe("/", h)
}
const TokenContextKey = "MyAppToken"
func WithAuth(a Authorizer, next http.Handler) http.Handler {
return http.HandleFunc(func(w http.ResponseWriter, r *http.Request) {
package main
import (
"context"
"log"
"net/http"
"time"
"fmt"
)
@p4tin
p4tin / caddy
Created February 25, 2017 03:33 — forked from slav123/caddy
caddy init.d script
#!/bin/bash
# Caddy daemon
# chkconfig: 345 20 80
# description: Caddy daemon
# processname: caddy
DAEMON_PATH="/usr/local/bin"
DAEMON='./caddy'
DAEMONOPTS="-conf=/etc/caddy/Caddyfile -log /var/log/caddy.log"
@p4tin
p4tin / poller-receiver.go
Last active October 21, 2017 00:03
golang message receive-process skeleton
package main
import (
"os"
"os/signal"
"sync"
"syscall"
"time"
log "github.com/sirupsen/logrus"
@p4tin
p4tin / sentinel.go
Created January 17, 2018 03:50
Go Routine Health Status - Future Kill/ReSpawn/Auto-Scale
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
const WORKERS = 3
@p4tin
p4tin / gen_slug.go
Last active January 18, 2018 04:04
package main
import (
"math/rand"
"time"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
@p4tin
p4tin / k8s-pi.md
Created February 11, 2018 13:28 — forked from alexellis/k8s-pi.md
K8s on Raspbian

K8s on (vanilla) Raspbian Lite

Yes - you can create a Kubernetes cluster with Raspberry Pis with the default operating system Raspbian. Carry on using all the tools and packages you're used to with the officially-supported OS.

Pre-reqs:

  • You must use an RPi2 or 3 for Kubernetes
  • I'm assuming you're using wired ethernet (Wi-Fi also works)

Master node setup