SSH Key Fingerprint

26 07 2012

If you have created a SSH key using ssh-keygen and have added the public key in some remote machine or site and you are wondering how you can verify the fingerprint which you are asked to do when you’re connecting via ssh for the first time to the remote machine, then you have come to the right place.

I initially thought that the fingerprint is stored in some file and was searching for it in ~/.ssh/ and /etc/ssh/ directories and I was wrong. You will get it when you run the following on bash:

ssh-keygen -lf /home/<user>/.ssh/id_rsa.pub

Or if you have given out your public key which is in /etc/ssh, then you will get it by running the same command on the public key file there:

ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub

You can also try:

ssh-keygen -l

and it asks for the file in which the key is present and returns with the fingerprint.





Adding a Ruby module containing filters to Rails Models

29 06 2012

I recently encountered this scenario where a few models in my rails app had to have the same before_save and after_save filters. To maintain the DRYness of the code, the obvious thing to do was put those methods in a module and just include that module in the model classes where I needed those filters. But since filters are defined on the class, I had to add an extra method to do this:

module ModuleContainingFilters
  def self.included(base)
    base.before_filter(:my_before_filter)
  end
  def my_before_filter
    ....
  end
end

And in the models, all you need to do is:

class MyModelM1 < ActiveRecord::Base
  include ModuleContainingFilters
  before_filter :another_before_filter1, :another_before_filter2
  ..
  ..
end

which will add my_before_filter as well as other before filters which you could have defined.

References: http://blog.jayfields.com/2006/12/ruby-instance-and-class-methods-from.html





Mini Deb Conf 2011

3 11 2011

There was a Mini Deb Conf conducted in NMIM Institute of Technology, Nitte on 28th, 29th and 30th of October: http://wiki.debian.org/DebianIndia/MiniDebConf2011/MangaloreEdition. This was one in the series of four deb confs that are being held in India this year. Vignesh and I had contemplated on attending it a month back, but as we came closer to the event, we got busy and it was getting increasingly difficult for us to attend the conference.

Vignesh called me on the 27th, Deepavali day and in the afternoon we decided that we’ll be leaving for Karkala the same night to attend the conference. We got the tickets booked online and we were lucky enough to get seats for the return journey too, considering the rush due to Deepavali and the weekend, etc. But we were unlucky that we got sleeper berths in the last row of the bus. The journey was the worst part of the whole trip. Ghat section + Bad roads + Last Seats proved to be a deadly combination and we found it difficult to hold on to our seats most of the time! The return journey was even more horrible as there were no racks to keep our luggage too.

We over-slept and found ourselves in Manipal and when we asked the driver, he said we had already crossed Karkala, from where we should have taken another bus to Nitte. He told us to get down at Udupi and take a different bus. We took a bus to BeLmaNNu and from there another one to Nitte. NMIM was a great host, providing us with good food and nice rooms in their  guest house. The hospitality was incomparable to anything I’ve seen in any other college so far. One of the volunteer students also got his car to pick us from the bus stop to take us to the guest house!

There were a few talks and a few hands-on sessions on packaging and localization. I was new to Debian. I only knew that Ubuntu is a derivative of Debian. We got a nice introduction to Debian, its philosophy and how we can contribute to the Debian project. We enjoyed the technical talks and it was nice to interact with Jonas Smedegaard on a lot of topics including a small hack that Vignesh, Chandan and I developed in a night’s time without internet (but with some help from Debayan on phone)! We got a lot of direction on how to take it forward and make it a great utility and we also got help on some of the libraries we could use. I got to meet a lot of other debian contributors including Praveen. We had a great time with Sandesh, Shashikiran and Karthic Rao. There was a Diwali celebration in NMIM IT on Friday evening which we all attended. On Saturday morning, we visited the Bahubali Jain Temple in Karkala and after we were back, attended more talks.

On Sunday morning, Vignesh, Karthic, Sandesh, Chandan and I took off in the morning. We visited Udupi Sri Krishna Mutt, went to Vignesh’s house and then left for Mangalore. Vignesh took us to an ice-cream joint called Pabba’s and from there we went to Sultanbatheri, KudloLi temple and Venkateshwara temple. Our return bus was from Lalbagh and we reached Bangalore in a single piece on Monday morning.





