Skip to content

Instantly share code, notes, and snippets.

View cpuguy83's full-sized avatar
🐶

Brian Goff cpuguy83

🐶
View GitHub Profile
@cpuguy83
cpuguy83 / Vagrantfile
Created December 6, 2017 21:10
Sometimes I need to setup a small kube cluster without thinking about it...
Vagrant.configure(2) do |config|
CNI_LOOPBACK = <<-EOF
{
"cniVersion": "0.3.0",
"type": "loopback"
}
EOF

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:

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\":\"\"},
@cpuguy83
cpuguy83 / base_pusher.rb
Last active January 23, 2016 03:02
Server Push based controller
class BasePusher < AbstractController::Base
include AbstractController::Logger
include AbstractController::Rendering
include AbstractController::Layouts
include AbstractController::Helpers
include AbstractController::Translation
include AbstractController::AssetPaths
include AbstractController::Callbacks
include Rails.application.routes.url_helpers if defined? Rails
@cpuguy83
cpuguy83 / Dockerfile
Created January 28, 2014 13:45
Docker issues#3753 Demo
FROM busybox
ADD echo.sh /tmp/echo.sh
ENTRYPOINT ["/tmp/echo.sh"]
@cpuguy83
cpuguy83 / operating_hour.rb
Created January 23, 2014 16:15
Time zone parsing from local time
class OperatingHour
class MissingTimeZoneError < StandardError; end
class MissingTimeStringError < StandardError; end
attr_reader :time_string, :time_zone
def initialize(opts={})
@time_string = opts[:time_string]
@time_zone = opts[:time_zone]
end
merged_images = left.images.with_index.collect do |image, index|
compare(left.images[index], right.images[index], index)
end
FROM ubuntu
# some awesome stuff with mysql
VOLUME /var/lib/mysql
--- End Dockerfile ---
docker build -t my/awesome_mysql_stuff
@cpuguy83
cpuguy83 / buildfile.go
Created December 27, 2013 21:30
extract functionality for building CMD and ENTRYPOINT
func (b *buildFile) BuildCmdFromJson(args string) []string {
var cmd []string
if err := json.Unmarshal([]byte(args), &cmd); err != nil {
utils.Debugf("Error unmarhsalling: %s, setting %s to /bin/sh -c", err)
cmd = []string{"/bin/sh", "-c", args}
}
return cmd
}
func (b *buildFile) CmdCmd(args string) error {
@cpuguy83
cpuguy83 / buildfile.go
Created December 27, 2013 16:53
Add support for multiple ENV key/values in one line
func (b *buildFile) CmdEnv(args string) error {
var env map[string]string
if err := json.Unmarshal([]byte(args), &env); err != nil {
env = []string{args}
}
if err := b.commit("", env, fm.Sprintf("ENV %v", env)); err != nil {
return err
}