Posts tagged "ruby"

Logfile art? Yeah I did.

Here’s a script that takes a filename, parses the file for IP addresses, maps each IP to an RGBA pixel, and creates a PNG (thanks seattle.rb!).

For example, the following would map 192.168.1.1 in reverse (i.e. 1.1.168.192)…

ruby ip_colorsquare.rb production.log 4,3,2,1

Here’s one example I created with a 24-hour chunk of logs from WhereWeDoWhatWeDo (disclaimer: I mixed up the octet order when I created it)

production.log PNG

Interesting to see patterns emerge, although the streaks of the same shade are probably just search bots or spammers.

Grab the script here.

Keep it shortenTweet

Behold… shortenTweet! It’s a wee microapp for Twitter that tries to shorten your tweets using UTF-8, ASCII and some shorthand. It’s a combination of Sinatra + jQuery, and after doing this I’m all aboard this microapp train (esp. with how easy it is to deploy Rack-based apps on Passenger).

And — par for the course — after I “launched” it, I discovered 2 or 3 or services that already did “tweet shortening” (although I don’t think any of them actually employ UTF-8).

Accent theme by Handsome Code


view archive



Ask me anything