Skip to content

Instantly share code, notes, and snippets.

View eliotb's full-sized avatar

Eliot Blennerhassett eliotb

View GitHub Profile
@eliotb
eliotb / aisgen.py
Last active October 26, 2022 16:35
Tools for working with Texas Instruments COFF and AIS files
#!/usr/bin/env python
'''Read fully linked TI COFF file, and generate AIS format file
Commandline parameters
enable sequential read,
pll and emifb configuration
pinmux configuration
enable checksums
'Eliot Blennerhassett' <eblennerhassett@audioscience.com>
@eliotb
eliotb / dissector_cobranet.lua
Created November 9, 2011 01:42
Wireshark CobraNet dissector as lua plugin
-- Wireshark dissector for CobraNet protocol (ethertype == 0x8819)
-- Note that this is incomplete. Shows PDU type and version, plus
-- some known fields from Reservation PDU
--
-- Eliot Blennerhassett <eblennerhassett@audioscience.com>
do
-- Create a new dissector
COBRANET = Proto ("cobranet", "CobraNet")
local cobranet_ethertype = 0x8819
@eliotb
eliotb / wscript_dox.patch
Created December 11, 2012 20:50
patch for jack2 wscript doxygen
--- /home/eliot/src/jack/jack-1.9.9.5/wscript
+++ /home/eliot/src/jack/wscript
@@ -115,7 +115,7 @@
#if conf.env['IS_SUN']:
# conf.check_tool('compiler_cxx')
# conf.check_tool('compiler_cc')
-
+
conf.env.append_unique('CXXFLAGS', '-Wall')
conf.env.append_unique('CFLAGS', '-Wall')
"""KeyedList : A list that can also be accessed using a (string) key like a dict
A mutable alternative to namedtuple, yet a lot simpler than the full featured 'namedlist' class
Intended for use like a C struct with writeable fields
"""
class KeyedList(list):
"""A list that can also be accessed using a (string) key like a dict.
#!/usr/bin/env python
"""
General CAN functions using Kvaser canlib
"""
from __future__ import print_function
import logging
from sys import exit
# kvaser canlib
@eliotb
eliotb / ba.c
Created September 3, 2015 02:51
Experiment with ctypes interface to string read/write from python string, bytearray, list or tuple
// Build library with : gcc -o ba.so -fPIC -shared ba.c
#include <string.h>
#include <stdio.h>
static unsigned char buf[100];
static size_t blen = 0;
int write(const char *pc, size_t len)
{
if (len > 100)
import logging
import string
def is_yes(prompt="", default=True):
"""Ask user to enter Y or N in response to a prompt.
returns True if answer is Y, Falseif N or default if answer is empty"""
if default:
prompt += " [Y/n]"
else: