Skip to content

Instantly share code, notes, and snippets.

View sidorares's full-sized avatar

Andrey Sidorov sidorares

View GitHub Profile
// repro for https://github.com/sidorares/node-mysql2/issues/2090
// the code prints "done" bit after cpu spikes to 100% and the process never finishes
class TextRow {
constructor(fields) {}
next(packet, fields, options) {
this.packet = packet;
const result = {};
// "t_id_0": LONGLONG
result["t_id_0"] = packet.parseLengthCodedInt(false);
// "t_id_1": LONGLONG
const { performance } = require("perf_hooks");
const minus = "-".charCodeAt(0);
const plus = "+".charCodeAt(0);
const dot = ".".charCodeAt(0);
const exponent = "e".charCodeAt(0);
const exponentCapital = "E".charCodeAt(0);
function bufToFloat(buf, start, len) {
let offset = start;
const mysql = require('mysql2');
const server = mysql.createServer();
server.listen(3307);
let connectionId = 0;
server.on('connection', conn => {
connectionId++;
console.log(`New connection ${connectionId}`);
let acceptSalt = null;
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.

/*
HelloX.C
========
(c) Copyright Paul Griffiths 1999
Email: [email protected]
"Hello, World!", X Window System style.
*/