Skip to content

Instantly share code, notes, and snippets.

@sh1mmer
sh1mmer / gist:7569407
Created November 20, 2013 19:26
raw text middleware
function bufferRawText(req,res,next) {
bufs = []
len = 0
req.on('data', function(d) {
bufs.push(d)
len += d.length
})
req.on('end', function() {
req.body = Buffer.concat(bufs, len)
next()
@sh1mmer
sh1mmer / tldr
Created July 12, 2012 00:19
Silk Vs. Node
enki:~ sh1mmer$ ab -t 30 -k -c 10 "http://127.0.0.1:9090/"
This is ApacheBench, Version 2.3 <$Revision: 1178079 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
[Shared libraries]:
ticks total nonlib name
37474837 59.0% 0.0% /data1/home/mobile/.nvm/v0.6.5/bin/node
209-204-163-6:xml-benchmark sh1mmer$ gdb --args node libxmljs.js
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ........... done
(gdb) run
#just list all of the urls you want to push to under the remote header
[remote "all"]
url=node@8.19.32.37:repo
url=node@199.192.240.159:repo
#
# example
#
[remote "dev"]
url=node@myname.no.de:repo
(gdb) b node.cc:2339
Breakpoint 1 at 0x10000fcc0: file ../src/node.cc, line 2339.
Breakpoint 2 at 0x1000136b4: file ../src/node.cc, line 2339.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb)
@sh1mmer
sh1mmer / Console output
Created October 24, 2011 09:03
HTTPS tests
Enki:~/Code/node-scratch $ node https-req.js
0reqs 13.30078125 Mb memory usage, diff 0 Mb
5reqs 15.55078125 Mb memory usage, diff 2.25 Mb
8reqs 15.89453125 Mb memory usage, diff 0.34375 Mb
11reqs 16.65625 Mb memory usage, diff 0.76171875 Mb
14reqs 17.015625 Mb memory usage, diff 0.359375 Mb
^[[1;10B16reqs 17.4296875 Mb memory usage, diff 0.4140625 Mb
^[[1;9D19reqs 17.4765625 Mb memory usage, diff 0.046875 Mb
^[[1;9C^[[1;9A23reqs 17.86328125 Mb memory usage, diff 0.38671875 Mb
24reqs 18.02734375 Mb memory usage, diff 0.1640625 Mb
src/cares_wrap.cc:41: At least two spaces is best between code and comments [whitespace/comments] [2]
src/cares_wrap.cc:144: The class QueryWrap probably needs a virtual destructor due to having virtual method(s), one declared at line 238. [runtime/virtual] [4]
src/cares_wrap.cc:624: At least two spaces is best between code and comments [whitespace/comments] [2]
Done processing src/cares_wrap.cc
src/fs_event_wrap.cc:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
src/fs_event_wrap.cc:6: Do not use namespace using-directives. Use using-declarations instead. [build/namespaces] [5]
src/fs_event_wrap.cc:14: Lines should be <= 80 characters long [whitespace/line_length] [2]
src/fs_event_wrap.cc:21: Labels should always be indented at least one space. If this is a member-initializer list in a constructor or the base class list in a class definition, the colon should be on the following line. [whitespace/labels] [4]
src/fs_event_wrap.
Enki:~/Code/node(master) $ git diff --stat origin/master
deps/uv/Makefile | 2 +-
deps/uv/include/uv-private/uv-win.h | 1 +
deps/uv/include/uv.h | 8 +-
deps/uv/src/unix/process.c | 10 +-
deps/uv/src/unix/stream.c | 19 +-
deps/uv/src/win/error.c | 2 +
deps/uv/src/win/fs-event.c | 71 +++-
deps/uv/src/win/internal.h | 3 +-
deps/uv/src/win/pipe.c | 17 +-
var net = require('net'),
var clients = []
var server = net.createServer()
server.listen(8000)
server.on('connection', function(connection) {
connection.type = 'tcp'
console.log('I got a connection')