Skip to content

Instantly share code, notes, and snippets.

View marshall's full-sized avatar

Marshall Culpepper marshall

View GitHub Profile
@marshall
marshall / smsIndicator.js
Created June 22, 2012 23:15
WebSmsIndicator example
// This example shows the WIP API in https://bugzilla.mozilla.org/show_bug.cgi?id=736710
// Note: mozSms access requires the URL to be in the dom.sms.whitelist
// I tested with the statusbar by adding the "sms" permission category to Gaia's system app in gaia/apps/system/manifest.webapp
var sms = window.navigator.mozSms;
sms.addEventListener("indicator", function onindicator(event) {
var indicator = event.message.indicator;
if (indicator.active) {
// show indicator
}
@marshall
marshall / shell output
Created September 6, 2012 18:52
shell expansion fun
# in each case the script sees $1 as the full value (with spaces, or quotes)
$ export ABC="a b c"
$ ./test.sh "ABC=$ABC"
=ABC=a b c=
$ export ABC="\"abc\""
$ ./test.sh "ABC=$ABC"
=ABC="abc"=
@marshall
marshall / force-update-check.sh
Created September 17, 2012 17:57
Force AUS update check
#!/bin/bash
DEVICE_TIME=$(date -j -f "%a %b %d %T %Z %Y" "`adb -d shell date`" "+%s" 2>/dev/null)
PROFILE_PREFS=$(adb -d shell cat '/data/b2g/mozilla/*.default/prefs.js')
PROFILE_DIR=$(adb -d shell ls -l /data/b2g/mozilla | grep .default)
PROFILE_REGEX="([^ ]+\.default)"
if [[ "$PROFILE_DIR" =~ $PROFILE_REGEX ]]; then
PROFILE_DIR=/data/b2g/mozilla/${BASH_REMATCH[1]}
else
@marshall
marshall / compare.js
Created January 8, 2013 12:37
Services.vc.compare for different version strings
Components.utils.import("resource://gre/modules/Services.jsm");
let versions = [
"1.0", "1.0.0", "1.0.0beta", "1.0.0.1", "1.0.20", "1.0.2.0", "1.1.0.1",
"1.1.0", "1.1.0alpha"
];
versions.sort(Services.vc.compare);
versions.reverse();
for (let i = 0; i < versions.length; i++) {
@marshall
marshall / README.md
Last active January 3, 2016 08:59
A dirt simple CSV to sqlite db generator.
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "csv.h"
char *city = "test";
int row_index = 0;
void data_callback(void *string, size_t i, void *data) {
@marshall
marshall / example.js
Last active August 29, 2015 14:03
All FxOS apps as JSON
var schemes = {
"app:": "A",
"http:": "H",
"https:": "S",
"file:": "F"
};
var domains = {
".gaiamobile.org": "G"
};
@marshall
marshall / Austin_IoT_Links.md
Last active August 29, 2015 14:20
Links from my Austin IoT presentation
#!/usr/bin/env python
# poor man's "lsusb -d" for Mac OS X
import argparse
import plistlib
import subprocess
import sys
devices = []
def add_device(item):
if '_items' in item:
@marshall
marshall / README.md
Created May 17, 2016 16:18
Anarduino MiniWireless RF96W prototype

Requires installation of the RadioHead library into Arduino IDE 1.7 to talk to the HopeRF chip embedded on the Anarduino MiniWireless-96-433

Before trying to program the board, in the Arduino menu, select Tools > Board > Arduino Pro or Pro Mini