Skip to content

Instantly share code, notes, and snippets.

View cutwater's full-sized avatar

Alexander Saprykin cutwater

  • Red Hat
  • Krakow, Poland
View GitHub Profile
import argparse
class _SubParsersAction(argparse._SubParsersAction):
def __init__(self, *args, **kwargs):
super(_SubParsersAction, self).__init__(*args, **kwargs)
self._other_actions = []
def add_parser(self, name, **kwargs):
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
class gen():
def __enter__(self):
print('enter')
def __exit__(self, exc_type, exc_val, exc_tb):
print('exit')
def test():
with gen():
for i in range(10):
@cutwater
cutwater / local.conf
Created July 25, 2015 11:42
Devstack local.conf file
[[local|localrc]]
ADMIN_PASSWORD=devstack
MYSQL_PASSWORD=devstack
RABBIT_PASSWORD=devstack
SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=devstack
# Neutron ML2 with OpenVSwitch
Q_PLUGIN=ml2
Q_AGENT=openvswitch
#!/bin/bash
VM_NAME="ubuntu-server-14.04.3"
MEMORY=512
VCPU=1
CDROM=/path/to/iso
DKSK=/path/to/disk/image
DISK_FORMAT=qcow2
OS_VARIANT=ubuntutrusty
GRAPHICS=spice
@cutwater
cutwater / install-fuel-master.sh
Created January 14, 2016 11:57
Fuel installation scripts
#!/bin/bash
NAME=fuel-master
MEMORY=2048
CPU=1
CPU_TYPE=host
CDROM="/mnt/data/images/_fuel/fuel-current.iso"
#DISK_1="path=/dev/vg0/fuel-master,bus=virtio,format=raw"
@cutwater
cutwater / vm-install-template.xml
Created February 1, 2016 21:37
Libvirt KVM templates
<domain type='kvm'>
<name>{{ vm_name }}</name>
<memory>{{ vm_memory_KB }}</memory>
<currentMemory>{{ vm_memory_KB }}</currentMemory>
<vcpu>{{ vm_cpu }}</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
@cutwater
cutwater / isolinux__txt.cfg
Last active February 12, 2016 14:50
Ubuntu automated installation
default virtserver
label virtserver
menu label Install ^Virtual Server
kernel /install/vmlinuz
append file=/cdrom/preseed/virtual-server.seed debian-installer/locale=en_US.UTF-8 keyboard-configuration/layoutcode=us vga=788 initrd=/install/initrd.gz quiet --
label install
menu label ^Install Ubuntu Server
kernel /install/vmlinuz
append file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz quiet --
label cloud
@cutwater
cutwater / yaml_loader.py
Last active July 25, 2016 09:45
YAML metadata loader
import six
import yaml
class YamlMetadata(object):
def __init__(self, mark):
self.mark = mark
@property
def line(self):
@cutwater
cutwater / policy-controller.yaml
Last active October 17, 2016 15:02
Calico Policy Controller
# Create this manifest using kubectl to deploy
# the Calico policy controller on Kubernetes.
apiVersion: v1
kind: ReplicationController
metadata:
name: calico-policy-controller
namespace: kube-system
labels:
k8s-app: calico-policy
kubernetes.io/cluster-service: "true"