Skip to content

Instantly share code, notes, and snippets.

View mattwilliamson's full-sized avatar

Matt Williamson mattwilliamson

View GitHub Profile
@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***
@mattwilliamson
mattwilliamson / gist:5db7cf94ce2e89459aa25f551b87fc3f
Created June 26, 2023 12:57
Failed jetson-containers build
This file has been truncated, but you can view the full file.
matt@fennee2:~/src$ git clone https://github.com/dusty-nv/jetson-containers
Cloning into 'jetson-containers'...
remote: Enumerating objects: 1394, done.
remote: Counting objects: 100% (542/542), done.
remote: Compressing objects: 100% (219/219), done.
remote: Total 1394 (delta 371), reused 370 (delta 323), pack-reused 852
Receiving objects: 100% (1394/1394), 584.47 KiB | 2.92 MiB/s, done.
Resolving deltas: 100% (920/920), done.
matt@fennee2:~/src$ cd jetson-containers
@mattwilliamson
mattwilliamson / camsense_parser.py
Created April 18, 2023 13:09
camsense x1 lidar parser
import serial
from struct import unpack
import matplotlib.pyplot as plt
import numpy as np
import queue
import threading
from matplotlib.animation import FuncAnimation
import time
import sys
from scipy.ndimage import median_filter, gaussian_filter1d

Keybase proof

I hereby claim:

  • I am mattwilliamson on github.
  • I am aimatt (https://keybase.io/aimatt) on keybase.
  • I have a public key ASBX5bTMl9V_gtr_6q63vxAFqqj3sXOSK2LVNSHWXRUcBAo

To claim this, I am signing this object:

@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;
@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:
@mattwilliamson
mattwilliamson / sendsqs.js
Created September 6, 2017 14:40
AWS Lambda sample: Send received events to SQS as Message
var QUEUE_URL = 'https://sqs.us-east-1.amazonaws.com/{AWS_ACCUOUNT_}/matsuoy-lambda';
var AWS = require('aws-sdk');
var sqs = new AWS.SQS({region : 'us-east-1'});
exports.handler = function(event, context) {
var params = {
MessageBody: JSON.stringify(event),
QueueUrl: QUEUE_URL
};
sqs.sendMessage(params, function(err,data){
@mattwilliamson
mattwilliamson / rtc_backup.c
Created February 3, 2017 00:51
Squeeze two floats into two uint16_t's
void writeRtcLatLng(void)
{
uint32_t tmp;
// RTC Backup registers have the first 2 bytes reserved. So we get to use the second half of each.
// Write lat tp first two backup registers
tmp = *(uint32_t*)⪫
rtcRegWrite(RTC_BKP_DR6, tmp >> 16);
rtcRegWrite(RTC_BKP_DR7, tmp & 0xffff);

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 / celery_greenlet_traceback.py
Created January 25, 2014 04:11
Celery Greenlet worker death.
[2014-01-24 22:17:36,558: INFO/MainProcess] Task myservice.email.tasks.poll_email_status[cf72ef6d-effa-449e-b866-ee1c3707ce25] succeeded in 2.47090099938s: SM778890846d03dd72f29749f6a7cf517e
[2014-01-24 22:17:36,874: WARNING/MainProcess] Cannot process event on channel 'celeryev': {'pattern': None, 'type': 'message', 'channel': 'celeryev', 'data': '{"body": "eyJ1dGNvZmZzZXQiOiAwLCAidHlwZSI6ICJ0YXNrLXN0YXJ0ZWQiLCAidXVpZCI6ICIyOWVhODQx\nMC02ODk5LTQ1ZTEtYTg3NC1iM2ExOTE1MzRmODgiLCAiY2xvY2siOiA4MTU5NzYsID4+PiBlc3Rh\nbXAiOiAxMzkwNjAwNTE5LjQ5NTMzMywgImhvc3RuYW1lIjogImdyZWVubGV0c0BpbmZsaWdodDMu\nbXlob3N0Lm5ldCIsICJwaWQiOiAzOTYxfQ==", "headers": {"hostname": "greenlets@inflight3.myservice.net"}, "content-type": "application/json", "properties": {"body_encoding": "base64", "delivery_info": {"priority": 0, "routing_key": "task.started", "exchange": "celeryev"}, "delivery_mode'}
Traceback (most recent call last):
File "/www/api.myservice.com/lib/python2.6/site-packages/kombu/transport/redis.py", line 493, in _receive