Skip to content

Instantly share code, notes, and snippets.

View crosbymichael's full-sized avatar

Michael Crosby crosbymichael

View GitHub Profile
@crosbymichael
crosbymichael / gist:6557161
Last active December 23, 2015 00:59
Docker links
REDIS=$(docker run -d crosbymichael/redis)
docker run -link $REDIS:6379:redis -t -i 71cba4d74d62 bash
root@7c1879d423b6:/# cat app.py
import docker
from redis import Redis
ip, port = docker.require('redis')
r = Redis(host=ip, port=int(port))
container containers graph hooks repositories unit-tests volumes
➜ docker cd hooks
➜ hooks tree
.
|-- container
| |-- create
| |-- die
| `-- start
| `-- growl-hook
|-- image
#!/usr/bin/env python
import sys
from redis import Redis
import rethinkdb as r
from rq import Queue
import os
from rss import parse_feed
from werkzeug.contrib.atom import AtomFeed
import tornado.ioloop
package main
import (
"flag"
"fmt"
"github.com/robertkrimen/otto"
)
type Person struct {
Name string
ID PARENT NAME
0 0 ROOT
1 0 APP
2 0 DB
3 1 DB
4 0 SENTRY
5 4 DB
func TestUniqueIndexSave(t *testing.T) {
s := NewStore()
key := func(v interface{}) string {
ts := v.(*test)
return fmt.Sprintf("%s:%d", ts.Name, ts.Age)
}
if err := s.AddIndex("name", key); err != nil {
t.Fatal(err)
}
package graphdb
import (
"testing"
)
type relationship string
func (p relationship) String() string {
return string(p)
package graphdb
import (
"fmt"
"sync"
)
type Nodes map[string]*Node
type Node struct {
➜ ~GOPATH/src/github.com/dotcloud/gograph git:(master) ✗ gocov test | gocov report
ok github.com/dotcloud/gograph 0.003s
github.com/dotcloud/gograph/gograph.go Entity.children 100.00% (17/17)
github.com/dotcloud/gograph/gograph.go NewDatabase 100.00% (5/5)
github.com/dotcloud/gograph/gograph.go Database.RootEntity 100.00% (1/1)
github.com/dotcloud/gograph/gograph.go Entity.ID 100.00% (1/1)
github.com/dotcloud/gograph/gograph.go Database.List 92.31% (12/13)
github.com/dotcloud/gograph/gograph.go Database.newEdge 90.91% (10/11)
github.com/dotcloud/gograph/gograph.go Database.NewEntity 90.00% (9/10)
@crosbymichael
crosbymichael / links.md
Last active June 4, 2018 01:01
Container Relationships