This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if args.qhost: | |
mq = args.qhost | |
elif local_config.get('amqp', 'dsn'): | |
mq = local_config.get('amqp', 'dsn') | |
else: | |
mq = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @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()) } %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'libvirt' | |
conn = Libvirt::open('qemu:///system') | |
mypooldef=<<EOF | |
<pool type='dir'> | |
<name>test_pool</name> | |
<target> | |
<path>/data/pool</path> | |
</target> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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?} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |