Wednesday, November 28, 2007

Where is the PSI for Ruby?

About every 6 months a Google recruiter will run across my LinkedIn page and try to trick me into starting the grueling 2-3 month interview process. Why anyone with a job already would put themselves through this is beyond me, but it did get me thinking about Python again and to catch up on my Python Package Index Feed (which kicks RubyForge's ass, BTW) and I ran across the Python System Information. I had to write this sort of stuff (and more) in Ruby about 6 months ago. That is the different between Python (and grudgingly Perl, gag) and Ruby. Some sort of mainstream task is probably already done (and relatively)

Not that I'm complaining

>>> import psi

>>> a = psi.arch.arch_type()
>>> a

>>> isinstance(a, psi.arch.ArchMacOSX)
>>> isinstance(a, psi.arch.ArchDarwin)
>>> a.sysname
>>> a.nodename
>>> a.release
>>> a.version
'Darwin Kernel Version 8.9.1: Thu Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386'
>>> a.machine

>>> psi.loadavg()
(0.705078125, 0.73046875, 0.7626953125)

>>> import os
>>> mypid = os.getpid()
>>> mypid
>>> p = psi.process.Process(mypid)
>>> p.command

No comments: