Skip to content
for v in $(xargs --null --max-args=1 < /proc/1/environ); do export $v; done
#!/bin/bash -e
docker ps -a -q | xargs docker rm
docker images | grep '^<none>' | awk '{print $3}' | xargs docker rmi
#!/bin/bash -e
PREV_ID=`docker ps | grep $PROJECT | awk '{print $1}'`
[[ -n $PREV_ID ]] && docker stop $PREV_ID 1>/dev/null
docker build -t=$PROJECT .
CONTAINER=`docker run -d -p 1022:22 -p 8000:80 $PROJECT`
BOOT2DOCKER_IP=`boot2docker ip 2>/dev/null`
TCP_PORT_MAPPING=`docker port $CONTAINER 80 | awk 'BEGIN{FS=":"}{print $2}'`
SSH_PORT_MAPPING=`docker port $CONTAINER 22 | awk 'BEGIN{FS=":"}{print $2}'`
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct{
Width, Height int
package main
import (
"fmt"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string {
return fmt.Sprintf("cannot Sqrt negative number: %v", float64(e))
package main
import (
"fmt"
"math"
"math/cmplx"
)
func Cbrt(x complex128) complex128 {
z := complex128(1)
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
var a, b int
return func() int {
a, b = b, a + b
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
res := make(map[string]int)
for _, w := range strings.Fields(s) {
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
res := make([][]uint8, dy)
for y := range res {
res[y] = make([]uint8, dx)
for x := range res[y] {
res[y][x] = uint8((x + y) /2)
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := 1.0
for i := 1; i <= 10; i++ {
Something went wrong with that request. Please try again.