WordPress Update Bash Script

12 December 2011 by Dan

I wrote this script some time ago. It's been working flawlessly for me, so I thought I'd share it here. It could use some progress messages, I suppose.


#!/bin/bash
DIR= # Put the file system path to your WordPress installation here. E.g., /var/www/html/blog
TMPDIR=$HOME/tmp
WPDIR=$TMPDIR/wordpress
cd $TMPDIR
rm -rf latest.zip ./wordpress # Clean up from the last run
wget -nd http://wordpress.org/latest.zip
unzip latest.zip
mv $DIR/wp-config.php $DIR/.config # Stash your configuration someplace safe
rm $DIR/*.{txt,html,php} # Delete the old install
rm -rf $DIR/{wp-admin,wp-includes} # Delete more. Don't delete plugins or themes.
cp -aR $WPDIR/* $DIR/
mv $DIR/.config $DIR/wp-config.php # Restore the configuration
# You may not need the last two lines. I like to give my web server the ability to write files.
chown -R .www-data $DIR/*.php $DIR/wp-admin $DIR/wp-includes
chmod -R g+w $DIR/*.php $DIR/wp-includes

Second Best Fortune Cookie Ever

8 July 2011 by Dan

All your hard work will soon be paid off

Best Fortune Cookie Ever

16 June 2011 by Dan

Your talents will be recognized and suitably rewarded.

Remap Mac Terminal Command-K

7 June 2011 by Dan

In case I need to remember that I did this...

By default, the Mac Terminal assigns the "Clear Scrollback" command to Command-K. This is annoying, because I often use Nano, which uses Control-K to cut a line of text, and I frequently press Command-K instead of Control-K by accident. This clears my screen while I'm in the middle of editing a file. Very annoying.

The solution is to assign a new (harder to hit by accident) command to the "Clear Scrollback" command, so that when I inevitably mistype Command-K, nothing happens.

Remap Command-K

Fun with River2

11 February 2011 by Dan

I decided to install Dave Winer's River2 to supplement my usual feed reading. Now that I can access it via its smart use of Dropbox, it should be good for feeds that I don't feel like I need to see every headline.

One of the things I love about River2 is that it's an app that runs in the OPML Editor, which means that it is endlessly hackable and (apropos to this post) you can fix your own bugs.

So here's a bug report. And fix. (Actually, it could be a workaround for a bug in another application, as I explain below).

  1. What I was doing: From the Tools > River2 > Pages menu, I selected a page to view (any one, it's the same bug no matter which page).
  2. What I expected to happen: I expected the selected page to open in my default web browser, Pale Moon (a Windows-optimized build of Firefox)
  3. What actually happened: Nothing. Not even an error dialog.

I immediately suspected that the problem was the communication between the OPML Editor and the Pale Moon browser. After all, there was a major bug for the longest time in Firefox's DDE implementation that required a workaround.

Bottom line: the OPML Editor's DDE implementation expects that the DDE service name is the same as the name of the executable with the filename suffix removed. So, for Excel, the service name is "excel," and for Firefox it's "firefox." But the service name is determined by the application, and the Pale Moon developers decided that its service name would be "Pale Moon," not "palemoon." A simple patch to system.verbs.builtins.webBrowser.openURL resolves the problem.

if string.lower (id) contains "palemoon" { // 2/11/11; 12:09:06 AM by DJM
	ddeName = "Pale Moon";
	return (webBrowser.callBrowser (ddeName, "WWW_OpenURL", s+",,0,0,,,,"))}

The function webBrowser.callBrowser expects ddeName to be the name of the executable, from which it attempts to remove the ".exe" suffix. Luckily, if the function is passed any string without an ".exe" suffix, it just accepts the passed string as the DDE service name.

Here's the full context:

system.verbs.builtins.webBrowser.openURL

That ",,0,0,,,," nonsense is part of the DDE message that Pale Moon expects:

Pale Moon DDE

Were Robert Johnson's recordings sped up?

22 October 2010 by Dan

A post over on Boing Boing ("The last mystery of the blues: were Robert Johnson's recordings sped up?") drove me right to my sound editor to see how Robert Johnson's performances may have sounded different from his recordings. Here's the result:

Robert Johnson Speed Demo

The audio is a 30 second clip of "Sweet Home Chicago" played once at normal speed (i.e., the recorded speed) and then a second time about 20% slower (2 semitones lower). (Note: I didn't labor over the crossfade between the clips.)

Pretty interesting, if you ask me.

Optimal Browser Status Update

10 October 2010 by Dan

I've been extremely annoyed with and concerned about Optimal's usage pattern that I've observed in the server logs. I had shut it down for a while to see if anyone noticed. No one did -- except me. I wanted to see this OPML of all the BBC's news feeds, so I turned Optimal back on. But I will be blacklisting spammers and malware purveyors from now on.

Failed Coleman Model 5312 Battery

27 July 2010 by Dan

Failed Fifutec SW1245 battery from Coleman Model 5312 lantern.

Posted with WordPress for BlackBerry.

[Link] FBI: Spies Hid Secret Messages on Public Websites

30 June 2010 by Dan

I think the Russian spies' use of steganography is the most interesting part of this story. Happy to see media outlets starting to look into it.

Delete Empty Folders

17 September 2009 by Dan

I recently found that I had a lot of empty folders in my MP3 folder after a wayward ripping session. So I whipped up this quick DOS one-liner to remove all empty folders.

From a command prompt, just change to the folder containing all the empty folders and enter the following:

FOR /f "tokens=*" %G IN ('dir /ad /b /s') DO rd /q "%G"

The command "rd /q" will be executed on every folder, but "rd" only deletes empty folders -- "rd" does not delete non-empty folders.