Skip to content

Instantly share code, notes, and snippets.

View kordless's full-sized avatar
🦥
sloth mode

Коrd Campbell kordless

🦥
sloth mode
View GitHub Profile
{% macro form_field(field) -%}
{% set with_label = kwargs.pop('with_label', False) %}
{% set placeholder = '' %}
{% if not with_label %}
{% set placeholder = field.label.text %}
{% endif %}
<div class="control-group {% if field.errors %}error{% endif %}">
{% if with_label %}
<label for="{{ field.id }}" class="control-label">
{{ field.label.text }}{% if field.flags.required %} *{% endif %}:
@kordless
kordless / openstack.py
Created April 20, 2014 12:40
python implementation of cinder volume and attach for openstack
import os
import shutil
from subprocess import Popen
from novaclient.v1_1 import client as novaclient
from cinderclient import client as cclient
import keystoneclient.v2_0.client as ksclient
import glanceclient
from webapp import app, db
#!/usr/bin/python
import sys
import time
import json
import hmac
import hashlib
from urllib2 import urlopen, Request, build_opener, HTTPError
from urllib import quote
@kordless
kordless / .DS_Store
Last active August 29, 2015 14:01
StackMonkey Public Prezo
#!/bin/bash
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "You need to be 'root' dude." 1>&2
exit 1
fi
. ./setuprc
@kordless
kordless / simpleboot.json
Last active August 29, 2015 14:05
A simple example for booting a Cirros image from StackMonkey.
{
"image": {
"url": "http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img",
"name": "cirros image",
"container_format": "bare",
"disk_format": "qcow2"
},
"callback_url": "",
"ssh_keys": [],
"post_create": []
post_data = {
"callback_url": "https://gist.githubusercontent.com/kordless/88046b0f91fb6e3e1b21/raw/prezo.json",
}
$.ajax({
type: "POST",
url: "https://www.stackmonkey.com/api/v1/bids/",
data: JSON.stringify(post_data),
dataType: "application/json"
}).done(function(data) {
@kordless
kordless / redirect.json
Last active August 29, 2015 14:08
When used with the StackMonkey pool, the the following JSON will cause a redirect to occur on the starting appliance. Subsequent calls will be made to the callback URL instead of the pool.
{
"callback_url": "https://gist.githubusercontent.com/kordless/7c59f33c0659d06948ce/raw/simpleboot.json"
}
@kordless
kordless / splunk_install.sh
Last active August 29, 2015 14:08
Simple Splunk Deployment to Ubuntu 14.04 for StackMonkey
#!/bin/bash
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "You need to be 'root' dude." 1>&2
exit 1
fi
echo;