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
# 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({ |
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
""" | |
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 |
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 | |
""" | |
This script can retrieve pageviews count by month and export to a CSV file | |
Usage: | |
>> python pv.py 2013 <input.csv> <output-csv> | |
""" | |
import sys |
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/sh | |
export MYSQL_HOST=<your-mysql-host> | |
export MYSQL_USER=<your-mysql-username> | |
export MYSQL_PASSWORD=<your-mysql-password> | |
export NAME=<name-of-backup> | |
export DATE=`date +"%Y%m%d"` | |
export BACKUP_FILE=$NAME.$DATE.sql.gz | |
export DATABASE_SCHEMA_NAME=<database-name> | |
export S3_BUCKET=<s3-bucket-name> |
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.path | |
from fabric.api import run, env, put | |
from fabric.context_managers import cd | |
from fabric.api import local | |
from datetime import datetime | |
from cuisine import * | |
ROOT_PATH = os.path.dirname(__file__) |
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
// Find line 386, in amazon-s3-and-cloudfront/classes/amazon-s3-and-cloudfront.php | |
$s3client = $this->get_s3client( $region ); | |
// Add this line below | |
$s3client->setRegion('ap-northeast-1'); |
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
location ~ ^/(.*)$ { | |
resolver 8.8.8.8 valid=300s; | |
resolver_timeout 10s; | |
set $s3_bucket '<bucket-name>.com.s3.amazonaws.com'; | |
set $url_full '$1'; | |
proxy_pass http://$s3_bucket/$url_full; | |
proxy_buffering off; | |
proxy_set_header Host $s3_bucket; |
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
def facebook_authorization(request): | |
url = "https://graph.facebook.com/oauth/authorize" | |
params = urllib.urlencode({ | |
'client_id': settings.FACEBOOK_APP_ID, | |
'redirect_uri': settings.FACEBOOK_REDIRECT_URI, | |
'scope': 'offline_access,read_stream,publish_stream' | |
}) | |
return redirect(url + '?' + params) |
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 StatusDate(db.Model): | |
user = db.ReferenceProperty(User, collection_name='status_dates') | |
count = db.IntegerProperty(default=0) | |
tweets_count = db.IntegerProperty(default=0) | |
plurks_count = db.IntegerProperty(default=0) | |
fb_posts_count = db.IntegerProperty(default=0) | |
date = db.DateProperty(required=True) |
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
<?php | |
/* | |
Author: tzangms | |
Email: tzangms@gmail.com | |
Apache Rewrite rules | |
========================================================================================= | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_URI} !=/imagick.php |
OlderNewer