<commit_before>require('shelljs/global');
require('colors');
var git  = require( 'gift');

// console.log(process.platform);

// console.log(git);

// https://github.com/notatestuser/gift
var modules = [
  "/home/michieljoris/mysrc/javascript/bb-server",
  "/home/michieljoris/mysrc/javascript/recaster",
  "/home/michieljoris/mysrc/javascript/cachejs",
  "/home/michieljoris/mysrc/javascript/url_washer",
  // "/home/michieljoris/mysrc/javascript/node-crawler",
  "/home/michieljoris/mysrc/javascript/bb-blog",

  "/home/michieljoris/mysrc/javascript/html-builder",
  "/home/michieljoris/mysrc/javascript/denodify",
  "/home/michieljoris/mysrc/javascript/denodify-core",

  // "/home/michieljoris/mysrc/javascript/cape",
  // "/home/michieljoris/www/sites/test-cape",

  // "/home/michieljoris/mysrc/javascript/adea",
  // "/home/michieljoris/mysrc/javascript/deploy-demo",
  "/home/michieljoris/mysrc/javascript/node-haproxy",
  // "/home/michieljoris/mysrc/javascript/serf-rpc",
  "/home/michieljoris/mysrc/javascript/vouchdb",

  "/home/michieljoris/mysrc/javascript/crypto-utils",

  "/home/michieljoris/mysrc/javascript/logthis"

  // // "/home/michieljoris/mysrc/javascript/roster/app",  //develop
  // "/home/michieljoris/mysrc/javascript/tw",
  // "/home/michieljoris/mysrc/javascript/validate_doc_update",
  // "/home/michieljoris/mysrc/javascript/trello-export",
  // "/home/michieljoris/mysrc/javascript/monad",

  // "/home/michieljoris/www/sites/quilt",

  // "/home/michieljoris/www/sites/firstdoor", //newlayout branch
  // "/home/michieljoris/mysrc/javascript/phantom-sitemap",

  // "/home/michieljoris/www/sites/dbeditor",
  // "/home/michieljoris/www/sites/greenglass",
  // "/home/michieljoris/www/sites/michieljoris.github.io",
  // "/home/michieljoris/www/sites/seo_laundry",
  // "/home/michieljoris/www/sites/personalinfo",
  // "/home/michieljoris/www/sites/roster_help",
  // "/home/michieljoris/www/sites/hexo-blog",

  // "/home/michieljoris/mysrc/javascript/blog",
  // "/home/michieljoris/www/sites/edge4",
  // "/home/michieljoris/mysrc/javascript/deploymeteor",
  // "/home/michieljoris/mysrc/javascript/less-monitor",

  // "/home/michieljoris/www/sites/testsite",

  // "/home/michieljoris/mysrc/job_applications",
  // "/home/michieljoris/mysrc/lisp/scheme/sicp",
  // "/home/michieljoris/mysrc/javascript/code-x",

  // "/home/michieljoris/mysrc/lisp/clojure/playground",

  // "/home/michieljoris/.i3",
  // "/home/michieljoris/.emacs.d",

  // "/home/michieljoris/mysrc/javascript/js-project",
  // "/home/michieljoris/mysrc/javascript/commit"

];

var npmList;

var repoPaths = [
    "/home/michieljoris/mysrc/javascript/bb-server",
    "/home/michieljoris/mysrc/javascript/recaster",
    "/home/michieljoris/mysrc/javascript/cachejs",
    "/home/michieljoris/mysrc/javascript/url_washer",
    "/home/michieljoris/mysrc/javascript/node-crawler",
    "/home/michieljoris/mysrc/javascript/bb-blog",

    "/home/michieljoris/mysrc/javascript/html-builder",
    "/home/michieljoris/mysrc/javascript/denodify",
    "/home/michieljoris/mysrc/javascript/denodify-core",

    "/home/michieljoris/mysrc/javascript/cape",
    "/home/michieljoris/mysrc/javascript/authpages",
    "/home/michieljoris/www/sites/test-cape",

    "/home/michieljoris/mysrc/javascript/adea",
    "/home/michieljoris/mysrc/javascript/deploy-demo",
    "/home/michieljoris/mysrc/javascript/node-haproxy",
    "/home/michieljoris/mysrc/javascript/serf-rpc",
    "/home/michieljoris/mysrc/javascript/vouchdb",
    "/home/michieljoris/mysrc/docker/Dockerfiles",
    "/home/michieljoris/mysrc/docker/rcouch",

    "/home/michieljoris/mysrc/javascript/crypto-utils",

    "/home/michieljoris/mysrc/javascript/logthis",

    // "/home/michieljoris/mysrc/javascript/roster/app",  //develop
    "/home/michieljoris/mysrc/javascript/tw",
    "/home/michieljoris/mysrc/javascript/validate_doc_update",
    "/home/michieljoris/mysrc/javascript/trello-export",
    "/home/michieljoris/mysrc/javascript/monad",

    "/home/michieljoris/www/sites/quilt",

    "/home/michieljoris/www/sites/firstdoor", //newlayout branch
    "/home/michieljoris/mysrc/javascript/phantom-sitemap",

    "/home/michieljoris/www/sites/dbeditor",
    "/home/michieljoris/www/sites/greenglass",
    "/home/michieljoris/www/sites/michieljoris.github.io",
    "/home/michieljoris/www/sites/seo_laundry",
    "/home/michieljoris/www/sites/personalinfo",
    "/home/michieljoris/www/sites/roster_help",
    "/home/michieljoris/www/sites/hexo-blog",

    "/home/michieljoris/mysrc/javascript/blog",
    "/home/michieljoris/www/sites/edge4",
    "/home/michieljoris/mysrc/javascript/deploymeteor",
    "/home/michieljoris/mysrc/javascript/less-monitor",

    "/home/michieljoris/www/sites/testsite",

    "/home/michieljoris/mysrc/job_applications",
    "/home/michieljoris/mysrc/lisp/scheme/sicp",
    "/home/michieljoris/mysrc/javascript/code-x",
    "/home/michieljoris/mysrc/org/readme.org-cheatsheet",

    "/home/michieljoris/mysrc/lisp/clojure/playground",
    "/home/michieljoris/mysrc/erlang/playground",

    "/home/michieljoris/.i3",
    "/home/michieljoris/.emacs.d",

    "/home/michieljoris/mysrc/javascript/js-project",
    "/home/michieljoris/mysrc/javascript/commit"
];

function sync(repoPath, cb) {
    var repo = git(repoPath);
    console.log("Processing:", repo.path);
    repo.status(function(err, repoStatus) {
        if (err) {
            console.log('Error fetching status: '.red , err);
            cb();
        }
        else {
            if (repoStatus.clean) {
                console.log('All up to date'.green);
                cb();
            }
            else if (Object.keys(repoStatus.files).length>0) {
                console.log('Adding files');
                repo.add('-A', function(err) {
                    if (err) {
                        console.log('Error staging files: '.red , err);
                        cb();
                    }
                    else {
                        var message = 'Sync ' + new Date();
                        console.log('Commiting: ' + message);

                        repo.commit(message, function(err) {
                            if (err) {
                                console.log('Error commiting:'.red , err);
                                cb();
                            }
                            else {
                                console.log('Pushing', repo);
                                repo.remote_push('origin', function(err) {
                                    if (err) console.log('Error pushing:'.error , err);
                                    else {
                                        npmList.push(repo.path);
                                        console.log('Done! Added to update npm list'.green);
                                    }
                                    cb();
                                });

                            }
                        });
                    }
                });

            }
            else cb();

        }
    });
}

