Created
October 19, 2014 19:56
-
-
Save ELLIOTTCABLE/25e9f8215179858cddc7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # Usage: | |
| # # ./dat_fixer.rb <width in pixels> | |
| # | |
| # for example, | |
| # $ ./dat_fixer.rb 150 >icons/usb.dat | |
| width = Integer ARGV[0] | |
| STDERR.puts "Splitting #{width}px wide image ..." | |
| STDERR.puts "Paste the .dat content, seperated by spaces or newlines:" if STDIN.tty? | |
| values = STDIN.read.split /\s+/ | |
| values.each_slice width do |arr| | |
| puts arr.join ' ' | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment