This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import boto.sns | |
AWS_ACCESS_KEY = 'xxxx' | |
AWS_SECRET_ACCESS_KEY = 'yyyyyyyy' | |
APPLICATION_ARN = 'arn:aws:sns:ap-northeast-1:0000:app/APNS_SANDBOX/aaaa' | |
# SNSに接続 | |
sns_connection = boto.sns.connect_to_region('ap-northeast-1', |
This file contains hidden or 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
""" | |
When I run this (vs. the Java SNS example), I get nearly identical bodies being submitted. | |
The only difference is the URL-escaping, the Javas serialization for JSON strips out spaces | |
& Boto adds a ``ContentType=JSON`` key, which the service accepts. | |
Verification this works on Android would be appreciated. | |
""" | |
import json | |
import os |
This file contains hidden or 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 | |
# GCC | |
## Prerequisites for GCC | |
## http://gcc.gnu.org/install/prerequisites.html | |
## Installing GCC: Configuration | |
## http://gcc.gnu.org/install/configure.html | |
# 初期設定 | |
GCC_VER=4.7.1 |
This file contains hidden or 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/bash | |
file="bin/*-debug.apk" | |
uninstall=0 | |
while getopts "ruf:" opt; do | |
case $opt in | |
r) | |
file="bin/*-release.apk" | |
;; | |
u) | |
uninstall=1 |
This file contains hidden or 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
// helper function that goes inside your socket connection | |
client.connectSession = function(fn) { | |
var cookie = client.request.headers.cookie; | |
var sid = unescape(cookie.match(/connect\.sid=([^;]+)/)[1]); | |
redis.get(sid, function(err, data) { | |
fn(err, JSON.parse(data)); | |
}); | |
}; | |
// usage |
This file contains hidden or 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/bash | |
for x in `adb devices | awk '/device$/ {print $1}'`; do | |
echo `adb -s $x install -r bin/*-debug.apk` | |
sleep 0; | |
done |
This file contains hidden or 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 required_parameter(object): | |
def __init__(self, paramName): | |
self.paramName = paramName | |
def __call__(self, function): | |
def error(param): | |
return HttpResponse('Required parameter %s not provided' % param) | |
def wrapped_f(*args): | |
if (self.paramName in args[0].REQUEST.keys() and args[0].REQUEST.get(self.paramName)): |
This file contains hidden or 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
// Simple function queue runner. Just pass me an array of functions and I'll | |
// execute them one by one at the given interval. | |
run_queue = function (funcs, step, speed) { | |
step = step || 0; | |
speed = speed || 500; | |
funcs = funcs || []; | |
if (step < funcs.length) { | |
// execute function | |
funcs[step](); |