Skip to content

Instantly share code, notes, and snippets.

View tomellis's full-sized avatar

Tom Ellis tomellis

View GitHub Profile
import hmac
from hashlib import sha1
from time import time
path = 'v1/MossoCloudFS_db3a5ebc-f7dd-4108-ab6e-a0bc7b3fbc93/test'
redirect = 'http://mysite.com/thanks.html'
max_file_size = 104857600
max_file_count = 10
expires = int(time() + 600)
print "expires: "
@tomellis
tomellis / gist:5531894
Created May 7, 2013 11:13
Get IP out of Rackspace cloud
#!/usr/bin/env python
import os
import sys
import logging
import pyrax
import pyrax.exceptions as exc
import exceptions
@tomellis
tomellis / gist:5531886
Created May 7, 2013 11:11
Add DNS with pyrax to Rackspace Cloud
import os
import logging
import sys
import pyrax
import pyrax.exceptions as exc
logging.basicConfig(level=logging.DEBUG)
@tomellis
tomellis / gist:5531859
Created May 7, 2013 11:05
Rax Ansible
- name: Launch a server in rax cloud # playbook name
hosts: local # target local host
connection: local # run actions locally
gather_facts: false # forget gathering facts, this is our local system
tasks:
- name: Create a server # task name
local_action:
module: rax # module to use
creds_file: /home/trellis/creds # path to your credentials
@tomellis
tomellis / get-ip-output
Created May 1, 2013 15:35
Intermittent connection issue
# Successful request output
trellis@debian:~/rackspace-cloud-env$ python get-ip.py
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lon.servers.api.rackspacecloud.com
DEBUG:requests.packages.urllib3.connectionpool:"GET /v2/xxxxx/servers/detail HTTP/1.1" 200 1643
Name: xxxx
ID: xxxx
Public IP: 1.2.3.4
# Unsuccessful request output
@tomellis
tomellis / get-ip.py
Created May 1, 2013 15:31
Get Rackspace Cloud Server Public IP Addresses
#!/usr/bin/env python
import os
import sys
import logging
import pyrax
import pyrax.exceptions as exc
# Set loglevel
@tomellis
tomellis / read_reddit.py
Created April 15, 2013 15:39
Updated for urllib3 for MongoDB for developers course (M101P)
import json
import urllib3
import pymongo
# connect to mongo
connection = pymongo.Connection("mongodb://localhost", safe=True)
# get a handle on the reddit db
db=connection.reddit
stories = db.stories
@tomellis
tomellis / ks-centos6-euca.cfg
Last active December 14, 2015 09:19
AMI-Creator CentOS6 Kickstart
# Build a basic CentOS 6 AMI
lang en_US.UTF-8
keyboard us
timezone US/Eastern
auth --useshadow --enablemd5
selinux --disabled
firewall --disabled
bootloader --timeout=1
network --bootproto=dhcp --device=eth0 --onboot=on
services --enabled=network
@tomellis
tomellis / euca-clc-backup.sh
Created December 12, 2012 15:15
Eucalyptus CLC backup script
#!/bin/sh
# Eucalyptus CLC Backup & Restore script
# - includes DB & Keys
# Database Options
DBPORT="8777"
DBUSER="root"
DBDIR="/var/lib/eucalyptus/db/data"
DBSOCKET="${DBDIR}/.s.PGSQL.${DBPORT}"
@tomellis
tomellis / CCclient-enabled-check.sh
Created November 8, 2012 01:23
Check script for keepalived
#!/bin/bash
#
# Check to see if a CC service is in ENABLED or DISABLED state using CCclient_full
# Author: Tom Ellis <tom.ellis@eucalyptus.com>
#
# Returns 1 if DISABLED or not installed
# Return 0 if ENABLED
export AXIS2C_HOME=/usr/lib64/axis2c
export LD_LIBRARY_PATH=$AXIS2C_HOME/lib:$AXIS2C_HOME/modules/rampart/