Skip to content

Instantly share code, notes, and snippets.

@benlower
benlower / newMacSetup.sh
Last active April 1, 2024 23:58
Setup a new Mac with required apps
echo "Starting up..."
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update homebrew recipes
@benlower
benlower / host.js
Created August 21, 2014 01:19
Get data from three Tessel ambient modules into Redis via Node.js. Used this as my starting point: http://blog.technical.io/post/93254241807/usb-communication-between-tessel-and-node-on-your-pc
var tessel = require('tessel');
var redis = require('redis');
var redisClient = redis.createClient();
var script = require.resolve('./device/index.js');
var opts = {
// Stop existing script, if any
stop: true,
// Serial number (`undefined` picks the first one)
serial: process.env.TESSEL_SERIAL,
@benlower
benlower / device.js
Last active August 29, 2015 14:03
This shows how to pass messages from a Tessel to the host machine over USB. Thanks to @kevinmehal for sharing the general approach (https://gist.github.com/kevinmehall/4c98d93e16323473b78b). I've combined that code with Tessel's ambient sample code (http://start.tessel.io/modules/ambient)
var tessel = require('tessel');
// changed from './ambient-attx4' to fix Error: Could not find module "/app/ambient-attx4/index.js"
var ambientlib = require('ambient-attx4');
var ambient = ambientlib.use(tessel.port['A']);
ambient.on('ready', function () {
// Get sound data.
setInterval( function () {
ambient.getSoundLevel( function(err, sdata) {
// Set up a collection to contain player information. On the server,
// it is backed by a MongoDB collection named "players."
Players = new Meteor.Collection("players");
if (Meteor.is_client) {
Template.leaderboard.players = function () {
return Players.find({}, {sort: {score: -1, name: 1}});
};
@benlower
benlower / gist:3456823
Created August 24, 2012 22:57
ENOMEM Error
[08/24 15:40:28 PDT] at ChildProcess.EventEmitter.emit (events.js:91:17)
[08/24 15:40:28 PDT] ^
[08/24 15:40:28 PDT] throw errnoException(errno, 'spawn');
[08/24 15:40:28 PDT] child_process.js:790
[08/24 15:40:28 PDT]
[08/24 15:40:28 PDT] at ChildProcess.exithandler (child_process.js:534:7)
[08/24 15:40:28 PDT] at /opt/haibu/apps/benlower/tenexp-upload/package/node_modules/easyimage/easyimage.js:38:12
[08/24 15:40:28 PDT] at format (/opt/haibu/apps/benlower/tenexp-upload/package/server.js:549:40)
[08/24 15:40:28 PDT] at convertImage (/opt/haibu/apps/benlower/tenexp-upload/package/server.js:615:6)
[08/24 15:40:28 PDT] at Object.exports.convert (/opt/haibu/apps/benlower/tenexp-upload/package/node_modules/imagemagick/imagemagick.js:189:10)