bookmark_borderUtility Bash script to setup key based ssh access quickly

I needed to add my public key to a couple of servers the same day. After having done it twice, I thought of writing a bash script to pull my key from a public url at dropbox and append it to the authorized_keys file on the server. It appends to the same user who I am logged in as.

You can build on this if you find yourself doing something similar repetitively.

bookmark_borderMultiple Rails apps with Quicksilver

The ~/works directory holds all the rails applications on my mac book. Some of these are VinSol projects, current and old. Some are my personal projects and some are open source apps like beast and radiant. There is a contribute app also as per HasManyThrough Josh’s recommendation.

[13:29:11 mjuneja works]$ ls -l | wc -l

There are 37 rails applications right now. This is purely co-incidental and has nothing to do with 37signals. 😉

If I run all these apps on the default 3000 port, I cannot run more than one app at a time. If I run the apps at random ports, my browser history will not be app-sensitive. I am heavily dependent on my browser’s location bar’s autocomplete feature, so choosing random ports for my apps is not an option.

I want to be able to run apps on different but fixed ports. I need to be able to make use of my browser history. Also I need to spend minimum time configuring any new app.

This is what I did

I created a YAML file called rappaport.yml. The name rappaport is a short form for “rails application ports”, the fact that my wife runs a diamond jewelery business is purely co-incidental 😉

The yaml file consists of application names and they port assigned to them, as show in this sample below

port: 3000
port: 3001
port: 3002

Next, I have a ruby script ss (short for start server) in the ~/works directory.
All the rails projects have a softlink to ss from their RAILS_ROOT. To start the web server for a project, I just need to execute ss from the app’s RAILS_ROOT.

The script assumes that the application name in the yaml file is the same as the directory name under which the rails code for the app lives ( convention over configuration! )

#! /usr/local/bin/ruby

require 'yaml'

apps = YAML.load_file('/Users/mjuneja/works/rappaport.yml')
current_app = Dir.pwd.split("/").last
port = apps[current_app]["port"]
`script/server -p "#{port}"`

Everytime I create a new project, I append the app name and port to rappaport.yml. Also I create a softlink to ss from the RAILS_ROOT.

So I have a fixed port and a standard command to start the server for all my apps.

The next part is training the browser to access the application, on the same port each time, with minimum intervention from me.

Here, I make use of another ruby script called browser.rb.

#! /usr/local/bin/ruby

require 'yaml'