When I sat down to Write

6 09 2011

 

A lot of things to write about

But not a clue where to start.

Here I am, starting my journey with my pen

It could be a long one or it could end right here.

 

When I start to ink things down,

Many a thought gush into my mind.

I hear one loud clear voice from within that says

“Do you know enough to write?”

 

Then I go back and think to myself

Do I publish it or move it to trash?

Once I’ve made up my mind I say,

Let me give it a try.

 

For there are wiser people

And those who know how to write

But everybody has their own views

About this game called Life.

 

Surprised I surely am,

glancing at the above lines.

And now laziness creeps in and makes me say

“That’s all for now folks, Let’s call it a day, Good night.”





Right After the Class

22 06 2010

One thing that I have noticed over so many years of education in schools and colleges is that everybody has something to take home after each and every class. It can be a few laughs over a funny incident that happened in the class, or a very informative and interesting fact that was presented, or some new concept that was completely unknown and seems path-breaking.

But a very common thing is that people have that hangover of the class for a long time after it has ended. That is good sometimes, but a few people tend to overdo it and try to apply some theory to everything, which can get annoying. It doesn’t matter if the class is really boring or if we have not understood a single thing in the class, but we never give up using the terms thrown at us in the class, which can be either due to excitement, anger, frustration or elation, but ultimately we make a person who has not attended it feel like they have missed something.

I was really surprised when even after a really hard-to-sit Finance and Accounting class people were discussing about credit, debit, assets and liabilities. The buzz words in IIITB have been changing with semester, time and subject. I remember the most talked ones at some point of time were IEEE 754, Finite Precision, Brooks’ Law, etc and have now given way to terms like Strategy, Planning, Credit, Debit, etc.

But our all time favourites have been (ask anyone from our batch) Circular Fallacy, Throwing the Book, Conformance Fallacy, etc which have been etched in all our brains and hearts right in our prep sem and will last for ever!





Abstract Art?

14 03 2010

Prologue():
I was feeling bored, not that I did not have anything to do, just that I did not want to do any of the things that I was supposed to do. Vasanth posts a link in his status message: http://mrdoob.com/projects/harmony/ and I go on and try it out.
~Prologue()

I have never understood why people pay millions of dollars to buy some piece of canvas scribbled with something that nobody understands and may be the guy who scribbled it (called “The Artist”) also doesn’t!

Yes, I am talking about Abstract Art.

I have not been able to make any meaning out of any of those paintings till now (You can call me “shallow” for this, but I don’t mind :P). May be that I cannot understand things at such high levels of abstraction. Each time I see one of them, I always think: “I can do better than that!”. And I see those paintings being sold at unimaginable prices, after a lot of bidding by some uber-rich people of the world. I can make a living by just selling one of them! So, here’s my attempt at it:


Any buyers?? :D





Tar Untar – When is this going to change?

26 01 2010

No, I’m not talking about tar and untar archiving utilities in linux here, but referring to asphalting of roads.

I went home on Friday night and could see that the main road (Vatal Nagraj Road) adjoining our street was being repaired and it was almost done. The next day, the work was completed and the roads looked awesome and it felt really good to drive on them. After all, the roads were being repaired for the first time after 5-6 years!

Come Monday, and I leave for college early in the morning around 7.30 and I already find some people digging the sides of the road. When I went up to them asked what they were digging for, they said there was a problem with the telephone cables and they are laying new ones.

I couldn’t stop but calculate the life-time of the new road and I found that it was a whopping 2 days! And the amount of money that would have got wasted for these 2 days is overwhelmingly high. I did not want to think about the wastage of resources, time and money any more as I do a lot of it myself. I just thought how it could have been avoided. Had the two concerned authorities worked with some co-ordination, the life-time of the new road would have been at least 5-6 years instead of just 2 days. That is a 10,000% increase in the life-time (yes, if you don’t believe it, go and calculate) and the money spent on it would have been totally worth it. And the communication cost between the two companies would have been negligible. After all, it all gets down to the tax-payers, why do we have to care?








Follow

Get every new post delivered to your Inbox.