Skip to content

Instantly share code, notes, and snippets.

View barnybug's full-sized avatar
🏠
Working from home

Barnaby Gray barnybug

🏠
Working from home
View GitHub Profile
@barnybug
barnybug / docker-compose.yml
Created November 21, 2017 11:14
Docker compose for a Docker-in-docker gitlab runners setup
# Docker-in-Docker Gitlab runners setup taken from:
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:17.09.0-ce-dind
command:
- --storage-driver=overlay2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.virtualbox.vboxautostart</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart</string>
<string>--start</string>
@barnybug
barnybug / ec2names.py
Created September 9, 2012 19:17
Script to name all ec2 instances after the node name allocated to the elasticsearch running on that instance.
#!/usr/bin/python
# Script to name all ec2 instances after the node name allocated to the
# elasticsearch running on that instance. This makes it easy to track back
# to the physical system from visualization tools like bigdesk and head.
#
# Run directly on any elasticsearch node or port forward 9200 to a node in the
# cluster. Simple run without arguments:
# ./ec2names.py
#
#!/usr/bin/env python
# Script to run dynamic dns for docker containers.
# DNS is served by dnsmasq running on the docker0 gateway ip, and dynamically
# updated at containers come and go.
#
# To use from docker, just provide the --dns option:
# docker run --dns <gateway> ...
# The gateway ip you need will be printed when this script is run.
@barnybug
barnybug / k8s-tips.md
Created July 17, 2018 09:43
kubernetes tips

List pods ordered by node:

kubectl get po -o=wide --sort-by=.spec.nodeName

List nodes by instance type / zone:

kubectl get no -Lbeta.kubernetes.io/instance-type -Lfailure-domain.beta.kubernetes.io/zone
{
_index: "events_201701160824",
_type: "event",
_id: "AV6VlZ-AHWGhPQNyr0dK",
_score: 6.8922844,
_source: {
event: "portal.impressions",
sid: "dc7e7cec-800a-4454-b89e-2d42dfe0097a",
pid: "a03f0281-c9e3-4ba2-b5d0-92af0554af54",
total_count: 1,
import macros
import strutils
proc compile(input: string, setup: string): NimNode {.compiletime.} =
var caseBody = newNimNode(nnkCaseStmt)
caseBody.add parseExpr("pc")
var pc = 0
template addCase(text): typed =
var branch = newNimNode(nnkOfBranch)
~ % mosquitto_sub -h iot.eclipse.org -t 'cheerlightsRGB'
#000000
~ % mosquitto_sub -h iot.eclipse.org -t 'cheerlights'
oldlace
~ % mosquitto_sub -h iot.eclipse.org -t 'cheerlightsRGB'
#000000
^C⏎ ~ % mosquitto_sub -h iot.eclipse.org -t 'cheerlights'
oldlace
^C⏎
@barnybug
barnybug / jg
Last active December 12, 2015 01:18
jg - json document generator
Moved to: http://github.com/barnybug/jg