Skip to content

Instantly share code, notes, and snippets.

View scottferg's full-sized avatar

Scott Ferguson scottferg

  • Numerator/InfoScout
  • Chicago, IL
View GitHub Profile
# -*- 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',
"""
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
@henry0312
henry0312 / build_gcc4.7.1.sh
Created June 14, 2012 17:32
Build GCC 4.7.1 on Mac OS X Lion
#!/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
@wmbest2
wmbest2 / adb_install.sh
Created August 17, 2011 19:28 — forked from scottferg/adb_install.sh
Small shell script to easily deploy an Android debug build to all connected devices using adb
#!/bin/bash
file="bin/*-debug.apk"
uninstall=0
while getopts "ruf:" opt; do
case $opt in
r)
file="bin/*-release.apk"
;;
u)
uninstall=1
// 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
@scottferg
scottferg / adb_install.sh
Created September 15, 2010 14:32
Small shell script to easily deploy an Android debug build to all connected devices using adb
#!/bin/bash
for x in `adb devices | awk '/device$/ {print $1}'`; do
echo `adb -s $x install -r bin/*-debug.apk`
sleep 0;
done
@scottferg
scottferg / django_required_parameter.py
Created July 7, 2010 20:24
This decorator will validate the request parameters sent to your view. Wrap the view with @required_parameter('someparam') to validate that 'someparam' was provided.
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)):
@HenrikJoreteg
HenrikJoreteg / simple_function_queue_runner.js
Created July 7, 2010 18:06
Simple function queue runner. Just pass me an array of functions and I'll execute them one by one at the given interval.
// 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]();