Skip to content

Instantly share code, notes, and snippets.

View mindscratch's full-sized avatar

Craig Wickesser mindscratch

View GitHub Profile
@mindscratch
mindscratch / .gitconfig
Created February 25, 2014 11:56
git config
[core]
editor = vim
[diff]
tool = kompare
[difftool]
prompt = false
[color]
ui = true
branch = auto
diff = auto
@mindscratch
mindscratch / check_env
Created February 26, 2014 10:28
script to check for environment variables
#!/usr/bin/env bash
. /etc/init.d/functions
declare -a env_variables=(FOO BAR)
function checkVariables {
for var in "${env_variables[@]}"
do
if env | grep -q ^"$var="
@mindscratch
mindscratch / learning_scala.md
Created March 7, 2014 11:36
learning scala

march 6, 2014

What's the difference between val and var?

  • A val variable can not have it's value changed, but a var variable can.

march 7, 2014

What's the deal with implicit val?

Keybase proof

I hereby claim:

  • I am mindscratch on github.
  • I am mindscratch (https://keybase.io/mindscratch) on keybase.
  • I have a public key whose fingerprint is 8AB1 4B40 90B4 C5EA 29D8 E3C9 5545 54A2 55F8 9F6E

To claim this, I am signing this object:

@mindscratch
mindscratch / cors_handler.go
Created June 8, 2014 04:11
CORS middleware in Go
// original: https://slack-files.com/T029RQSE6-F02ATJ4RW-75d559
func (h *corsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "*")
if r.Method == "OPTIONS" {
fmt.Fprint(w)
return
}
@mindscratch
mindscratch / docker-orchestration-options.md
Created July 8, 2014 23:45
DockerCon 2014 - orchestration (keynote)

At DockerCon 2014, Solomon Hykes presented a keynote that discussed the future of Docker. One topic of discussion was orchestration, in which he showed a slide that listed a bunch of projects that have come up around this problem:

  • Shipper
  • Geard
  • Mesos
  • Coreos
  • Consul
  • Helios
  • Centurion
@mindscratch
mindscratch / .aliases
Last active August 29, 2015 14:08
linux config
alias ll='ls -alh'
alias gcm='git commit -m'
alias gp='git push origin $(git_full_branch_name)'
alias ga='git diff --check && git add'
@mindscratch
mindscratch / gist:f95a50cfb3bfc53af5d7
Last active August 29, 2015 14:10
build cAdvisor in a CentOS docker container
# docker run --rm -it -v /Users/craig/projects/cadvisor:/cadvisor centos /bin/bash
yum install -y golang git mercurial
mkdir -p /code/{bin,pkg,src}
cd /code
export GOPATH=$(pwd)
export PATH=$PATH:$GOPATH/bin
# install godep and cover
@mindscratch
mindscratch / ifconfig.txt
Created November 26, 2014 13:16
ifconfig
# Host A
docker0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:10.100.64.1 Bcast:0.0.0.0 Mask:255.255.255.0
flannel.1 Link encap:Ethernet HWaddr <some stuff>
inet addr:10.100.64.0 Bcast:0.0.0.0 Mask:255.255.0.0
# Host B
docker0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:10.100.7.1 Bcast:0.0.0.0 Mask:255.255.255.0
package main
import (
"encoding/base64"
"net/http"
"strings"
)
type handler func(w http.ResponseWriter, r *http.Request)