Skip to content

Instantly share code, notes, and snippets.

@stefanor
Last active September 2, 2016 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanor/905cf9d63e0a90f1a81df35565ed6671 to your computer and use it in GitHub Desktop.
Save stefanor/905cf9d63e0a90f1a81df35565ed6671 to your computer and use it in GitHub Desktop.
buffering demo
#!/usr/bin/env python3
import difflib
import subprocess
import sys
qty = 1000000
seq = subprocess.check_output(
('seq', str(qty))).decode('utf-8')
seqjs = subprocess.check_output(
('nodejs', 'seq.js', str(qty))).decode('utf-8')
diff = difflib.unified_diff(seq.splitlines(keepends=True),
seqjs.splitlines(keepends=True),
fromfile='seq', tofile='seqjs')
sys.stdout.writelines(diff)
'use strict';
var end = parseInt(process.argv[2]);
var output = ''
for (var i=1; i <= end; i++) {
output += i + '\n';
}
console.log(output.slice(0, -1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment