Skip to content

Instantly share code, notes, and snippets.

$ cat fig.yml
web:
build: ./web
command: npm ls
ports:
- 3000:3000
$ fig up
Recreating koafig_web_1...
Attaching to koafig_web_1
koafig_web_1 | web@0.0.0 /code
$ cat fig.yml
web:
build: ./web
command: find .
ports:
- 3000:3000
$ fig up
Recreating koafig_web_1...
Attaching to koafig_web_1
koafig_web_1 | .
$ cat fig.yml
dckr:
image: ubuntu
command: ls /
volumes:
- /var/run/docker.sock:/docker.sock
$ fig up
Creating figldleworktest_dckr_1...
Attaching to figldleworktest_dckr_1
$ cat fig.yml
dckr:
image: ubuntu
command: ls -l /
volumes:
- /var/run/docker.sock:/docker.sock
$ fig run dckr bash
root@dac750a9bcb3:/# apt-get install -y netcat > /dev/null
root@dac750a9bcb3:/# nc -U /docker.sock
$ curl 'http://localhost:4243/v1.10/version'
{"Arch":"amd64","GitCommit":3600720,"GoVersion":"go1.2.1","KernelVersion":"3.8.0-29-generic","Os":"linux","Version":"0.9.1"}
$ curl --no-buffer -X POST 'http://localhost:4243/v1.10/images/create?fromImage=ubuntu&tag='
{"status":"Pulling repository ubuntu"}
{"status":"Pulling image (raring) from ubuntu","progressDetail":{},"id":"eb601b8965b8"}{"status":"Pulling image (raring) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/","progressDetail":{},"id":"eb601b8965b8"}{"status":"Pulling image (lucid) from ubuntu","progressDetail":{},"id":"9cc9ea5ea540"}{"status":"Pulling image (lucid) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/","progressDetail":{},"id":"9cc9ea5ea540"}{"status":"Pulling image (saucy) from ubuntu","progressDetail":{},"id":"9f676bd305a4"}{"status":"Pulling image (saucy) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/","progressDetail":{},"id":"9f676bd305a4"}{"status":"Pulling image (precise) from ubuntu","progressD
func randomHexString(length int) (string, error) {
chars := "01234567890abcdef"
bytes := make([]byte, length)
for idx, _ := range bytes {
num, err := rand.Int(rand.Reader, big.NewInt(int64(len(chars))))
if err != nil {
return "", err
}
bytes[idx] = chars[num.Int64()]
}
@aanand
aanand / gist:fb1fb3ea406d8e37accf
Created June 24, 2014 18:33
Unexplored libswarm topics

Comment on this Gist with any present or potential concerns regarding the design and use of libswarm.

from sqlalchemy import create_engine, Table, Column, String, LargeBinary, MetaData
from sqlalchemy.sql import select
from io import BytesIO
class SQLStorage(object):
def __init__(self, url):
engine = create_engine(url)
self.conn = engine.connect()
# if you define to_a
irb(main):001:0> class Foo
irb(main):002:1> def to_a
irb(main):003:2> puts "hi"
irb(main):004:2> []
irb(main):005:2> end
irb(main):006:1> end
=> nil
irb(main):007:0> [*Foo.new]
hi
@aanand
aanand / gist:0d6fbaa75bd5c65cf3f9
Created April 7, 2015 11:25
Use Docker Machine to get a VM running Docker 1.6.0 RC4
docker-machine create -d virtualbox --virtualbox-boot2docker-url=https://github.com/tianon/boot2docker/releases/download/v1.6.0-rc4/boot2docker.iso dev-1.6.0-rc4