March 30th, 2006

Export Firefox Bookmarks to Safari

Firefox on OS X sucks. Big time. I decided to move to Safari, but I couldn’t do that without exporting my bookmarks. Here’s how I did it:

The Firefox bookmarks is in an HTML file. It’s typically located at ~/Library/Application Support/Firefox/Profiles/<profile name>/bookmarks.html. Safari stores its bookmarks at ~/Library/Safari/Bookmarks.plist, which is a binary file.

Use this simple script to export your Firefox bookmarks as a readable XML, and follow these steps:

renegade:~ $ ruby ff2safari.rb  > ~/Library/Safari/Bookmarks.xml
renegade:~ $ cd ~/Library/Safari/
renegade:~/Library/Safari $ mv Bookmarks.plist Bookmarks.plist.backup
renegade:~/Library/Safari $ plutil -convert binary1 -o Bookmarks.plist Bookmarks.xml

Note that this script simply dumps all your Firefox bookmarks in Safari’s Bookmarks Bar. (I have a very few bookmarks on my browser, most of which are in the Bookmarks Toolbar.) You could use an XML parser to export bookmarks as is. To understand the format of the XML you need to generate, you might want to export the existing Safari Bookmarks file to XML:

renegade:~/Library/Safari $ plutil -convert xml1 -o readable.xml Bookmarks.plist

One interesting thing to note: a ktrace/kdump on Safari didn’t do any open on Bookmarks.plist. I wonder why.

This post brought to you from Safari.

Posted at 02:34 pm | Link | 16 comments | Leave a comment

June 17th, 2005

Skip Slashdot Comment Preview

On any of Slashdot’s Post Comment pages—this, for example:

...
Logged-in users aren't forced to preview their comments.
...

Now forcing users—whether Anonymous Cowards or not—to preview sucks. I hate it. And it’s stupid considering I can get rid of it. Here’s the Greasemonkey script you’d require. It adds a ‘Submit’ button on the page, and sets a hidden variable op—which, apparently, Slashdot uses to identify whether it’s a preview, or submit, or whatever—set to value Submit.

Well, I thought that alone would have done the job. Turned out there’s some more weird shit that it does internally—and I’m not terribly sure what all. My guess is that it does some session stuff, where it sets some flag to indicate that the comment-to-be-posted has been previewed. So, the script, when you click on submit, first does a xmlhttpRequest with op=Preview, and then submits the form. Seems to work.

That’s it from Monkeyland for now.

Posted at 01:10 pm | Link | 4 comments | Leave a comment