Friday, October 28, 2011

Remove empty directories or folders

find -depth -type d -empty -exec rmdir {} \;

Friday, October 21, 2011

Integrate google contacts into your Mutt address Book

Goobook will alow you to interact with your gmail contacts from the command line and also enable mutt to access them

install goobook

easy-install -U goobook

Once installed create .netrc  file in your home folder with the credentials to your google account
Vim ~/.netrc

inside .netrc put the following

password yourpassword

save the file

to test if it is working type

goobook dump_contacts

this will dump all your contact information from gmail to stn out

to search for a string from your gmail contacts type

goobook query query

eg to search for clive type

goobook query clive

if you want to use goobook from mutt

edit your .muttrc file and add in the following line:

set query_command="goobook query '%s'"

to query the address book from inside mutt use the "Q" key

If you want to be able to use to complete email addresses instead of Ctrl-t add this:
bind editor complete-query
To add email addresses (with "a" key normally bound to create-alias command) add the following line:

macro index,pager A "goobook add" "add the sender address to Google contacts"

If you want to add an email's sender to Contacts, press "a" while it's selected in the index or pager.