11:56 AM EDT Friday, April 11 2008
I saw this post about Shell History and thought why not try to do it in Ruby. Probably inspired by the fact that the Masters underway, this became an exercise in Code Golf. Here's what I came up with:
~ $ history | ruby -e '$<.inject(Hash.new(0)){|h,l| h[l.split[1]] += 1; h}.sort{
|a,b| b[1]<=>a[1]}[0..9].each{|k,v| puts "#{v} #{k}"}'
138 cd
55 ls
40 merb
31 mate
29 cat
19 mv
17 httperf
15 rm
14 ant
14 rake
I must admit, the fact that I can't fit in on one line in the blog makes me feel slightly defeated. Can you do better?
Posted in
Technology |
Tags
Golf, Ruby, ShellHistory |
0 Comments
11:16 AM EST Sunday, February 4 2007
Eileen and I are down in Naples, Florida visiting Eileen's Father. Yesterday I played golf at Hammock Bay. It was my first round of the year and it was a great course. I got off to a slow start on the front 9, but played better on the back. I shot 43-36, and made a 5 foot par putt on the 18th to break 80. I was pretty happy about that, as my goal for the day was to break 80. I entered by score into my Yahoo! Golf Tracker and my unofficial handicap is 8.6.
I haven't had a chance to play much golf since college, but this year I'm hoping to change that. I'd also like to establish an official USGA Handicap. I had one in when I was playing a lot of golf while I was in High School, but that is long since expired. I'd love to try to get in 20 official rounds this year and establish a real handicap. I signed up to do it online at Golf.com. I've joined the Metro Washington club and entered yesterday's score. You can see my score here. Besides allowing you to establish a real handicap, you can track a variety of stats:
- Driver Used Off Tee
- Driving Distance
- Drives Hit in Fairway
- Greens Hit in Regulation
- Putts
- Fairway Bunkers Hit
- Green Side Bunkers Hit
- Sand Saves
- Chips
- Up and Downs
- Penalty Strokes
- Mulligans
I think that I would only track these:
- Drives Hit in Fairway
- Greens Hit in Regulation
- Putts
- Sand Saves
- Penalty Strokes
You have to play at least 3 rounds with other club members within the season, which is March 15 - November 15. I'm not sure while they just don't limit it to the calendar season, because given the kind of weather we've had lately, we might be able to play some rounds before March or after November. Anyway, so I'll have to find some other club members to play with.
Posted in
Sports, General |
Tags
Golf |
2 Comments