This file contains 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 collections | |
class TransformedDict(collections.MutableMapping): | |
def __init__(self, *args, **kwargs): | |
self.store = dict() | |
self.update(dict(*args, **kwargs)) # use the free update to set keys | |
def __getitem__(self, key): | |
return self.store[self.__keytransform__(key)] |
This file contains 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
python yourscript.py 2>&1 | awk '/ line / {file = gensub(/,/, "", "", $2); line = $4} END {printf("vim +%d %s\n",line, file)}' | |
This file contains 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
# first example, data from different sources | |
--- | |
openstack: | |
nova: | |
location: | |
source: link!openstack.hw.node0 | |
conf: | |
source: link!/parent/location/fs/etc/nova/nova.conf | |
hw: |
This file contains 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
--- | |
openstack: | |
nodes: | |
.backend: "sqlite!nodes.db" | |
keys: | |
.backend: "memcached!10.2.50.90:5553" | |
--- |
This file contains 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
#!/bin/sh | |
IP=172.16.128.1 | |
SOURCE_CMD="ssh root@${IP} ps w" | |
#SOURCE_CMD="cat /tmp/tpl" | |
while :; do | |
ping -W1 -c1 ${IP} && break | |
done |
This file contains 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
#!/bin/sh | |
PATH=${PATH}:/usr/local/bin/ | |
calendar_get_events() { | |
local day="${1:-tomorrow}" # see man date(1) DATE STRING | |
# validate day syntax | |
for i in $day "$day + 1 day"; do | |
date -d"${i}" "+%Y-%m-%d" >/dev/null 2>&1 || { |
This file contains 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
export IMAGE_ID=`nova image-list | awk '/TestVM/ {print $2}'` export NET_ID=`nova net-list | awk '/net04 / {print $2}'`; export FLAVOR_ID=`nova flavor-list | awk '/m1.micro/ {print $2}'`; seq 1 15 | xargs -tI% sh -c 'nova add-floating-ip `nova boot vm% --image $IMAGE_ID --flavor=${FLAVOR_ID} --nic net-id=$NET_ID | awk "/ id / {print \\$4}"` `nova floating-ip-create | awk "/[0-9]+?\.[0-9]+\./ {print \\$2}"`' |
This file contains 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
#!/usr/bin/ruby | |
# | |
# | |
require 'astute' | |
require 'net/http' | |
require 'pp' | |
require 'yaml' | |
require 'json' |
This file contains 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
def router_data(node, router_id): | |
stdout, _ = ssh.call(["/bin/bash", "-c", ". /root/openrc &&" | |
"neutron l3-agent-list-hosting-router " | |
"{0} -f json".format(router_id)], | |
stdout=subprocess.PIPE, node=node) | |
try: | |
return json.loads(stdout)[0] | |
except: |
This file contains 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
#!/bin/sh | |
KEYSTONE_USER=`cat /etc/fuel/astute.yaml | python -c 'import yaml, sys; print yaml.load(sys.stdin)["FUEL_ACCESS"]["user"]'` | |
KEYSTONE_PASS=`cat /etc/fuel/astute.yaml | python -c 'import yaml, sys; print yaml.load(sys.stdin)["FUEL_ACCESS"]["password"]'` | |
KEYSTONE_TENANT=admin | |
KEYSTONE_URL="http://127.0.0.1:5000/v3" | |
function auth_data() { | |
cat<<EOF | |
auth: |
OlderNewer