function cmd(cmd, args, cb) {
    var spawn = require('child_process').spawn,
        child = spawn(cmd, args), stdout = '', stderr = '';
    child.stdout.on('data', function (buffer) {  stdout += buffer.toString(); });
    child.stderr.on('data', function (buffer) {  stderr += buffer.toString(); });
    child.stderr.on('end', function (buffer) {  console.log(stderr); });
    child.stdout.on('end', function() { cb(stdout); });
}

// var foo = new cmd(
//     'ls', ['-al'],
//     function (result) { console.log(result) }
// );

function print(str) { console.log(str); }

function updateNpm() {
    var path = modules[0];
    var out;
    modules.filter(function(m) {
        // console.log(m, npmList.indexOf(m));
        return npmList.indexOf(m) !== -1;
    }).forEach(function(module){
        cd(module);
        out = exec( 'node '+ 'package.js', {silent:true}).output;
        console.log('Bumped version for ' + module);
        out = exec('npm ' + 'publish', {silent:true}).output;
        console.log(out);
    });
    // console.log(path);
    // cmd('node', [path + '/package.js'], function(result) {
    //     print(result);
    //     cmd('npm', ['publish'], print);
    // });
}

function updateGit(paths, cb) {
    function recur() {
        var repoPath = paths.pop();
        if (repoPath) {
            sync(repoPath, function() {
                recur();
            });
        }
        else cb();
    }
    recur();
}

npmList = [];
updateGit(repoPaths, function() {
    console.log('Updating npm..');
    console.log(npmList);
    updateNpm();
    updateGit(npmList, function() {
        console.log('Done!!');
    });

});

// updateNpm();
// recur();

// Sync call to exec()

// // Async call to exec()
// exec('netstat -an', function(status, output) {
//   console.log('Exit status:', status);
//   console.log('Program output:', output);
// });

<commit_msg>Sync Mon Oct 20 2014 14:02:00 GMT+0200 (CEST)<commit_after>require('shelljs/global');
require('colors');
var git  = require( 'gift');

// console.log(process.platform);

// console.log(git);

// https://github.com/notatestuser/gift
var modules = [
  "/home/michieljoris/mysrc/javascript/bb-server",
  "/home/michieljoris/mysrc/javascript/recaster",
  "/home/michieljoris/mysrc/javascript/cachejs",
  "/home/michieljoris/mysrc/javascript/url_washer",
  // "/home/michieljoris/mysrc/javascript/node-crawler",
  "/home/michieljoris/mysrc/javascript/bb-blog",

  "/home/michieljoris/mysrc/javascript/html-builder",
  "/home/michieljoris/mysrc/javascript/denodify",
  "/home/michieljoris/mysrc/javascript/denodify-core",

  // "/home/michieljoris/mysrc/javascript/cape",
  // "/home/michieljoris/www/sites/test-cape",

  // "/home/michieljoris/mysrc/javascript/adea",
  // "/home/michieljoris/mysrc/javascript/deploy-demo",
  "/home/michieljoris/mysrc/javascript/node-haproxy",
  // "/home/michieljoris/mysrc/javascript/serf-rpc",
  "/home/michieljoris/mysrc/javascript/vouchdb",

  "/home/michieljoris/mysrc/javascript/crypto-utils",

  "/home/michieljoris/mysrc/javascript/logthis"

  // // "/home/michieljoris/mysrc/javascript/roster/app",  //develop
  // "/home/michieljoris/mysrc/javascript/tw",
  // "/home/michieljoris/mysrc/javascript/validate_doc_update",
  // "/home/michieljoris/mysrc/javascript/trello-export",
  // "/home/michieljoris/mysrc/javascript/monad",

  // "/home/michieljoris/www/sites/quilt",

  // "/home/michieljoris/www/sites/firstdoor", //newlayout branch
  // "/home/michieljoris/mysrc/javascript/phantom-sitemap",

  // "/home/michieljoris/www/sites/dbeditor",
  // "/home/michieljoris/www/sites/greenglass",
  // "/home/michieljoris/www/sites/michieljoris.github.io",
  // "/home/michieljoris/www/sites/seo_laundry",
  // "/home/michieljoris/www/sites/personalinfo",
  // "/home/michieljoris/www/sites/roster_help",
  // "/home/michieljoris/www/sites/hexo-blog",

  // "/home/michieljoris/mysrc/javascript/blog",
  // "/home/michieljoris/www/sites/edge4",
  // "/home/michieljoris/mysrc/javascript/deploymeteor",
  // "/home/michieljoris/mysrc/javascript/less-monitor",

  // "/home/michieljoris/www/sites/testsite",

  // "/home/michieljoris/mysrc/job_applications",
  // "/home/michieljoris/mysrc/lisp/scheme/sicp",
  // "/home/michieljoris/mysrc/javascript/code-x",

  // "/home/michieljoris/mysrc/lisp/clojure/playground",

  // "/home/michieljoris/.i3",
  // "/home/michieljoris/.emacs.d",

  // "/home/michieljoris/mysrc/javascript/js-project",
  // "/home/michieljoris/mysrc/javascript/commit"

];

var npmList;

