Friday, November 18, 2011

And Randall Munroe too.

See, that's what I mean when I talk about old-and-solved-but-forgotten problems!
http://www.xkcd.com/979/
"History has a way of repeating itself",
"Let us learn from our mistakes",
and all that stuff.

Thursday, November 17, 2011

Vertical select


Do you sometimes have a list with columns displayed on your screen or on a text editor, and you only want to select one or a few of the columns, like so?

Option-Click to the rescue! (On Mac OS X only). Press Option key, click'n drag, copy, paste. Like so!



Desktop
Documents
Downloads
Dropbox
ED
Library
Movies
Music
Pictures
Public
Tera
data
dev
nltk_data

Also works on TextEdit and stuff. Not on browsers. (Not on Chrome, at least). Courtesy of Kaan's facebook post on Nov 16th, 2011:

just discovered that OSX Terminal supports vertical select (option-click)

Comparing Directory Structures


I often face a problem, spend significant amounts of time finding the solution, apply the solution, and then forget it. And when I face the same problem later on, I remember I knew the solution once, but have long forgotten it by then. And I ask myself:

How the Hell did I do that?

Hence this blog. And for my first post, directory structure comparison. Handy for anyone who wants to keep data synced across external hard drives, or who wants to make sure that a big copy procedure went well. This is linux-based, it also works on Mac OS X, here goes:
  1. find /path1 -exec basename {} \; | sort > file1
  2. find /path2 -exec basename {} \; | sort > file2
  3. # at this point you can use diff file1 file2
  4. # or
  5. # here we want files only listed in file1 but not in file2
  6. comm -23 file1 file2
  7. # here we show files listed in file2 but not in file1
  8. comm -23 file2 file1
And the be-nice reference link to where I found it: