Skip to content

Instantly share code, notes, and snippets.

@casualjim
casualjim / channel_example_test.go
Created July 9, 2017 05:12
examples of golang context and channels
package channel
import (
"fmt"
"sync"
"time"
)
func ExampleUnbufferedSend() {
c1 := make(chan string)
tdnf install -y tar gzip
curl -L'#' https://get.docker.com/builds/Linux/x86_64/docker-latest.tgz | tar -C /tmp -xzf -
cp -a /tmp/docker/* /usr/bin
echo '[Unit]
Description=Docker Socket for the API
PartOf=docker.service
[Socket]
ListenStream=/var/run/docker.sock
@casualjim
casualjim / photon-xhyve.sh
Last active September 25, 2016 19:47
photon os in xhyve
#!/bin/bash
tmp=$(mktemp -d)
pushd "$tmp"
iso=$HOME/Downloads/photon-1.0-13c08b6.iso
if [ ! -f $iso ]; then
echo "downloading photon os iso"
curl -o $iso -L'#' https://bintray.com/artifact/download/vmware/photon/photon-1.0-13c08b6.iso
fi
package main
import (
"fmt"
)
type Gettable interface {
Name() string
}
-- import requirements
local cjson = require "cjson"
-- Ubuntu broke the install. Puts the source in /usr/share/lua/5.1/https.lua,
-- but since the source defines itself as the module "ssl.https", after we
-- load the source, we need to grab the actual thing. Building from source
-- wasn't practical.
require "https"
local https = require "ssl.https"
local ltn12 = require("ltn12")
@casualjim
casualjim / download-stats.sh
Created March 4, 2016 14:30
github releases download stats
curl -s https://api.github.com/repos/go-swagger/go-swagger/releases/latest | jq '.assets[]' | jq -r '"\(.name): \(.download_count)"'

Keybase proof

I hereby claim:

  • I am casualjim on github.
  • I am casualjim (https://keybase.io/casualjim) on keybase.
  • I have a public key ASA7n5sW2iWTvRLsVaDr1XEXQb3q5I7tJ5OrJRihbpCSGAo

To claim this, I am signing this object:

@casualjim
casualjim / build-go-swagger.sh
Last active January 25, 2016 03:14 — forked from anonymous/build-go-swagger.sh
building go-swagger — for a five year old
#---- run this section just once ----#
export GOPATH="${HOME}/go"
export GO15VENDOREXPERIMENT='1'
`
cd $GOPATH/src/github.com/go-swagger/go-swagger
go get -u github.com/asaskevich/govalidator
go get -u github.com/naoina/denco
go get -u github.com/go-swagger/scan-repo-boundary/makeplans
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
def OS.mac?
(/darwin/ =~ RUBY_PLATFORM) != nil
end
def OS.unix?