Skip to content

Instantly share code, notes, and snippets.

@t0mmyt
t0mmyt / figure_1.png
Last active February 14, 2017 20:45
Basic calculation of frequency as a function of time based on change of direction
figure_1.png
@t0mmyt
t0mmyt / bars.js
Created January 31, 2017 20:18
d3 stuff
var w = 500;
var h = 100;
var barPadding = 2;
var dataset = [ 5, 10, 13, 19, 21, 25, 22, 18, 15, 13,
11, 12, 15, 20, 18, 17, 16, 18, 23, 25 ];
var svg = d3.select("#contents")
.append("svg")
.attr("width", w)
.attr("height", h);
var bars = svg.selectAll("rect")
<script>
var w = 500;
var h = 100;
var barPadding = 2;
var dataset = [ 5, 10, 13, 19, 21, 25, 22, 18, 15, 13,
11, 12, 15, 20, 18, 17, 16, 18, 23, 25 ];
var svg = d3.select("#contents")
.append("svg")

Keybase proof

I hereby claim:

  • I am t0mmyt on github.
  • I am tommyt (https://keybase.io/tommyt) on keybase.
  • I have a public key ASBppUWZXPp-KOW8xqjzqn_ZIhilTlQ8MoJEkRoJPjI1_go

To claim this, I am signing this object:

@t0mmyt
t0mmyt / Dockerfile
Created December 13, 2016 14:27
Etcd Autoscaling
FROM python:2.7-alpine
MAINTAINER Tom Taylor <[email protected]>
EXPOSE 2379 2380
ENV ETCD_VER=v2.3.7
RUN apk --update --no-cache --virtual .builddeps add curl tar && \
curl -Lso etcd-${ETCD_VER}-linux-amd64.tar.gz https://github.com/coreos/etcd/releases/download/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz && \
tar zxf etcd-${ETCD_VER}-linux-amd64.tar.gz etcd-${ETCD_VER}-linux-amd64/etcd && \
mv etcd-${ETCD_VER}-linux-amd64/etcd / && \
@t0mmyt
t0mmyt / kubedns-rc.yaml
Created November 28, 2016 15:21
kubedns
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@t0mmyt
t0mmyt / config
Created November 15, 2016 23:35
i3 configs
set $mod Mod4
# Less silly DPI
exec --no-startup-id xrandr --dpi 160
# Auto screensaver
exec --no-startup-id xautolock -time 10 -locker ~/bin/lock.sh
# wallpapers
exec --no-startup-id nitrogen --restore
# GSD
exec --no-startup-id /usr/lib64/gnome-settings-daemon/gnome-settings-daemon
@t0mmyt
t0mmyt / get
Created August 30, 2016 13:28
Get kubectl
curl -o ~/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.3.4/bin/linux/amd64/kubectl
function addIfNotIn {
grep "${1}" ${2} >/dev/null 2>&1 || echo "${1}" | tee -a ${2}
}
@t0mmyt
t0mmyt / Get my ASG
Last active April 21, 2016 15:20
AWS CLI
# Requires describe tags in IAM
aws ec2 --region eu-west-1 describe-tags --filter "Name=resource-id,Values=$(curl -ss http://169.254.169.254/latest/meta-data/instance-id)" | jq '.Tags[] | select(.Key=="aws:autoscaling:groupName").Value'
# Get IPs of other instances in my ASG
aws ec2 --region eu-west-1 describe-instances --filter Name=tag:aws:autoscaling:groupName,Values=$(aws ec2 --region eu-west-1 describe-tags --filter "Name=resource-id,Values=$(curl -ss http://169.254.169.254/latest/meta-data/instance-id)" | jq '.Tags[] | select(.Key=="aws:autoscaling:groupName").Value') | jq '.Reservations[].Instances[] | select(.State.Name=="running") | .NetworkInterfaces[0].PrivateIpAddress'