Skip to content

Instantly share code, notes, and snippets.

@stuartmyles
stuartmyles / SNSTopic.py
Last active February 6, 2020 22:36
A complete example of how to use Amazon Web Services Simple Notification Services from Python. This code uses the boto library https://github.com/boto/boto to create a topic, wait for a confirmation and then send a success message. Simply plug in your AWS access and secret keys, plus your email and mobile phone number.
# An example of how to use AWS SNS with Python's boto
# By Stuart Myles @smyles
# http://aws.amazon.com/sns/
# https://github.com/boto/boto
#
# Inspired by parts of the Ruby SWF SNS tutorial http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-sns-tutorial-implementing-activities-poller.html
# And the Python SNS code in http://blog.coredumped.org/2010/04/amazon-announces-simple-notification.html and http://awsadvent.tumblr.com/post/37531769345/simple-notification-service-sns
import boto.sns as sns
import json
@vojtajina
vojtajina / all-templates.html
Created August 15, 2012 00:00
AngularJS: load all templates in one file
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 20, 2024 03:08
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@aderowbotham
aderowbotham / django_ami.md
Created June 7, 2012 14:19
Django stack setup on EC2 AMI

Django Stack

Overview

This is a set of instructions to setup a Django Nginx Gunicorn MySQL/Postgres stack on a single Amazon EC2 instance.

Server - AWS

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@andreiolariu
andreiolariu / hackaton.py
Created November 27, 2011 15:14
uberVU Hackaton - Noun-verb relationships
# more info: http://webmining.olariu.org/ubervu-hackaton-relationship-tagcloud
from nltk import pos_tag, word_tokenize
import en # Nodebox English Linguistics library
import urllib, urllib2, re
import json
from time import time
def fetch_url(url, get=None, post=None):
user_agent = 'Andrei Olariu\'s Web Mining for Dummies'
@purplecabbage
purplecabbage / pgDebug.js
Created July 15, 2010 01:10
Workout your iPhone PhoneGap UI in Desktop Safari
var safariDebug = ( navigator.platform.indexOf("iPhone") < 0 && navigator.platform.indexOf("iPod") < 0 && navigator.platform.indexOf("iPad") < 0 );
if(safariDebug)
{
PhoneGap.run_command = function()
{
if (!PhoneGap.available || !PhoneGap.queue.ready)
return;
@somic
somic / gist:123889
Created June 4, 2009 22:16
Prints out how many seconds ago this EC2 instance was started
#!/bin/bash
#
# Prints out how many seconds ago this EC2 instance was started
#
# It uses Last-Modified header returned by EC2 metadata web service, which as far
# as I know is not documented, and hence I assume there is no guarantee
# that Last-Modified will be always set correctly.
#
# Use at your own risk.
#
@qingfeng
qingfeng / logtodb.py
Created August 4, 2008 06:07
Python Class
#!/usr/local/bin/python
from __future__ import with_statement
import sys
import MySQLdb
class Log2DB(object):
"""hadoop log result into database"""
def __init__(self):
self.DB_USER='root'
self.DB_PASS=''