Skip to content

Instantly share code, notes, and snippets.

View ericterpstra's full-sized avatar

Eric Terpstra ericterpstra

  • Methodist Le Bonheur Healthcare
  • Fairfax, VA
  • 19:48 (UTC -05:00)
View GitHub Profile
@ericterpstra
ericterpstra / 2dPlasma.pde
Created September 29, 2019 17:03
2D Plasma Effect in Processing 3
// Derived from https://www.bidouille.org/prog/plasma
int WIDTH = 400;
int HEIGHT = 400;
float kx = WIDTH/HEIGHT;
int strokeColor = 255;
float time = second();
float timeScalar = .004;
@ericterpstra
ericterpstra / test.js
Last active October 7, 2017 04:09
spawn in batches with async/await and stuff.
const { spawn } = require('child_process');
// Search for each the following terms in a file called 'words.txt'
const SEARCH_TERMS = "at quis risus sed vulputate odio";
// Split the terms into an array.
const searchArray = SEARCH_TERMS.split(" ");
// Create an array of 'batches' with 2 terms each.
let batches = [];
const rpi433 = require('rpi-433');
// Instantiate rpi433 lib with a pulse length that matches my RF Outlet remote control
const rfEmitter = rpi433.emitter({
pin: 0,
pulseLength: 176
});
// Codes have been altered to nobody can come to my house and turn off the lights.
const code = {
@ericterpstra
ericterpstra / lola_feeder.js
Created February 25, 2017 23:13
Lola Feeder Script
const RaspiCam = require('raspicam');
const axios = require('axios');
const schedule = require('node-schedule');
const fs = require('fs');
const moment = require('moment');
const rfDevice = require('./RF_Thing');
const tweeter = require('./tweets');
// Set times to turn lamp on and off
const LAMP_ON_CRONTAB = "0 5,20 * * *";
@ericterpstra
ericterpstra / lola_detector.py
Created February 25, 2017 22:56
Lola Detector
import tensorflow as tf, sys
import simplejson as json
from flask import Flask, jsonify
app = Flask(__name__)
def start_tf_session():
# Loads label file, strips off carriage return
@ericterpstra
ericterpstra / leftcw
Created September 23, 2016 21:58
J5 CHIP servo.cw() output
Servo {
board:
Board {
io:
ChipIO {
domain: null,
_events: [Object],
_eventsCount: 4,
_maxListeners: undefined,
_pins: [Object],
@ericterpstra
ericterpstra / wemos-d1-oled-eth-ticker
Last active July 28, 2016 01:09
Ethereum Ticker on Wemos D1 Mini with OLED Shield
btc = 0
usd = 0
json = {}
doGetData = true
currencyLabel = "BTC"
currencyValue = btc
-- setup I2c and connect display
function init_i2c_display()
-- SDA and SCL can be assigned freely to available GPIOs
@ericterpstra
ericterpstra / ESPTool Command
Last active January 16, 2017 19:59
Wemos d1 mini El Capitan esptool command
esptool -cd nodemcu -cb 230400 -cp /dev/tty.wchusbserial1420 -cf nodemcu-master-8-modules-2016-07-16-03-31-21-float.bin

Keybase proof

I hereby claim:

  • I am ericterpstra on github.
  • I am ericterpstra (https://keybase.io/ericterpstra) on keybase.
  • I have a public key ASCWbKWfd9m0BF5MR5phu_hJm45YgLdc89h6sF2eV_Z8IQo

To claim this, I am signing this object:

@ericterpstra
ericterpstra / gist:97070f8b5a1f73301dd0
Created December 9, 2015 16:19
meteor transform in pub
Meteor.publish('pubname', function(doTransform) {
let options = {};
if (doTransform) {
options.transform = function(doc) {
doc.username = 'johndoe';
}
} else {
options.transform = null;
}