Skip to content

Instantly share code, notes, and snippets.

template<typename Signature>
class callback
{
};
template<typename R , typename ARG_TYPE0>
class callback<R( ARG_TYPE0)>
{
public:
callback() {}
import struct
import sys
class NamedStruct( struct.Struct ):
def __init__(self, *contents):
"""
Construct with ("Format", "Name"), tuples as arguments.
"""
self.names, format = zip(*contents)
#Flatten format into a string
@engie
engie / Singleton.py
Created October 15, 2010 09:46
Reminding myself of the order of static initialisation.
#include <stdio.h>
class C
{
public:
C()
{
printf("Created C\n");
}
};
@engie
engie / play_vid.py
Created December 29, 2010 13:22
Script to send gstreamer data to the acab video wall
import sys
import threading
import gobject
gobject.threads_init()
import gst
import struct
import Queue
RGB_UNPACKER = struct.Struct("BBBB")
COLS = 16
@engie
engie / gist:778062
Created January 13, 2011 15:39
C++ doesn't support template specialisation based on typedefs, so wrap a float in a struct.
#include <iostream>
using namespace std;
struct Float
{
Float( float val ) : m_val( val ) {}
operator float() { return m_val; }
float m_val;
@engie
engie / minimalcfg.cmd
Created April 5, 2011 09:34
Debug release tconf generated linker command file
/* Do *not* directly modify this file. It was */
/* generated by the Configuration Tool; any */
/* changes risk being overwritten. */
/* INPUT minimal.cdb */
/* MODULE PARAMETERS */
-u _FXN_F_nop
GBL_USERINITFXN = _FXN_F_nop;
@engie
engie / minimal_test.map
Created April 5, 2011 09:35
Map file created by code composer in debug mode
******************************************************************************
TMS320C6x Linker PC v6.1.19
******************************************************************************
>> Linked Tue Apr 05 10:32:09 2011
OUTPUT FILE NAME: <minimal_test.out>
ENTRY POINT SYMBOL: "_c_int00" address: c00779e0
MEMORY CONFIGURATION
@engie
engie / minimal_test.map
Created April 5, 2011 09:50
Map file created by cl6x on linux
******************************************************************************
TMS320C6x Linker Unix v6.1.19
******************************************************************************
>> Linked Tue Apr 5 10:46:29 2011
OUTPUT FILE NAME: </home/stephen.english/ise/production/build/linux/Tms_None_Heed_Emit_Off_32bit/applications/embedded/minimal_test/minimal_test.out>
ENTRY POINT SYMBOL: "_c_int00" address: c00779e0
MEMORY CONFIGURATION
@engie
engie / minimalcfg.cmd
Created April 5, 2011 09:50
TConf generated config file from linux platform
/* Do *not* directly modify this file. It was */
/* generated by the Configuration Tool; any */
/* changes risk being overwritten. */
/* INPUT minimal.cdb */
/* MODULE PARAMETERS */
-u _FXN_F_nop
GBL_USERINITFXN = _FXN_F_nop;
@engie
engie / gist:968920
Created May 12, 2011 16:50
Possible problem with busybox sh handling of pipes
/tmp $ cat spawnShortPipeSleep.sh
#!/bin/sh
sleep 5 | logger -t ZZZZZ &
Running this under bash:
/tmp $ bash --version
GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)
Running this under bash returns immediately: