Skip to content

Instantly share code, notes, and snippets.

View philips's full-sized avatar
👨‍💻
at the keebs

Brandon Philips philips

👨‍💻
at the keebs
View GitHub Profile
@philips
philips / gist:7310435
Last active March 17, 2017 21:03
Setting up swap on coreos

Setup a swap file in the stateful partition

Run these commands as root to create a 512 megabyte swap.

fallocate -l 512m /media/state/512MiB.swap
chmod 600 /media/state/512MiB.swap
mkswap /media/state/512MiB.swap

Keybase proof

I hereby claim:

  • I am philips on github.
  • I am philips (https://keybase.io/philips) on keybase.
  • I have a public key ASD6egp9-BSE1l3ExMqrjHCKwKJX9NkZ3qK9-B80pATxigo

To claim this, I am signing this object:

Add a local docker unit file

Create a file called /media/state/units/docker-local.service that has the following contents:

[Unit]
Description=docker local

[Service]
PermissionsStartOnly=true
Example of rkt today with systemd service file generation and systend-nspawn execution of systemd.
$ sudo rkt run docker://redis --insecure-options image
$ rkt list | grep redis
764de9a0 redis registry-1.docker.io/library/redis:latest running 5 minutes ago 5 minutes ago default:ip4=172.16.28.2
$ ps aux | grep 764de9a0
root 8168 4.4 0.1 41780 4440 pts/2 S+ 19:04 0:13 stage1/rootfs/usr/lib/ld-linux-x86-64.so.2 stage1/rootfs/usr/bin/systemd-nspawn --boot --register=true --link-journal=try-guest --quiet --uuid=764de9a0-9442-4512-9d73-5a040dac5fe2 --machine=rkt-764de9a0-9442-4512-9d73-5a040dac5fe2 --directory=stage1/rootfs --bind=/mnt/sda1/var/lib/rkt/pods/run/764de9a0-9442-4512-9d73-5a040dac5fe2/sharedVolumes/redis-volume-data:/opt/stage2/redis/rootfs/data --capability=CAP_AUDIT_WRITE,CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FSETID,CAP_FOWNER,CAP_KILL,CAP_MKNOD,CAP_NET_RAW,CAP_NET_BIND_SERVICE,CAP_SETUID,CAP_SETGID,CAP_SETPCAP,CAP_SETFCAP,CAP_SYS_CHROOT -- --default-standard-output=tty --log-target=nul
{
"metadata": {
"name": "tectonic-channel"
},
"apiVersion": "channel.tectonic.com/v1",
"kind": "Version",
"channel": "alpha",
"server": "https://update.core-os.net",
"updatesPaused": false,
"publicKey": "gpg-public-key-override"
@philips
philips / merklesum.go
Last active July 3, 2016 19:04
merklesum prints out the hashes of each chunk from a merkle tree.
package main
import (
"fmt"
"github.com/vbatts/merkle"
"io"
"os"
)
func traverse(n *merkle.Node) *merkle.Node {
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=docker.socket early-docker.target network.target
Requires=docker.socket early-docker.target
[Service]
EnvironmentFile=-/run/flannel_docker_opts.env
MountFlags=slave
LimitNOFILE=1048576
$ DOCKER_BUILDTAGS="exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_aufs" AUTO_GOPATH=1 ./hack/make.sh binary
@philips
philips / gist:8324564
Last active May 24, 2016 11:29
I love go. SSH client using the agent in under 50 lines of code.
// example: go run ssh.go core myhost:22 "ps aux | head -n 5"
package main
import (
"log"
"net"
"os"
"code.google.com/p/go.crypto/ssh"
)
@philips
philips / libpci-example.c
Created September 8, 2010 15:47
pci-lookup.c
#include <stdio.h>
#include "pci/pci.h"
/* Compile: gcc pci-lookup.c -lpci -o pci-lookup */
int main(int argc, char **argv)
{
struct pci_access *pacc;
struct pci_dev dev;
char namebuf[1024], *name;