Skip to content

Instantly share code, notes, and snippets.

View unix-vs-tcp.go
func BenchmarkUnixVsTcpProbe(b *testing.B) {
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
})
tcpServer := httptest.NewServer(handler)
b.Cleanup(tcpServer.Close)
tmpDir := b.TempDir()
@julz
julz / main.go
Created Jun 6, 2020
Pick two distinct random numbers efficiently
View main.go
package main
import (
"fmt"
"math/rand"
)
// (repeatedly) picks 2 distinct random numbers from a range, avoids looping in case of clashes
func main() {
l := 10
@julz
julz / main.go
Created Nov 20, 2015
containersched minicontainer
View main.go
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
View adapter.md

Standard Operations

The following operations should be supported by all runtimes. A container runtime supports an operation by invoking ‘[binary name] [operation name]’.

The following examples use ‘funC’ as the runtime, an alternate runtime can be used by substituting its name where funC appears.

Standard Flags

All operations should support the following flags:

@julz
julz / runtime.md
Last active Sep 15, 2015
Example Runtime Spec
View runtime.md

Operations:

The command line should support each operation listed below as its first argument. It operates by default on the 'config.json' in the current directory.

Start

Starts a container from a bundle directory.

Flags: none. Output: The process output is printed to stdout and stderr, and the process exits with the delegate process exit code.