Skip to content

Instantly share code, notes, and snippets.

@wolfeidau
Created October 7, 2013 21:58
Show Gist options
  • Save wolfeidau/6875651 to your computer and use it in GitHub Desktop.
Save wolfeidau/6875651 to your computer and use it in GitHub Desktop.
Leaking Code
module.exports = {key: 'XXXX', secret:'XXXX'};
'use strict';
var url = require('url');
var request = require('request');
var creds = require('./creds.js');
var scheme = 'https';
var hostname = 'api.tempo-db.com';
var baseUrl = scheme + '://' + hostname;
var auth = 'Basic ' + new Buffer(creds.key + ':' + creds.secret).toString('base64');
var headers = {
Host: hostname,
Authorization: auth
};
var seriesKey = '1_D90343085872CA9C_687_0_2000';
function uploadEntry(cb){
var data = [];
data.push({t: new Date(), v: Math.random() * 50})
var opts = {
url: url.parse(baseUrl + '/v1/series/key/' + seriesKey + '/data/'),
method: 'POST',
headers: headers,
body: JSON.stringify(data)
}
console.log('sending', data[0]);
request(opts,cb);
};
function callback(err, result){
if (!err) console.log('statusCode', result.statusCode);
}
setInterval(uploadEntry.bind(null, callback), 1000);
@wolfeidau
Copy link
Author

Diff of pmap.

$ diff pmap.out.1 pmap.out.2
1c1
< 19493:  node --expose-gc httptest.js

---
> 19493:    node --expose-gc httptest.js
17c17
< 000009746B100000       1024K rw---    [ anon ]

---
> 00000D5428700000       1024K rw---    [ anon ]
38,39c38,40
< 000023819AD00000         20K rw---    [ anon ]
< 000023819AD06000        996K rwx--    [ anon ]

---
> 00002381AED00000         20K rw---    [ anon ]
> 00002381AED06000        996K rwx--    [ anon ]
> 00002A0475000000       1024K rw---    [ anon ]
42d42
< 00003DAE62C00000       1024K rw---    [ anon ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment