Skip to content

Instantly share code, notes, and snippets.

💭
Mashing buttons hoping to hit the right combos.

Brian Goff cpuguy83

View GitHub Profile
@cpuguy83
cpuguy83 / gist:530e8a40eb03dc08c4072686cfaff053
Last active Jan 22, 2019
splice vs userspace copy on containerd/fifo using Go
View gist:530e8a40eb03dc08c4072686cfaff053
goos: linux
goarch: amd64
pkg: github.com/containerd/fifo
BenchmarkRawCopy/8B-4 300000 4869 ns/op 1.44 MB/s 176 B/op 8 allocs/op
BenchmarkRawCopy/16B-4 300000 4688 ns/op 3.20 MB/s 176 B/op 8 allocs/op
BenchmarkRawCopy/32B-4 300000 4312 ns/op 7.19 MB/s 176 B/op 8 allocs/op
BenchmarkRawCopy/64B-4 300000 4447 ns/op 14.16 MB/s 176 B/op 8 allocs/op
BenchmarkRawCopy/1024B-4 300000 4415 ns/op 231.66 MB/s 176 B/op 8 allocs/op
BenchmarkRawCopy/4096B-4 300000 4410 ns/op 928.50 MB/s 176 B/op 8 allocs/op
BenchmarkRawCopy/8192B-4 300000 5215 ns/op 1570.37 MB/s 176 B/op 8 allocs/op
@cpuguy83
cpuguy83 / gitsynch.sh
Created Sep 12, 2018
Synchronize a git fork with origin
View gitsynch.sh
#!/bin/bash
set -e -u -o pipefail
export ORIGIN="${1}"
export FORK="${2}"
dir=$(mktemp -d)
(
View pull.go
package main
import (
"context"
"fmt"
"io/ioutil"
"os"
"github.com/containerd/containerd/content/local"
"github.com/containerd/containerd/images"
@cpuguy83
cpuguy83 / Vagrantfile
Created Dec 6, 2017
Sometimes I need to setup a small kube cluster without thinking about it...
View Vagrantfile
Vagrant.configure(2) do |config|
CNI_LOOPBACK = <<-EOF
{
"cniVersion": "0.3.0",
"type": "loopback"
}
EOF
View keybase.md

Keybase proof

I hereby claim:

  • I am cpuguy83 on github.
  • I am cpuguy83 (https://keybase.io/cpuguy83) on keybase.
  • I have a public key ASAo08bHNxNOVVkkmpl5T8GZMOgan7PmdCC7zM0-zVNcsQo

To claim this, I am signing this object:

View gist:e3a3baefd7d217ffeb786801c8640a69
time="2016-07-27T18:58:18.401642630Z" level=debug msg="Calling POST /v1.24/containers/create"
time="2016-07-27T18:58:18.401896983Z" level=debug msg="form data: {\"AttachStderr\":false,\"AttachStdin\":false,\"AttachStdout\":false,\"Cmd\":[\"true\"],\"Domainname\":\"\",\"Entrypoint\":null,\"Env\":[],\"HostConfig\":{\"AutoRemove\":false,\"Binds\":null,\"BlkioDeviceReadBps\":null,\"BlkioDeviceReadIOps\":null,\"BlkioDeviceWriteBps\":null,\"BlkioDeviceWriteIOps\":null,\"BlkioWeight\":0,\"BlkioWeightDevice\":null,\"CapAdd\":null,\"CapDrop\":null,\"Cgroup\":\"\",\"CgroupParent\":\"\",\"ConsoleSize\":[0,0],\"ContainerIDFile\":\"\",\"CpuCount\":0,\"CpuPercent\":0,\"CpuPeriod\":0,\"CpuQuota\":0,\"CpuShares\":0,\"CpusetCpus\":\"\",\"CpusetMems\":\"\",\"Devices\":[],\"DiskQuota\":0,\"Dns\":[],\"DnsOptions\":[],\"DnsSearch\":[],\"ExtraHosts\":null,\"GroupAdd\":null,\"IOMaximumBandwidth\":0,\"IOMaximumIOps\":0,\"IpcMode\":\"\",\"Isolation\":\"\",\"KernelMemory\":0,\"Links\":null,\"LogConfig\":{\"Config\":{},\"Type\":\"\"},
View keybase.md

Keybase proof

I hereby claim:

  • I am cpuguy83 on github.
  • I am cpuguy83 (https://keybase.io/cpuguy83) on keybase.
  • I have a public key whose fingerprint is DC2B 8BF0 03B4 72B1 606E 2F8F A8F2 CB5F 82B3 1F49

To claim this, I am signing this object:

View Dockerfile
FROM debian
ADD my_entrypoint.sh /my_entrypoint.sh
ENTRYPOINT ["/my_entrypoint.sh"]
@cpuguy83
cpuguy83 / logforwarder.go
Last active Aug 29, 2015
libswarm logger demo
View logforwarder.go
package backends
import (
"fmt"
"io"
"strings"
"sync"
"time"
"github.com/docker/libswarm"
View gist:b7748f3fbe957a699e3b
---> Making bundle: binary (in bundles/1.1.0-dev/binary)
Created binary: /go/src/github.com/dotcloud/docker/bundles/1.1.0-dev/binary/docker-1.1.0-dev
ln: failed to create symbolic link '/go/src/github.com/dotcloud/docker/bundles/1.1.0-dev/binary/docker': Read-only file system
[2014-07-07 12:11:38 -0400 EDT] 37b6470e8b6b03cc4c68554735e9685b7bec7dc070eaf8ece4c0ff77f1bee01d: (from docker:fix_gh#6856_add_pass_unpause_events) die
[2014-07-07 12:11:38 -0400 EDT] 37b6470e8b6b03cc4c68554735e9685b7bec7dc070eaf8ece4c0ff77f1bee01d: (from docker:fix_gh#6856_add_pass_unpause_events) destroy
make: *** [test] Error 1
You can’t perform that action at this time.