Archive for November, 2010

Coming to a food court near you

Saturday, November 27th, 2010

Gotta get me one of these food courts!

Nice Python Cheat Sheet

Wednesday, November 24th, 2010

I’m currently working on consuming some of the yum-utils package on Fedora/RHEL to add a repo “mirror” sort of functionality to nushus. One of the files in the package is /usr/bin/repodiff which defines a class that has some functionality that would be super helpful to not have to rewrite. Problem is that you can’t do a straight import on that file because it doesn’t have a .py extension. A little googling for variants of “python import non .py” had a couple different ways to do the import. Best answer I’ve found that provides access to the class was found on a little cheat sheet. Just wanted to post a link and a copy, it has some good information for those new to python and a few little gems of “things you don’t do all the time”.

the link on google went directly to the pdf: All I ever needed to know about python scripting
Here’s my copy of it: All I ever needed to know about python scripting

Answer to my question is on page one of the pdf:

>>> from types import ModuleType
>>> my_script = ModuleType(‘my_script’)
>>> exec open(‘bin/my_script’) in my_script.__dict__
>>> my_script.main(['-t', 'bar'])

Thanks Matt Harrison! (no idea who you are, but thanks!)
Maybe I’ll email him now :)

In case anyone is looking to learn python, here’s the resource I learned on: Dive into Python

Fedora 14

Tuesday, November 2nd, 2010

Happy Release Day!

Just updated my work desktop to Fedora 14 . Some how I actually remembered to make a separate partition for my home directory when I upgraded to 13. This made my 14 installation cake. Booted a live disk that landed on my desk, ran the installer, reassigned the mount points, formatted the root partition and was back up and running in no time at all. My irc logs say I was disconnected for 42 minutes total, that included a yum update and reinstalling my day to day apps.

Congratulations to the Fedora Community