Category Archives: Geek

All things geek

In lieu of flowers…

This week, our network engineer unexpectedly passed away.  It’s been a rough week for all of the IT department as we deal with it.

To inform the rest of the company, Jason, his manager, wrote something for our internal daily newsletter. Anticipating the requests for where to send flowers or other remembrances, Jason wrote something that everyone agrees is exactly what our friend would want and I think deserves to be shared with a larger audience:

Kyle often shunned typical traditions and so after talking amongst his friends and loved ones, in lieu of flowers or donations we think he would have liked it if everyone would generate a strong password and change it regularly for any critical accounts, personal or professional. I know it sounds odd, but he would have smiled at the thought.

Rest in peace, Kyle.  Well played, sir.

quick and dirty dns lint

I run a DNS server that I and a lot of my friends use. The problem with it being “free” and being between friends is sometimes people forget to tell you if they have switched DNS serving arrangements or just haven’t kept the registration.  I wrote a quick and dirty script, thanks to the whois ruby gem, to check to see if all the domains listed in Bind9‘s named.conf are still registered and if so do they still have our nameserver listed as one of the nameservers.  g0ff asked me for a copy, so I thought it might be useful to share with others.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'rubygems'
require 'whois'
 
zones = Array.new
ZONE_RE = /^zone "(\w+.\w+)" in/
File.open(ARGV[0]) do |f|
  f.each_line do |line|
    md = ZONE_RE.match(line.chomp)
    zones << md[1] unless md.nil?
  end
end
 
NS_RE = /^#{ARGV[1]}$/i
 
zones.each do |zone|
  c = Whois::Client.new
 
  begin
    domain = c.query(zone)
 
    if domain.registered?
      if domain.nameservers.detect { |ns| !NS_RE.match(ns.name).nil? }.nil?
        puts "#{domain.domain} doesn't seem to have us as a dns server"
      end
    else
      puts "#{zone} doesn't appear to be registered"
    end
  rescue Whois::ResponseIsThrottled
    sleep 120
    c = Whois::Client.new
    retry
  end
end

FFI for Ruby and an mp4v2 example

Previously on my blog: In my TiVo2Podcast stuff I automated the process of putting chapters around commercials, but had to call out to a small C++ app I wrote to put the chapters in using libmp4v2.

A few weeks ago I was looking at some ruby gems for a project I was working on and stumbled across ffi, a foreign function interface gem for ruby, or as its docs put it: “a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code.”  As long as you know the function signatures that you need, its pretty trivial to make the calls from Ruby. You do need to be aware of memory management stuff sometimes, but overall its pretty easy, especially for basic use. If you’re only going to be working in Ruby and need access to a C library, this is much easier than mucking with swig, that’s for sure.

The mind-blowing part for me is that the authors of the gem have made it smart enough to know what flavor of ruby vm and platform the code is running in and it does the right thing, no matter if its JRuby or on Windows or whatever. While I haven’t had a chance to use it yet, I suspect this property will be useful with JRuby at work in the future.
Continue reading FFI for Ruby and an mp4v2 example

Using Ruby with Viewpoint unhork an Exchange mailbox

(It’s been awhile since I’ve done a technical post, so I may do that on the next few.)

Through some craziness we haven’t figured out, a user at work managed to get over *pinky to mouth* one million items in their Deleted Items folder in Outlook which is hooked up to our Exchange server. This turned into an interesting problem.

Needless to say, that is a stupid amount of items that Outlook had issues with processing. Telling Outlook to empty the trash would send it out into la-la land as a hung process. I’m thinking it was trying to pull all million items into memory to do a delete on them. I’m sure if we let it sit long enough it may have done something, but it just really didn’t like that volume of stuff.  Similarly, using another Exchange or IMAP client like Mail.app, Thunderbird, and mutt had similar issues as they needed to retrieve the million headers before they would do anything. Deleting it batches at a time by hand worked, but was slow and required someone to do it by hand which…we can see the issue there.

As is often the case, the solution to the problem could be had by creating a small script to do the pain in the butt stuff for you. Actually, the big reason a script works here is that it could be smart and just snag small batches and work on those. Luckily, a few months back I had played with Viewpoint, a “ruby client access library for Microsoft Exchange Web Services. Previously, I had used Viewpoint to read mail in a certain folder and generate stats for it, so using it to identify and delete messages would be a snap.

The first go around I was grabbing the messages in a batch and deleting them one by one.  That works, but was a bit slow.  I figured out how to do something that hasn’t been written into Viewpoint yet: a batch delete.  That sped up the operation by 4.5 times or so.  This still took over a day to run.  It also couldn’t delete everything.  For some reason it seemed to not be able to delete calendar invites.  After the script was running entirely, we were left with about 30,000 items left behind, but Outlook could handle wiping the rest of them out if we left it alone for 20 minutes or so.
Continue reading Using Ruby with Viewpoint unhork an Exchange mailbox

Dinah makes the media

Today Dinah and I went to C2E2 for about 5 hours.  We had a great time, and what made it better was Dinah being in costume. Lots of people wanted to take their picture with her and she loved it.

For a good idea of what the day was like (and to see Dinah at the 7:22 mark) check out http://www.chicago3media.com/events/kevin-grace-at-chicago-comic-entertainment-expo-c2e2-2012 (the video is non-embeddable, deal with it.)

(I’ll update this post later with some images, just too wiped out right now.)

[Update 4/16: As promised, images!
]

Your life has ended in the Wasteland

Back when I lived in Kohler, WI, my buddy Joe Cline and I played hours upon hours of RPGs on our C=64/C=128.  One of the favorite games we played was Wasteland. This caused us 32 points of geekery and exploded our minds like a blood sausage.

Many of the original Wasteland guys worked on the Fallout series, the “spiritual successor” to Wasteland.  However, its always been a dream of fans and the designers to do a direct sequel. Thanks to the stuff that’s popped up on the modern internet, specifically Kickstarter, they are raising funds to do just that.

For just $15 in backing, based on current funding, you’ll get a copy of the game on Linux, Mac, and/or Windows.  The more they raise, the better they can make the game.  I’m excited enough about the game that I’m writing a blog post.  DO IT!

Nest in my nest

Last year the Nest Learning Thermostat came out and sold out pretty damn quickly. At the time I wasn’t really in a position to purchase one anyway. They recently came back into stock and Nest e-mailed me that it was available to be ordered again. I jumped on it right away.

In case you’re not familiar with the Nest: its a thermostat created by some ex-Apple folks that attempts to learn its schedule from you so it can save energy. (Its interesting to note, that most people don’t end up programming their programmable thermostats because its too hard.  Most of your standard ones have interfaces not unlike VCR programming. We all know how that went.) Even if you don’t remember to set the thermostat down when you leave, it’ll start to learn when you’re “away” and use its away temperature to build the schedule.  The Nest also hooks into your wireless network so you can remotely control your thermostat through their webpage or an app on your mobile device. The wifi also lets it do things like look up the external temperature, so it can use that as a factor into your heading or cooling.

Needless to say, I’m excited about such a device. Its weird to be excited by something like a thermostat, but its a thermostat made for today.  I had tweeted about my excitement that it was on the way, and had a nice interaction with Nest over twitter where they asked for pictures. That leads to this blog post… I thought I’d take the chance to do an unboxing video, which I’ve never done before, and post some photos of the install of the Nest.

Continue reading Nest in my nest