Skip to content

Instantly share code, notes, and snippets.

View toastdriven's full-sized avatar

Daniel Lindsley toastdriven

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am toastdriven on github.
  • I am daniellindsley (https://keybase.io/daniellindsley) on keybase.
  • I have a public key whose fingerprint is 96D8 9667 409F BAD8 F716 690D 554A 1A3D B0B6 CFFE

To claim this, I am signing this object:

from __future__ import print_function
import glob
import os
import re
old_method_syntax = re.compile('[A-Z][\w\d_]+\.[\w\d_]+\(self')
cwd = os.getcwd()
files = glob.glob(os.path.join(cwd, '*.py'))
import boto
s3 = boto.connect_s3()
bukkit = s3.get_bucket('test_for_yellowfish')
test = bukkit.get_key('test.txt')
test.set_acl('public-read')
apns_msg = json.dumps({"aps":{"alert":"",'sound':'default',"badge":14}})
published = sns_connection.publish(
message_structure='json',
message=json.dumps({'default':'This is the default message',"APNS_SANDBOX":apns_msg})
)
@toastdriven
toastdriven / outofsorts.py
Created October 30, 2013 10:00
A bit of code kata for me. Brushing back up on some sorting algorithms... Requires ``pip install chrono`` to run.
Total time for 500 runs.
Bubble sort [average]: 0.00372815132141 seconds
Bubble sort [worst]: 0.00349998474121 seconds
Bubble sort [best]: 0.00349807739258 seconds
Bubble sort [huge]: 6.59933185577 seconds
Quick sort [average]: 0.00668597221375 seconds
Quick sort [worst]: 0.0066499710083 seconds
Quick sort [best]: 0.00685095787048 seconds
const int CENTER = 8;
const int UR = 9;
const int LR = 11;
const int LL = 6;
const int UL = 10;
void setup() {
pinMode(CENTER, OUTPUT);
pinMode(UR, OUTPUT);
# The gif used for uploading below can be grabbed from https://dl.dropboxusercontent.com/u/114233/tally_ho.gif
import boto
conn = boto.connect_s3()
try:
bucket = conn.get_bucket('ssl_test')
except:
bucket = conn.create_bucket('ssl_test')
"""
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