Skip to content

Instantly share code, notes, and snippets.

@copernicus
copernicus / ebs_stats.py
Created February 16, 2012 14:16 — forked from beaufour/ebs_stats.py
Get CloudWatch metrics for Amazon EBS volumes
#!/usr/bin/python
#
# Get Cloudwatch metrics for the EBS volumes attached to an instance
#
import datetime
import logging
import sys
import urllib
@miketheman
miketheman / security-group-cleanup.py
Created May 7, 2012 21:07
AWS EC2 Unused Security Group cleanup
#!/usr/bin/env python
import sys
import boto
import pprint
del_flag = ''
if len(sys.argv) > 1:
del_flag = sys.argv[1]
@alq666
alq666 / custom_event.rb
Created July 5, 2012 16:24
An example on using custom events, tags and aggregation
require 'rubygems'
require 'dogapi'
# Create a simple client
# The host is optional here, it's a shortcut to tie event and metrics to a given host
#
# You typically want to do:
# Dogapi::Client.new(your_actual_api_key_as_a_string, ...)
# We are using ENV to let you experiment via an environment variable.
dog = Dogapi::Client.new(ENV['DATADOG_KEY'])
@kjoconnor
kjoconnor / monitor_queue.py
Created July 20, 2012 11:10
Monitor your SQS queues with boto
from boto.ec2.cloudwatch import CloudWatchConnection
from boto.sqs.connection import SQSConnection
import boto
import sys
from datetime import datetime, timedelta
import locale
from time import sleep
if(len(sys.argv) > 1):
queue_name = sys.argv[1]
@caniszczyk
caniszczyk / clone-all-twitter-github-repos.sh
Created October 9, 2012 04:25
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@tstone2077
tstone2077 / commandLineTemplate.py
Last active June 1, 2019 15:58
Template for a python tool. This template supports:* running on the command line or importing* alternate return codes* argument parsing and validating* logging
# vim: set fileencoding=utf-8
import argparse
import logging
import os
import sys
import json
# -------------------
__doc__ = """
@vgoklani
vgoklani / app.py
Last active December 19, 2022 09:13
Using Flask to output Python data to High Charts
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index(chartID = 'chart_ID', chart_type = 'bar', chart_height = 350):
chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,}
series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}]
title = {"text": 'My Title'}
@glennschler
glennschler / Setup OpenVPN.md
Last active March 5, 2023 00:13
Setup OpenVPN server running on Amazon ec2.

OpenVPN Technologies has provided their SSL VPN solution in a free virtual machine image that can be hosted in the Amazon cloud. This allows anyone to quickly setup their own VPN solution to provide secure internet access, or a secure network between local and remote locations. With Amazon EC2 the cost can be free for the first year, and then can cost less than one US cent ($.005) per hour depending on configuration and bandwidth needs. The OpenVPN license is free for the first two users.

The instructions given by OpenVPN are thorough and easy to follow. They also describe an optional step on how to setup an Amazon static IP address. For free tier or other users who will leave the instance running full-time there is zero cost for this static IP, but for users who plan to only run the VPN on an hourly basis there will be additional ip "reservation" cost for e

@viglesiasce
viglesiasce / monitor-jenkins.py
Last active November 19, 2018 03:55
Monitor Jenkins Free Executors and post to CloudWatch
#!/usr/bin/python
import subprocess
from eucaops import Eucaops
from eucaops import EC2ops
from eutester.eutestcase import EutesterTestCase
from eutester.sshconnection import CommandExitCodeException
import ast
import urllib
class JenkinsCloudwatch(EutesterTestCase):
@SavvyGuard
SavvyGuard / botos3upload.py
Last active September 10, 2024 06:53
Use boto to upload directory into s3
import boto
import boto.s3
import os.path
import sys
# Fill these in - you get them when you sign up for S3
AWS_ACCESS_KEY_ID = ''
AWS_ACCESS_KEY_SECRET = ''
# Fill in info on data to upload