The best kittens, technology, and video games blog in the world.

Monday, May 06, 2013

Small Unix utilities written in Ruby - part 3

Naughty cat by kevin dooley from flickr (CC-BY)

Here's the third instalment in my ongoing series (Part 1. Part 2).

All utilities mentioned are available on github.

flickr_find

Find Creative Commons licenced photos on flickr.

Usage example: flickr_find cute kittens.

flickr_get

Download best quality version of a photo from flickr and annotate it with proper file name.

Usage example:

    flickr_get http://www.flickr.com/photos/pagedooley/386303100/

which will be saved as ~/Downloads/naughty_cat_by_kevin_dooley_from_flickr_cc-by.jpg

I've been using flickr_find and flickr_get for years on this blog.

It requires objectiveflickr gem.

osx_suspend

OSX surprisingly lacks an easy way to suspend your current session. This utility does just that.

rand_passwd

Have you ever needed to quickly generate a new password? This utility generates easy to type (lower case letters only) 12 character password, with 56.4 bits of entropy, so you never need to reuse the same password across multiple sites.

webman

The most annoying thing about man pages (and even more about this silly GNU info idea) is that they display in terminal, where they're really painful to search. What man really needs is in-browser display.

Here comen webman. It is fuly intended to be used with alias man=webman in your ~/.bashrc. It finds proper man page, groffs it to HTML, caches that in ~/.man_cache since groff is slow as hell for some reason, and opens your favourite browser.

The code looks fairly overengineered, since the actual script I use also checks EC2 (so I can man page for both OSX and Linux programs with the same command), and this stripped down and somewhat refactored version is still a bit on the complex side.

If it fails to find man page for any reason, it opens relevant Google search instead.

If you need to open it in a terminal simply pass -T flag.

It wasn't tested outside OSX environment yet, so pull requests welcome. Further cleanup pull requests also very much welcome.