Skip to content

Instantly share code, notes, and snippets.

View crosbymichael's full-sized avatar

Michael Crosby crosbymichael

View GitHub Profile
@crosbymichael
crosbymichael / links.md
Last active June 4, 2018 01:01
Container Relationships
@crosbymichael
crosbymichael / notification.go
Last active June 2, 2018 15:03
Programatic events for docker
package main
import (
"encoding/json"
"io"
"log"
"net/http"
)
type Event struct {
package main
import (
"bufio"
"flag"
"fmt"
"log"
"os"
"sort"
"strconv"
package main
import (
"context"
"syscall"
"time"
"github.com/Sirupsen/logrus"
"github.com/containerd/containerd"
"github.com/containerd/containerd/namespaces"
package main
import (
_ "context"
_ "math"
_ "net/http"
_ "github.com/containerd/console"
package main
import (
"encoding/json"
"log"
"os"
"os/exec"
"github.com/docker/containerd/osutils"
)
@crosbymichael
crosbymichael / init.c
Last active August 26, 2016 21:02
Simple Container Pid 1
#define _GNU_SOURCE
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/resource.h>
@crosbymichael
crosbymichael / keybase.md
Created August 15, 2016 19:58
keybase.md

Keybase proof

I hereby claim:

  • I am crosbymichael on github.
  • I am crosbymichael (https://keybase.io/crosbymichael) on keybase.
  • I have a public key whose fingerprint is 03AC FE05 5FF8 E919 F278 00FA 0930 0471 AA36 D4B3

To claim this, I am signing this object:

package dontfearthereaper
import "syscall"
// PR_SET_CHILD_SUBREAPER
const prSetSubreaper = 0x36
func init() {
if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, prSetSubreaper, 0, 0); err != 0 {
panic(err)
package main
import "github.com/opencontainers/specs"
func main() {
device := specs.ThrottleDevice{}
device.Major = 0
device.Minor = 0
var rate uint64
rate = 292929