var repoPaths = [
    "/home/michieljoris/mysrc/javascript/bb-server",
    "/home/michieljoris/mysrc/javascript/recaster",
    "/home/michieljoris/mysrc/javascript/cachejs",
    "/home/michieljoris/mysrc/javascript/url_washer",
    "/home/michieljoris/mysrc/javascript/node-crawler",
    "/home/michieljoris/mysrc/javascript/bb-blog",

    "/home/michieljoris/mysrc/javascript/html-builder",
    "/home/michieljoris/mysrc/javascript/denodify",
    "/home/michieljoris/mysrc/javascript/denodify-core",

    "/home/michieljoris/mysrc/javascript/cape",
    "/home/michieljoris/mysrc/javascript/authpages",
    "/home/michieljoris/www/sites/test-cape",

    "/home/michieljoris/mysrc/javascript/adea",
    "/home/michieljoris/mysrc/javascript/deploy-demo",
    "/home/michieljoris/mysrc/javascript/node-haproxy",
    "/home/michieljoris/mysrc/javascript/serf-rpc",
    "/home/michieljoris/mysrc/javascript/vouchdb",
    "/home/michieljoris/mysrc/docker/Dockerfiles",
    "/home/michieljoris/mysrc/docker/rcouch",

    "/home/michieljoris/mysrc/javascript/crypto-utils",

    "/home/michieljoris/mysrc/javascript/logthis",

    // "/home/michieljoris/mysrc/javascript/roster/app",  //develop
    "/home/michieljoris/mysrc/javascript/tw",
    "/home/michieljoris/mysrc/javascript/validate_doc_update",
    "/home/michieljoris/mysrc/javascript/trello-export",
    "/home/michieljoris/mysrc/javascript/monad",

    "/home/michieljoris/www/sites/quilt",

    "/home/michieljoris/www/sites/firstdoor", //newlayout branch
    "/home/michieljoris/mysrc/javascript/phantom-sitemap",

    "/home/michieljoris/www/sites/dbeditor",
    "/home/michieljoris/www/sites/greenglass",
    "/home/michieljoris/www/sites/michieljoris.github.io",
    "/home/michieljoris/www/sites/seo_laundry",
    "/home/michieljoris/www/sites/personalinfo",
    "/home/michieljoris/www/sites/roster_help",
    // "/home/michieljoris/www/sites/hexo-blog",

    "/home/michieljoris/mysrc/javascript/blog-example",
    "/home/michieljoris/www/sites/edge4",
    "/home/michieljoris/mysrc/javascript/deploymeteor",
    "/home/michieljoris/mysrc/javascript/less-monitor",

    "/home/michieljoris/www/sites/testsite",

    "/home/michieljoris/mysrc/job_applications",
    "/home/michieljoris/mysrc/lisp/scheme/sicp",
    "/home/michieljoris/mysrc/javascript/code-x",
    "/home/michieljoris/mysrc/org/readme.org-cheatsheet",

    "/home/michieljoris/mysrc/lisp/clojure/playground",
    "/home/michieljoris/mysrc/erlang/playground",

    "/home/michieljoris/.i3",
    "/home/michieljoris/.emacs.d",

    "/home/michieljoris/mysrc/javascript/js-project",
    "/home/michieljoris/mysrc/javascript/commit"
];

function sync(repoPath, cb) {
    var repo = git(repoPath);
    console.log("Processing:", repo.path);
    repo.status(function(err, repoStatus) {
        if (err) {
            console.log('Error fetching status: '.red , err);
            cb();
        }
        else {
            if (repoStatus.clean) {
                console.log('All up to date'.green);
                cb();
            }
            else if (Object.keys(repoStatus.files).length>0) {
                console.log('Adding files');
                repo.add('-A', function(err) {
                    if (err) {
                        console.log('Error staging files: '.red , err);
                        cb();
                    }
                    else {
                        var message = 'Sync ' + new Date();
                        console.log('Commiting: ' + message);

                        repo.commit(message, function(err) {
                            if (err) {
                                console.log('Error commiting:'.red , err);
                                cb();
                            }
                            else {
                                console.log('Pushing', repo);
                                repo.remote_push('origin', function(err) {
                                    if (err) console.log('Error pushing:'.error , err);
                                    else {
                                        npmList.push(repo.path);
                                        console.log('Done! Added to update npm list'.green);
                                    }
                                    cb();
                                });

                            }
                        });
                    }
                });

            }
            else cb();

        }
    });
}

function cmd(cmd, args, cb) {
    var spawn = require('child_process').spawn,
        child = spawn(cmd, args), stdout = '', stderr = '';
    child.stdout.on('data', function (buffer) {  stdout += buffer.toString(); });
    child.stderr.on('data', function (buffer) {  stderr += buffer.toString(); });
    child.stderr.on('end', function (buffer) {  console.log(stderr); });
    child.stdout.on('end', function() { cb(stdout); });
}

// var foo = new cmd(
//     'ls', ['-al'],
//     function (result) { console.log(result) }
// );

function print(str) { console.log(str); }

function updateNpm() {
    var path = modules[0];
    var out;
    modules.filter(function(m) {
        // console.log(m, npmList.indexOf(m));
        return npmList.indexOf(m) !== -1;
    }).forEach(function(module){
        cd(module);
        out = exec( 'node '+ 'package.js', {silent:true}).output;
        console.log('Bumped version for ' + module);
        out = exec('npm ' + 'publish', {silent:true}).output;
        console.log(out);
    });
    // console.log(path);
    // cmd('node', [path + '/package.js'], function(result) {
    //     print(result);
    //     cmd('npm', ['publish'], print);
    // });
}

function updateGit(paths, cb) {
    function recur() {
        var repoPath = paths.pop();
        if (repoPath) {
            sync(repoPath, function() {
                recur();
            });
        }
        else cb();
    }
    recur();
}

npmList = [];
updateGit(repoPaths, function() {
    console.log('Updating npm..');
    console.log(npmList);
    updateNpm();
    updateGit(npmList, function() {
        console.log('Done!!');
    });

});

// updateNpm();
// recur();

// Sync call to exec()

// // Async call to exec()
// exec('netstat -an', function(status, output) {
//   console.log('Exit status:', status);
//   console.log('Program output:', output);
// });

<|endoftext|>


<commit_before>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes"<commit_msg>Updated the readme<commit_after>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes",<|endoftext|>


