a remake of a lost python script, in ruby