Wishful Coding

Didn't you ever wish your
computer understood you?

RSS feed of Twitter lists

You want them? Me to! Here is how. The old-fashioned way:
  1. Create a Yahoo! ID
  2. Do some Yahoo! Pipe magic
  3. Get the RSS feed
But this is sub-ideal. Pipes have a huge url, a delay to long for practical use with Twitter, and are unreliable at times. I searched the API for a solution but found none. The only official format for lists is XML and JSON. Just by trying anyway, I and Jaap found out that lists do not have an RSS feed, but they do have an Atom feed(which is sort of RSS on steroids)! This can be used in most cases where an RSS feed is required. The new way:
  1. Copy the url of a list, for example http://twitter.com/erwinelling/eightmedia
  2. Modify the url to look like this http://api.twitter.com/1/erwinelling/lists/eightmedia/statuses.atom
Have fun! One word of warning though, because this feed is undocumented, it might change or disappear at any time.

Save your date with PyMouse

Save your date with PyMouse With PyMouse this would never have happened. Don't risk your date, get PyMouse right now at its GitHub page! All that it takes to wiggle your pointer with PyMouse is this:
from pymouse import PyMouse
from time import sleep
from random import randint

m = PyMouse()
w, h = m.screen_size()
while True:
    try:
        m.move(randint(0, w), randint(0, h))
        sleep(20)
    except KeyboardInterrupt:
        print "Goodby!"
        break
Published on

Open external links in running browser

Open external links in running browserAs a web developer I have like 5 browsers installed which I use regularly. That is, not on daily basis, but for occasional testing and browsing. What annoys me most about this is that when I click a link in another application, no matter what browser I'm currently running, it opens a fresh Safari window. The ideal solution would be to open any urls with the browser I'm using at that moment, no mater which browser that is and which one is set as the default browser. I have written a piece of Applescript that will do just this, you might need to edit this for the browsers which you are using though. Below you'll find a zip file containing the app bundle, and all the scripts needed to generate it yourself.

Browser Loader

To edit the browsers you use, open "/Applications/Utilities/AppleScript Editor.app" and then open the app bundle, this will reveal the script below, where you can make adjustments to the browsers used and their order. If you want do do this yourself, or the app bundle does not work for you for some reason, this is the actual Applescript I used:
on open location the_url
        tell application "System Events"
                set browser_apps to the name of every process whose visible is true
                if "Opera" is in browser_apps then
                        tell application "Opera"
                                open location the_url
                                activate
                        end tell
                else if "firefox-bin" is in browser_apps then
                        tell application "Firefox"
                                open location the_url
                                activate
                        end tell
                else if "Google Chrome" is in browser_apps then
                        tell application "Google Chrome"
                                open location the_url
                                activate
                        end tell
                else
                        tell application "WebKit"
                                open location the_url
                                activate
                        end tell
                end if
        end tell
end open location
Open external links in running browserCopy this file to the Applescript editor and hit Save, before you save, choose to save as an app bundle and make sure to check the "Stay Open" box. Now we need to modify the app bundle to make it eligible for url opening. To do this, right-click on the app and select "Show Package Contents", go to "Contents" and open "Info.plist". Edit "Info.plist" to contain this xml code within the outer dict element. For an example, download the app bundle above.
<key>CFBundleIdentifier</key>
        <string>nl.pepijndevos.urlhandler</string>
        <key>CFBundleURLTypes</key>
        <array>
                <dict>
                        <key>CFBundleURLName</key>
                        <string>Applescript urls</string>
                        <key>CFBundleURLSchemes</key>
                        <array>
                                <string>http</string>
                                <string>https</string>
                                <string>file</string>
                        </array>
                        <key>LSIsAppleDefaultForScheme</key>
                        <true/>
                </dict>
        </array>
Now, when you click an url it will just open your browser. I'm not sure what to do exactly, but here is what I did
  1. Run the app once
  2. Set it as the default browser in Safari
[update] Using Linux? Try this script on Humbug.in This script has also appeared on lifehacker.com download.com and maxosxhints.com