Skip to content

Instantly share code, notes, and snippets.

View wido's full-sized avatar

Wido den Hollander wido

View GitHub Profile
@wido
wido / radostimeout.c
Created February 12, 2014 11:57
Testing Ceph RADOS timeout options
#include <stdio.h>
#include <string.h>
#include <rados/librados.h>
int set_rados_option(rados_t cluster, const char *option, const char *value) {
printf("Set the %s option to: %s\n", option, value);
return rados_conf_set(cluster, option, value);
}
int main(int argc, char *argv[]) {
#!/usr/bin/env python
from optparse import OptionParser
def get_object_name(prefix, sector, order):
sector_size = 512
return "%s.%012x" % (prefix, (sector * sector_size) / pow(2, order))
def main():
parser = OptionParser()
@wido
wido / ceph-mirror.vcl
Last active September 22, 2015 10:36
Varnish VCL EU Ceph mirror
vcl 4.0;
import std;
backend download {
.host = "download.ceph.com";
.port = "80";
.connect_timeout = 5s;
.first_byte_timeout = 5s;
.probe = {
@wido
wido / GuestAgent.java
Last active November 9, 2015 12:45
libvirt-java Qemu Guest Agent
import org.libvirt.Connect;
import org.libvirt.Domain;
import org.libvirt.LibvirtException;
public class GuestAgent {
public static void main(String argv[]) {
Connect conn = null;
try {
conn = new Connect("qemu+tcp://[::1]/system");
Domain testDomain = conn.domainLookupByName("guest-agent");
@wido
wido / salt-unbound-dns.py
Created November 25, 2015 08:01
Use Local Salt client to populate DNS
#!/usr/bin/env python
"""
Fetch all IPv6 addresses of Minions and generate local
unbound data based on the output
"""
import json
import salt.client
import salt.output.json_out
local = salt.client.LocalClient()
@wido
wido / pdns-backend-rgw.py
Created November 26, 2013 19:42
PowerDNS backend for Ceph's RGW It responds with a CNAME to the correct bucket location
#!/usr/bin/python
from flask import abort, Flask, request, Response
import json
import subprocess
listen_port = 6780
listen_addr = "0.0.0.0"
debug_mode = True
@wido
wido / keybase.md
Created February 5, 2016 12:04
keybase.md

Keybase proof

I hereby claim:

  • I am wido on github.
  • I am widodh (https://keybase.io/widodh) on keybase.
  • I have a public key whose fingerprint is 3E6B 72CD D59B 1182 20C1 83F7 7DC6 F238 3B4C EEDA

To claim this, I am signing this object:

@wido
wido / kea.json
Last active February 5, 2016 16:05
ISC Kea DHCPv6 server
{
"Dhcp6": {
"renew-timer": 1000,
"rebind-timer": 2000,
"preferred-lifetime": 3000,
"valid-lifetime": 4000,
"lease-database": {
"type": "memfile",
"persist": true,
"name": "/tmp/kea-leases6.csv",
@wido
wido / docker-ipv6
Last active March 10, 2016 11:39
Docker DHCPv6 Prefix Degelation hook
#!/bin/bash
#
# DHCPv6 hook for Docker
#
# This hook will configure Docker to use the first /80 IPv6 subnet
# from the Prefix we got through DHCPv6 Prefix Delegation
#
# A /80 subnet is large enough for Docker. 80 + 48 bits (MAC) equals 128-bits.
#
# dhclient will run this hook after it obtains the lease
@wido
wido / kea-dhcp6.json
Created April 20, 2016 14:58
Kea DHCPv6 Prefix Delegation configuration
{
"Dhcp6": {
"renew-timer": 1000,
"rebind-timer": 2000,
"preferred-lifetime": 86400,
"valid-lifetime": 172800,
"lease-database": {
"type": "memfile",
"persist": false,
"name": "/var/lib/kea/leases6.csv"