Skip to content

Instantly share code, notes, and snippets.

View dominicgs's full-sized avatar

Dominic Spill dominicgs

View GitHub Profile
dominicgs / gist:eb43859f4239a8afdc78
Last active August 29, 2015 14:04
USB packet format for dot11 device
struct dot11_packet {
int32_t tv_sec;
int32_t tv_usec;
int dlt;
/* Channel we captured on, if available in packet headers, or channel we
* will tx on */
int channel;
/* Length of components */
diff --git a/host/cmake/modules/FindUSB1.cmake b/host/cmake/modules/FindUSB1.cmake
index 0cbf802..2f3138d 100644
--- a/host/cmake/modules/FindUSB1.cmake
+++ b/host/cmake/modules/FindUSB1.cmake
pkg_check_modules(PC_LIBUSB libusb-1.0)
+ set(LIBUSB_LIBRARY_NAME usb-1.0)
dominicgs /
Last active August 29, 2015 14:27
Flipdot version of the osmocom_spectrum_sense (designed for MuCCC's UDP controller)
#!/usr/bin/env python
# Copyright 2005,2007,2011,2015 Free Software Foundation, Inc.
# GNU Radio 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, or (at your option)
# any later version.
# GNU Radio is distributed in the hope that it will be useful,
dominicgs /
Created June 6, 2014 12:22 uploader
# Utility to upload USB descriptors to
# Copyright 2014 Dominic Spill
LSUSB=`which lsusb`
CURL=`which curl`
AWK=`which awk`
SORT=`which sort`
dominicgs /
Created November 7, 2012 03:21 — forked from ipmb/
Say election results (with Linux support)
#!/usr/bin/env python
import time
import json
import urllib2
import os
platform = os.uname()[0]
if platform == 'Darwin':
import subprocess
def speak(phrase):
dominicgs / quartus.desktop
Created April 24, 2013 09:12
A quartus.desktop file for launching Altera Quartus from desktop menus. I thought it might be useful to someone else.
[Desktop Entry]
Name=Quartus II
Comment=Altera Quartus II Web Edition
GenericName=FPGA Tools
dominicgs / btle_crcgen.c
Last active December 17, 2015 00:59
Bluetooth Low Energy CRC based on a LUT (probably inefficient, I worked this out on a piece of paper).
u32 btle_crc_lut[256] = {
0x000000, 0x01b4c0, 0x036980, 0x02dd40, 0x06d300, 0x0767c0, 0x05ba80, 0x040e40,
0x0da600, 0x0c12c0, 0x0ecf80, 0x0f7b40, 0x0b7500, 0x0ac1c0, 0x081c80, 0x09a840,
0x1b4c00, 0x1af8c0, 0x182580, 0x199140, 0x1d9f00, 0x1c2bc0, 0x1ef680, 0x1f4240,
0x16ea00, 0x175ec0, 0x158380, 0x143740, 0x103900, 0x118dc0, 0x135080, 0x12e440,
0x369800, 0x372cc0, 0x35f180, 0x344540, 0x304b00, 0x31ffc0, 0x332280, 0x329640,
0x3b3e00, 0x3a8ac0, 0x385780, 0x39e340, 0x3ded00, 0x3c59c0, 0x3e8480, 0x3f3040,
0x2dd400, 0x2c60c0, 0x2ebd80, 0x2f0940, 0x2b0700, 0x2ab3c0, 0x286e80, 0x29da40,
0x207200, 0x21c6c0, 0x231b80, 0x22af40, 0x26a100, 0x2715c0, 0x25c880, 0x247c40,
0x6d3000, 0x6c84c0, 0x6e5980, 0x6fed40, 0x6be300, 0x6a57c0, 0x688a80, 0x693e40,
dominicgs / .gitconfig
Last active December 18, 2015 09:49
My git config file - obviously the original has my name and email address in it.
email =
name = John Doe
diff = auto
status = auto
branch = auto
interactive = auto
grep = auto
dominicgs / btle_crcgen.c
Created September 2, 2013 13:39
Script for generating and testing a look up table for the BTLE CRC
#include <stdio.h>
#include <stdint.h>
#define u8 uint8_t
#define u32 uint32_t
u32 btle_calc_crc(u32 crc_init, u8 *data, int len) {
u32 state = crc_init;
dominicgs /
Created May 24, 2016 00:29
Perfect card shuffling example
#!/usr/bin/env python
decks = [range(1, 53)]
def shuffle(deck):
a = deck[:len(deck)/2]
b = deck[len(deck)/2:]
c = zip(a, b)
return c