Skip to content

Instantly share code, notes, and snippets.

View mattwilliamson's full-sized avatar

Matt Williamson mattwilliamson

View GitHub Profile
@mattwilliamson
mattwilliamson / gist:1177185
Created August 28, 2011 20:35
App Engine Django ClientLoginError Fix
/google/appengine/tools/appengine_rpc.py
206c206
< account_type = "GOOGLE"
---
> account_type = "HOSTED_OR_GOOGLE"
@mattwilliamson
mattwilliamson / gist:1177179
Created August 28, 2011 20:29
App Engine Django ClientLoginError
python manage.py remote createsuperuser
inserting module path: /Users/matt/Dropbox/Projects/App Delegate Inc/SMSBlast/autoload.zip
inserting module path: /Users/matt/Dropbox/Projects/App Delegate Inc/SMSBlast/dbindexer.zip
inserting module path: /Users/matt/Dropbox/Projects/App Delegate Inc/SMSBlast/django.zip
inserting module path: /Users/matt/Dropbox/Projects/App Delegate Inc/SMSBlast/djangotoolbox.zip
inserting module path: /Users/matt/Dropbox/Projects/App Delegate Inc/SMSBlast/registration.zip
INFO 2011-08-28 15:09:44,535 stubs.py:75] Setting up remote_api for "smsblast-dev" at https://smsblast-dev.appspot.com/_ah/remote_api
Connecting to remote_api handler.
IMPORTANT: Check your login method settings in the App Engine Dashboard if you have problems logging in. Login is only supported for Google Accounts.
scream_enterprise_id = 'deb1c7b8-5170-11e0-9d53-12313d0462df'
product_id = 'deb2e2ba-5170-11e0-9d53-12313d0462df'
from json_rpc import JsonRpcProxy
a = JsonRpcProxy('public-sandbox.teltech.local', 1919)
import csv
with open('scream.csv', 'w') as c_file:
c = csv.writer(c_file)
c.writerow(['address', 'type', 'call_id'])
calls = a.call_remote('call.find', {'filters':[['product_id', '=', '4ef0d924-5171-11e0-9d53-12313d0462df']], 'limit': 999999})
<include>
<extension name="1337">
<condition field="destination_number" expression="1337">
<action application="socket" data="127.0.0.1:8888 async full"/>
</condition>
</extension>
</include>
@mattwilliamson
mattwilliamson / twisted.py
Created May 5, 2011 18:30
Freeswitch twisted
import sys, os.path
import eventsocket
from twisted.internet import defer, protocol
from twisted.application import service, internet
from models.user import User
class FreeswitchProtocol(eventsocket.EventProtocol):
@defer.inlineCallbacks
def connectionMade(self):
self.pin = []
@mattwilliamson
mattwilliamson / pocket_sentry.php
Created April 13, 2011 18:52
Sample callback script to capture motion triggers for the iPhone app Pocket Sentry
<?php
$device_id = $_POST["udid"];
$lat = $_POST["lat"];
$lng = $_POST["lng"];
if(array_key_exists("photo", $_FILES)) {
$file = $_FILES["photo"];
if($file["error"] == 0) {
$size = $file["size"]; // Bytes
$type = $file["type"]; // image/jpeg
@mattwilliamson
mattwilliamson / dictmerge.py
Created January 12, 2011 19:46
Merge two dicts together
#!/usr/bin/env python
import collections
def quacks_like_dict(object):
"""Check if object is dict-like"""
return isinstance(object, collections.Mapping)
def merge(a, b):
"""Merge two deep dicts non-destructively
@mattwilliamson
mattwilliamson / msp430i2c.c
Created December 18, 2010 00:03
MSP430 I2C Slave
//******************************************************************************
// MSP430G2x21/G2x31 Demo - I2C Slave Receiver, single byte
//
// Description: I2C Slave communicates with I2C Master using
// the USI. Master data should increment from 0x00 with each transmitted byte
// which is verified by the slave.
// LED off for address or data Ack; LED on for address or data NAck.d by the slave.
// ACLK = n/a, MCLK = SMCLK = Calibrated 1MHz
//
// ***THIS IS THE SLAVE CODE***
#include <Ultrasound.h>
// Set Pins
int pinSpeaker = 10;
int pinSonar = 7;
int pinObstructionIndicator = 13;
// Distance an object must be to consider it an obstacle (M)
double sonarObstructionDistance = .56;
#define CODE_COUNT 2
#define MIN_ROTATION 150
#define MAX_ROTATION 30
int val = 0;
char code[10];
int bytesread = 0;
int ledPin = 13;
int speakerOut = 5;