Monday, February 17, 2014

Image Management

Depending on your camera most of the file names do not add value the real information is in the exif tags on the pictures.

Sometimes you just want to name the pictures by taken date:

exiv2 -r '%Y%m%d-%H%M%S' rename *.JPG

Tuesday, February 11, 2014

Counting calories with a few commands

Lets say you like to use the Linux shell for totaling up your calories. Maybe you've got a file something like this:

590<tab>soft beef tacos
290<tab>fish sandwich

You could manually calculate these or... you could use some nifty Linux programs. First lets get those numbers away from the rest of the file.

cat 20140211.calories | cut -f 1

gives you:


cut uses <tab> as the default delimiter and we want the first field.

Now you've got the numbers but they are not in a usable math expression so you can use "paste"

cat 20140211.calories | cut -f 1 | paste -s -d+

gives you:


now you just need to total it all up with "bc" can give a complete break down:

cut -f 1 | paste -s -d+ | bc