Skip to content

Instantly share code, notes, and snippets.

🐋
Thanks for the fish!

Fedor Indutny indutny

🐋
Thanks for the fish!
Block or report user

Report or block indutny

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View couchdb-users.diff
commit bda00b93bed86610319f73cc6e857bd6ae05bff7
Author: Fedor Indutny <fedor.indutny@gmail.com>
Date: Thu Jun 20 23:32:26 2013 +0200
couch_users_db: introduce public_users option
When `couchdb.public_users` is set to `true`, getting `/_users/id` will
return user document with sensitive information stripped.
diff --git a/etc/couchdb/default.ini.tpl.in b/etc/couchdb/default.ini.tpl.in
View https.js
var cluster = require('cluster');
var os = require('os');
var fs = require('fs');
var https = require('https');
if (cluster.isMaster) {
for (var i = 0; i < os.cpus().length; i++) {
cluster.fork();
}
return;
View graph.js
//
// Place in the folder with node's source and run following in bash:
// $ node graph.js 60bf2d6 0d7a021 > graph.log
//
var child_process = require('child_process'),
exec = child_process.exec;
var start = process.argv[2];
var end = process.argv[3];
var bench = process.argv[4];
@indutny
indutny / 0-HOWTO.md
Last active Nov 4, 2015
FLUSH+RELOAD in node.js
View 0-HOWTO.md

How to run this

  1. Take any binary that has OpenSSL functions listed in collect.js
  2. Open lldb /path/to/binary
  3. Do disas -n function-name for each function in collect.js
  4. Choose some offset near the end of the function
  5. Subtract 0x1000000000 to get file offset
  6. Put the number in collect.js
  7. Run node collect.js /path/to/binary | node filter.js > log
  8. Let it run for some time to collect enough information
View 1.lir
rax: ............|......|......R_r_r.R_r.|......R_r_r...|......|....|....R_r_r.R_r.
rbx: ............|......|....R___r.....r.|....R___r.....|......|....|..R___r.......
rcx: ............|......|........r.....r.|........r.....|......|....|......r.......
rdx: ............|......|........r.....r.|........r.....|......|....|......r.......
004: ....R_______|______|______..........|..............|......|....|..............
005: ......A_a...|......|................|..............|......|....|..............
006: ........A___|__a...|................|..............|..A___|....|..............
007: ............|..A___|______..........|..............|......|....|..............
008: ............|......|..R_a...........|..............|......|....|..............
009: ............|......|..........A_a...|..............|......|....|..............
View lock-less-ring.log
Transactions: 200000 hits
Availability: 100.00 %
Elapsed time: 47.48 secs
Data transferred: 585.37 MB
Response time: 0.02 secs
Transaction rate: 4212.30 trans/sec
Throughput: 12.33 MB/sec
Concurrency: 98.79
Successful transactions: 200000
Failed transactions: 0
@indutny
indutny / example.js
Created Oct 11, 2015
json-pipeline usage example
View example.js
// 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.
View vock_challenge.md

Challenge

So you're mad opensource hacker, spent days and nights working with node.js and/or network protocols. Time to show other people how cool you are!

This file describes all logic of Vock's peer-to-peer protocol (which works over UDP). And there's an issue hidden behind it's lines. Find it, fix it or just get into hacking on Vock - and you'll be awarded! Your name will be in github project's readme and I'll mention your on my twitter account.

Cheers,

Fedor Indutny (https://github.com/indutny)

View async-sess-storage.js
var cluster = require('cluster'),
https = require('https'),
fs = require('fs'),
Buffer = require('buffer').Buffer;
function start() {
var options = {
key: fs.readFileSync('./test/fixtures/test_key.pem'),
cert: fs.readFileSync('./test/fixtures/test_cert.pem')
};
View gist:3064373
CryptoStream.prototype._push = function() {
if (this == this.pair.encrypted && !this.writable) {
// If the encrypted side got EOF, we do not attempt
// to write out data anymore.
return;
}
while (!this._paused) {
<<<<<<< HEAD
var bytesRead = 0;
You can’t perform that action at this time.