Skip to content

Instantly share code, notes, and snippets.

Hoping I don't break anything

Brian Goff cpuguy83

Hoping I don't break anything
Block or report user

Report or block cpuguy83

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
cpuguy83 /
Last active Dec 18, 2019
Simple loading spinner for long requests with turbolinks and bootstrap modal
@PageSpinner =
spin: (ms=500)->
@spinner = setTimeout( (=> @add_spinner()), ms)
$(document).on 'page:change', =>
spinner_html: '
<div class="modal hide fade" id="page-spinner">
<div class="modal-head card-title">Please Wait...</div>
<div class="modal-body card-body">
<i class="icon-spinner icon-spin icon-2x"></i>
cpuguy83 / custom_kernel
Last active Dec 9, 2019
Boot Ubuntu with custom kernel on Digital Ocean
View custom_kernel
apt-get install kexec-tools
# Insert this at the top of /etc/init.d/rcS
if grep -qv ' kexeced$' /proc/cmdline ;then
kexec --load /vmlinuz --initrd=/initrd.img --append='root=LABEL=DOROOT kexeced' &&
mount -o ro,remount / &&
kexec -e
# Then just use apt/dpkg to install whatever kernel you want, e.g. from

This script helps to clean up vmss nodes that may have Azure disks attached to it that should not be due to bugs in Kubernetes. The specific case for this is that a disk has been re-attached to by Kubernetes when it should not have been.

This DOES NOT detect a bad node/disk, only assists in cleaning it up.


View pull.go
package main
import (
cpuguy83 / gist:530e8a40eb03dc08c4072686cfaff053
Last active Jan 22, 2019
splice vs userspace copy on containerd/fifo using Go
View gist:530e8a40eb03dc08c4072686cfaff053
goos: linux
goarch: amd64
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 /
Created Sep 12, 2018
Synchronize a git fork with origin
set -e -u -o pipefail
export ORIGIN="${1}"
export FORK="${2}"
dir=$(mktemp -d)
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|
"cniVersion": "0.3.0",
"type": "loopback"

Keybase proof

I hereby claim:

  • I am cpuguy83 on github.
  • I am 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\":\"\"},
cpuguy83 / base_pusher.rb
Last active Jan 23, 2016
Server Push based controller
View base_pusher.rb
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
You can’t perform that action at this time.