Posts Categorized: Uncategorized

PHP: Random Password Oneliner

I am exceedingly lazy, so I made a one-liner random password generator.

How it works: Creates an md5 from a random string, packs this into binary representation, base64 encodes that, strips some of the characters used by base64 (most importantly the = that are typically at the end), and then limits it to 8 characters. It’s been broken out here on several lines to make modifying it a bit easier.

(Could make longer passwords by changing what’s allowed and providing more text to base64_encode or hexadecimal to pack.)

$randpw = substr(
   preg_replace('/[^a-zA-Z0-9\.\-!\$]/', '',
      base64_encode(
         pack('H*', md5(time().rand()))
      )
   ), 0, 8);

Touhou Music Database

I’ve created a new project, which I’ve dubbed the touhou music database.  Well, it doesn’t actually contain the raw MP3 files or anything, however.  I collected the track listings of over 1200 touhou music/remix albums and entered them into a database.  Given the name of a song, you can find what albums it can be found on.

Also, when you view a track’s page, I attempt a search of Youtube to see if the track can be found on Youtube, so you can immediately find music videos for most of the more popular songs!  Additionally, I have a page that shows the some of the most recent Touhou music videos from Youtube.  I love the Youtube data API.

Links: Main site Most recent videos

My absence

Sorry for the lack of updates, I’ve been working on a pretty large project that has eaten much of my time.  Posting should be a little more regular in a couple of weeks, and I should plop in some new stuff soon.

Easily import sitewide comments – WPMU

One of my work responsibilities is the administration and development of a WordPress MU installation, Puget Sound Blogs. Someone suggested adding a feed of the most recent comments onto the front page, but obviously this isn’t terribly easy to do with WPMU, unless you have the sitewide comments plugin. http://wpmudev.org/project/Sitewide-recent-comments

Now the problem with this plugin becomes: What do I do to import my old comments. It’s fairly easy to simply export and re-import the comments, but I found this to be rather time consuming. So I wrote this script to do it all for me. Keep in mind that you’ll need to change which tables you use if they are different and whatnot, but it sure saved me a lot of time anyway.

Continue reading

Ubuntu 9.04 With Compiz

It seems most appropriate to post my screenshots of Ubuntu Linux 9.04 with Compiz-Fusion right now right after replacing Windows 7 Beta 7000 with it.  I went through and turned on quite a few custom effects, including my windows burning up when they are minimized or restored.

I suspect that it’s having all these animations and effects on that make the WordPress editor terribly unresponsive.  Or it could be something completely different since CPU utilization only spikes when I interact with the windows.

Continue reading