apps = YAML.load_file('/Users/mjuneja/works/rappaport.yml')"dev_bookmarks.html", "w+") do |f|
apps.each_pair { |k,v| f.print "<a href="http://localhost:#{v&#91;" port"&#93;}"=""> #{k}_dev </a> n" }

This script takes rappaport.yml as the input and creates a list of links in a file called dev_bookmarks.html as the output.
I need to execute this script everytime I add a new project to rappaport.yml.

This is what dev_bookmarks.html looks like

<a href="http://localhost:3000"> lovetastic_dev </a>
<a href="http://localhost:3001"> tperks_dev </a>
<a href="http://localhost:3002"> mmbx_dev </a>

Now I just need to add the contents of this file to Quicksilver’s index.
I go to Quicksilver’s Preferences and click on Catalog and drop the file dev_bookmarks.html from finder onto Quicksilver and Click “Rescan source”

In the information panel, I select “omit source items” and “Include content: HTML Links” and Rescan source.

I can see that the content panel contains all the links.

Quicksilver Content Pane

I can see the project links in the content meaning that quicksilver has correctly parsed the content. On the attributes panel, I select “Include in Global Catalog”.

To point my browser to a rails application running on localhost, I invoke the quicksilver hotkey and start entering the project name, and quicksilver prompts me the project name, and it already knows the port number too.

Quicksilver launching the app


The first thing I was recommended when i bought my mac was to install quicksilver on it.

And so I did. That really proved to be the best thing to do. QuickSilver is much more than an app launcher. For me it the central point of control from where i control my whole mac.

If you are not using quicksilver yet, read these two articles to get started.

And amaze your friends with you mac wizardry.

bookmark_borderWhat do you use Basecamp for?

I started thinking about blogging about this while writing the previous post comparing activeCollab and basecamp. I had started using basecamp for managing and collaborating on software development projects. But gradually the list has increased to include a lot more kinda projects.
My definition of “projects” here is same as David Allen’s in Getting Things Done.
So basically Basecamp has become my repository of { information, next-actions, waiting-for and someday } for such projects.
Here are some of the things, apart from software projects, that I am using basecamp for

  1. Managing Hiring at Vinsol
  2. Managing accounts related tasks
  3. Managing construction of our new office
  4. Managing internal training and knowledge sharing sessions at Vinsol

Let me ask you this, What do you use basecamp for?

bookmark_borderbasecamp vs. activeCollab

After reading a few comparisons of Basecamp and activecollab, particularly the one at slackermanager, I decided to run a few projects on activeCollab.

Though features-wise activecollab has been seen giving basecamp a run for it’s money, the area where it clearly lacks is usability.
This point becomes clear if you just compare the dashboards of the two apps.
Basecamp is so intutive that rarely do I have to look around to find some information. And even the effort required to digest the displayed information is minimal in basecamp. The fonts and visual clues used on basecamp are much better than those in activeCollab.

Another feature which I do not like about AC is that it just sends links in emails and not the actual messages. Basecamp sends the actual messages in the email notification, hence avoiding the unnecessary trip to the project website.

I agree that AC is under heavy development but definitely it needs a lot of love.

I find myself much more productive on projects which I run on basecamp that I plan to stick with basecamp and am happy paying them my money.

bookmark_borderTime and Money

Rajesh Setty’s post on Time and Money got me thinking about situations when I squander time to save money.

  • I do it when i fix things at home, while I have the option of hiring outside help, which is cheap in India and does better work that me. I do not enjoy the fixing job either, certainly not after the first ten minutes.
  • Not hiring another programmer and continuing to code, while I know I have to focus on other larger things. I love to code… but i know my ego also plays a role here.
  • When i spend more time looking for bargains, than the amount of money I save at the end of the whole “evaluating offers” exercise.

Some of my thoughts on time and money relation.

  • Money is more finite than time. I used to count money and enter into the “assets” column of my balance sheet. I did not do it with time.
  • Money can be converted into other forms at my will. Converting time into money or other forms is not dependent on me alone. [ though i can sharpen the saw when i am not cutting the wood]
  • Bcos I have been taught only half the equation. “Money saved = money earned” … and now Rajesh has added the time variable to this equation ummmm. But I have learnt “time is money” also. Now this becomes an issue of conversion rate… how much time is equal to how much money. My mentor always tells me “There are good savings and there are bad savings”. Probably the answer lies somewhere in these words.
  • Cash flow and Time flow. How much of my cash can i spend to buy other people’s time. As a result of which I have more cash and time than I had at the beginning. Balance is important. Otherwise I might have to choose between bankruptcy and (divorce|stroke|burnout|all of these).

Will keep on adding to these two lists. Cos I have to Distinguish Myself.

Thanks Rajesh for the triggers.

bookmark_borderThat time of the Year

It is that time of the year again…. when one should take stock. For me 2005 was the first time that i had set yearly goals [ read a new year resolution].

I had set many goals. They covered various fields like health, work, learning japanese, learning to swim, teaching Kuhu[my daughter] etc …

I did not achieve all that I had written down. But I made a lot of progress in all of them.

At the end of the year, I am in a position to say that for me this year was a lot better than the previous years… cos i had set some parameters to measure my performance against. I had those goals guiding me throughout the year, as i used to check my performace against them, every monthend.

I came across this quote today by Karen Lamb :
A year from now you may wish you had started today.

I am happy that I had started doing some things last year. At the same time, I want to add a few more this year.
I will spend a few hours tomorrow to write my goals for the year 2006.

I want to do so much… and breaking all of that down into smaller tasks makes it a lot easier to achieve.