Skip to content

Instantly share code, notes, and snippets.

View crosbymichael's full-sized avatar

Michael Crosby crosbymichael

View GitHub Profile
@crosbymichael
crosbymichael / main.c
Created September 23, 2014 06:10
rocksdb C example
/*
* compiled with:
* g++ -std=c++11 main.c -Wall -lrocksdb -lbz2 -lpthread -lsnappy -lz
*/
#include <rocksdb/c.h>
#include <stdio.h>
#include <stdlib.h>
@crosbymichael
crosbymichael / Dockerfile
Last active January 8, 2022 13:47
Docker with supervisor
FROM ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -y openssh-server supervisor
ADD sshd.conf /etc/supervisor/conf.d/sshd.conf
RUN mkdir -p /var/run/sshd
@crosbymichael
crosbymichael / alpine.md
Created November 2, 2019 13:29
Apine Desktop

Alpine

apk-tools 2.10.4, compiled for x86_64.

Installing and removing packages:
  add       Add PACKAGEs to 'world' and install
            (or upgrade) them, while ensuring
            that all dependencies are met
  del       Remove PACKAGEs from 'world' and
@crosbymichael
crosbymichael / mqueue.md
Created January 28, 2015 16:52
Why docker needs mqueue

Docker provides /dev/mqueue to containers because some applications require or take advantage of this features. Docker does not use this directly. You will see some people with the question like "why does my application run slower when inside a container than on my host?" There can be a number of reasons why but one thing with applications like apache2, it uses mqueue to help speed things up if available.

All the major distros have this enabled by default in their kernel configs and we have not heard of any downsides where you would require this to be disabled. If you know of a reason why then let us know.

Hope this helps and sorry for the gist, i wanted to explain in more than 140 chars.

@crosbymichael
crosbymichael / mesos-ubuntu-install.sh
Created July 9, 2014 18:43
Install mesos on ubuntu 14.04
#!/bin/bash
set -e
apt-get install -y curl python-setuptools python-pip python-dev python-protobuf
# zookeeper
apt-get install -y zookeeperd
echo 1 | dd of=/var/lib/zookeeper/myid
@crosbymichael
crosbymichael / docker.sh
Created January 2, 2020 16:52
Docker v2 PoC Run
> docker run --rm -t -i --logger d2-syslog --profile privileged --net d2 --net b2 alpine ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: eth0@if28: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
link/ether b2:da:6d:61:18:56 brd ff:ff:ff:ff:ff:ff
inet 10.10.0.52/24 brd 10.10.0.255 scope global eth0
package main
import (
"context"
"syscall"
"time"
"github.com/Sirupsen/logrus"
"github.com/containerd/containerd"
"github.com/containerd/containerd/cio"
#!/bin/bash
mkdir -p /sys/fs/cgroup/cpuset/buildkit
echo 5-7 >> /sys/fs/cgroup/cpuset/buildkit/cpuset.cpus
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 2.1686e-05
go_gc_duration_seconds{quantile="0.25"} 5.9681e-05
go_gc_duration_seconds{quantile="0.5"} 7.8483e-05
go_gc_duration_seconds{quantile="0.75"} 9.5376e-05
go_gc_duration_seconds{quantile="1"} 0.000303761
go_gc_duration_seconds_sum 0.064228354
go_gc_duration_seconds_count 802
# HELP go_goroutines Number of goroutines that currently exist.
@crosbymichael
crosbymichael / upgrade-lxc.sh
Created October 31, 2013 19:06
Docker on Ubuntu 13.10
#!/bin/bash
# Remove current lxc version which is lxc/1.0.0~alpha1-0ubuntu11
sudo apt-get remove lxc
# Download the new pakcages with the updated
wget https://launchpad.net/ubuntu/+source/lxc/1.0.0~alpha1-0ubuntu12/+build/5171688/+files/lxc_1.0.0~alpha1-0ubuntu12_amd64.deb
wget https://launchpad.net/ubuntu/+source/lxc/1.0.0~alpha1-0ubuntu12/+build/5171688/+files/liblxc0_1.0.0~alpha1-0ubuntu12_amd64.deb
# Install the updated packages