This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import boto3 | |
### ### | |
# Need aws credentails already been configured # | |
### ### | |
### Code based on https://gist.github.com/miketheman/2630437 | |
client = boto3.client('ec2') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, os | |
import boto | |
def print_usage(): | |
print """ | |
mysqlrds launch <id> | |
mysqlrds status <id> | |
mysqlrds destroy <id> | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
if __name__ == "__main__": | |
fname = os.path.basename(__file__) | |
print fname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### optparser has been discarded since python2.7, try argparse instead | |
### Url: http://lingxiankong.github.io/blog/2014/01/14/command-line-parser/ | |
from optparser import OptionParser | |
parser = OptionParser() | |
parser.add_option('-f', '--file', dest="filename", help="write report to FILE", metavar="FILE") | |
options, args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class argTester(object): | |
def __init__(self, name1, name2): | |
self.name1 = name1 | |
self.name2 = name2 | |
def printer(self): | |
print("Hello, this is %s. Nice to meet you, %s" % (self.name1, self.name2)) | |
tester = argTester("Frank", "Shirly") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ebs-snapshot.sh. Performs and validates EBS snapshots. | |
# snapshot date format 20111118-2305 | |
snapshot_date=`date +s%Y%m%d-%H%M` | |
# Set name of script | |
progname=${0##*/} ## Get the name of the script without its path |