Skip to content

Instantly share code, notes, and snippets.

@theterg
theterg / code.py
Created March 17, 2021 23:10
Open Hardware Summit Badge 2020 - Enhanced Hello World Example
import board
import busio
import microcontroller as m
import time
from analogio import AnalogIn
from digitalio import DigitalInOut, Direction, Pull
import adafruit_imageload
import adafruit_bme680
import adafruit_lsm9ds1
@theterg
theterg / Code.gs
Created February 3, 2021 18:04
Autofilling Google Slides from Google Sheets
function myFunction() {
var sheeturl = "https://docs.google.com/spreadsheets/d/11_gwfesnphiI6uy4HmnCNpzL-pX1572SPKDiiiROnKs/edit";
var ss = SpreadsheetApp.openByUrl(sheeturl);
var deck = SlidesApp.getActivePresentation();
var sheet = ss.getSheetByName("test");
var values = sheet.getRange('A2:B18').getValues();
var slides = deck.getSlides();
var template = slides[0];
values.forEach(function(page) {
@theterg
theterg / init.vim
Created January 2, 2018 22:31
My new nvim init script (rememner, vim-plug needs to be installed first, then the rest with :PlugInstall)
syntax on
call plug#begin('~/.local/share/nvim/plugged')
" Think of sensible.vim as one step above 'nocompatible' mode: a
" universal set of defaults that (hopefully) everyone can agree on.
Plug 'tpope/vim-sensible'
" Far.vim makes it easier to find and replace text through multiple files.
" It's inspired by fancy IDEs, like IntelliJ and Eclipse, that provide cozy
" tools for such tasks.
Plug 'brooth/far.vim'
@theterg
theterg / WickedLightRope.ino
Last active January 31, 2016 02:05
Wicked motor shield -> light rope
#include <Wicked_DCMotor.h>
int num_motors = 5;
Wicked_DCMotor motor1(M1);
Wicked_DCMotor motor2(M2);
Wicked_DCMotor motor3(M3);
Wicked_DCMotor motor4(M4);
Wicked_DCMotor motor5(M5);
Wicked_DCMotor *m[] = {&motor1, &motor2, &motor3, &motor4, &motor5};
@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:

public void CommunicationsTask(bool blnOnlyCheckXmitQueue)
{
try
{
if (serialPort1.IsOpen)
{
if (blnCommEnabled)
{
if (!blnWaitingForResponse)
{
@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"
)
@theterg
theterg / auto_measure.py
Created September 9, 2014 14:09
AFE4300 EVM automation tool
import sys
import time
import math
sys.path.append("./Scripts")
GUI_Module=__import__('Device_GUI')
def FWR_read(input_mask, frequency=32, delay=0.5):
set_frequency(frequency)
GUI.write_register("AFE4300", "IQ_MODE_ENABLE", 0x00) #Select FWR Mode
GUI.write_register("AFE4300", "ADC_CONTROL_REGISTER2", 0x63) #ADCREF to VREF / ADC connected to BCM
@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 / 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