Wed, 28 Feb 2007

Power Magnet Update

In response to my questions about using Lua and Lighttpd to serve up static blosxom pages, Tomas Carnecky sent me an email with a better way to check for an empty query string within Lua, using "if next(get) then return 1 end". Here's my new power-magnet.cml

-- if query string is empty and static file exists, serve static file
dr = request["DOCUMENT_ROOT"]
-- local f=assert("/debug.out","a"))

if next(get) then return 1 end

sn = request["SCRIPT_NAME"]

static = string.gsub(sn, '^/blog/(.*)$', '/static/%1')

if (file_isdir(dr .. static) and file_isreg(dr .. static .. "/index.html")) then
--      f:write("cache hit on directory\n")
        output_include = { dr .. static .. "/index.html" }
        return 0
elseif file_isreg(dr .. static) then
--      f:write("cache hit on file\n")
        output_include = { dr .. static }
        return 0

-- f:write("no cache hit\n")
return 1

tech | Permanent Link

Yahoo Pipes

Yahoo Pipes allows you to manipulate rss feeds. I built my first very simple pipe this morning. It takes the Amazon Gold Box feed and strips out the Baby Deals. You can also much fancier stuff like match geocoded addresses in feed items and modify the content of individual items. Too bad they don't provide a way to screen-scrape pages to build feeds.

If I build any more pipes, you'll be able to find them on my pipes page.

tech | Permanent Link

Sun, 04 Feb 2007

JSTOR Proxy Greasemonkey Script

I've written my first greasemonkey script, to rewrite links to JSTOR. JSTOR contains articles from tons of journals, but you need to have a subscription to access it. My university has a license, but in order to use the site remotely, you must go through the school's proxy server. So my script appends the name of your proxy server onto the domain, in my case

Install the script.

Update: It now supports url's too. I knew the name would come back to bite me. I guess I'll wait to rename it until I rewrite to handle multiple domains more cleanly.

Another Update: Support for

tech | Permanent Link

The state is that great fiction by which everyone tries to live at the expense of everyone else. - Frederic Bastiat