mochahochabeachside.com

Archive for March, 2010

Auto-install of WordPress Theme from CLI

by on Mar.25, 2010, under Blog, Scripts, wordpress

If you're like me, and you still like to install your WordPress themes from the command line (or you were 3/4 asleep and forgot WordPress now has a nice, easy-to-use auto-installer built into the admin interface), you know it can be a pain.  You have to download the file, unzip it, make sure it's right, delete the archive, chwon the files, etc...  It can be a pain.

So, I created a nice little script to take care of all of that.  wpthemeget will take a download URL from the WordPress Themes directory (in the format of http://(www.)wordpress.org/extend/themes/download/themename.ver.zip (or .tar.gz, or .tgz)), and will download, unarchive, chown, and remove the downloaded file, with no muss or fuss...  The output?:

root@fyre [.../wp-content/themes]# wpthemeget http://wordpress.org/extend/themes/                                        download/motion.1.0.4.zip
Downloading theme motion.1.0.4.zip...
Theme is a zip archive...
Unzipping... [COMPLETE]
...Removing downloaded archive file... removed `motion.1.0.4.zip'
...Chowning files... [COMPLETE]
...Installation Complete!

No muss, no fuss. The only caveat is that you have to be in your themes directory when you run it.  Future versions probably won't have this requirement, but hey, I hacked this out when I was barely awake, on heavy medication, and repeatedly falling asleep at the keyboard.  At one point, I had to delete something like 40 lines of "zzzzzzzzzzz......" because I fell asleep with my finger on the key.  Fortunately, vi treated it as all one paragraph so '<esc> dd' did the job.  The code for this little script is after the break.  Grab it, chmod it to exec, and drop it in /usr/local/bin, and it'll be good to go anywhere on your system, for all your blogs.  Happy blogging!

(continue reading...)

Leave a Comment :, , more...

Medley of current TV Theme Songs…

by on Mar.25, 2010, under Interesting, Videos

This guy is amazing... I say "this guy" when it appears to be two guys in the video. If you look very, very closely, you can tell it's an edited video, and it is really one guy. Well, I won't stake my life on it, but I'll wager my pride. Regardless, this guy (or these guys) go through 22 of your favorite TV theme songs in around 7 minutes (list after the cut). Pretty good transitions, and pretty good playing, as well, especially for some songs that don't transpose to keyboard and guitar. And so, withour further ado...

YouTube Preview Image

(continue reading...)

Leave a Comment :, , , , , , , more...

SQL Headache?

by on Mar.09, 2010, under work

I thought I had a headache, today, and then I came across an SQL problem. Actually, it was just a crashed table, but the SQL in the error message made my head spin...
SELECT IF(votenum >= 1, votenum, 0) AS votenum, IF(votenum >= 1 AND votenum > 0, votetotal / votenum, 0) AS voteavg, post.pagetext AS preview, thread.threadid, thread.title AS threadtitle, thread.forumid, pollid, open, postusername, postuserid, thread.iconid AS threadiconid, thread.dateline, notes, thread.visible, sticky, votetotal, thread.attach, thread.lastpost, thread.lastposter, thread.lastpostid, thread.replycount, IF(thread.views<=thread.replycount, thread.replycount+1, thread.views) AS views, thread.prefixid, thread.taglist, hiddencount, deletedcount , NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed , deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason, threadredirect.expires, post.pagetext AS previewbbcode FROM thread AS thread LEFT JOIN deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND deletionlog.type = 'thread') LEFT JOIN subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = 1682 AND canview = 1) LEFT JOIN post AS post ON(post.postid = thread.firstpostid) LEFT JOIN threadredirect AS threadredirect ON(thread.open = 10 AND thread.threadid = threadredirect.threadid) WHERE thread.threadid IN (0,25887,23738,25882,25869,25881,25843,25792,25533,24533,25874,25879,25884,25870,25866,25873,25832,25846,22121,15123,25859) ORDER BY sticky DESC, lastpost DESC;

....After that? I need a drink...

Leave a Comment :, more...

I Speakth with a Lithp

by on Mar.02, 2010, under Humor, Life

Between a co-worker and myself:

(6:20 AM) co-worker: the most amusing part is that it's all in parantheses
(6:21 AM) myself: (I love parentheses (in fact, I've been told that I use too many of them (actually, an old English teacher accused me of writing in LISP (he was a bit of a geek))))
(6:22 AM) co-worker: at least you close all of them
(6:22 AM) myself: I wouldn't want it to fail at compile.

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...