Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -e
GVERSION="1.9"
GFILE="go$GVERSION.linux-amd64.tar.gz"
GOPATH="/mnt/d/Dropbox/Go"
GOROOT="/usr/local/go"
if [ -d $GOROOT ]; then
echo "Installation directories already exist $GOROOT"
@djherbis
djherbis / keybase.md
Created February 18, 2017 21:58
Keybase Proof
@djherbis
djherbis / not.go
Last active August 29, 2015 14:19
Go "Not" Regex Prefix
package main
import (
"bytes"
"fmt"
"regexp"
)
func main() {
var valid = regexp.MustCompile(Not("abcd"))
@djherbis
djherbis / README.md
Last active August 29, 2015 14:18 — forked from joyrexus/README.md

Looks like you have to use gob to register the types you want to stow when using stow.NewStore.

Compare original example using stow.NewJsonStore.

See this post for context.

@djherbis
djherbis / fscache_ex.go
Last active August 29, 2015 14:17
FsCache Example.go
import (
"io"
"log"
"net/http"
"github.com/djherbis/fscache"
)
// This will only get called on a cache-miss
func Handler(w http.Response, r *http.Request) {
@djherbis
djherbis / Bad Cache.go
Last active August 29, 2015 14:17
Bad Cache Example
var mu sync.Mutex
var cache map[string][]byte
func Handler(w http.Response, r *http.Request) {
mu.Lock()
defer mu.Unlock()
url := r.URL.String()
p, ok := cache[url]
@djherbis
djherbis / Stow Example.go
Last active August 29, 2015 14:16
Example djherbis/stow usage.
package main
import (
"fmt"
"log"
"github.com/boltdb/bolt"
"github.com/djherbis/stow"
)