Skip to content

Instantly share code, notes, and snippets.

@theterg
theterg / pwmtest.py
Created February 10, 2014 13:38
Raspberry pi wiringpi2 pwm test
import wiringpi2 as wiringpi
import sys
import argparse
import time
parser = argparse.ArgumentParser()
# parser.add_argument('--clock', type=int, default=32)
parser.add_argument('--period', type=int, default=200)
parser.add_argument('--pulsewidth', type=int, default=15)
args = parser.parse_args()
@theterg
theterg / scope_get_data.py
Created February 26, 2014 21:23
Continually retrieve a single datapoint from any VISA device such as an oscilloscope or benchtop multimeter.
import visa
import sys
import pandas as pd
import numpy as np
import datetime
import time
import argparse
parser = argparse.ArgumentParser(description='Continuously retrieve data from scope as quickly as possible')
parser.add_argument('command', type=str, help='The command to execute. EG: MEAS:PWIDTH? CHANNEL3')
@theterg
theterg / serial_port_logger.py
Created March 18, 2014 23:05
A simple python 3.0 script to log data from two different serial ports at one time
import serial
import sys
import time
import argparse
parser = argparse.ArgumentParser(description='Dump serial data from basis')
parser.add_argument('portA', type=str, help='Serial port A')
parser.add_argument('portB', type=str, help='Serial port B')
parser.add_argument('--baud', type=int, default=1000000, help='The baud rate of both devices')
parser.add_argument('--labelA', type=str, default='A')
@theterg
theterg / jsssdk.unminified.js
Created March 31, 2014 14:33
Nike Plus Javascript SDK unminified
/*! Nike+ Javascript SDK - v2.0.0 - Build 67 - 2014-03-24 */
var NIKEPLUS = NIKEPLUS || {};
! function (a) {
"use strict";
var b = {};
b.config = {};
var c;
/**
* @license
* Q - v1.0
@theterg
theterg / new_format_RR.csv
Last active August 29, 2015 13:58
IOS HRV Data Logger file format
timestamp relative_time rr_sincestart rr
1391491315566 0 800 800
1391491316569 1003 1612 812
1391491317557 1991 2424 812
1391491317557 1991 3220 796
1391491319202 3636 4012 792
1391491320550 4984 4788 776
1391491323544 7978 5540 752
1391491324546 8980 6264 724
1391491324546 8980 6960 696
@theterg
theterg / routes_api.go
Created September 15, 2014 04:04
Golang: Using reflection to abstract web handlers on models in
package routes
import (
"github.com/theterg/BOH-web/models"
"github.com/bmizerany/pat"
"net/http"
"strconv"
"encoding/json"
"reflect"
)
public void CommunicationsTask(bool blnOnlyCheckXmitQueue)
{
try
{
if (serialPort1.IsOpen)
{
if (blnCommEnabled)
{
if (!blnWaitingForResponse)
{
@theterg
theterg / keybase.md
Created May 28, 2015 21:40
keybase.md

Keybase proof

I hereby claim:

  • I am theterg on github.
  • I am theterg (https://keybase.io/theterg) on keybase.
  • I have a public key whose fingerprint is E90E C4F4 3844 AF3B 18AD C3B6 573E 88D2 6E50 5813

To claim this, I am signing this object:

@theterg
theterg / ma.l
Created December 27, 2011 20:00
MA translator plugin for chef
static int i_seen = 0;
%}
WC [A-Za-z']
NW [^A-Za-z']
%start INW NIW
%%
./produce.py produce 32c570d1d07756d92eb1a0e1cb3afbc60bfd5a94 ea8da467c44d4e3f2327b9346f0869787aa8342a
{"message":"derp"}
./consume.py consume 32c570d1d07756d92eb1a0e1cb3afbc60bfd5a94 489a92e768b4904fcf62b866017990d6f3af96d9
{"presence":{"from":{"resource":"489a92e768b4904fcf62b866017990d6f3af96d9"},"type":"available"}}
{"presence":{"from":{"resource":"ea8da467c44d4e3f2327b9346f0869787aa8342a"},"type":"available"}}
{"presence":{"from":{"swarm":"32c570d1d07756d92eb1a0e1cb3afbc60bfd5a94","resource":"ea8da467c44d4e3f2327b9346f0869787aa8342a"}}}