Skip to content

Instantly share code, notes, and snippets.

View dch's full-sized avatar
🛋️

Dave Cottlehuber dch

🛋️
View GitHub Profile
@dch
dch / couchdb.yml
Last active August 29, 2015 14:04 — forked from kafecho/gist:2ba793c53f1c0cb15eca
build & install couchdb on centos 6.5 via ansible
---
- hosts: cd-servers
gather_facts: no
sudo: true
user: deploy
tasks:
- name: Install Couchdb dependencies
yum: name={{ item }} state=installed
with_items:
- autoconf
worker_processes 4;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
%% vim:set softtabstop=4 shiftwidth=4 tabstop=4:
-module(sign_certificate).
-author("Michael Taylor <[email protected]>").
%% External exports
-export([sign_certificate/1]).
% sign a certificate from a certificate signing request (CSR)
% RequestDER is a CSR binary in DER format
% return Certificate as binary in DER format
@dch
dch / example.ex
Created June 5, 2014 17:25 — forked from alco/example.ex
# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763
3.14 ; 5.0e21 ; 0.5e-12
100_000_000
# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xf
(ns your.namespace
(:require [riemann.transport :as rtransport]
[riemann.transport.udp :as rudp]
[interval-metrics.core :as metrics]
[clojure.tools.logging :as log])
(:import (java.nio ByteBuffer ByteOrder)
(org.jboss.netty.buffer ChannelBufferInputStream)
(org.jboss.netty.handler.codec.oneone OneToOneDecoder)
(org.jboss.netty.handler.execution ExecutionHandler
MemoryAwareThreadPoolExecutor)))
@dch
dch / reflect.py
Created May 28, 2014 06:58 — forked from huyng/reflect.py
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):

I was able to install FreeBSD on GCE in a very direct way, without the hurdles of Qemu, gcutil, and the FreeBSD installer. All are great tools, but I think my apporach is somewhat more suitable for GCE, or at least much simpler. Much of this is well-known practice for installing manually, with some fluff for managing it as a disk image, as well as the few odd networking requirements of GCE (MTU and netmask).

My basic approach is to:

  • Use my FreeBSD machine at home to build a self-hosting "rescue" disk image for GCE.
  • Start a temporary Linux machine in GCE from a provided image.
  • Copy my image from home to a raw block device.
  • Start a FreeBSD machine in GCE using that block device as the root.
{module, mpegts_alloc}. %% version = 0
{exports, [{module_info,0},{module_info,1},{new,1}]}.
{attributes, []}.
{labels, 7}.
{function, new, 1, 2}.