Friday, November 20, 2009

My last greasemonkey script: blog picasa images

I got so fed up with picasaweb breaking web conventions and stealing an onMouseDown rather than an onClick. This prevented me from dragging images from a picasa album into my blogger posting window and made it a pain to add images to my blogs. I'd have to right click, copy image location, new tab, select all, copy, close tab, tab over to my bloger window and then paste (and hope I was in compose mode rather than edit html mode).

I wrote this greasemonkey script to add a blog button at the top, clicking it made a new window with all your images in it and a link back to the original album.

blog_picasa_images.user.js

Right after I did this blogger in draft added better image linking support and it works great. So this script is kind of useless to me know. but thought I'd post incase it helps someone out.

Friday, November 16, 2007

preview feeds in google reader

I dislike that when I click on a feed icon in firefox, it opens a lame google page showing an option to insert on iGoogle or view in reader which automatically subscribes me rather than showing me the feed.

here's how to fix it

make a file like this called openfeed

#!/usr/bin/python2.4
# Copyright 2007 Alex K (wtwf.com) All rights reserved.

import os
import sys
import urllib

def main(argv):
feed_url = urllib.quote(argv[1])
url = 'http://www.google.com/reader/view/feed/' + feed_url
cmd = 'firefox -noraise -remote "openURL(%s,new-tab)" >/dev/null 2>&1' % url
os.system(cmd)

if __name__ == '__main__':
main(sys.argv)
and then in preferences under feed, choose this application and always do it.

I previously tried this, but never got it to work properly....

set
browser.feeds.handlers.webservice
and
browser.contentHandlers.auto.application/vnd.mozilla.maybe.feed
to
http://www.google.com/reader/view/feed/%s

problem solved

Sunday, August 20, 2006

snippy urls

I really like the idea of being able to make nice small urls from really big ones like you can with snipurl.com but of course their keyword namespace is all used up. So I wrote my own. The intention is that you put it as the 404 error document for your server and when someone goes to yourdomain.com/keyword this picks that up and sees if it's in its map and if it is redirects you. You add urls using a cgi prameter which is very easy to do with Mozilla keywords. The database is a regular old ini file which php is o.k. about parsing. Since you probably don't want everyone filling up your namespace with their keywords, adding keywords is either protected by an IP address white list, or failing that a simple user name/password setup. It's all very basic, but it works and I'm happy with it at this point so I'm putting it up here. At a future date I might put in some kind of keyword management so you can see all your keywords and perhaps trim them down, but right now it's easy enough to just edit the config/db file by hand.

While writing this the biggest frustration was dealing with the config file. I tried to use the pear config module it was uber frustrating. It just wasn't easy to have an object I can load, get settings from, add settings and save. So I gave up, used the built in parse_ini_file which was super simple and is built in. Since my [urls] section is at the end I can add urls just by appending to the file.

So here it is: your very own url shortening code.

I guess I should have used snippy urls for the links in this post eh?

Update: 2006-12-25: I just changed the code that displays the snippy url to have it be in a text input, pre focussed and pre selected so you can just control-C when the page loads and it's in your clipboard. The form's action is the snippy url (via post) so you can hit enter to test your new snippy url.

Update: 2008-08-10: I made it so you can use the same mozilla keyword to add a url as you can to choose a url. I use the keyword 'w' so I can type "w cnn http://cnn.com/" in mozilla to create a snippy url. Then I can type "w cnn" to access that url. 'w' is a mozilla keyword to 'http://example.com?kw=%s'

Sunday, February 20, 2005

My Favorite Firefox Plugins

Favorite Greasemonkey Scripts
Things to Set in about:config (That you won't find in the UI)
  • layout.word_select.stop_at_punctuation true
  • keyword.enabled false
  • browser.fixup.alternate.enabled false
  • browser.urlbar.doubleClickSelectsAll false
  • browser.download.manager.retention 1
Things to add to userContent.css
img[src*="http://feeds.feedburner.com/~a/"] {
display: none !important;
visibility: hidden !important;
}
img[src*="overture.com"] {
display: none !important;
visibility: hidden !important;
}
img[src*="http://imageads.googleadservices.com/"] {
display: none !important;
visibility: hidden !important;
}
img[src*="http://www.burstnet.com/cgi-bin/ads/"] {
display: none !important;
visibility: hidden !important;
}
Stuff that didn't quite make it, but you might like it.