Skip to content

Instantly share code, notes, and snippets.

View rod-dot-codes's full-sized avatar

Rodney Hawkins rod-dot-codes

View GitHub Profile
@rod-dot-codes
rod-dot-codes / COS2611Assignment2.cpp
Created September 10, 2012 21:16
Computer Science Homework for COS2611: Data Structures
//COS2611 UNIQUE ASSIGNMENT 394025
//QUESTION 1:
#include <iostream>
#include "CustomLinkedList.h"
using namespace std;
int main() {
unorderedLinkedList<char> name;
@rod-dot-codes
rod-dot-codes / treeorder.cpp
Created September 11, 2012 12:20
Assignment 2 Question 6 Trees Traversal Code
#include <boost/scoped_ptr.hpp>
#include <iostream>
#include <queue>
template<typename T>
class TreeNode {
public:
TreeNode(const T& n, TreeNode* left = NULL, TreeNode* right = NULL)
: mValue(n),
mLeft(left),
@rod-dot-codes
rod-dot-codes / custom_smtp_handler.py
Created November 23, 2012 05:56
Send an error message using a custom SMTP Handler from Python logging via Amazon SES.
from logging.handlers import SMTPHandler
from boto.ses.connection import SESConnection
from auth import AWS_ACCESS_KEY,AWS_SECRET_ACCESS_KEY
class SESHandler(SMTPHandler):
""" Send's an email using BOTO SES.
"""
def emit(self,record):
conn = SESConnection(AWS_ACCESS_KEY,AWS_SECRET_ACCESS_KEY)
conn.send_email(self.fromaddr,self.subject,self.format(record),self.toaddrs)
@rod-dot-codes
rod-dot-codes / open-mysql.py
Created June 8, 2013 18:17
This gist allows you to temporarily open up a cluster of Amazon databases or just one to your current IP. Requires GetMyIP
#!/usr/bin/python
from boto.rds import RDSConnection,DBSecurityGroup
from auth import AWS_ACCESS_KEY,AWS_SECRET_ACCESS_KEY
from getmyip import GetMyIP
#Opens access for an IP address to the server.
class RDS():
def __init__(self,ip=None):
self.connection = RDSConnection(AWS_ACCESS_KEY,AWS_SECRET_ACCESS_KEY,validate_certs=False)
self.ip = ip
@rod-dot-codes
rod-dot-codes / GetMyIP.py
Created June 8, 2013 18:17
This returns your current IP.
#!/usr/bin/python
import mechanize
class GetMyIP():
def __init__(self):
br = mechanize.Browser()
br.set_handle_equiv(True)
#br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
@rod-dot-codes
rod-dot-codes / fabfile.py
Created June 8, 2013 18:28
This is a simple Fabric application that can be used to deploy a particular machine within our enviroment. We use Debian based servers. #TODO: Sudo for our users.
#!/usr/bin/python
##Default Installer for Remote Servers
from fabric.api import env,local,run,sudo,put,cd,settings,lcd
from fabric.contrib.files import upload_template,exists
import os
env.user = 'fabricuser'
env.hosts = [""]
@rod-dot-codes
rod-dot-codes / supervisor_django.text
Created June 8, 2013 18:29
Template for Supervisor, UWSGI Django
[program:{{module}}]
command =uwsgi --chdir=/code/{{module}} --logto=/var/log/{{module}}.uwsgi.log --module={{module}}.wsgi:application --env DJANGO_SETTINGS_MODULE={{module}}.settings --socket={{server}} --processes={{processes}} --uid={{uid}} --gid={{gid}} --harakiri={{harakiri}} --home={{home}}
@rod-dot-codes
rod-dot-codes / nginx_django.text
Created June 8, 2013 18:30
A template for Nginx Django connecting to uWSGI
server {
listen {{ports}};
{% if ssl_secure %}
include ssl_secure;
{% endif %}
server_name {{url}};
client_max_body_size 5G;
@rod-dot-codes
rod-dot-codes / nginx.text
Created June 8, 2013 18:30
A basic Nginx Static File server, particular focused for use with Backbone.js install.
server {
listen {{ports}};
{% if ssl_secure %}
include ssl_secure;
{% endif %}
server_name {{url}};
client_max_body_size 5G;
@rod-dot-codes
rod-dot-codes / gist:5736145
Last active December 18, 2015 05:58
Works slower than expected due to the unexpected uselessness of S3FS.
#!usr/bin/python
#run: python S3UploadGit.py <full_repo> <s3_full_name>
from CREDENTIALS import AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from fabric.context_managers import shell_env
from fabric.api import local,settings,lcd,prefix
import os