Skip to content

Instantly share code, notes, and snippets.

View hughsaunders's full-sized avatar

Hugh Saunders hughsaunders

View GitHub Profile
@hughsaunders
hughsaunders / delegatesubdomain.py
Last active December 11, 2015 09:19
Delegating a subdomain with the Rackspace Cloud DNS API.
#!/usr/bin/env python
#Import clouddns module
import clouddns
#Authenticate to API
dns=clouddns.connection.Connection('YOUR RACKSPACE CLOUD USERNAME','YOUR API KEY')
#Get domain object
domain=dns.get_domain(name='wherenow.org')
@hughsaunders
hughsaunders / gist:4664040
Created January 29, 2013 12:58
gpg demonstration
hugh3869@hughsaunders:/tmp$ gpg --gen-key
gpg (GnuPG) 1.4.11; Copyright (C) 2010 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
@hughsaunders
hughsaunders / gist:4713772
Created February 5, 2013 11:08
nova upstart job
root@allinone:/var/log/nova# cat /etc/init/nova-compute.conf
description "Nova compute worker"
author "Soren Hansen <soren@linux2go.dk>"
start on runlevel [2345]
stop on runlevel [016]
chdir /var/run
@hughsaunders
hughsaunders / dep_graph.py
Last active December 12, 2015 09:28
Analysing Dependencies in Chef Cookbooks
#!/usr/bin/python
# Script for extracting dependencies from chefcookbook repositories.
# Hugh Saunders 2013
# The output is "item,depdency" one pair per line. The idea is to then graph these with Gegpih (https://gephi.org/)
# There are three methods for working out dependencies see -h or the argparse section in main()
# If you wish to use the cookbook metadata option, use:
# knife cookbook metadata -o cookbook-dir --all
# to generate the json files.
hugh3869@hughsaunders:~/git/roush-client/roushclient$ python shell.py node list
Traceback (most recent call last):
File "shell.py", line 10, in <module>
class RoushShell():
File "shell.py", line 11, in RoushShell
endpoint = RoushEndpoint(None)
File "/home/hugh3869/git/roush-client/roushclient/client.py", line 511, in __init__
self.master_schema = r.json['schema']
TypeError: 'instancemethod' object has no attribute '__getitem__'
@hughsaunders
hughsaunders / gist:5052381
Created February 27, 2013 22:22
check for IDE cruft
(default27)~/git> for repo in opencenter* chef-cookbooks; do pushd &>/dev/null $repo; echo $repo; git ls-files |grep -i idea; popd &>/dev/null; done
opencenter
opencenter-agent
opencenter-client
opencenter-dashboard
opencenter-install-scripts
chef-cookbooks
[2013-03-04T13:13:48+00:00] INFO: Processing package[nova-common] action install (nova::nova-common line 32)
[2013-03-04T13:13:58+00:00] FATAL: SIGTERM received, stopping

================================================================================
Error executing action `install` on resource 'package[nova-common]'
================================================================================

SystemExit
----------
(default27)dont_use_schema_for_args opencenterclient/shell.py:286 ~/git/opencenter-client/opencenterclient > python shell.py
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): opencenter-server.uk.rs.wherenow.org
DEBUG:requests.packages.urllib3.connectionpool:"GET /schema HTTP/1.1" 200 160
usage: opencentercli [-h] [-v] [-d] {node} ...
opencentercli: error: too few arguments
# -*- mode: ruby -*-
# vi: set ft=ruby :
server_ip = '172.20.0.1'
instances = [
{ :name => 'server', :roles => ['server','dashboard'], :ip => server_ip,
:forwards => [8080, 3000] },
{ :name => :chef, :roles => ['agent'], :ip => '172.20.0.2' },
{ :name => :controller, :roles => ['agent'], :ip => '172.20.0.3' },
Log:
---------------
[chef] Fixed port collision for 22 => 2222. Now on port 2200.
[chef] Creating shared folders metadata...
[chef] Clearing any previously set network interfaces...
[chef] Preparing network interfaces based on configuration...
[chef] Forwarding ports...
[chef] -- 22 => 2200 (adapter 1)
VBoxManage showvminfo: