Skip to content

Instantly share code, notes, and snippets.

@esoupy
esoupy / ec2-get-ssh
Created August 23, 2012 17:42
Updated ec2 public key retrieval script. Modified to not append the key if the key already exists.
#!/bin/bash
# Modified to check if the already exists
# processname: ec2-get-ssh
# description: Capture AWS public key credentials for EC2 user
# Source function library
. /etc/rc.d/init.d/functions
# Source networking configuration
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
@esoupy
esoupy / LockFile.sh
Last active December 10, 2015 18:58
Bash LockFile function to prevent multiple executions of the same script. Remember to include 'LockFile remove' with any script exits to prevent lingering stale lock files.
#!/bin/bash
## LockFile function ##
# example:
# main() {
# LockFile create
# RunScriptStuff
# LockFile remove
# }
#Globals
@esoupy
esoupy / Timer.sh
Last active December 10, 2015 18:58
bash script Timer function. Creates a stopwatch and displays the time duration between calls.
#!/bin/bash
## Timer Function - displays the timed duration between start and stop ##
# example:
# Timer start
# Script_Cmds
# Timer stop
Timer() {
## Set a timer to display duration ##
@esoupy
esoupy / mkmongolinks
Created April 14, 2013 19:36
Create MongoDB links in /usr/local/bin
@esoupy
esoupy / OpenSwan-guide
Created November 5, 2013 21:53
OpenSwan Install and Configuration on Ubuntu between AWS VPC's
Required:
An instance accessible with an EIP from each VPC network
Unique and non-overlapping CIDR ranges
Security Group allowing each others EIP (udp: 500,4500 and icmp: echo reply)
Disable Source/Dest Check on each Openswan AWS instance
Configure Routing Tables on each VPC (add tables with associated subnets)
Remote Network A: 10.11.0.0/16 -> openswan instance id
Remote Network B: 10.10.0.0/16 -> openswan instance id
@esoupy
esoupy / modconfig.py
Created January 24, 2013 23:24
Python script to Modify a setting in a config or properties file. It will overwrite the existing assigned value or append the new variable if it isn't found.
#!/usr/bin/env python
__author__ = 'Eric Sales'
INFO="""
modconfig
Modify a setting in a config or property file.
It will overwrite the existing assignment or make an
addition if the variable isn't found."""
USAGE="""
@esoupy
esoupy / aws_ec2_manage.py
Created December 6, 2013 22:00
Quick boto script to start, stop, or view the status of your AWS instances
#!/usr/bin/env python
"""
Required:
boto
IAM account credentials with EC2 instances describe,start,stop privileges
"""
import boto.ec2
import sys