Skip to content

Instantly share code, notes, and snippets.

@hurulu
hurulu / preseed-2G-swap
Created March 25, 2015 05:43
Ubuntu unattended installation preseed sample
# Ubuntu Server Quick Install
# by Dustin Kirkland <kirkland@ubuntu.com>
# * Documentation: http://bit.ly/uquick-doc
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/splash boolean false
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
#d-i console-setup/variantcode string
d-i netcfg/choose_interface select auto
@hurulu
hurulu / gist:f5d72aecfa3922b7e5ea
Created June 23, 2015 03:20
openstack-offline-migrate.sh
#!/bin/bash
export OS_AUTH_URL=
export OS_TENANT_NAME=
export OS_USERNAME=
export OS_PASSWORD=
db_password=
if [ $# -ne 2 ];then
echo "$0 instance_uuid dest_compute_node"
exit
fi
@hurulu
hurulu / gist:4b690f5a0764f273b224
Created June 25, 2015 04:47
google-doc-update
var apiUrlPrefix = "http://public-server/";
function getSaUsage() {
getApiData("sa_usage");
getApiData("vcpus_by_user");
getApiData("vcpus_by_tenant");
getApiData("vcpus_by_org");
getApiData("vcpus_by_compute");
getApiData("vcpus_free");
@hurulu
hurulu / cred.conf
Created June 25, 2015 05:21
Update aws route 53
[dev]
Access =
Secret =
Domain = a.edu.au
[production]
Access =
Secret =
Domain = a.org.au
@hurulu
hurulu / bot.py
Created June 25, 2015 05:35
python httpserver
#!/usr/bin/env python
import sys,string,re
import os
import MySQLdb as mdb
dbHost = ''
dbUser = ''
dbPass = ''
dbName = ''
@hurulu
hurulu / vcpus_free.py
Created June 25, 2015 05:37
get free vcpus in nova database
#!/usr/bin/env python
import sys,string
import os
import MySQLdb as mdb
try:
con = mdb.connect('db-server', 'username', 'password', 'dbname');
cur = con.cursor()
cur.execute("select compute_nodes.hypervisor_hostname,sum(compute_nodes.vcpus),sum(compute_nodes.vcpus-compute_nodes.vcpus_used) as free_cores from compute_nodes join services on services.disabled=0 and services.topic='compute' and compute_nodes.service_id=services.id and compute_nodes.deleted_at is NULL;")
@hurulu
hurulu / launch_test_instance.sh
Created February 18, 2016 02:59
Launch a test instance in neutron net environment
#!/bin/bash
prefix="lei-test"
public_net="public-net-id"
subnet_cidr="192.168.9.0/24"
gateway="192.168.9.1"
instance_flavor="Micro-Small"
instance_image="CentOS-7"
@hurulu
hurulu / yum_list_diff.py
Last active March 15, 2016 06:18
Show differences of installed packages on two servers
#!/usr/bin/env python
import subprocess
import sys
#http://fedora.12.x6.nabble.com/yum-list-display-some-package-in-2-rows-td2496921.html
#a wordaround for yum list installed output formatting issue
COMMAND="yum list installed 2>/dev/null|tr \"\n\" \"#\" | sed -e 's/# / /g' | tr \"#\" \"\n\""
def usage():