Skip to content

Instantly share code, notes, and snippets.

Index: /Users/trentm/tm/json/lib/jsontool.js
index 734729c..d2764f9 100755
--- a/lib/jsontool.js
+++ b/lib/jsontool.js
@@ -399,36 +399,140 @@ function parseArgv(argv) {
* Get input from either given file paths or stdin.
*
* @param opts {Object} Parsed options.
- * @param callback {Function} `function (err, callback)` where err is an
- * error string if there was a problem.
[root@headnode (bh1-kvm7:0)]# cat foo.js
var fs = require('fs');
fs.watch("/var/tmp/follow.log", {persistent: true}, function (event, filename) {
console.log("EVENT", event, filename);
});
[root@headnode (bh1-kvm7:0)]# ./build/node/bin/node --version
v0.6.19
[root@headnode (bh1-kvm7:0)]# uname -a
SunOS headnode 5.11 joyent_20120723T091636Z i86pc i386 i86pc
@trentm
trentm / fetch.diff
Created June 28, 2012 19:36
better fetch
Index: /Users/trentm/tm/npm/lib/utils/fetch.js
index b489c21..6042abc 100644
--- a/lib/utils/fetch.js
+++ b/lib/utils/fetch.js
@@ -25,17 +25,31 @@ function fetch (remote, local, headers, cb) {
function fetch_ (remote, local, headers, cb) {
var fstr = fs.createWriteStream(local, { mode : npm.modes.file })
+ var response = null
+ var calledback = false
@trentm
trentm / no-retry-on-404.log
Created June 28, 2012 19:23
npm retry on 408 or 5xx only: npm/lib/cache.js and fetch.js changes
$ touch proxy.js && sleep 1 && rm -rf tmp/cache node_modules/bunyan && node ~/tm/npm/cli.js --loglevel=info --cache=`pwd`/tmp/cache --registry=http://localhost:8000/ install bunyan@0.6.8npm info it worked if it ends with ok
npm info using npm@1.1.32
npm info using node@v0.6.19
npm info retry registry request attempt 1 at 12:21:47
npm http GET http://localhost:8000/bunyan/0.6.8
npm http 200 http://localhost:8000/bunyan/0.6.8
npm info retry fetch attempt 1 at 12:21:48
npm http GET http://localhost:8000/bunyan/-/bunyan-0.6.8-BOGUS.tgz
npm http 404 http://localhost:8000/bunyan/-/bunyan-0.6.8-BOGUS.tgz
npm ERR! fetch failed http://localhost:8000/bunyan/-/bunyan-0.6.8-BOGUS.tgz
@trentm
trentm / diff.diff
Created June 28, 2012 18:33
npm retry on 408 or 5xx only
Index: /Users/trentm/tm/npm/node_modules/npm-registry-client/lib/request.js
index cba8ba2..7781d37 100644
--- a/node_modules/npm-registry-client/lib/request.js
+++ b/node_modules/npm-registry-client/lib/request.js
@@ -88,8 +88,11 @@ function regRequest (method, where, what, etag, nofollow, cb_) {
self.log.info("retry", "registry request attempt " + currentAttempt
+ " at " + (new Date()).toLocaleTimeString())
makeRequest.call(self, method, remote, where, what, etag, nofollow
- , function (er) {
- if (operation.retry(er)) {
@trentm
trentm / 3-server-failures.log
Created June 28, 2012 03:36
npm retry testing results
npm info it worked if it ends with ok
npm info using npm@1.1.32
npm info using node@v0.6.19
npm info retry registry request attempt 1 at 20:20:29
npm http GET http://localhost:8000/bunyan
npm http 500 http://localhost:8000/bunyan
npm info retry will retry, error on last attempt: 500 Internal Server Error
npm info retry registry request attempt 2 at 20:20:39
npm http GET http://localhost:8000/bunyan
npm http 500 http://localhost:8000/bunyan
@trentm
trentm / npm.diff
Created June 28, 2012 00:25
onResponse is gone
Index: /Users/trentm/tm/npm/lib/utils/fetch.js
index f69975b..2962cf9 100644
--- a/lib/utils/fetch.js
+++ b/lib/utils/fetch.js
@@ -55,14 +55,16 @@ function makeRequest (remote, fstr, headers) {
? "https-proxy"
: "proxy")
- request({ url: remote
+ var req = request({ url: remote
@trentm
trentm / shell.log
Created June 28, 2012 00:21
npm retry
[17:08:19 trentm@banana:~/tm/npm-registry-proxy (master)]
$ (touch proxy.js && sleep 1 # ensure my npm-registry-proxy restarts
&& rm -rf tmp/cache node_modules/bunyan # start fresh
&& node ~/tm/npm/cli.js --loglevel=info \
--cache=`pwd`/tmp/cache --registry=http://localhost:8000/ \
install bunyan)
npm info it worked if it ends with ok
npm info using npm@1.1.32
npm info using node@v0.6.19
npm info retry registry request attempt 1 at 17:08:22
@trentm
trentm / test.log
Created June 15, 2012 22:40
Test run of markdown2 against all versions of Python on my Mac.
$ make test
cd test && python testall.py
-- test with Python 2.5 (/usr/local/bin/python2.5)
markdown2/tm/auto_link ... ok
markdown2/tm/auto_link_email_with_underscore [issue26] ... ok
markdown2/tm/auto_link_safe_mode [issue7, safe_mode] ... ok
markdown2/tm/basic_safe_mode [safe_mode] ... ok
markdown2/tm/basic_safe_mode_escape [safe_mode] ... ok
markdown2/tm/blockquote ... ok
markdown2/tm/blockquote_with_pre ... ok
@trentm
trentm / macosx.txt
Created May 15, 2012 17:02
node 0.6.18 RC1 test results
[09:40:19 trentm@banana:~/tmp/n]
$ wget http://nodejs.org/dist/v0.6.18/node-v0.6.18-RC1.tar.gz
--2012-05-15 09:40:19-- http://nodejs.org/dist/v0.6.18/node-v0.6.18-RC1.tar.gz
Resolving nodejs.org... 8.12.44.238
Connecting to nodejs.org|8.12.44.238|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10261465 (9.8M) [application/octet-stream]
Saving to: `node-v0.6.18-RC1.tar.gz'
] 1,374,584 143K/s eta 58s
100%[======================================================================>] 10,261,465 59.8K/s in 1m 40s