Playing With Ruby
A couple of weeks ago I was bitten by the Ruby bug. I’m not entirely certain why. From my perspective the language isn’t terribly intuitive. The default library that comes with it is huge, and there’s alot of stuff that can be done pretty quickly using it. For example, here’s a really simple script that can be used to calculate when your mount point will be full:
#!/usr/bin/ruby require "time" startdate = Time.parse( ARGV[0] ) startsize = ARGV[1].to_i enddate = Time.parse( ARGV[2] ) endsize = ARGV[3].to_i maxsize = ARGV[4].to_i growthrate = (( endsize - startsize ) / ( enddate - startdate )) maxdate = (( maxsize - endsize ) / growthrate ) p ( enddate + maxdate )
Here’s I’m running it with arguments that indicate the total size of my mount point was 123456 bytes on Jan 1st and 234567 bytes on Jan 31st. The maximum size for this mount point is 678900 bytes.
$ ./diskspace.rb "2006-01-01" 123456 "2006-01-31" 234567 678900 Wed May 31 00:16:50 -0600 2006
According to the output I’m either going to have to grow my volume or remove some data by May 31st.

February 21st, 2007 09:09
Hey inter mountain west ruby conference, I’ll be there, you should come to if you have nothing better to do. Also the Ruby on Rails framework is worth looking into, ruby is ‘neat’ but the rails framework is a web programmers wet dream.
February 21st, 2007 19:15
I was hoping to go to that conference. Unfortunately, there’s a bunch of stuff going on that week at work. I’ve played a little bit with Rails, haven’t had enough time to do anything serious with it though.