Skip to content

Instantly share code, notes, and snippets.

View AdamMagaluk's full-sized avatar
🚀

Adam Magaluk AdamMagaluk

🚀
View GitHub Profile
@AdamMagaluk
AdamMagaluk / ws_cleint.js
Created March 5, 2014 20:30
Websocket pub/sub client.
var ws = require('ws');
var socket = new ws('ws://localhost:3000/events');
socket.on('open',function(){
socket.send( JSON.stringify({cmd : 'subscribe',name : 'photosensor/value'}) );
});
socket.on('message',function(data){
console.log(data);
"data": { "registered": true, "id": "001788fffe10857f", "ipaddress": "192.168.1.2", "user": "ca4ca411381b0f29b140ccd1bdc97" }
FAILED to get phantomjs version: /mnt/data/1/node_modules/phantomjs/lib/phantom/bin/phantomjs: 3: 4w��h: not found
/mnt/data/1/node_modules/phantomjs/lib/phantom/bin/phantomjs: 3: �����8__TEXT: not found
�n��y�T: not foundodules/phantomjs/lib/phantom/bin/phantomjs: 3: E�bss����j���-��m�b
/mnt/data/1/node_modules/phantomjs/lib/phantom/bin/phantomjs: 6: Syntax error: ")" unexpected
@AdamMagaluk
AdamMagaluk / gist:9512279
Last active August 29, 2015 13:57
Crash with elroy
Mar-12-2014 13:47:31 [fog-runtime] Device led transititon turn-on
<Buffer 48 54 54 50 2f 31 2e 31 20 35 30 33 20 53 65 72 76 69 63 65 20 55 6e 61 76 61 69 6c 61 62 6c 65 0d 0a 53 65 72 76 65 72 3a 20 4d 6f 63 68 69 57 65 62 2f ...>
HTTP/1.1 503 Service Unavailable
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Wed, 12 Mar 2014 17:48:02 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 409
<!DOCTYPE html>
<html>
elroy.filter('crockpot').on('connection',function(crockpot){
elroy.expose(crockpot);
elroy.filter('huehub').on('connection',function(hub){
crockpot.on('lid-closed',function(){
hub.call('blink');
});
crockpot.on('lid-closed',function(){
hub.call('blink');
@AdamMagaluk
AdamMagaluk / test.js
Created March 19, 2014 17:50
xbee and node
var SerialPort = require('serialport').SerialPort;
var xbee_api = require('xbee-api');
var C = xbee_api.constants;
var xbeeAPI = new xbee_api.XBeeAPI({
api_mode: 1
});
var port = new SerialPort('/dev/tty.usbserial-A601EM9S', {
baudrate: 9600,
host="fieldcontroller.wavemark.net" sourcetype="zenosseventhistory"
| where MESSAGE like "%Low Power%"
| rex field=MESSAGE "Power :(?<Voltage>.{5})"
| timechart span=1d min(LowVolt) as LowVoltage by DEVICE
@AdamMagaluk
AdamMagaluk / build.js
Created March 21, 2014 02:19
Sample Dependancy Runner
var path = require('path');
var cfiles = ['file_a.c','file_b.c'];
task()
.env({gcc : '/usr/bin/gcc',cflags : '-Wall '})
.add('somelib.a',cfiles,compileLib)
.each(cfiles,compileFile)
.done(function(err){
/home/pi/zigbee-demo-app/node_modules/mdns/lib/resolver_sequence_tasks.js:115
} else if (errno === 'ENOENT') {
^
ReferenceError: errno is not defined
at Object.wrap.oncomplete (/home/pi/zigbee-demo-app/node_modules/mdns/lib/resolver_sequence_tasks.js:115:18)
#!/bin/bash
#ps -p `pidof node` -opid -opcpu -orss -ovsz | tail -1 > node.log
START_DATE=`date -u +%s`
PIDS=$1
LOG_FILE=$2
while [ 1 ]
do