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
@p4tin
p4tin / genPass.go
Last active December 13, 2015 18:34
Golang Generate Passwords
package main
import (
"fmt"
"strings"
"bytes"
"github.com/Pallinder/go-randomdata"
)
func main() {
@p4tin
p4tin / generate_data.go
Created December 13, 2015 21:25
Demo the use of the github.com/Pallinder/go-randomdata
package main
import (
"fmt"
"github.com/Pallinder/go-randomdata"
)
func main() {
// Print a random silly name
fmt.Println(randomdata.SillyName())
@p4tin
p4tin / aes.key
Last active December 13, 2015 22:36
Demo of Data Encrypt/Decrypt with AES 256 Key
jHa1bVPQeck+3AsZJa9exEBcI9Pe40XvNSMsezaRr2c=
"""
Map oplog to you custom interface. To, for example, have triggers in mongo.
see example in '__main__' below
https://gist.github.com/rescommunes/4e5035242b8e4b07ff3a
"""
import logging
from time import sleep
import pickle
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"