Skip to content

Instantly share code, notes, and snippets.

View mattwilliamson's full-sized avatar

Matt Williamson mattwilliamson

View GitHub Profile
Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken.
@mattwilliamson
mattwilliamson / smtplib_custom.py
Created May 8, 2013 21:18
Customized smtplib standard library that allows you to set source host and port on the socket.
#! /usr/bin/env python
'''SMTP/ESMTP client class.
This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Authentication) and RFC 2487 (Secure SMTP over TLS).
Notes:

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@mattwilliamson
mattwilliamson / config.h
Created July 27, 2012 20:52
MultiWii328 v1 config file
/*************************************************************************************************/
/**** CONFIGURABLE PARAMETERS ****/
/*************************************************************************************************/
/***************************** Motor minthrottle *******************************/
/* Set the minimum throttle command sent to the ESC (Electronic Speed Controller)
This is the minimum value that allow motors to run at a idle speed */
//#define MINTHROTTLE 1300 // for Turnigy Plush ESCs 10A
//#define MINTHROTTLE 1120 // for Super Simple ESCs 10A
//#define MINTHROTTLE 1220
@mattwilliamson
mattwilliamson / avrdude.conf
Created June 1, 2012 15:51
ATmega1284 AVRDude support
#------------------------------------------------------------
# ATmega1284
#------------------------------------------------------------
# similar to ATmega164p
part
id = "m1284";
desc = "ATMEGA1284";
has_jtag = yes;
#include <Wire.h>
void i2c_write(int address, byte reg, byte data) {
// Send output register address
Wire.beginTransmission(address);
Wire.write(reg);
// Connect to device and send byte
Wire.write(data); // low byte
Wire.endTransmission();
}
@mattwilliamson
mattwilliamson / gist:2437412
Created April 21, 2012 14:38
Aeroquad Remote PC Debugging
1 joystick(s) detected.
Joystick 0: Saitek ST290 Pro
Axis: 0, value: 125
Throttle:0 Roll:125 Pitch:0 Yaw:0 A1:250
Axis: 1, value: 125
Throttle:0 Roll:125 Pitch:125 Yaw:0 A1:250
Axis: 2, value: 125
Throttle:0 Roll:125 Pitch:125 Yaw:125 A1:250
Axis: 3, value: 250
Throttle:0 Roll:125 Pitch:125 Yaw:125 A1:250
/*
AeroQuad v3.0.1 - February 2012
www.AeroQuad.com
Copyright (c) 2012 Ted Carancho. All rights reserved.
An Open Source Arduino based multicopter.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@mattwilliamson
mattwilliamson / gist:1770625
Created February 8, 2012 15:57
Snippet to add to django.db.models.base.Model to make decimal fields work with django-nonrel
# Hack by @mattwilliamson because DecimalFields are being set as unicode for some reason with the
# nonrel or maybe mongo updates
def __setattr__(self, name, value):
for field in iter(self._meta.fields):
if field.attname == name:
if field.get_internal_type() == 'DecimalField':
value = field.to_python(value)
break
super(Model, self).__setattr__(name, value)
@mattwilliamson
mattwilliamson / gist:1340368
Created November 4, 2011 20:13
Metaclass Django Model Instance Caching
import logging
import uuid
import re
from decimal import Decimal
from django.conf import settings
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
from django.core.cache import cache