Skip to content

Instantly share code, notes, and snippets.

"""
Delete S3 bucket with contents, with S3 Multi-Object Delete.
This script makes you delete S3 bucket quickly.
Before using this script, please install boto
$ pip install boto
and setup ~/.boto config
# Description:
# Messing around with the curator.im API.
#
# Commands:
# hubot curator - give you random girl photo from curator.im
module.exports = (robot) ->
robot.respond /(curator|girl)/i, (msg) ->
msg.http("http://curator.im/api/stream/")
.query({
@tzangms
tzangms / positive.coffee
Created July 10, 2013 05:34
Positive plugin for Hubot
# Description:
# Positive plugin, it just anwsers you "超充實der!"
#
module.exports = (robot) ->
robot.respond /今天.*|How's going/i, (msg) ->
msg.send "超充實der!"
@tzangms
tzangms / octo2wp.py
Last active December 18, 2015 03:38
I wrote this script to convert my octopress posts back into wordpress, by using xmlrpc.
"""
Requirements:
* A Wordpress Blog
* Python Packages: Markdown, PyYAML, python-wordpress-xmlrpc
>>> pip install Markdown python-wordpress-xmlrpc PyYAML
WARNING:
import requests
import urllib
import json
import logging
logger = logging.getLogger(__name__)
class FacebookLike(object):
def __init__(self, access_token, user_id):
@tzangms
tzangms / cfsign.py
Created November 26, 2012 03:30
Private content signing for CloudFront in python
import Crypto.Hash.SHA
import Crypto.PublicKey.RSA
import Crypto.Signature.PKCS1_v1_5
import base64
import time
KEY_PAIR_ID = "your_key_pair_id"
PRIV_KEY_FILE = "pk-xxxxxxxxxx.pem"
@tzangms
tzangms / PutIOUpload.py
Created November 21, 2012 02:59
put.io upload
import sys
import requests
import urllib
PUTIO_ACCESS_TOKEN = '<token>'
PUTIO_API_URL = 'https://api.put.io/v2/files/upload'
url = sys.argv[1]
@tzangms
tzangms / python_install.sh
Created October 30, 2012 18:30
One Command line installer for python web development on ubuntu 12.04 LTS
echo "This script requires superuser access to install apt packages."
echo "You will be prompted for your password by sudo."
# clear any previous sudo permission
sudo -k
# run inside sudo
sudo sh <<SCRIPT
apt-get update -y
apt-get upgrade -y
@tzangms
tzangms / gist:3852402
Created October 8, 2012 13:02
1px transparent gif with base64 encoded
data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
@tzangms
tzangms / http_servlet_handler.rb
Created February 23, 2012 12:54
DjangoHandler for FireApp
module WEBrick
module HTTPServlet
class DjangoHandler < AbstractServlet
def initialize(server, name)
super(server, name) if( server )
@root_path = Compass.configuration.project_path
@script_filename = name
end