200426.5 481b64a667e8d9aca522a0455a00f32dac1f4977 initial commit of ~/bin
commit time warp
This brings over everything that was in my bin-only repository.
I removed scripts that were unused or were no longer understood. I also moved any work-specific scripts to a separate (private) repository.
Changes to bin/csv-count. All files
bin/csv-count
new file mode 100755@@ -0,0 +1,24 @@+#!/usr/bin/env python2++from __future__ import absolute_import, division, print_function+import argparse+import csv+import sys++p = argparse.ArgumentParser(+ description='Count the number of records in the given CSV file.')+p.add_argument('file', metavar='FILE')+p.add_argument('-d', metavar='DELIMITER', default=',')+args = p.parse_args()++csv.field_size_limit(sys.maxsize)+count = 0+rdr = csv.reader(open(args.file), delimiter=args.d)+try:+ for i, row in enumerate(rdr):+ count += 1+except Exception as e:+ print(e, file=sys.stderr)+ print('Current count: %d' % count)+ sys.exit(1)+print(count)