Skip to content

Instantly share code, notes, and snippets.

View indutny's full-sized avatar
🐋
Thanks for the fish!

Fedor Indutny indutny

🐋
Thanks for the fish!
View GitHub Profile
@indutny
indutny / example.js
Created October 11, 2015 02:09
json-pipeline usage example
// Just for viewing graphviz output
var fs = require('fs');
var Pipeline = require('json-pipeline');
var Reducer = require('json-pipeline-reducer');
var Scheduler = require('json-pipeline-scheduler');
//
// Create empty graph with CFG convenience
// methods.
#!/usr/sbin/dtrace -C -s
#pragma D option quiet
#pragma D option strsize=4096
#define PTR__SIZE sizeof(uint64_t)
struct SSL {
uint32_t version;
uint8_t pad[0x12c];

stream_base: introduce StreamBase

StreamBase is a brand new way to write C++ streams. The class itself is for separting StreamWrap (with the methods like .writeAsciiString, .writeBuffer, .writev, etc) from the HandleWrap class, making possible writing abstract C++ streams that are not bound to any uv socket.

Important part of the abstraction is following methods (which mimics libuv's stream API):

Benchmarking: create-10
bn.js#create-10 x 1,967,120 ops/sec ±1.65% (9 runs sampled)
bignum#create-10 x 642,220 ops/sec ±0.80% (8 runs sampled)
------------------------
Fastest is bn.js#create-10
========================
Benchmarking: create-hex
bn.js#create-hex x 2,610,191 ops/sec ±0.85% (9 runs sampled)
bignum#create-hex x 614,238 ops/sec ±2.36% (9 runs sampled)
------------------------

Keybase proof

I hereby claim:

  • I am indutny on github.
  • I am indutny (https://keybase.io/indutny) on keybase.
  • I have a public key whose fingerprint is AF2E EA41 EC34 47BF DD86 FED9 D706 3CCE 19B7 E890

To claim this, I am signing this object:

{
init: function(elevators, floors) {
var floorButtons = new Array(floors.length);
var floorTime = new Array(floors.length);
var UP = 1;
var DOWN = 2;
var DISABLED = 4;
for (var i = 0; i < floorButtons.length; i++) {
floorButtons[i] = 0;
floorTime[i] = 0;
ECDHE-ECDSA-AES256-GCM-SHA384
ECDHE-RSA-AES256-GCM-SHA384
ECDHE-ECDSA-AES256-GCM-SHA256
ECDHE-RSA-AES256-GCM-SHA256
ECDHE-ECDSA-AES256-SHA256
ECDHE-RSA-AES256-SHA256
DHE-RSA-AES256-GCM-SHA384
DHE-RSA-AES256-GCM-SHA256
DHE-RSA-AES256-SHA256
AES256-GCM-SHA384
commit c732e933f995b42317e63875bfaa6907085a5811
Author: James M Snell <jasnell@gmail.com>
Date: Wed Aug 21 14:39:54 2013 -0700
Support for unknown extension methods in the http parser.. implemented
in a way that does not slow the parser down.
Conflicts:
.gitignore
http_parser.h
uv_stream_t* s;
uv_pipeline_t p1 = {
.alloc_cb = int(uv_stream_t* s, uv_pipeline_t*, size_t size, uv_buf_t* buf) {
},
.read_cb = int(uv_stream_t* s, uv_pipeline_t* p, uv_buf_t* buf) {
// The point here is that you could call it in a later tick, thus
// the next pipeline couldn't be provided as an argument to this function
uv_pipeline_t* next = uv_stream_next_pipeline(s, &p);
@indutny
indutny / basis.js
Created June 18, 2014 20:00
secp256k1 128bit 3d endomorphism basis
[ <Vec: <Frac: 1/1>, <Frac: 1/1>, <Frac: 1/1>>,
<Vec: <Frac: 6c706108703d1fec15648b260fede8fa/1>, <Frac: -a859efef38a5d40a425c85678d56e6de/1>, <Frac: 3be98ee6c868b41e2cf7fa417d68fde5/1>>,
<Vec: <Frac: -1716c16e24434960ffb9b72ad34c25720/1>, <Frac: 87a1b8eb65bce60ecb7a1d8973425d7b/1>, <Frac: -2c1af3c8f37d364bbb6dd13b04f89c33/1>> ]