Skip to content

Instantly share code, notes, and snippets.

View giegiey's full-sized avatar
🚬

MFAHMI giegiey

🚬
  • CLT
  • Singapore
  • 16:48 (UTC +08:00)
View GitHub Profile
@giegiey
giegiey / Node-ffi-array.md
Created April 26, 2019 09:26 — forked from ryosuzuki/Node-ffi-array.md
Node-ffi example: Passing and receiving array object between Node.js and C++ binding

Node-ffi with IntArray

Passing and receiving array object between Node.js and C++ binding

$ g++ -dynamiclib -o mylib.dylib main.cpp
$ node index.js
[matrix size: 100x100; n_nonzero: 4; density: 0.04%]

 (1, 1) 2.0000
@giegiey
giegiey / client.js
Created April 16, 2019 03:38 — forked from branneman/client.js
Node.js TCP Socket - if either of them breaks, they'll keep trying to reconnect
var net = require('net');
//
// Client
//
function openSocket() {
var socket = net.connect(3e3);
socket.setKeepAlive(true);
socket.on('connect', onConnect.bind({}, socket));