Skip to content

Instantly share code, notes, and snippets.

View lpinca's full-sized avatar

Luigi Pinca lpinca

  • Foligno (PG), Italy
View GitHub Profile
@lpinca
lpinca / index.js
Created June 10, 2021 18:33
websockets/ws PR 1899 discussion
const crypto = require('crypto');
const fs = require('fs');
const http = require('http');
const stream = require('stream');
const GUID = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
const data = `<!DOCTYPE html>
<html>
<head>
@lpinca
lpinca / index.js
Created June 16, 2019 15:36
websocket-stream does not handle backpressure
'use strict';
const WebSocket = require('ws');
const websocketStream = require('websocket-stream');
const { Readable, Writable } = require('stream');
const chunk = Buffer.alloc(1024);
const src = new Readable({
read() {
@lpinca
lpinca / dylib-patch.diff
Created January 26, 2019 15:03
mpdecimal dylib patch
diff -Naur mpdecimal-2.4.2-original/Makefile.in mpdecimal-2.4.2-patched/Makefile.in
--- mpdecimal-2.4.2-original/Makefile.in 2016-02-27 22:55:00.000000000 +0100
+++ mpdecimal-2.4.2-patched/Makefile.in 2019-01-23 11:10:30.000000000 +0100
@@ -6,6 +6,7 @@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
LIBSTATIC = @LIBSTATIC@
+LIBNAME = @LIBNAME@
LIBSONAME = @LIBSONAME@
LIBSHARED = @LIBSHARED@
@lpinca
lpinca / keybase.md
Created April 8, 2018 11:32
Keybase

Keybase proof

I hereby claim:

  • I am lpinca on github.
  • I am lpinca (https://keybase.io/lpinca) on keybase.
  • I have a public key ASCTgTeWXtyVqWiam4l-_MHjYPvY7_dYNOCHcavNoGDZFgo

To claim this, I am signing this object:

@lpinca
lpinca / index.html
Last active November 21, 2016 17:52
InvalidStateError: SockJS has already been closed
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script src="https://cdn.jsdelivr.net/sockjs/1.1.1/sockjs.min.js"></script>
<script>
(function () {
var sockjs = new SockJS('/foo');
@lpinca
lpinca / faye.js
Last active May 4, 2016 07:18
Compare different WebSocket modules echoing big and small buffers
'use strict';
const deflate = require('permessage-deflate');
const Faye = require('faye-websocket');
const http = require('http');
exports.echo = opts => {
const messages = opts.messages;
const length = messages.length;
const extensions = [];
@lpinca
lpinca / index.js
Created October 19, 2015 09:25
Istanbul GH-464
'use strict';
exports.foo = function foo() {
return 'bar';
};
exports.baz = function baz() {
return 'qux';
};
@lpinca
lpinca / clients.js
Created October 16, 2015 09:08
Metroplex GH-13
'use strict';
var Socket = require('primus').createSocket({ transformer: 'faye' })
, one = new Socket('http://localhost:3001')
, two;
one.on('data', function (data) {
console.log('"one" received message: '+ data);
});
@lpinca
lpinca / client.js
Last active November 30, 2015 09:20
Primus GH-398
'use strict';
const eio = require('engine.io-client');
new eio('http://localhost:3000/');
@lpinca
lpinca / index.js
Last active August 29, 2015 14:26
Test case for redis/ioredis#120
'use strict';
var Benchmark = require('benchmark')
, _ = require('lodash');
var suite = new Benchmark.Suite()
, arr = []
, i;
for (i = 0; i < 1000; i++) arr.push(i);