Skip to content

Instantly share code, notes, and snippets.

View rwaldron's full-sized avatar

Rick Waldron rwaldron

  • Boston, MA
View GitHub Profile
function* asyncIterator() {
let value, done;
while ({value, done} = (yield null), !done) {
console.log("got", value);
}
console.log("done");
}
it = asyncIterator();
it.next();
@probonopd
probonopd / Arduino Yun (Linino) on OpenWrt
Last active December 21, 2021 06:28
Install Arduino Yun (Linino) software on OpenWrt on 3rd-party devices. TODO: Fully automate install and/or use Linino rootfs image and/or build own firmware using OpenWrt Image Generator. CAVEATS: I have not yet found out how to make the Bridge use Serial (USB) instead of Serial1 (HardwareSerial) for the Leonardo. I have asked a question about t…
opkg install luci-lib-json luci rng-tools usbutils avrdude avahi-daemon
# If rng-tools is not installable, then install it by hand from e.g., http://download.linino.org/linino_distro/linino_dev/latest/packages/rng-tools_3-2_ar71xx.ipk
# Edit your /etc/opkg.conf, add
src/gz barrier_breaker http://download.linino.org/dogstick/all-in-one/latest/packages/
# Comment out your earlier src/gz
opkg update
opkg list|grep bridge
@ajfisher
ajfisher / firmatatest.js
Last active December 22, 2019 08:15
Serial comms over hardware UART for Johnny-Five between Arduino and a Raspberry Pi
var firmata = require('firmata');
var repl = require('repl');
var board = new firmata.Board('/dev/ttyAMA0',function(err){
//arduino is ready to communicate
if (err) {
console.log("err:" + err);
return;
}
console.log("Firmata Firing LEDs");
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@parshap
parshap / sphero-with-node.md
Last active December 28, 2015 22:19
Orbotix Sphero with Node.js

Sphero with Node

This document will help you get started with controlling an Orbotix Sphero using Node.js.

Client Libraries

There are several different libraries for controlling the Sphero. Currently, the best one seems to be spheron. This module provides a simple interface to the Sphero API.

There is also CylonJS, but this just uses the spheron module and exposes the same API, so unless you are already using Cylon to control different hardware it probably makes sense to just use spheron directly.

@genericallyloud
genericallyloud / protocols.md
Created October 21, 2013 16:03
A potential solution for doing scoped binding of methods to types using a technique similar to Clojure protocols instead of Ruby refinements.

The following example uses the '::' operator which has a proposal already and a champion on the committee. Other than the bind operator, the example I give uses no new syntax (other than what is new to ES6), and could fairly easily be polyfilled - though I expect it could be optimized if implemented natively. If you haven't seen Clojure protocols, they allow for single dispatch polymorpism based on type, without the methods being defined as part of that type. In clojure, they use the first parameter, but for my proposal, it uses the receiver (this), and uses the bind operator to make the call look similar to a normal method call. While I haven't actually written an implementation of the Protocol class I demonstrate here, I've thought enough about it that I feel it could be done in a few different ways without too much complexity.

/**
  • The following module is a sampling of underscore methods conver
@bmeck
bmeck / Reading a message.md
Created September 30, 2013 05:47
A romp through time, on how we got our problems written down / ready to be read by a computer.
  • 1940s : "In my day we wrote down our problems"
  • 1950s : "In my day we plugged wires in manually"
  • 1970s : "In my day we read punch cards not "key" boards"
  • 1980s : "In my day we deserialized the baud connections manually"
  • 1990s : "In my day we read a shared key state mask"
  • 2000s : "In my day we listened for when buttons are pressed on the BIOS itself"
  • 2010s : "In my day we read our chars from a buffer"
  • 2020s : "In my day we waited for keys to be pressed"
  • 2030s : "In my day we used to have movies about terminators"
@sgk
sgk / patch.ino
Last active April 9, 2017 20:36
Patch Arduino Yun to disable WiFi
#include <Process.h>
void setup() {
Bridge.begin();
Serial.begin(9600);
while (!Serial)
;
Serial.println("Invoking patch script on Yun.");
var five = require('../lib/johnny-five.js'),
board, button;
board = new five.Board();
board.on("ready", function() {
this.firmata.sendI2CConfig();
var LSM303_CTRL_REG1_A = 0x20
, LSM303_CTRL_REG2_A = 0x21
@dherman
dherman / node.c
Created July 18, 2013 23:48
A lightweight implementation of node.js
#include <stdio.h>
int main() {
int *p = 0;
char line[1024];
printf("> ");
fgets(line, 1024, stdin);
*p = 12;