Skip to content

Instantly share code, notes, and snippets.

View bmidgley's full-sized avatar

Brad Midgley bmidgley

  • Utah
  • 00:32 (UTC -06:00)
View GitHub Profile
Device.include showView: ->
CoffeeKup.render (->
div "data-role": "page", id: "#{@device.id}", ->
div "data-role": "header", text: "#{@device.name}", ->
h1 "#{@device.name}"
div "data-role": "content"
div "data-role": "footer"), {context: {device: @}}
@bmidgley
bmidgley / gist:1061877
Created July 3, 2011 01:31
hcidump -aV while running test-audio connect xx
HCI sniffer - Bluetooth packet analyzer ver 1.42
device: hci0 snap_len: 1028 filter: 0xffffffff
< HCI Command: Create Connection (0x01|0x0005) plen 13
bdaddr 00:0D:3C:37:46:22 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
Packet type: DM1 DM3 DM5 DH1 DH3 DH5
> HCI Event: Command Status (0x0f) plen 4
Create Connection (0x01|0x0005) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
status 0x00 handle 42 bdaddr 00:0D:3C:37:46:22 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
@bmidgley
bmidgley / bootstrap.js
Created August 29, 2011 18:08
fennec browser load/switch detection + local proxy server
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
function startup(aData, aReason) {
var gBaseURL;
var installSpec = Services.io.newFileURI(aData.installPath).spec;
@bmidgley
bmidgley / list.txt
Created April 15, 2013 22:16
flavor-list
caportal (master) $ nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 1 | m1.tiny | 512 | 0 | 0 | | 1 | 1.0 | True | {} |
| 2 | m1.small | 2048 | 10 | 20 | | 1 | 1.0 | True | {} |
| 3 | m1.medium | 4096 | 10 | 40 | | 2 | 1.0 | True | {} |
| 4 | m1.large | 8192 | 10 | 80 | | 4 | 1.0 | True | {} |
| 5 | m1.xlarge | 16384 | 10 | 160 | | 8 | 1.0 | True | {} |
| 6 | m2.large | 32768 | 80 | 240 | | 4 | 1.0 | True | {} |
@bmidgley
bmidgley / gist:9627611
Last active August 29, 2015 13:57
3d ghosts! place inside gamingjs.com/ice for easy modification
<body></body>
<script src="http://gamingJS.com/Three.js"></script>
<script src="http://gamingJS.com/ChromeFixes.js"></script>
<script>
var requestFullScreen = function(element) {
var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
if (requestMethod) {
requestMethod.call(element);
}
}
@bmidgley
bmidgley / gist:f9786b093ab334876a5b
Last active October 30, 2015 12:25
unbrick an hsmm router
# On your raspberry pi that is connected to the internet:
# assuming a wrt54gs
wget 'http://www.broadband-hamnet.org/download/firmware/link/310/bbhn-3.1.0-wrt54g-2.4-squashfs.bin'
sudo apt-get install -y tftp
cat > wrtftp << EOF
#!/bin/sh
@bmidgley
bmidgley / meshy.py
Last active October 26, 2015 12:03
scan for oslr discoveries and display on a grove lcd
#!/usr/bin/env python
# turn LCD backlight on as soon as something is detected
# and once the name resolves, put that detail on screen
import json
import urllib2
import csv
import datetime
import os
@bmidgley
bmidgley / gist:29747406d0d03b851a1e
Last active December 28, 2015 15:56
lightblue bean mouse trap watcher
/*
Activate an ibeacon when activity appears on d0 above a threshold
I use this to monitor when a mouse enters the live catch trap
"iBeacon Locate" app on iOS can alert when an iBeacon comes into range which is how the alert appears
https://twitter.com/bmidgley/status/681491360650637314
Major ID is voltage of battery
Minor ID is temperature
*/
#include <PinChangeInt.h>
uint8_t jingles = 0;
@bmidgley
bmidgley / orbiter1.ino
Created January 17, 2016 13:58
lightblue bean balloon payload
/*
Helium balloon payload!
Blink the LED according to the accelerometer setting
Advertise both accelerometer and temperature readings as part of the iBeacon message
*/
void setup()
{
Bean.setBeanName("Orbiter1");
}
@bmidgley
bmidgley / scores.py
Created March 9, 2016 04:00
collect scores from multiple beans
#!/usr/bin/env python
import blescan
import sys
import re
import bluetooth._bluetooth as bluez
dev_id = 0
try: