iTerm2: inline images(Ruby)

Because Python is slower on my machine, I made a little script to use the proprietary escape code of iTerm2 for printing pictures inline.

Nothing fancy, just to exercice.

require "base64"

def printi(α)
    χtmp = nil
    File.open(α, 'rb') { |χf|
        χtmp = Base64.encode64(χf.read)
    }
    puts("\x1b]1337;File=name=#{Base64.encode64(α)};inline=1:" + χtmp + "\a\n")
end
Advertisements

Orc Name Generator (again).

orc iconSo I’ve managed to have few hours to relax this weekend, so  I’ve played with ruby. I finally ended up with the will to remake the “Orc name generator” I’ve made few months ago, I’m happy to see my coding skills increases a little (everything’s less messy, I’ve get rid of my horrible C habit to make all my loops with “while” ah ah).

I’ve also discovered some really cool features of Ruby.

It’s a really stupid program that generates a random orc names with an Orcish clan name. This time Entirely in english.

Continue reading