Skip to content

Instantly share code, notes, and snippets.

@tjdett
tjdett / backup.service
Last active October 12, 2017 04:54
Backup script for use with backup2swift
[Unit]
Description=Run backup script
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'PATH=/opt/bin:$PATH /opt/bin/backup.sh /etc/systemd/system /opt/bin'
@tjdett
tjdett / pick_random.scala
Created September 22, 2017 03:33
Random team pick
import scala.util.Random
import scala.util.Try
import scala.collection.immutable.Stream
object PickRandom extends App {
def picksValid(picksStr: String) =
Try(picksStr.toInt).filter(_ > 0).isSuccess
override def main(args: Array[String]) {
val picksRequired = args.toList match {
@tjdett
tjdett / Dockerfile
Last active January 13, 2017 05:08
Quay.io ACI vs docker2aci for https://github.com/dit4c/dockerfile-nghttpx
FROM alpine:edge
MAINTAINER Tim Dettrick <t.dettrick@uq.edu.au>
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
adduser -S -D -h /dev/null -s /sbin/nologin nghttpx && \
apk add --update nghttp2 python openssl ca-certificates && \
rm -rf /var/cache/apk/*
ENTRYPOINT ["/usr/bin/nghttpx", "--user=nghttpx"]
@tjdett
tjdett / instructions.md
Created November 2, 2016 03:04
Archiving secret keys to printed 2D data matrix

Produce with following steps:

paperkey --output-type raw < /tmp/mykey.gpg \
    > /tmp/mykey.paperkey
dmtxwrite -e 8 /tmp/mykey.paperkey > /tmp/mykey.paperkey.png

To reassemble, scan to JPG and then:

gpg2 --import /tmp/mykey.pub.asc
@tjdett
tjdett / convo.txt
Last active October 26, 2016 23:06
Kublet & rkt from #rkt @ 2016-10-26T13:44Z
<waly> Hi everyone
<waly> I've read somewhen in the past, that rkt provides a better featureset for the kubelet than docker does. Was somehow around the context, why the kubelet-wrapper is using rkt ... Can somebody explain that/point me to the missing link about that?
<vincent_vdk> waly: maybe because rkt is pod 'aware'
<sur> waly The are two aspects: 1) launching the kubelet and 2) launching pods
<sur> for 1) launching the kubelet the kubelet-wrapper uses rkt, because we can leverage the https://quay.io/repository/coreos/hyperkube image to launch the kubelet using "rkt fly", which doesn't do any isolation, but only chroot, because the kubelet is a privileged component on the host. That way we can reuse the same (hyperkube) image for both the kubelet, and
<sur> all the other kubernetes components (proxy, apiserver, ....)
<sur> for 2) launching pods from withing the kubelet you can also use rkt as the container runtime. There are quite a few nice points for doing so, one summary I tried to give i.e. in this p
@tjdett
tjdett / systemd-in-rkt.sh
Created October 19, 2016 00:53
Run systemd init in a rkt container
sudo `which rkt` run --interactive \
--volume volume-sys-fs-cgroup,kind=host,source=/sys/fs/cgroup,readOnly=true \
--insecure-options=image,seccomp,capabilities \
docker://fedora/systemd-systemd --exec /bin/bash -- \
-c "exec unshare --pid --fork --mount-proc /sbin/init"
@tjdett
tjdett / run.sh
Last active October 7, 2016 02:18
Very basic example of a sidekick app registering a rkt pod service
# PUTs IP as plain text to http://requestb.in/pimdumpi
sudo `which rkt` run --dns=8.8.8.8 --insecure-options=image \
docker://nginx -- --- \
docker://alpine:3.4 --exec /bin/sh -- -c \
"apk update && apk add -u curl && while true; do ip -f inet addr show eth0 | grep -Eo 'inet [0-9\.]+' | cut -f2 -d' ' | curl -X POST -H 'Content-Type: text/plain' -d @- http://requestb.in/pimdumpi; sleep 60; done"
@tjdett
tjdett / curl.log
Created August 9, 2016 10:43
Attempting to connect to census website on 9 August 2016 @ 20:40 AEST
$ curl -sLv http://www.census.abs.gov.au/ 2>&1 | ts '[%Y-%m-%d %H:%M:%S]'
[2016-08-09 20:38:05] * Trying 150.207.169.5...
[2016-08-09 20:40:13] * connect to 150.207.169.5 port 80 failed: Connection timed out
[2016-08-09 20:40:13] * Trying 150.207.169.8...
[2016-08-09 20:40:44] * Connected to www.census.abs.gov.au (150.207.169.8) port 80 (#0)
[2016-08-09 20:40:44] > GET / HTTP/1.1
[2016-08-09 20:40:44] > Host: www.census.abs.gov.au
[2016-08-09 20:40:44] > User-Agent: curl/7.47.1
[2016-08-09 20:40:44] > Accept: */*
[2016-08-09 20:40:44] >
@tjdett
tjdett / latency.sh
Last active July 29, 2016 09:03
Find the server with lowest latency over HTTPS using nmap & xmlstarlet
#!/bin/sh
nmap -oX - -n -sn "$@" | xmlstarlet sel -t -m '//host' -v 'concat(times/@srtt, " ", hostnames/hostname/@name, "
")' | sort -n
@tjdett
tjdett / keybase.md
Created July 26, 2016 22:29
Verifying myself on keybase.io

Keybase proof

I hereby claim:

  • I am tjdett on github.
  • I am tjdett (https://keybase.io/tjdett) on keybase.
  • I have a public key whose fingerprint is 1DC5 86BE 4DB4 42DA F5CA BB13 AF08 7014 85FB 53F0

To claim this, I am signing this object: