Introduction to Containers and Docker
# Provision a ubuntu VM
gcloud compute --project=infra101 instances create vm-based \
import tornado.ioloop | |
import tornado.web | |
import socket | |
class MainHandler(tornado.web.RequestHandler): | |
def get(self): | |
self.write("Hostname: " + socket.gethostname()) | |
def make_app(): | |
return tornado.web.Application([ |
# Configuration for Alacritty, the GPU enhanced terminal emulator. | |
# Any items in the `env` entry below will be added as | |
# environment variables. Some entries may override variables | |
# set by alacritty itself. | |
#env: | |
# TERM variable | |
# | |
# This value is used to set the `$TERM` environment variable for | |
# each instance of Alacritty. If it is not present, alacritty will |
#!/bin/bash | |
# Usage: | |
# sh etcd-cluster.sh <instance_name> | |
INSTANCE_NAME=$1 | |
REGISTRY=quay.io/coreos/etcd | |
# available from v3.2.5 | |
REGISTRY=gcr.io/etcd-development/etcd |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"net/http" | |
"strconv" | |
owm "github.com/briandowns/openweathermap" |
#!/bin/bash | |
# Usage: bash vegeta.sh <rate> <duration> | |
ACTION="GET http://google.com" | |
DURATION=${2:-5s} | |
RATE=${1:-10} | |
SLAVE_INSTANCES=$(gcloud compute instances list | grep vegeta- | awk '{print $1}') | |
SSH_ARGS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" | |
# --- run cmd on all slave instances in parallel --- |
type MyLogger struct{} | |
func (m *MyLogger) Log(format string, v ...interface{}) { | |
log.Printf(format, v...) | |
} | |
type Master struct { | |
Logger `inject:"logger"` | |
Food `inject:"example.Master.Food"` | |
Transport `inject:"example.Master.Transport"` |
func (s *InjectTestSuite) TestWeave() { | |
driver := example.Driver{} | |
farmer := example.Farmer{} | |
master := example.Master{} | |
myLogger := example.MyLogger{} | |
tillageMachine := example.TillageMachine{} | |
depMap := map[interface{}][]string{ | |
&myLogger: []string{ | |
"logger", |
I hereby claim:
To claim this, I am signing this object:
type fileReader struct { | |
src string | |
} | |
func (f *fileReader) Read() ([]byte, error) { | |
return ioutil.ReadFile(f.src) | |
} | |
type dbReader struct { | |
host string |