Skip to content

Instantly share code, notes, and snippets.

View JohnPreston's full-sized avatar
🏠
Working on AWS' cloud

John Preston JohnPreston

🏠
Working on AWS' cloud
View GitHub Profile
@JohnPreston
JohnPreston / DB_cleanup.sh
Created September 14, 2014 08:40
DB Cleanup
delete from volume_exports where token in (select id from volume_tokens where volume in (select id from volumes where status='deleted'));
delete from volume_tokens where volume in (select id from volumes where status='deleted');
delete from volumes where status='deleted';
@JohnPreston
JohnPreston / ec2.json
Created October 2, 2014 12:32
EC2 example
{
"_meta": {
"hostvars": {
"euca-109-104-120-20.ecu.emea-cloud-testlab.eucalyptus.com": {
"ec2__in_monitoring_element": false,
"ec2_ami_launch_index": "0",
"ec2_architecture": "x86_64",
"ec2_client_token": "cfe42f3d-15df-4fa6-ac03-c5e1cf714a8f_emea-01_1",
"ec2_dns_name": "euca-109-104-120-20.ecu.emea-cloud-testlab.eucalyptus.com",
"ec2_eventsSet": "",
@JohnPreston
JohnPreston / deny_instance_type.json
Last active August 29, 2015 14:09
IAM deny instance type policy
## Eucalyptus Generator ###
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "ec2:RunInstances",
"Conditions": {
"StringNotEquals": {
"ec2:InstanceType": "m1.small"
@JohnPreston
JohnPreston / tests3.py
Created December 12, 2014 11:24
SimpleS3Test
#!/usr/bin/env python
import boto
from boto.s3.connection import OrdinaryCallingFormat
import os
import requests
S3_HOST='10.105.10.30'
connection = boto.connect_s3(is_secure=False, host=S3_HOST, port=8773, path="/services/objectstorage", calling_format=OrdinaryCallingFormat())
@JohnPreston
JohnPreston / test_private_addressing.sh
Created February 2, 2015 09:31
Check instances private only routing works
#!/usr/bin/env bash
# Eucalyptus account credentials need to be sourced in the environment first.
# If not, add -I -S and -U options accordingly
# Using a specific NC IP, we list all instances on this NC then get their IP address to get ssh-ed to it and ping outside network.
#
euca-describe-instances | grep $NODE_IP | awk '{print $3}' | xargs -i -P10 euca-describe-instances {} | grep INST |awk '{print $12}' | xargs -i -P10 ssh -i ~/admin.pem {} ping -c1 google.co.uk
@JohnPreston
JohnPreston / wait_for.sh
Created May 6, 2015 09:58
Wait for ITER to show up in a file
tail -500f /var/log/messages | while read LINE ;
do if [ `echo $LINE | grep sda | wc -l` -gt 0 ];
then echo victory ; killall tail ; exit 0;
fi ; done
# can be a single line :)
# replace 'sda' by the ITER you are looking for
@JohnPreston
JohnPreston / my_shortcuts.sh
Created May 12, 2015 21:44
Euca shortcuts
#!/usr/bin/env bash
# for TYPED in `euca-describe-instance-types | grep -v Name | awk '{print $2}'` ; do euca-modify-instance-type $TYPED -d `euca-describe-instance-types $TYPED | grep -v GiB | awk '{print $5 - 5}' | bc` ; done
#!/usr/bin/env bash
PHY_DRIVES=`hpssacli ctrl slot=0 show config | grep physicaldrive | awk '{print $2}'`
for phy_drive in $PHY_DRIVES ; do
echo $phy_drive
if [ "$#" -eq 1 ] && [ "$1" == "--apply" ]; then
hpssacli ctrl slot=0 create type=ld raid=0 drives=$phy_drive size=max ss=256 aa=disable
[epel-c-6]
name=epel-c-6
baseurl=http://dl.fedoraproject.org/pub/epel/6/x86_64
enabled=1
priority=99
gpgcheck=0
[centos-6-updates]
name=centos-6-updates
[epel-c-6]
name=epel-c-6
baseurl=http://dl.fedoraproject.org/pub/epel/7/x86_64
enabled=1
priority=99
gpgcheck=0
[centos-6-updates]
name=centos-6-updates