Mon August 01 2011
For those of you unaware, at InMotion Hosting we had a month of Highfive Tuesdays. This was a weekly competition to see who could highfive the most people. I wrote a Rails application to keep track of who highfived who, and their corresponding “highfive points”. At the end of the day, the winners received lame prizes (like palm tree shaped water bottles, and pez dispensers). It was a lot of fun.
This idea was born out of the awkward growing phase InMotion had gone through. We had turned into a middle school lunch room, where each department knew nothing of the people outside of itself. It was bad. We wanted to get people to leave their little bubbles, and meet their co-workers. Highfiving them seemed to do the trick. It worked.
Interestingly, the overall productivity of our support team and our system admin team increased during these tuesdays. My hypothesis here is quite basic (and possibly obvious). Highfive Tuesdays made people happy. When people are happy, they are able to work better.
Overall, the experiment was a success. Together, over 1,000 highfives were dished out, we banished the awkward avoidance tactics in the breakroom, we demonstrated a basic concept (happy people = good workers), and we had some fun along the way.
If you would like to give Highfive Tuesdays a try at your office, I have open sourced the code, which you can grab on my github. And if you need a hand deploying it, just hit me up on twitter and I’ll be glad to help.
Sun July 10 2011
Last night was the July CVREG meetup, and the 757rb regulars decided to take a road trip to visit the Legend Brewery, and talk Ruby with our Richmond friends. The theme of the evening was Ruby’s role in doing freelance/contract work. They had a panel of four self-employed Rubyists who answered some questions about working with Ruby as a one-man-shop.
One of the interesting questions that came up was “Is it difficult to ‘sell’ Ruby to clients?” All of the members of the panel had experienced at least one client who was scared off by the fact that they were using Ruby. It goes to show that despite the hard work put in by so many in the Ruby community, and the so blatantly obvious golden beacons that show Ruby does scale (Github, Gowalla, all 37signals products, etc.), a few strategic “RUBY IS SLOW” statements have seriously devastated the public understanding of the language.
Demonstrating that it works, providing benchmarks that smack down PHP, and showing that we can develop applications faster with Ruby don’t matter. The fact that Ruby is “weird” and “slow” make it a non-starter for so many. So what can we do to make Ruby more accepted?
Fri March 25 2011
So, I’ve been thinking how cool it would be to setup a collaborative Boom database. With its recent support for Redis and MongoDB, I figured it was a good time to give this crazy idea a whirl. So, let’s run through the basic requirements to set this up. Fending off the baddies from deleting your beautiful lists is up to you, I must warn. What I’m going to explain in this example is how to do the following:
- Install Redis on a centralized server
- Install Boom
- Configure Boom to use the centralized server
Install Redis
Installing Redis is really easy. At the time of writing, the latest version of Redis is 2.2.2. Redis is under somewhat heavy development, so you may want to check to see if there’s a newer version. To install 2.2.2, run the following in your teminal:
$ wget http://redis.googlecode.com/files/redis-2.2.2.tar.gz
$ tar xvzf redis-2.2.2.tar.gz
$ cd redis-2.2.2
$ make && make install
Now that Redis is installed, you can fire up the server with, strangely enough, redis-server. By default, it’s going to run the server on port 6379. If you’re running a firewall on the server you’re installing this on (you are running a firewall, aren’t you?), you will need to open up this port.
To test that everything’s working, you can use the always handy telnet. In your command line, you can do the following:
$ telnet <hostname> 6379
> SET hello thar
> GET hello
You should get responses back from the Redis server showing that the value was stored during the SET, and return your “thar” when you GET. Redis is pretty cool, huh?
Installing BOOM
Onto installing boom on your local machine. I’m going to assume you have ruby and rubygems already installed and setup. Boom, itself, has one dependency: yajl-ruby. If you don’t already have this, go ahead and install it with gem install yajl-ruby. Once you’ve got yajl, a simple gem install boom will get you rolling with Boom. Now that you’ve got boom installed, run boom in your terminal to initialize your configuration file and your default .boom json file. Go ahead and give it a stab, and get a feel for how to use it. boom help will get you started. Once you’re comfortable with its amazing powers of organization, let’s move forward and configure it to use Redis.
Configuring Boom For Redis
To use Boom with our new Redis server, you’ll need to install the Redis gem: gem install redis. Next, you’ll need to crack open your newly created ~/.boom.conf file in your favorite text-editor, and edit it to look like this:
{
"backend": "redis",
"redis": {
"port": "6379",
"host": "your-host-name.com"
}
}
You’ll obviously be swapping out the cleverly named “your-host-name.com” to whatever your hostname actually is. Once that bit of configuration is done, boom will be using your centralized redis database to store its contents. Neat! You and your friends or co-workers can now share this, and get into all sorts of mischief! Enjoy it.
Where To Go From Here
This is obviously not an ideal setup. It’s open to anyone with an internet connection, so you may want to do IP-based verification, some kind of authentication scheme, etc. Your server is just running in your SSH session, if you stop with where I left you. You’ll likely want to setup an rc.d / init.d script to fire up the redis server for you on startup. You also will probably want some kind of data persistence, since Redis stores all data in memory (although it will periodically dump to disk).
In all, this is a pretty neat concept. I’m not sure how well it will work with co-workers or friends, since everyone has full read/write access to everything. But for compiling lists of funny image urls, command line one-liners, canned e-mail responses, etc., you may just find that this comes in handy if everyone is cooperative.
Tue January 25 2011
Recently, my friend Brandon wrote about using Pianobar on Linux (specifically on Debian based systems). In every attempt to steal his thunder, I’m copying him, and posting about how to get the same thing working on Mac OS X with similar functionality.
For those unfamiliar, Pianobar is a command line interface to Pandora, which is more gentle on your memory footprint (no Adobe anything!), and is easier to tuck away in the background. We’re going to do a few things in this brief tutorial:
- Setup homebrew if you have not already
- Install Pianobar
- Install growlnotify
- Configure Pianobar
- Setup Growl notification for Pianobar
Installing Homebrew
Frankly, you should be ashamed of yourself if you haven’t installed homebrew yet on your mac. To put it plainly, it’s the bee’s knees. Alright, now that you’re convinced, let’s get started.
Installation is really difficult, so be prepared for some heartache and pain. First, run this in your terminal:
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
AND THAT’S IT. Difficult, eh?
Installing Pianobar
So now that we’ve made it through that grueling task, we can move forward and install pianobar using our favorite package manager (in case you’ve forgotten already that’s homebrew. We just installed it. Pay attention.) Run this whiz-bang command in your terminal:
BANG! You’re ready to listen to some Pandora through your terminal. You can go ahead and try it out by typing pianobar in your terminal. Go ahead. I’ll wait.
Install Growl Notify
This probably doesn’t even merit its own step. But let’s go ahead anyways.
We’re getting there. I’m proud of you for making it this far. Well done.
So Pianobar has a few things that you can set in a config file so that you don’t have to set these each time you load the application. These are things like your Pandora username, your password, and something else we’ll be talking about in the next section, the event_command. It sounds pretty complicated, but we’ll get through it. I promise.
So, open up your favorite text editor (unless it’s TextEdit, in which case, please just leave my site), and edit ~/.config/pianobar/config. You’ll enter in the following lines:
user = you@youraddress.com
password = hopefullyNot123456
Go ahead. Give Pianobar another whirl. It should log you in automatically. Pretty fancy, huh? Onward!
Setup Growl Notification
You can obviously skip this part if you find Growl obnoxious or annoying. I happen to like it. It’s like a good friend who keeps you informed when exciting events are happening. I call him Ralph.
So, don’t get angry, but remember that pianobar configuration file? Yea? Ok, we’re going to edit that once again. So open it up again in anything but TextEdit, and we’re going to add this line to the bottom:
event_command = /Users/yourusername/bin/pianobar-notify.rb
Obviously, you’ll want to swap out “yourusername” for your actual username. If you don’t know what it is, you can use the whoami command. You’re welcome.
Now the exciting part. We’re going to write a simple little program (in Ruby) to let us know some info about new songs that are being played through Pianobar. Ok, it’s not really THAT exciting, but still pretty cool. Let’s open up our text editors for one final edit. This time we’re opening the /Users/yourusername/bin/pianobar-notify.rb file. Ok, now that you’ve got your file open (welcome back, by the way), you’re going to type (or you can copy/paste if you really want to) this:
#!/usr/bin/ruby
trigger = ARGV.shift
if trigger == 'songstart'
songinfo = {}
STDIN.each_line { |line| songinfo.store(*line.chomp.split('=', 2))}
`growlnotify -t "Now Playing" -m "#{songinfo['title']}\nby #{songinfo['artist']}"`
end
Save the file, and you’re done. You can now listen to your favorite tunes through the command line, see who’s playing when new songs start, and you’re now up to speed with the latest in package management fashion for the Mac platform.