<commit_before>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes",
  "Should work now",
  "Back out the last commit",
  "Reverting changes",
  "One more time...",
  "Re-commiting last",
  "One more User Story done",
  "Can work my way through the Kanban",
  "Sprint complete",
  "Well that seemed pretty easy",
  "What do you mean you can't pack up the commit?",
  "Merge in master",
  "Fast-forwarding changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.floor(commit_time / 3600)
    var commit_time_rem = commit_time - (commit_time_hour * 3600)
    var commit_time_min = Math.floor(commit_time_rem / 60)
    var commit_time_sec = commit_time_rem - (commit_time_min * 60)
    console.info("Input file is %s Bytes, this will generate %s commits and take approximately %s hours %s minutes %s seconds", length, commit_count, commit_time_hour, commit_time_min, commit_time_sec)
    var t_offset = 0
    if (process.env.FAKETIME) {
      // 20% buffer, to reduce the likelihood of going in to the future
      t_offset = commit_time * -1.2;
      faketime(t_offset);
    }
    try {
      child_process.execFileSync('git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var counter = 0
    process.stdout.write("Queueing up the first commit...\r");
    var timeout;
    if (process.env.FAKETIME) {
      faketime(t_offset);
      timeout = 20;
    } else {
      timeout = randomIntFromInterval(0, max_sleep) * 1000
    }
    setTimeout(commit, timeout, t_offset, outFD, outFile, data, counter, length);
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [max_time_in_seconds] [step]")
}

function sleep(seconds) {
  var endTime = new Date().getTime() + (seconds * 1000);
  while (new Date().getTime() <= endTime) {;}
}

function randomIntFromInterval(min,max)
{
   return Math.floor(Math.random()*(max-min+1)+min);
}

function commit(t_offset, outFD, outFile, data, counter, length)
{
  if (counter < length)
  {
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    if (counter + step >= length) step = length - counter
    process.stdout.write("\033[2K Writing " + counter + "/" + length + " bytes: " + message + "\r");
    fs.writeSync(outFD, data.slice(counter, counter+step), 0, step)
    child_process.execFileSync('/Applications/Xcode.app/Contents/Developer/usr/bin/git', args)
    var timeout = randomIntFromInterval(0, max_sleep)
    co<commit_msg>Can work my way through the Kanban<commit_after>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes",
  "Should work now",
  "Back out the last commit",
  "Reverting changes",
  "One more time...",
  "Re-commiting last",
  "One more User Story done",
  "Can work my way through the Kanban",
  "Sprint complete",
  "Well that seemed pretty easy",
  "What do you mean you can't pack up the commit?",
  "Merge in master",
  "Fast-forwarding changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.floor(commit_time / 3600)
    var commit_time_rem = commit_time - (commit_time_hour * 3600)
    var commit_time_min = Math.floor(commit_time_rem / 60)
    var commit_time_sec = commit_time_rem - (commit_time_min * 60)
    console.info("Input file is %s Bytes, this will generate %s commits and take approximately %s hours %s minutes %s seconds", length, commit_count, commit_time_hour, commit_time_min, commit_time_sec)
    var t_offset = 0
    if (process.env.FAKETIME) {
      // 20% buffer, to reduce the likelihood of going in to the future
      t_offset = commit_time * -1.2;
      faketime(t_offset);
    }
    try {
      child_process.execFileSync('git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var counter = 0
    process.stdout.write("Queueing up the first commit...\r");
    var timeout;
    if (process.env.FAKETIME) {
      faketime(t_offset);
      timeout = 20;
    } else {
      timeout = randomIntFromInterval(0, max_sleep) * 1000
    }
    setTimeout(commit, timeout, t_offset, outFD, outFile, data, counter, length);
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [max_time_in_seconds] [step]")
}

function sleep(seconds) {
  var endTime = new Date().getTime() + (seconds * 1000);
  while (new Date().getTime() <= endTime) {;}
}

function randomIntFromInterval(min,max)
{
   return Math.floor(Math.random()*(max-min+1)+min);
}

function commit(t_offset, outFD, outFile, data, counter, length)
{
  if (counter < length)
  {
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    if (counter + step >= length) step = length - counter
    process.stdout.write("\033[2K Writing " + counter + "/" + length + " bytes: " + message + "\r");
    fs.writeSync(outFD, data.slice(counter, counter+step), 0, step)
    child_process.execFileSync('/Applications/Xcode.app/Contents/Developer/usr/bin/git', args)
    var timeout = randomIntFromInterval(0, max_sleep)
    cou<|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var<commit_msg>Cleaned out the intertubes<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var <|endoftext|>


<commit_before>require('shelljs/global');
require('colors');
var git  = require( 'gift');

// console.log(process.platform);

// console.log(git);

// https://github.com/notatestuser/gift
var modules = [
  "/home/michieljoris/mysrc/javascript/bb-server",
  "/home/michieljoris/mysrc/javascript/recaster",
  "/home/michieljoris/mysrc/javascript/cachejs",
  "/home/michieljoris/mysrc/javascript/url_washer",
  // "/home/michieljoris/mysrc/javascript/node-crawler",
  "/home/michieljoris/mysrc/javascript/bb-blog",

  "/home/michieljoris/mysrc/javascript/html-builder",
  "/home/michieljoris/mysrc/javascript/denodify",
  "/home/michieljoris/mysrc/javascript/denodify-core",

  // "/home/michieljoris/mysrc/javascript/cape",
  // "/home/michieljoris/www/sites/test-cape",

  // "/home/michieljoris/mysrc/javascript/adea",
  // "/home/michieljoris/mysrc/javascript/deploy-demo",
  "/home/michieljoris/mysrc/javascript/node-haproxy",
  // "/home/michieljoris/mysrc/javascript/serf-rpc",
  "/home/michieljoris/mysrc/javascript/vouchdb",

  "/home/michieljoris/mysrc/javascript/crypto-utils",

  "/home/michieljoris/mysrc/javascript/logthis"

  // // "/home/michieljoris/mysrc/javascript/roster/app",  //develop
  // "/home/michieljoris/mysrc/javascript/tw",
  // "/home/michieljoris/mysrc/javascript/validate_doc_update",
  // "/home/michieljoris/mysrc/javascript/trello-export",
  // "/home/michieljoris/mysrc/javascript/monad",

  // "/home/michieljoris/www/sites/quilt",

  // "/home/michieljoris/www/sites/firstdoor", //newlayout branch
  // "/home/michieljoris/mysrc/javascript/phantom-sitemap",

  // "/home/michieljoris/www/sites/dbeditor",
  // "/home/michieljoris/www/sites/greenglass",
  // "/home/michieljoris/www/sites/michieljoris.github.io",
  // "/home/michieljoris/www/sites/seo_laundry",
  // "/home/michieljoris/www/sites/personalinfo",
  // "/home/michieljoris/www/sites/roster_help",
  // "/home/michieljoris/www/sites/hexo-blog",

  // "/home/michieljoris/mysrc/javascript/blog",
  // "/home/michieljoris/www/sites/edge4",
  // "/home/michieljoris/mysrc/javascript/deploymeteor",
  // "/home/michieljoris/mysrc/javascript/less-monitor",

  // "/home/michieljoris/www/sites/testsite",

  // "/home/michieljoris/mysrc/job_applications",
  // "/home/michieljoris/mysrc/lisp/scheme/sicp",
  // "/home/michieljoris/mysrc/javascript/code-x",

  // "/home/michieljoris/mysrc/lisp/clojure/playground",

  // "/home/michieljoris/.i3",
  // "/home/michieljoris/.emacs.d",

  // "/home/michieljoris/mysrc/javascript/js-project",
  // "/home/michieljoris/mysrc/javascript/commit"

];

var npmList;

var repoPaths = [
  "/home/michieljoris/mysrc/javascript/bb-server",
  "/home/michieljoris/mysrc/javascript/recaster",
  "/home/michieljoris/mysrc/javascript/cachejs",
  "/home/michieljoris/mysrc/javascript/url_washer",
  "/home/michieljoris/mysrc/javascript/node-crawler",
  "/home/michieljoris/mysrc/javascript/bb-blog",

  "/home/michieljoris/mysrc/javascript/html-builder",
  "/home/michieljoris/mysrc/javascript/denodify",
  "/home/michieljoris/mysrc/javascript/denodify-core",

  "/home/michieljoris/mysrc/javascript/cape",
  "/home/michieljoris/www/sites/test-cape",

  "/home/michieljoris/mysrc/javascript/adea",
  "/home/michieljoris/mysrc/javascript/deploy-demo",
  "/home/michieljoris/mysrc/javascript/node-haproxy",
  "/home/michieljoris/mysrc/javascript/serf-rpc",
  "/home/michieljoris/mysrc/javascript/vouchdb",

  "/home/michieljoris/mysrc/javascript/crypto-utils",

  "/home/michieljoris/mysrc/javascript/logthis",

  // "/home/michieljoris/mysrc/javascript/roster/app",  //develop
  "/home/michieljoris/mysrc/javascript/tw",
  "/home/michieljoris/mysrc/javascript/validate_doc_update",
  "/home/michieljoris/mysrc/javascript/trello-export",
  "/home/michieljoris/mysrc/javascript/monad",

  "/home/michieljoris/www/sites/quilt",

  "/home/michieljoris/www/sites/firstdoor", //newlayout branch
  "/home/michieljoris/mysrc/javascript/phantom-sitemap",

  "/home/michieljoris/www/sites/dbeditor",
  "/home/michieljoris/www/sites/greenglass",
  "/home/michieljoris/www/sites/michieljoris.github.io",
  "/home/michieljoris/www/sites/seo_laundry",
  "/home/michieljoris/www/sites/personalinfo",
  "/home/michieljoris/www/sites/roster_help",
  "/home/michieljoris/www/sites/hexo-blog",

  "/home/michieljoris/mysrc/javascript/blog",
  "/home/michieljoris/www/sites/edge4",
  "/home/michieljoris/mysrc/javascript/deploymeteor",
  "/home/michieljoris/mysrc/javascript/less-monitor",

  "/home/michieljoris/www/sites/testsite",

  "/home/michieljoris/mysrc/job_applications",
  "/home/michieljoris/mysrc/lisp/scheme/sicp",
  "/home/michieljoris/mysrc/javascript/code-x",

  "/home/michieljoris/mysrc/lisp/clojure/playground",

  "/home/michieljoris/.i3",
  "/home/michieljoris/.emacs.d",

  "/home/michieljoris/mysrc/javascript/js-project",
  "/home/michieljoris/mysrc/javascript/commit"
];

function sync(repoPath, cb) {
    var repo = git(repoPath);
    console.log("Processing:", repo.path);
    repo.status(function(err, repoStatus) {
        if (err) {
            console.log('Error fetching status: '.red , err);
            cb();
        }
        else {
            if (repoStatus.clean) {
                console.log('All up to date'.green);
                cb();
            }
            else if (Object.keys(repoStatus.files).length>0) {
                console.log('Adding files');
                repo.add('-A', function(err) {
                    if (err) {
                        console.log('Error staging files: '.red , err);
                        cb();
                    }
                    else {
                        var message = 'Sync ' + new Date();
                        console.log('Commiting: ' + message);

                        repo.commit(message, function(err) {
                            if (err) {
                                console.log('Error commiting:'.red , err);
                                cb();
                            }
                            else {
                                console.log('Pushing', repo);
                                repo.remote_push('origin', function(err) {
                                    if (err) console.log('Error pushing:'.error , err);
                                    else {
                                        npmList.push(repo.path);
                                        console.log('Done! Added to update npm list'.green);
                                    }
                                    cb();
                                });

                            }
                        });
                    }
                });

            }
            else cb();

        }
    });
}

function cmd(cmd, args, cb) {
    var spawn = require('child_process').spawn,
        child = spawn(cmd, args), stdout = '', stderr = '';
    child.stdout.on('data', function (buffer) {  stdout += buffer.toString(); });
    child.stderr.on('data', function (buffer) {  stderr += buffer.toString(); });
    child.stderr.on('end', function (buffer) {  console.log(stderr); });
    child.stdout.on('end', function() { cb(stdout); });
}

// var foo = new cmd(
//     'ls', ['-al'],
//     function (result) { console.log(result) }
// );

function print(str) { console.log(str); }

function updateNpm() {
    var path = modules[0];
    var out;
    modules.filter(function(m) {
        // console.log(m, npmList.indexOf(m));
        return npmList.indexOf(m) !== -1;
    }).forEach(function(module){
        cd(module);
        out = exec( 'node '+ 'package.js', {silent:true}).output;
        console.log('Bumped version for ' + module);
        out = exec('npm ' + 'publish', {silent:true}).output;
        console.log(out);
    });
    // console.log(path);
    // cmd('node', [path + '/package.js'], function(result) {
    //     print(result);
    //     cmd('npm', ['publish'], print);
    // });
}

function updateGit(paths, cb) {
    function recur() {
        var repoPath = paths.pop();
        if (repoPath) {
            sync(repoPath, function() {
                recur();
            });
        }
        else cb();
    }
    recur();
}

npmList = [];
updateGit(repoPaths, function() {
    console.log('Updating npm..');
    console.log(npmList);
    updateNpm();
    updateGit(npmList, function() {
        console.log('Done!!');
    });

});

// updateNpm();
// recur();

// Sync call to exec()

// // Async call to exec()
// exec('netstat -an', function(status, output) {
//   console.log('Exit status:', status);
//   console.log('Program output:', output);
// });

<commit_msg>Sync Tue Sep 16 2014 00:23:12 GMT+1000 (EST)<commit_after>require('shelljs/global');
require('colors');
var git  = require( 'gift');

// console.log(process.platform);

// console.log(git);

// https://github.com/notatestuser/gift
var modules = [
  "/home/michieljoris/mysrc/javascript/bb-server",
  "/home/michieljoris/mysrc/javascript/recaster",
  "/home/michieljoris/mysrc/javascript/cachejs",
  "/home/michieljoris/mysrc/javascript/url_washer",
  // "/home/michieljoris/mysrc/javascript/node-crawler",
  "/home/michieljoris/mysrc/javascript/bb-blog",

  "/home/michieljoris/mysrc/javascript/html-builder",
  "/home/michieljoris/mysrc/javascript/denodify",
  "/home/michieljoris/mysrc/javascript/denodify-core",

  // "/home/michieljoris/mysrc/javascript/cape",
  // "/home/michieljoris/www/sites/test-cape",

  // "/home/michieljoris/mysrc/javascript/adea",
  // "/home/michieljoris/mysrc/javascript/deploy-demo",
  "/home/michieljoris/mysrc/javascript/node-haproxy",
  // "/home/michieljoris/mysrc/javascript/serf-rpc",
  "/home/michieljoris/mysrc/javascript/vouchdb",

  "/home/michieljoris/mysrc/javascript/crypto-utils",

  "/home/michieljoris/mysrc/javascript/logthis"

  // // "/home/michieljoris/mysrc/javascript/roster/app",  //develop
  // "/home/michieljoris/mysrc/javascript/tw",
  // "/home/michieljoris/mysrc/javascript/validate_doc_update",
  // "/home/michieljoris/mysrc/javascript/trello-export",
  // "/home/michieljoris/mysrc/javascript/monad",

  // "/home/michieljoris/www/sites/quilt",

  // "/home/michieljoris/www/sites/firstdoor", //newlayout branch
  // "/home/michieljoris/mysrc/javascript/phantom-sitemap",

  // "/home/michieljoris/www/sites/dbeditor",
  // "/home/michieljoris/www/sites/greenglass",
  // "/home/michieljoris/www/sites/michieljoris.github.io",
  // "/home/michieljoris/www/sites/seo_laundry",
  // "/home/michieljoris/www/sites/personalinfo",
  // "/home/michieljoris/www/sites/roster_help",
  // "/home/michieljoris/www/sites/hexo-blog",

  // "/home/michieljoris/mysrc/javascript/blog",
  // "/home/michieljoris/www/sites/edge4",
  // "/home/michieljoris/mysrc/javascript/deploymeteor",
  // "/home/michieljoris/mysrc/javascript/less-monitor",

  // "/home/michieljoris/www/sites/testsite",

  // "/home/michieljoris/mysrc/job_applications",
  // "/home/michieljoris/mysrc/lisp/scheme/sicp",
  // "/home/michieljoris/mysrc/javascript/code-x",

  // "/home/michieljoris/mysrc/lisp/clojure/playground",

  // "/home/michieljoris/.i3",
  // "/home/michieljoris/.emacs.d",

  // "/home/michieljoris/mysrc/javascript/js-project",
  // "/home/michieljoris/mysrc/javascript/commit"

];

var npmList;

var repoPaths = [
    "/home/michieljoris/mysrc/javascript/bb-server",
    "/home/michieljoris/mysrc/javascript/recaster",
    "/home/michieljoris/mysrc/javascript/cachejs",
    "/home/michieljoris/mysrc/javascript/url_washer",
    "/home/michieljoris/mysrc/javascript/node-crawler",
    "/home/michieljoris/mysrc/javascript/bb-blog",

    "/home/michieljoris/mysrc/javascript/html-builder",
    "/home/michieljoris/mysrc/javascript/denodify",
    "/home/michieljoris/mysrc/javascript/denodify-core",

    "/home/michieljoris/mysrc/javascript/cape",
    "/home/michieljoris/www/sites/test-cape",

    "/home/michieljoris/mysrc/javascript/adea",
    "/home/michieljoris/mysrc/javascript/deploy-demo",
    "/home/michieljoris/mysrc/javascript/node-haproxy",
    "/home/michieljoris/mysrc/javascript/serf-rpc",
    "/home/michieljoris/mysrc/javascript/vouchdb",

    "/home/michieljoris/mysrc/javascript/crypto-utils",

    "/home/michieljoris/mysrc/javascript/logthis",

    // "/home/michieljoris/mysrc/javascript/roster/app",  //develop
    "/home/michieljoris/mysrc/javascript/tw",
    "/home/michieljoris/mysrc/javascript/validate_doc_update",
    "/home/michieljoris/mysrc/javascript/trello-export",
    "/home/michieljoris/mysrc/javascript/monad",

    "/home/michieljoris/www/sites/quilt",

    "/home/michieljoris/www/sites/firstdoor", //newlayout branch
    "/home/michieljoris/mysrc/javascript/phantom-sitemap",

    "/home/michieljoris/www/sites/dbeditor",
    "/home/michieljoris/www/sites/greenglass",
    "/home/michieljoris/www/sites/michieljoris.github.io",
    "/home/michieljoris/www/sites/seo_laundry",
    "/home/michieljoris/www/sites/personalinfo",
    "/home/michieljoris/www/sites/roster_help",
    "/home/michieljoris/www/sites/hexo-blog",

    "/home/michieljoris/mysrc/javascript/blog",
    "/home/michieljoris/www/sites/edge4",
    "/home/michieljoris/mysrc/javascript/deploymeteor",
    "/home/michieljoris/mysrc/javascript/less-monitor",

    "/home/michieljoris/www/sites/testsite",

    "/home/michieljoris/mysrc/job_applications",
    "/home/michieljoris/mysrc/lisp/scheme/sicp",
    "/home/michieljoris/mysrc/javascript/code-x",

    "/home/michieljoris/mysrc/lisp/clojure/playground",

    "/home/michieljoris/.i3",
    "/home/michieljoris/.emacs.d",

    "/home/michieljoris/mysrc/javascript/js-project",
    "/home/michieljoris/mysrc/javascript/commit"
];

function sync(repoPath, cb) {
    var repo = git(repoPath);
    console.log("Processing:", repo.path);
    repo.status(function(err, repoStatus) {
        if (err) {
            console.log('Error fetching status: '.red , err);
            cb();
        }
        else {
            if (repoStatus.clean) {
                console.log('All up to date'.green);
                cb();
            }
            else if (Object.keys(repoStatus.files).length>0) {
                console.log('Adding files');
                repo.add('-A', function(err) {
                    if (err) {
                        console.log('Error staging files: '.red , err);
                        cb();
                    }
                    else {
                        var message = 'Sync ' + new Date();
                        console.log('Commiting: ' + message);

                        repo.commit(message, function(err) {
                            if (err) {
                                console.log('Error commiting:'.red , err);
                                cb();
                            }
                            else {
                                console.log('Pushing', repo);
                                repo.remote_push('origin', function(err) {
                                    if (err) console.log('Error pushing:'.error , err);
                                    else {
                                        npmList.push(repo.path);
                                        console.log('Done! Added to update npm list'.green);
                                    }
                                    cb();
                                });

                            }
                        });
                    }
                });

            }
            else cb();

        }
    });
}

function cmd(cmd, args, cb) {
    var spawn = require('child_process').spawn,
        child = spawn(cmd, args), stdout = '', stderr = '';
    child.stdout.on('data', function (buffer) {  stdout += buffer.toString(); });
    child.stderr.on('data', function (buffer) {  stderr += buffer.toString(); });
    child.stderr.on('end', function (buffer) {  console.log(stderr); });
    child.stdout.on('end', function() { cb(stdout); });
}

// var foo = new cmd(
//     'ls', ['-al'],
//     function (result) { console.log(result) }
// );

function print(str) { console.log(str); }

function updateNpm() {
    var path = modules[0];
    var out;
    modules.filter(function(m) {
        // console.log(m, npmList.indexOf(m));
        return npmList.indexOf(m) !== -1;
    }).forEach(function(module){
        cd(module);
        out = exec( 'node '+ 'package.js', {silent:true}).output;
        console.log('Bumped version for ' + module);
        out = exec('npm ' + 'publish', {silent:true}).output;
        console.log(out);
    });
    // console.log(path);
    // cmd('node', [path + '/package.js'], function(result) {
    //     print(result);
    //     cmd('npm', ['publish'], print);
    // });
}

function updateGit(paths, cb) {
    function recur() {
        var repoPath = paths.pop();
        if (repoPath) {
            sync(repoPath, function() {
                recur();
            });
        }
        else cb();
    }
    recur();
}

npmList = [];
updateGit(repoPaths, function() {
    console.log('Updating npm..');
    console.log(npmList);
    updateNpm();
    updateGit(npmList, function() {
        console.log('Done!!');
    });

});

// updateNpm();
// recur();

// Sync call to exec()

// // Async call to exec()
// exec('netstat -an', function(status, output) {
//   console.log('Exit status:', status);
//   console.log('Program output:', output);
// });

<|endoftext|>


<commit_before>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes",
  "Should work now",
  "Back out the last commit",
  "Reverting changes",
  "One more time...",
  "Re-commiting last",
  "One more User Story done",
  "Can work my way through the Kanban",
  "Sprint complete",
  "Well that seemed pretty easy",
  "What do you mean you can't pack up the commit?",
  "Merge in master",
  "Fast-forwarding changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.floor(commit_time / 3600)
    var commit_time_rem = commit_time - (commit_time_hour * 3600)
    var commit_time_min = Math.floor(commit_time_rem / 60)
    var commit_time_sec = commit_time_rem - (commit_time_min * 60)
    console.info("Input file is %s Bytes, this will generate %s commits and take approximately %s hours %s minutes %s seconds", length, commit_count, commit_time_hour, commit_time_min, commit_time_sec)
    var t_offset = 0
    if (process.env.FAKETIME) {
      // 20% buffer, to reduce the likelihood of going in to the future
      t_offset = commit_time * -1.2;
      faketime(t_offset);
    }
    try {
      child_process.execFileSync('git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var counter = 0
    process.stdout.write("Queueing up the first commit...\r");
    var timeout;
    if (process.env.FAKETIME) {
      faketime(t_offset);
      timeout = 20;
    } else {
      timeout = randomIntFromInterval(0, max_sleep) * 1000
    }
    setTimeout(commit, timeout, t_offset, outFD, outFile, data, counter, length);
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [max_time_in_seconds] [step]")
}

function sleep(seconds) {
  var endTime = new Date().getTime() + (seconds * 1000);
  while (new Date().getTime() <= endTime) {;}
}

function randomIntFromInterval(min,max)
{
   return Math.floor(Math.random()*(max-min+1)+min);
}

function commit(t_offset, outFD, outFile, data, counter, length)
{
  if (counter < length)
  {
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    if (counter + step >= length) step = length - counter
    process.stdout.write("\033[2K Writing " + counter + "/" + length + " bytes: " + message + "\r");
    fs.writeSync(outFD, data.slice(counter, counter+step), 0, step)
    child_process.execFileSync('/Applications/Xcode.app/Contents/Developer/usr/bin/git', args)
    var timeout = randomIntFromInterval(0, max_sleep)
    counter = counter + step
    if (process.env.FAKETIME) {
      t_offset = t_offset + timeout;
      faketime(t_offset);
      timeout = 20;
    } else {
      timeout = timeout * 1000
    }
    setTimeout(commit, timeout, t_offset, outFD, outFile, data, counter, length);
  } else {
    var args = ['push']
    child_process.execFileSync('git', args)
    console.info("Finished"<commit_msg>AAAAAAAAAAARGH!<commit_after>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes",
  "Should work now",
  "Back out the last commit",
  "Reverting changes",
  "One more time...",
  "Re-commiting last",
  "One more User Story done",
  "Can work my way through the Kanban",
  "Sprint complete",
  "Well that seemed pretty easy",
  "What do you mean you can't pack up the commit?",
  "Merge in master",
  "Fast-forwarding changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.floor(commit_time / 3600)
    var commit_time_rem = commit_time - (commit_time_hour * 3600)
    var commit_time_min = Math.floor(commit_time_rem / 60)
    var commit_time_sec = commit_time_rem - (commit_time_min * 60)
    console.info("Input file is %s Bytes, this will generate %s commits and take approximately %s hours %s minutes %s seconds", length, commit_count, commit_time_hour, commit_time_min, commit_time_sec)
    var t_offset = 0
    if (process.env.FAKETIME) {
      // 20% buffer, to reduce the likelihood of going in to the future
      t_offset = commit_time * -1.2;
      faketime(t_offset);
    }
    try {
      child_process.execFileSync('git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var counter = 0
    process.stdout.write("Queueing up the first commit...\r");
    var timeout;
    if (process.env.FAKETIME) {
      faketime(t_offset);
      timeout = 20;
    } else {
      timeout = randomIntFromInterval(0, max_sleep) * 1000
    }
    setTimeout(commit, timeout, t_offset, outFD, outFile, data, counter, length);
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [max_time_in_seconds] [step]")
}

function sleep(seconds) {
  var endTime = new Date().getTime() + (seconds * 1000);
  while (new Date().getTime() <= endTime) {;}
}

function randomIntFromInterval(min,max)
{
   return Math.floor(Math.random()*(max-min+1)+min);
}

function commit(t_offset, outFD, outFile, data, counter, length)
{
  if (counter < length)
  {
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    if (counter + step >= length) step = length - counter
    process.stdout.write("\033[2K Writing " + counter + "/" + length + " bytes: " + message + "\r");
    fs.writeSync(outFD, data.slice(counter, counter+step), 0, step)
    child_process.execFileSync('/Applications/Xcode.app/Contents/Developer/usr/bin/git', args)
    var timeout = randomIntFromInterval(0, max_sleep)
    counter = counter + step
    if (process.env.FAKETIME) {
      t_offset = t_offset + timeout;
      faketime(t_offset);
      timeout = 20;
    } else {
      timeout = timeout * 1000
    }
    setTimeout(commit, timeout, t_offset, outFD, outFile, data, counter, length);
  } else {
    var args = ['push']
    child_process.execFileSync('git', args)
    console.info("Finished")<|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in <commit_msg>Re-updating the readme.<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in t<|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    for (var counter = 0; counter < length; counter++)
    {
      var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
      var args = ['commit', outFile, '-m', message]
      fs.writeSync(outFD, data.slice(counter, counter+1), 0, 1)
      sleep(Math.random() * max_sleep)
      child_process.execFileSync('/usr/bin/git', args)
    }
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [time in seconds]")
}

function sleep(seconds) {
  var endTime = new Date().getTime() + (seconds * 1000);
  while (new Date().getTi<commit_msg>AAAAAAAAAAARGH!<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    for (var counter = 0; counter < length; counter++)
    {
      var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
      var args = ['commit', outFile, '-m', message]
      fs.writeSync(outFD, data.slice(counter, counter+1), 0, 1)
      sleep(Math.random() * max_sleep)
      child_process.execFileSync('/usr/bin/git', args)
    }
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [time in seconds]")
}

function sleep(seconds) {
  var endTime = new Date().getTime() + (seconds * 1000);
  while (new Date().getTim<|endoftext|>


<commit_before>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes",
  "Should work now",
  "Back out the last commit",
  "Reverting changes",
  "One more time...",
  "Re-commiting last",
  "One more User Story done",
  "Can work my way through the Kanban",
  "Sprint complete",
  "Well that seemed pretty easy",
  "What do you mean you can't pack up the commit?",
  "Merge in master",
  "Fast-forwarding changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.fl<commit_msg>AAAAAAAAAAARGH!<commit_after>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes",
  "Should work now",
  "Back out the last commit",
  "Reverting changes",
  "One more time...",
  "Re-commiting last",
  "One more User Story done",
  "Can work my way through the Kanban",
  "Sprint complete",
  "Well that seemed pretty easy",
  "What do you mean you can't pack up the commit?",
  "Merge in master",
  "Fast-forwarding changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.flo<|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real g<commit_msg>Fixed memory parsing error #1337<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real go<|endoftext|>


<commit_before>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in <commit_msg>Commit all the required changes<commit_after>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in t<|endoftext|>


<commit_before>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes",
  "Should work now",
  "Back out the last commit",
  "Reverting changes",
  "One more time...",
  "Re-commiting last",
  "One more User Story done",
  "Can work my way through the Kanban",
  "Sprint complete",
  "Well that seemed pretty easy",
  "What do you mean you can't pack up the commit?",
  "Merge in master",
  "Fast-forwarding changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.floor(commit_tim<commit_msg>Fixing a typo added in the last readme update<commit_after>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes",
  "Should work now",
  "Back out the last commit",
  "Reverting changes",
  "One more time...",
  "Re-commiting last",
  "One more User Story done",
  "Can work my way through the Kanban",
  "Sprint complete",
  "Well that seemed pretty easy",
  "What do you mean you can't pack up the commit?",
  "Merge in master",
  "Fast-forwarding changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.floor(commit_time<|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.floor(commit_time / 3600)
    var commit_time_rem = commit_time - (commit_time_hour * 3600)
    var commit_time_min = Math.floor(commit_time_rem / 60)
    var commit_time_sec = commit_time_rem - (commit_time_min * 60)
    console.info("Input file is %s Bytes, this will generate %s commits and take approximately %s hours %s minutes %s seconds", length, commit_count, commit_time_hour, commit_time_min, commit_time_sec)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var timeout = randomIntFromInterval(0, max_sleep) * 1000
    var counter = 0
    process.stdout.write("Queueing up the first commit...\r");
    setTimeout(commit, timeout, outFD, outFile, data, counter, length);
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [max_time_in_seconds] [step]")
}

function sleep(seconds) {
  var endTime = new Date().getTime() + (seconds * 1000);
  while (new Date().getTime() <= endTime) {;}
}

function randomIntFromInterval(min,max)
{
   return Math.floor(Math.random()*(max-min+1)+min);
}

function commit(outFD, outFile, data, counter, length)
{
  if (counter < length)
  {
    var message = commit_messages[random<commit_msg>Work in Progress<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I do that?",
  "Commit all the required changes",
  "Really commit all the required changes"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (inFile == outFile) {
    console.error("Aborted: infile and outfile must be different")
    return(-1);
  }
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  if (process.argv [ 5 ]) step = parseInt(process.argv [ 5 ])
  console.info("Writing from %s to %s, with up to %s seconds between commits of %s bytes", inFile, outFile, max_sleep, step)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    var commit_count = Math.ceil(length / step)
    var commit_time = commit_count * max_sleep / 2
    var commit_time_hour = Math.floor(commit_time / 3600)
    var commit_time_rem = commit_time - (commit_time_hour * 3600)
    var commit_time_min = Math.floor(commit_time_rem / 60)
    var commit_time_sec = commit_time_rem - (commit_time_min * 60)
    console.info("Input file is %s Bytes, this will generate %s commits and take approximately %s hours %s minutes %s seconds", length, commit_count, commit_time_hour, commit_time_min, commit_time_sec)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var timeout = randomIntFromInterval(0, max_sleep) * 1000
    var counter = 0
    process.stdout.write("Queueing up the first commit...\r");
    setTimeout(commit, timeout, outFD, outFile, data, counter, length);
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [max_time_in_seconds] [step]")
}

function sleep(seconds) {
  var endTime = new Date().getTime() + (seconds * 1000);
  while (new Date().getTime() <= endTime) {;}
}

function randomIntFromInterval(min,max)
{
   return Math.floor(Math.random()*(max-min+1)+min);
}

function commit(outFD, outFile, data, counter, length)
{
  if (counter < length)
  {
    var message = commit_messages[randomIntFromInterval(0, commit_mess<|endoftext|>


<commit_before>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I<commit_msg>One more User Story done<commit_after>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Almost there",
  "Nearly got it",
  "Not quite working",
  "Ooops!",
  "Did I <|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300

i<commit_msg>Update character<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300

if<|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var args = ['commit', outFile, '-m', 'Update character']
    for (var counter = 0; counter < l<commit_msg>Update character<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var args = ['commit', outFile, '-m', 'Update character']
    for (var counter = 0; counter < le<|endoftext|>


<commit_before>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Al<commit_msg>Commit all the required changes<commit_after>var child_process = require('child_process')
var fs = require('fs');
var max_sleep = 300
var step = 10
//Added a comment that achieves no real goal.
//Non-blocking loop
//Adjustable step
//Status line
//Add a rough time indicator
//First cut at libfaketime support

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error",
  "Alm<|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    va<commit_msg>Five bullets or six?<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var<|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    for (var counter = 0; counter < length; counter++)
    {
      var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
      var args = ['commit', outFile, '-m', message]
      fs.writeSync(outFD, data.slice(counter, counter+1), 0, 1)
      sleep(Math.random() * max_sleep)
      child_process.execFileSync('/usr/bin/git', args)
    }
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [time in seconds]")
}

function sleep(seconds)<commit_msg>Grammar fix<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    for (var counter = 0; counter < length; counter++)
    {
      var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
      var args = ['commit', outFile, '-m', message]
      fs.writeSync(outFD, data.slice(counter, counter+1), 0, 1)
      sleep(Math.random() * max_sleep)
      child_process.execFileSync('/usr/bin/git', args)
    }
  })
} else {
  console.info("Usage:")
  console.info("node commit.js infile outfile [time in seconds]")
}

function sleep(seconds) <|endoftext|>


<commit_before>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    for (var counter = 0; counter < length; counter++)
    {
      var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
      var args = ['commit', outFile, '-m', message]
      fs.writeSync(outFD, data.slice(counter, counter+1), 0, 1)
      sleep(Math.random() * max_sleep)
      child_process.execFileSync('/us<commit_msg>Fixing an important issue with the universe.<commit_after>var fs = require('fs');
var child_process = require('child_process')
var max_sleep = 300
//Added a comment that achieves no real goal.

var commit_messages = [
  "Fixing an important issue with the universe.",
  "Someone poisoned the waterhole!",
  "You feeling lucky punk?",
  "Five bullets or six?",
  "Fixed memory parsing error #1337",
  "Cleaned out the intertubes",
  "AAAAAAAAAAARGH!",
  "Fixed a typo",
  "Updated the readme",
  "Fixing a typo added in the last readme update",
  "GET A HAIRCUT!",
  "Updated the readme again",
  "Found an issue with the letter 'a', so I fixed it.",
  "Incompatible dimensions found, Cthuhlu Error 666",
  "Who you calling a fool?",
  "How many more of these can I make?",
  "Fixing an error introduced in the last commit",
  "Re-updating the readme.",
  "Work in Progress",
  "WIP",
  "Quick fix",
  "Grammar fix",
  "Fixing punctuation",
  "Correcting style",
  "Logic error"
]

if ( process.argv[ 2 ] && process.argv[ 3 ] ) {
  var inFile = process.argv[ 2 ]
  var outFile = process.argv[ 3 ]
  if (process.argv [ 4 ]) max_sleep = process.argv [ 4 ]
  console.info("Writing from %s to %s, with up to %s seconds between commits", inFile, outFile, max_sleep)
  var outFD = fs.openSync(outFile, 'w')
  fs.readFile(inFile, function(err,data) {
    var length = data.length
    console.info("Bytes: %s", length)
    try {
      child_process.execFileSync('/usr/bin/git', ['add', outFile])
    } catch (e) {
      console.error("Couldn't add %s to git: %s", outFile, e)
    }
    var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
    var args = ['commit', outFile, '-m', message]
    for (var counter = 0; counter < length; counter++)
    {
      var message = commit_messages[randomIntFromInterval(0, commit_messages.length - 1)]
      var args = ['commit', outFile, '-m', message]
      fs.writeSync(outFD, data.slice(counter, counter+1), 0, 1)
      sleep(Math.random() * max_sleep)
      child_process.execFileSync('/usr<|endoftext|>