Skip to content

Instantly share code, notes, and snippets.

View lusis's full-sized avatar

John E. Vincent lusis

View GitHub Profile
@lusis
lusis / again.py
Created September 23, 2010 06:39
if args.qhost:
mq = args.qhost
elif local_config.get('amqp', 'dsn'):
mq = local_config.get('amqp', 'dsn')
else:
mq = None
<% @fragments = %w[foo bar baz] %>
var1 = <%= somevar1 %>
var2 = <%= somevar2 %>
<%= @fragments.each_index { |x| fragment = @fragments[x]; ERB.new(IO.read("../fragments/#{fragment}_.erb"), nil, nil, "_#{fragment}_#{x}").result(binding()) } %>
import logging
import logging.handlers
DEFAULT_LOG_FMT = '[%(asctime)s: %(levelname)s] %(name)s (%(module)s) - %(message)s'
DEFAULT_LOG_LEVEL = logging.WARN
DEFAULT_LOG_FILE = None
class NullHandler(logging.Handler):
def emit(self, record):
pass
conn = pymongo.Connection()
db = conn['testdb']
coll = db['testcollection']
mydict = {'foo': 'bar', 'baz.bingo.com': 'down'}
coll.insert({'status': mydict})
c in encode(cls, document, check_keys)
460 .. versionadded:: 1.9
461 """
--> 462 return cls(_dict_to_bson(document, check_keys))
require 'rubygems'
require 'libvirt'
conn = Libvirt::open('qemu:///system')
mypooldef=<<EOF
<pool type='dir'>
<name>test_pool</name>
<target>
<path>/data/pool</path>
</target>
Find an available public or private IP via grid_ip_list. Optionally, specify US-East-1 datacenter.
Find the image you want to use via grid_image_list
Instantiate server with chosen IP address id, chosen image id and ram setting. CPU is automatically allocated based on RAM sizing
import argparse
from mock import Mock
m = Mock()
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
query_group = subparsers.add_parser('query')
add_group = subparsers.add_parser('add')
snippet feat
Feature: ${1:Feature name}
In order to ${2}
As a ${$3}
I want to ${4}
snippet scen
Scenario: ${1:Scenario}
Given ${2:what?}
And ${3:what?}
When ${4:what?}
@lusis
lusis / db-dev.xml
Created October 21, 2010 05:27
sample kvm vm definition
<domain type='kvm'>
<name>db-dev</name>
<uuid>3729efd2-affd-de56-205c-be336fd4a658</uuid>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='i686' machine='pc-0.12'>hvm</type>
<boot dev='hd'/>
</os>
class Storage
class Pool
# Basic attributes for a storage pool
attr_accessor :type
attr_accessor :name
attr_accessor :uuid
attr_accessor :target_args
attr_accessor :source_args
# Optional attributes for pool target