Friday, January 27, 2012

Repeated strings in bash

I just whipped up a little bar graph in bash using this trick: printf '=%.0s' $(seq 10)

A more complete example, using some file with lines containing a date string:

for d in {17..27} ; do
  N=$(grep 2012_01_$d /tmp/somefile | wc -l)
  echo -n "Jan $d: $N "
  printf "=%.0s" $(seq $N)
  echo
done
Jan 17: 28 ============================
Jan 18: 22 ======================
Jan 19: 43 ===========================================
Jan 20: 32 ================================
Jan 21: 0 =
Jan 22: 0 =
Jan 23: 46 ==============================================
Jan 24: 50 ==================================================
Jan 25: 50 ==================================================
Jan 26: 51 ===================================================
Jan 27: 41 =========================================

(Breaks for 0, as you can see)

If you're doing it for constant numbers, you can use {1..10} instead of $(seq 10), but {1..$N} doesn't seem to work.

Friday, January 06, 2012

Creating spectrograms in Linux using a ColorMunki


The software that comes with the ColorMunki Photo is windows-only and is only about calibrating displays and printers.  I wanted to get spectrograms out of it so that we can measure lighting and transmissive materials -- a chart of wavelength vs. intensity.  BTW, check the argyll docs before you buy a ColorMunki -- apparently several of the models are the same hardware priced differently.

Install the argyll ubuntu package, then use the spotread command to take readings.  The -S flag will display a graph after each reading.  Other flags let you set which mode to use -- it has its own light for lighting a surface and measuring the reflected color, or you can have it read ambient light through a diffuser, or do spot readings without the light.  I used -e to take spot readings.

It also prints out a list of intensities at regular wavelength intervals, so that should be easy to import into a spreadsheet for making your own charts.

Here's an example of a chart that spotread produced:



Monday, January 02, 2012

Walmart / vudu video rental sucks

Just for the heck of it, we tried renting a video at walmart.com's vudu streaming service.  It was unwatchable, freezing every few seconds for buffering.  Checked our connection with speedtest.net, and the connection is fine.

And of course they've taken netflix's nonexistent customer service approach, with no way to ask for a refund.  Thanks Walmart for wasting a half hour of my time.