Skip to content

Instantly share code, notes, and snippets.

# -- app.js --
var sys = require('sys');
var net = require('net');
var server = net.createServer(function (stream) {
stream.setEncoding('utf8');
setInterval(function () {
sys.puts('writing to stream');
Vagrant::Config.run do |global_config|
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.76.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027076")
fixed = (ENV['FIXED'] or "10.0.76.0/24")
global_config.vm.define :chef do |config|
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
@termie
termie / shadow.txt
Created November 21, 2011 18:21
termie todo
- sqlite backend for ksl
- mysql backend for ksl
- keystone-style crud
- (freeform_extras) roles as first class citizens / complex data types
- /bin/ksl tests
- portable policy brain / engine
@termie
termie / gist:1384158
Created November 21, 2011 22:24
example brain / policy interaction
# target:
# nova:action:reboot_instance
# rule:
# roles:admin
# roles:sysadmin, tenant_id:%(tenant_id)s
can_haz(target='nova:action:reboot_instance',
extra={'tenant_id': object.project_id},
@termie
termie / devstack.rb
Created January 19, 2012 19:30 — forked from vishvananda/devstack.rb
Vagrant script for devstack
Vagrant::Config.run do |config|
sshdir = "#{ENV['HOME']}/.ssh/"
cachedir = (ENV['CACHEDIR'] or "#{ENV['HOME']}/box/cache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/box/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.27.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027027")
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "oneiric"
config.vm.box_url = "http://images.ansolabs.com/vagrant/oneiric64.box"
@termie
termie / convert.sh
Created February 13, 2012 23:50
convert mysql dump to sqlite dump
#!/bin/sh
# ================================================================
#
# Convert a mysql database dump into something sqlite3 understands.
#
# Adapted from
# http://stackoverflow.com/questions/489277/script-to-convert-mysql-dump-sql-file-into-format-that-can-be-imported-into-sqlit
#
# (c) 2010 Martin Czygan <martin.czygan@gmail.com>
@termie
termie / gist:2210833
Created March 26, 2012 23:57
Always Say No

Always Say No

Add a new feature? No. Add a column to the database? No. Add another way to lookup a data item? No. Add a new query param to the API? No. No no no no. A quick rule to follow when you want your project to keep a tight scope, to remain scalable and easy to maintain, is to say no to everything.

Feature creep can be subtle, the simple change of making an attribute required in your data model leads to a slew of other new "expected" behaviors.

@termie
termie / gist:4597338
Created January 22, 2013 19:03
Chattime With Termie
10:27 < Hyptosis> man
10:27 < Hyptosis> this software is an iso
10:28 < Hyptosis> I've never gotten an iso to work, not once
10:28 < Hyptosis> but it's the only copy
10:29 < mey> I remember, back at my high school lans, we almost used nothing but iso files to distribute games to play.
10:29 <termie> i can't think of the last time an iso didn't work
10:30 < mey> How are you trying to use them, Hyptosis?
10:31 <termie> they are non-edible, so don't put em in your mouth
10:31 < Hyptosis> I've tried burning them to a disk, but it just wastes the disc
10:31 < Hyptosis> it doesn't do anything
@termie
termie / auth_and_list_images.json
Created February 27, 2013 00:39
Some of the code to make mitmproxy code into replayable http test code
[
{
"request": {
"url": "http://example.com:8770/v2.0/tokens",
"method": "POST",
"content": "{\"auth\": {\"tenantName\": \"termie\", \"passwordCredentials\": {\"username\": \"termie\", \"password\": \"termie\"}}}",
"headers": {
"content-length": "103",
"accept-encoding": "gzip, deflate, compress",
"accept": "*/*",
@termie
termie / haikus_2013_03_13.txt
Created March 14, 2013 02:28
termie's wednesday haiku hour (give or take)
drinking from rooftops
the cloud slakes our very thirst
filtered rainwater
pray the rainmaker
deliver us from the ground
the cloud is our way
within each droplet
seeds of the cloud suspended