Skip to content

Instantly share code, notes, and snippets.

View euank's full-sized avatar

Euan Kemp euank

View GitHub Profile
(function() {
Array.prototype.slice.call(arguments).map(
(x) => {
console.log(arguments);
}
);
})(1,2)
// Outputs:
// { '0': 1, '1': 2 }
export ENABLE_NODE_LOGGING=false
export ENABLE_CLUSTER_MONITORING=none
export LOG_LEVEL=4
export CONTAINER_RUNTIME=remote
export IMAGE_SERVICE_ENDPOINT=/var/run/rktlet.sock
export CONTAINER_RUNTIME_ENDPOINT=/var/run/rktlet.sock
export ALLOW_SECURITY_CONTEXT=yes
export ALLOW_PRIVILEGED=yes
#!/bin/sh
set -x
# Pick a random chain name
chain_name=foo-$RANDOM
# Create the chain
iptables -t nat -N $chain_name --wait
created_chain=$?
@euank
euank / atheme.yaml
Created August 28, 2016 06:39
atheme pod
apiVersion: v1
kind: Pod
metadata:
name: atheme
annotations:
app: atheme
# Dear lord WHY
pod.alpha.kubernetes.io/init-containers: '[{"name": "r53-register","restartPolicy":"Never","image":"euank/route53-registerer:v0.1.1","env": [{"name": "AWS_ACCESS_KEY_ID","valueFrom": {"secretKeyRef": {"name": "wobscale-r53","key":"access"}}},{"name": "AWS_SECRET_ACCESS_KEY","valueFrom": {"secretKeyRef":{"name":"wobscale-r53","key":"secret"}}},{"name": "REGISTER_IP","value": "PUBLICIP"},{"name":"REGISTER_DOMAIN","value":"services.irc.wobscale.website"}]}]'
spec:
@euank
euank / readdir_bug.go
Last active August 29, 2016 19:25
A simple program that is able to reproduce a bug in the go stdlib whereby `Readdir` does not behave as documented.
package main
import (
"fmt"
"io"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
"strconv"
package main
import (
"errors"
"fmt"
"log"
"os"
"strings"
"time"
$ sudo systemd-run --unit=test-machined-reg rkt run --uuid-file-save=/tmp/rkt-uuid --insecure-options=image docker://nginx
Running as unit test-machined-reg.service.
$ sudo rkt status $(cat /tmp/rkt-uuid)
state=running
created=2016-08-11 16:12:00.844 -0700 PDT
started=2016-08-11 16:12:00.944 -0700 PDT
networks=default:ip4=172.16.28.206
pid=31239
exited=false
@euank
euank / rkt
Created July 8, 2016 17:56
rkt launch
#!/bin/bash
# This script, if put on your path before your real rkt binary (e.g. /usr/bin/rkt vs /usr/local/bin/rkt),
# augments the rkt command with the `launch` and `land` subcommands corresponding to `run` and `stop`
# The path to the actual rkt binary
rkt=/usr/local/bin/rkt
case $1 in
launch)
$ sudo rkt run --uuid-file-save=/tmp/uuid quay.io/coreos/alpine-sh --exec=sh -- -c ls
image: using image from local store for image name coreos.com/rkt/stage1-coreos:1.8.0+gite129fd7
image: using image from local store for image name quay.io/coreos/alpine-sh
run: group "rkt" not found, will use default gid when rendering images
networking: loading networks from /etc/rkt/net.d
networking: loading network default with type ptp
stage1: warning: error setting journal ACLs, you'll need root to read the pod journal: group "rkt" not found
$ sudo journalctl -m _MACHINE_ID=$(cat /tmp/uuid | sed 's/-//g') -o json --no-pager
package main
import (
"fmt"
rktapi "github.com/coreos/rkt/api/v1alpha"
"golang.org/x/net/context"
"google.golang.org/grpc"
)