Skip to content

Instantly share code, notes, and snippets.

@siliconcow
siliconcow / gist:bd9e4ac5fa994c834dc5
Created February 11, 2016 18:24
confd nginx difficulties
location /{{ if (exists (printf "/orca/router/routes/%s" .)) }}{{getv (printf "/orca/router/routes/%s")}}/ {{else}}{{ . }}{{end}} {
@siliconcow
siliconcow / gist:fc17703c7f123cd943b9
Last active October 22, 2015 20:19
Docker cache optimization (osx)
#!/bin/bash
#put this in .git/hooks/post-checkout and chmod 755
platform='unknown'
unamestr=`uname`
if [[ "$OSTYPE" == "linux-gnu" ]]; then
touchutil='touch'
dateutil='date'
elif [[ "$OSTYPE" == darwin* ]]; then
brew install coreutils > /dev/null 2>&1
touchutil='gtouch'
@siliconcow
siliconcow / gist:d5c991f49b7550360465
Created October 7, 2015 17:47
Dockerfile cache optimization
#!/bin/bash
platform='unknown'
unamestr=`uname`
if [[ "$OSTYPE" == "linux-gnu" ]]; then
touchutil='touch'
dateutil='date'
elif [[ "$OSTYPE" == darwin* ]]; then
brew install coreutils > /dev/null 2>&1
touchutil='gtouch'
dateutil='gdate'
#cloud-config
coreos:
update:
reboot-strategy: off
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
#discovery: https://discovery.etcd.io/92c378a361f5727086e5a90c94a99b4a
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
May 07 23:42:22 coreos-test-3ee2b1c1-0845-41db-9fd5-d421a1cfea76 sh[2171]: 2014-05-07 23:42:22 10.42.5.172:47431 test-app3[web.1]: Listening on 5000
May 07 23:42:22 coreos-test-3ee2b1c1-0845-41db-9fd5-d421a1cfea76 sh[2171]: panic: Could not find app name in message
May 07 23:42:22 coreos-test-3ee2b1c1-0845-41db-9fd5-d421a1cfea76 sh[2171]: goroutine 4 [running]:
May 07 23:42:22 coreos-test-3ee2b1c1-0845-41db-9fd5-d421a1cfea76 sh[2171]: runtime.panic(0x51d920, 0xc21000a410)
May 07 23:42:22 coreos-test-3ee2b1c1-0845-41db-9fd5-d421a1cfea76 sh[2171]: /usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
May 07 23:42:22 coreos-test-3ee2b1c1-0845-41db-9fd5-d421a1cfea76 sh[2171]: main.(*handler).mainLoop(0xc210000050)
May 07 23:42:22 coreos-test-3ee2b1c1-0845-41db-9fd5-d421a1cfea76 sh[2171]: /go/src/github.com/deis/deis/logger/syslogd/syslogd.go:90 +0x1c0
May 07 23:42:22 coreos-test-3ee2b1c1-0845-41db-9fd5-d421a1cfea76 sh[2171]: created by main.newHandler
May 07 23:42:22 coreos-test-3ee2b1c1-0845-41db-9fd5-d421a1cfea76 sh[
@siliconcow
siliconcow / gist:8572979
Last active January 4, 2016 05:09
Go gitcoin
package main
import (
"github.com/jgrahamc/go-openssl/sha1"
//"crypto/sha1"
"fmt"
"io/ioutil"
"log"
"os"
"strconv"