Skip to content

Instantly share code, notes, and snippets.

View sidorares's full-sized avatar

Andrey Sidorov sidorares

View GitHub Profile
import React, {Component} from 'react';
import ReactHardware from 'react-hardware';
import {createStore} from 'redux';
import Leap from 'leapjs';
import {Provider, connect} from 'react-redux';
class LeapServo extends Component {
componentDidMount() {
const controller = new Leap.Controller();
controller.on('frame', frame => {
const http = require('http');
const parse = require('url').parse;
const spawn = require('child_process').spawn;
const script = `
(function() {
document.addEventListener('mousedown', function(e) {
var dom = e.target;
for (var key in dom) {
if (key.startsWith("__reactInternalInstance$")) {
function crc16 (buf) {
var crc = 0xffff;
var i;
var c;
var len = buf.length;
var start = 0;
while (len--) {
c = buf[start];
for (i = 0; i < 8; i++) {
var SerialPort = require('serialport');
// /dev/tty.usbserial-FTZ2C9FV
var port = new SerialPort(process.argv[2], {
baudRate: 1200
}, function (err) {
if (err) {
return console.log('Error: ', err.message);
}
port.on('data', function (data) {
console.log('Data: ' + data.toString('hex') );
function bytes() {
var buffer = new ArrayBuffer(arguments.length);
var view = new Uint8Array(buffer);
for (var i = 0; i < arguments.length; i++) {
var val = arguments[i];
if ((typeof val) == "string") val = val.charCodeAt(0);
view[i] = val | 0;
}
return buffer;
}

Code of Conduct

All attendees, speakers, sponsors and volunteers at our event are required to agree with the following code of conduct. Organisers will enforce this code throughout the event. We are expecting cooperation from all participants to help ensuring a safe environment for everybody.

Need Help?

Contact one of the event organisers. The list of organisers for each event can be seen on event page.

The Quick Version

Our event is dedicated to providing a harassment-free event experience for everyone, regardless of gender, age, sexual orientation, disability, physical appearance, body size, race, or religion (or lack thereof). We do not tolerate harassment of event participants in any form. Sexual language and imagery is not appropriate for any event venue, including talks, workshops, parties, Twitter and other online media. Event participants violating these rules may be sanctioned or expelled from the event at the discretion of the organisers.

@sidorares
sidorares / output.txt
Created September 27, 2013 02:31
node.js empty loop optimisation test
[marking boo 0x168ec4f7ae88 for recompilation, reason: small function, ICs with typeinfo: 1/8 (12%)]
Analyzing block B0
Initial inferred range of 1 (Constant) set to [-2147483648,2147483647]
Initial inferred range of 54 (Constant) set to [1,1]
Initial inferred range of 15 (Constant) set to [-2147483648,2147483647]
Initial inferred range of 2 (ArgumentsObject) set to [-2147483648,2147483647]
Initial inferred range of 3 (Parameter) set to [-2147483648,2147483647]
Initial inferred range of 4 (Context) set to [-2147483648,2147483647]
Analyzing block B1
Initial inferred range of 10 (LoadGlobalCell) set to [-2147483648,2147483647]
/*
HelloX.C
========
(c) Copyright Paul Griffiths 1999
Email: mail@paulgriffiths.net
"Hello, World!", X Window System style.
*/
135 1.3% 7.5% RegExp: ^(\\/?|)([\\s\\S]*?)((?:\\.{1\,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$
71 0.7% 3.9% LazyCompile: *Time.start /home/brian/middleware/node_modules/nodetime/lib/core/time.js:35
41 0.4% 2.3% LazyCompile: *tree.visitor.visit /home/brian/middleware/node_modules/less/lib/less/visitor.js:8
37 0.4% 2.1% LazyCompile: ~Contextify.sandbox.run /home/brian/middleware/node_modules/jsdom/node_modules/contextify/lib/contextify.js:11
36 0.4% 2.0% Stub: StringAddStub
35 0.3% 1.9% Stub: CEntryStub
32 0.3% 1.8% Builtin: A builtin from the snapshot
29 0.3% 1.6% Stub: SubStringStub
29 0.3% 1.6% Stub: RegExpExecStub
29 0.3% 1.6% LazyCompile: *Time.done /home/brian/middleware/node_modules/nodetime/lib/core/time.js:59
{ name: '/org/freedesktop/NonExisting/Manager',
service:
{ name: 'org.freedesktop.NonExisting',
bus:
{ connection: [Object],
serial: 2,
cookies: [Object],
methodCallHandlers: {},
signals: [Object],
exportedObjects: {},