Skip to content

Instantly share code, notes, and snippets.

View mikrostew's full-sized avatar

Michael Stewart mikrostew

View GitHub Profile
@mikrostew
mikrostew / list-files-and-sizes.js
Created January 29, 2018 18:01
Node.js - list all files and sizes in a directory and write that info to a JSON file
/* eslint no-param-reassign: 0, no-console: 0 */
// Get a list of all files with their sizes for each input directory
// NOTE: this is a simple implementation - for dir with millions of files this will run out of heap
// Run like:
// node list-files-and-sizes.js <dir> [<dir2 ...]
// This script:
// * recursively walks the file tree to get a list of files in order,
@mikrostew
mikrostew / render_pbm.rb
Created July 23, 2014 18:46
Displays images saved in PBM/PGM/PPM ascii formats
#!/usr/bin/ruby
require 'tk'
IMG_BORDER = 10
MIN_IMG_SIZE = 100
# use the filename entered on the command line, else prompt
def get_filename
return ARGV[0] if ARGV.length > 0
{
"A": [[ "0", "0", "1", "0", "0" ],
[ "0", "1", "0", "1", "0" ],
[ "1", "0", "0", "0", "1" ],
[ "1", "1", "1", "1", "1" ],
[ "1", "0", "0", "0", "1" ],
[ "1", "0", "0", "0", "1" ],
[ "1", "0", "0", "0", "1" ]],
"B": [[ "1", "1", "1", "1", "0" ],
[ "1", "0", "0", "0", "1" ],