The cake is a lie

Archive for January, 2008

Code storytelling

It’s fun writing code that tells a story. Hopefully it’s also fun reading it.


class TerminationNotice(Exception):
    "Exception raised inside a thread when it's time for it to die."
    pass
 
class SuicideJob(QueryJob):
    "A worker receiving this job will commit suicide."
    def run(self):
        raise TerminationNotice()
 
class QueryWorker(Thread):
    "Devoted worker who will pull jobs from the `jobs` queue and perform them."
    def __init__(self, jobs):
        self.jobs = jobs
        Thread.__init__(self)
 
    def run(self):
        "Get jobs from the queue and perform them."
        while 1:
            job = self.jobs.get()
            if not isinstance(job, QueryJob):
                debug.error("%r ate a job that wasn't a edible: %r" % (self, job))
                continue
            try:
                job.run()
            except TerminationNotice:
                # Nice knowing you :(
                break
1 comment

Installing Gentoo on Playstation 3

Mario!

  1. Back up my precious save files: Formatted my external hard drive to FAT32, plugged it into the PS3, went to System Settings > Backup Utility, and hit OK.

    While it’s backing up, I’m reading various Playstation 3 hacking forums, such as ps2dev.org where the first hack to utilize the locked-away GPU in Linux was created. Apparently there’s also hope to use the Playstation Eye as a webcam

  2. Burned the installcd ISO, inserted it into my PS3, hit Install other OS, it did its magic, rebooted, and I was in the Gentoo install CD. Just like that.
  3. Plugged in a keyboard into the PS3, created a password, started sshd, and ssh’d in from my desktop and did the rest from the comfort of my fancy chair.
  4. Followed the Gentoo Install guide which took about 20 minutes of work, the rest was waiting for things to download, extract, and compile. Meanwhile, I ate pizza and watched the first couple of episodes of Jericho through my PC. Not too bad.
  5. Time for the real purpose of this ordeal: Setting up emulators. After much trial and error, I learned that Mednafen is the cream of the crop. After more jumping through hoops, I created the perfect controller configuration that supports two PS3 Sixaxis controllers plugged in USB (bluetooth works too!). You can download it here: mednafen.cfg. Shove it in your ~/.mednafen/ and you’ll be good to go — full screen and all.

    To make your own key bindings, read the nitty gritty in this thread.

PS3 Mario

13 comments

Happy new year…

… to all my readers. Everyone else is not important.

<3
1 comment