A Yahoo Pipe to add hyperlinks to your Twitter favorites

January 10th, 2010

I often use to favor certain tweets in order to read the links in them at a later moment. To do so I added the RSS feed of my Twitter Favorites to NetNewsWire. Unfortunately the items in the RSS feed consist of plain text linking to the corresponding status page on Twitter.

Some time ago I used Yahoo Pipes to create a RSS feed that linkifies my Twitter Favorites RSS feed. Yesterday I made this a bit better:

  • It tries to find all links by using a simple regex. I know this is a hard problem (see 1, 2, 3) but I haven’t noticed it missing a link yet
  • It uses the first link found as the link on the RSS item, making it possible to directly open what the tweet is about in one click
  • It adds a ★ that links to the corresponding status page on Twitter, like Daring Fireball does when he’s mostly quoting another article
  • It adds links to usernames and hashtags

The only problem with the RSS feed is that it needs your Twitter User ID, not your Username, to work. This can be found by going to twitter.com while logged in and looking for the RSS feed icon. When hovering over it, you’ll see it linking to something like http://twitter.com/statuses/friends_timeline/659313.rss. In my case my User ID is 659313.

You can add the RSS feed of the Yahoo Pipe directly by adding http://pipes.yahoo.com/pipes/pipe.run?id=1fd5eef468624286c4bfbbe6192ac9c9&render=rss&user_id=659313 to your RSS reader. You’ll only need to change the User ID into your own.

I did find a Yahoo Pipe by earth2marsh that is able to use your Username instead of the User ID. It directly uses Twitters API instead of the RSS feed and a bit of YQL to construct an RSS feed of your Twitter Favorites, including avatars. Unfortunately it does not linkify the text. Perhaps I should combine both feeds someday

How to remove a Google Chrome extension on Mac OS X

October 24th, 2009

After downloading a .crx file, Google Chrome installs the extension into a randomly generated directory in ~/Library/Application Support/Google/Chrome/Default/Extensions and registers it in its Preferences file.

To remove an extension

  1. Close Google Chrome
  2. Open ~/Library/Application Support/Google/Chrome/Default/Preferences in a text editor
  3. Search for the extension and write down its id
  4. Remove it from the settings element
  5. Go to ~/Library/Application Support/Google/Chrome/Default/Extensions
  6. Remove the directory with as name the id from above
  7. Start Google Chrome

For example

Lets remove an extension that provides a toolbar icon for Google Reader. In the Preferences file this is registered using the id cciomicmolmofdcijoabgmccejjbacgg

....
"extensions": {
  "autoupdate": {
     "last_check": "12900842060608418",
     "next_check": "12900863894021384"
  },
  "settings": {
     "cciomicmolmofdcijoabgmccejjbacgg": {
        "location": 1,
        "manifest": {
           "background_page": "tpgr.html",
           "content_scripts": [ {
              "js": [ "feedLine.js", "makeRequest.js", "tpgr_cs.js" ],
              "matches": [ "http://*/*", "https://*/*" ]
           } ],
           "description": "Google Reader on the toolbar. Extension by TPReal (tpreal@gmail.com)",
           ....
     },
     "kebibidoobkefhegbnfmlkcejmaebblf": { 
     ....
     },
 ....

After removing the setting for cciomicmolmofdcijoabgmccejjbacgg the Preferences file looks like this:

....
"extensions": {
  "autoupdate": {
     "last_check": "12900842060608418",
     "next_check": "12900863894021384"
  },
  "settings": {
     "kebibidoobkefhegbnfmlkcejmaebblf": { 
     ....
     },
 ....

Now simply remove the directory using rm -rf '~/Library/Application Support/Google/Chrome/Default/Extensions/cciomicmolmofdcijoabgmccejjbacgg' in the Terminal.

Edit

Hehe, going to chrome://extensions/ is a lot easier, didn’t know that

Direct links to all DevDays’09 videos

June 14th, 2009

I’ve created a list of direct links to the videos taken at the DevDays’09 in The Hague. The list was created by parsing the devdays session timeline. Unfortunately Silverlight is needed to watch the videos, and many videos are still not uploaded

Thursday

Friday

Many of these videos can be downloaded from Channel9 in multiple formats

Greyscale Tweetie for Mac menubar icons

April 20th, 2009

Tweetie for Mac has been released, a Twitter client with a simple, but still feature rich, user-interface.

Unfortunately the menubar icon uses a glowing blue icon to indicate new Twitter messages.

tweetie_menubar_original.png

I’ve changed both icons to be greyscale and made them less heavy by making them an outline of the Tweetie dock icon. I’ve also added one pixel to their height to make it align better vertically.

tweetie_menubar_changed.png

Download the zip file containing both icon, copy them to

/Applications/Tweetie.app/Contents/Resources
and restart Tweetie to use these icons yourself.

Introducing www.sofinummer.com

April 18th, 2009

In the first days of january Dreamhost ran a promotion where one could get two years of hosting for about 20 dollars on which I acted. As part of this package came a free one year .com registration. I used it to registrer www.sofinummer.com on which I intended to implement a tiny web application that can be used to generate and validate BSN/sofinummers

I have tried to keep the site as simple as possible. It shows an oversized text input field that is used for both validating and generating numbers and a message box that shows if the input field contains a correct sofinummer. After generating a number the contents of the input field are selected for easy copy/pasting.

Initially I wanted to use Ruby and learn a little about Sinatra and Haml. When I found out that deploying was quite hard I decided to rewrite it in Javascript.

The javascript has been split in two scripts. The first handles the user-interface and uses jQuery to add some event handlers and to show/hide the message boxes. The second script handles validating and generating numbers. I’ve implemented generating numbers by simply taking a random number, validating it and retrying if incorrect. In modern browsers Javascript is fast enough to make a few tries before arriving at a correct number and this has the advantage that the code is kept simple and that the numbers aren’t pulled from a skewed distribution.

I’ve used TDD and QUnit when creating the second script, and the test suite has really saved me a lot of times. To test the user-interface I’m thinking of using Selenium as I want to get some knowledge of it.

As dutch bankaccount numbers use almost the same check I’ve also registered www.banknummer.com to check bankaccount numbers that are 9 decimals large. Perhaps one day I’ll extend this to bankaccount numbers that are 10 decimals large, or to SEPA numbers

Grayscale Little Snitch Network Monitor

April 1st, 2009

A great tool for Mac OS X is Little Snitch. It’s a tool that monitors all your applications network activity and lets you create rules to allow/disallow certain network activity.

It comes with a small menubar application, Little Snitch Network Monitor, that shows the current network activity. The menubar icon uses red and green bars to show the amount of download and upload. This choice of color conflicts with Mac OS X Leopards system wide use of grayscale menubar icons.

I’ve changed the tiff files used by Little Snitch Network Monitor to grayscale pictures to make it more inline with the rest of my menubar icons. To do this yourself copy the files from the zip-file into /Library/Little Snitch/Little Snitch Network Monitor.app/Contents/Resources.

How to create a md5sum of a partial part of a file

February 4th, 2009

At home I have a NAS that holds all my media files. Next to residing on my NAS these files are also backed up to dvd. To be able to move these files around while also changing their filenames I needed an way to fingerprint these files.

As I only needed the fingerprint to match files to each other, not to validate their contents, and as the files reside on an external disk I though that using md5sum would be too much. So I’ve created a small shell script that creates a fingerprint using only the first megabyte of a file.

The script md5sum_partial:

#!/bin/sh
FILE="$1"
MD5=`head -c 1M "$FILE"  | md5sum | sed -e 's/ -//'`
echo "$MD5 $FILE"

To recursively run it on an entire directory and send the output the STDOUT run

find . -type f -print0 |xargs -0 -IF md5sum_partial F

Restoring a corrupt iTunes library

February 2nd, 2009

After inserting an external hard drive yesterday, my iTunes library became corrupt. It apparently saw the external hard drive as the location of my music, something for which I indeed used the drive eons ago.

After disconnecting the drive I noticed that some newly added songs would not sync to my iPhone. I reconnected the external drive, checked the location of my music (which as I later found out is only updated after relaunching iTunes) and used the _File > Library > Consolidate _ . When I noticed that it was copying all my music to instead of from the external drive I canceled the process. And so I ended up with an iTunes library that thinks that my music is split between two disks even when all the music is still available in its original location.

I’ve quit iTunes and tried to fix iTunes library. iTunes keeps its music library in the file ~/Music/iTunes/iTunes Library and also exports it the XML file ~/Music/iTunes/iTunes Music Library.xml. iTunes directly uses ~/Music/iTunes/iTunes Library and will only reconstruct it from the XML file when this file is corrupt (if it’s simply deleted iTunes will start with an empty library).

First I’ve made a backup of ~/Music as these steps might make the problem even worse.

mv ~/Music/iTunes Music Library.xml ~/Music/iTunes Music Library.xml.backup

Corrupt the database by replacing it with some data, I suggest

echo 'stupid iTunes' > ~/Music/iTunes Library

Then replace all occurrences to the external hard drive with the original location. In my case the external hard drive lives at /Volumes/Music/Music and the original location was /Users/ckuijjer/Music

perl -pe 's@Volumes/Music@Users/ckuijjer@g' ~/Music/iTunes Music Library.xml.backup > ~/Music/iTunes Music Library.xml

Start iTunes and wait for it to import the XML file

Now lets see if all my iPhone applications are still there and that it still syncs with my iPhone. Also updating Time Machine as I had it configured to skip ~/Music. Changing that to skip ~/Music/iTunes/iTunes Music, e.g. skip the music files itself, but please, please backup iTunes library.

Moving a NTFS Windows XP installation to a new harddrive

October 19th, 2008

This weekend I’ve been trying to move Esther her Windows XP installation from a NTFS partition to a new, larger harddrive.

Initially I tried doing this using a Clonezilla live CD, by letting Clonezilla create an image of each partition (the Windows XP installation, the rescue partition, etc.) to an USB drive. Restoring the images to the new harddrive failed because there appeared to be some bad sectors on the old harddrive.

After this I used SystemRescueCd to manually clone the Windows XP installation:

  • Create an image of the Windows XP partition (in my case the 2nd partition, /dev/sda2) using --rescue to ignore bad sectors: ntfsclone --rescue --save-image --output sda2.img /dev/sda2
  • Replace the old harddrive with the new harddrive
  • Recreate the partition table on the new harddrive. Apparently Windows will not (easily) boot if the partition number or starting sector is different. As the 1st partition was only 100 MB large, and Clonezilla already recreated the partition table, I’ll restore the image to the 2nd partition.
  • Restore the image: ntfsclone --restore-image /dev/sda2 sda2.img
  • The bad sectors are also copied to the new harddrive, but do not exist there. Reset the bad sector list using:
    • ntfsinfo -i 8 /dev/sda2 and write down the "Allocated size" close to ‘$Bad’
    • ntfstruncate /dev/sda2 8 0x80 '$Bad' 0
    • ntfstruncate /dev/sda2 8 0x80 '$Bad' "Allocated size"
  • Reboot into Windows and check the harddrive for bad sectors (by right-clicking on the harddrive, Settings, TODO
  • Reboot into SystemRescueCd
  • Resize the partition to cover the rest of the harddrive
    • Start fdisk: fdisk /dev/sda
    • Set the display units from cylinders to sectors: u [enter]
    • Delete the partition (in my case the 2nd partition): d [enter] 2 [enter]
    • Recreate the partition: n [enter] p [enter] 2 [enter]. By default the 1st sector is the 1st sector of the deleted partition, and the last sector the last sector on the disk, so [enter] [enter]
    • Set the partition type to HPFS/NTFS: t [enter] 2 [enter] 7 [enter]
    • Set the 2nd partition active, so that it will be booted: a [enter] 2 [enter]
    • Write the partition to disk: w [enter] and quit: q [enter]
  • Resize the filesystem to fill the enlarged partition (by default the filesystem gets resized to the entire partition): ntfsresize /dev/sda2
  • Boot into Windows

Moving from Google Reader back to NetNewsWire

October 6th, 2008

On my daily commute I pass some spots where my iPhones reception is flaky at best. As this leads me to staring into the void of Google Reader trying to fetch some articles, I really want to use a feed reader that downloads articles in advance. Next to this I didn’t really like Google Readers interface on the iPhone (too much unnecessary links on the frontpage and the fixed viewport makes long lines of code to be cut off) and can’t seem to recall why I left NetNewsWire in the first place.

When comparing Google Readers OPML export to an old OPML export from NetNewsWire I noticed that quite a few feeds appeared in only one of the two exports. After googling for a way create an union out of more than one OPML file, and contemplating to make one myself using the XML::OPML CPAN module I settled for the following workflow to find get the feeds unique to Google Readers OPML export

Creating an OPML export out of Google Reader can be done in Settings and then Import/Export

In TextMate

  • Apply a regular expression replace to both OPML files. Replace .xmlUrl="(.?)".|. with $1
  • Use the Filter through Command sort|uniq on both files and save them
  • Select both files in the Project Drawer and apply a diff to the selected files
  • To only keep feeds unique to the first OPML file use the Filter through Command grep '^-'
  • Apply a regular expression replace replacing ^(.*)$ with <outline xmlUrl="$1" />
  • Add <opml version="1.0"><body> to the begin and <body/><opml/> to the end of the file and save the file
  • Import the OPML file in NetNewsWire and refresh all subscriptions

Now lets hope that the web interface to NewsGator is as nice as Google Reader

Edit: Hmm, just thought that I could also do this by importing my old NetNewsWire OPML, replacing the NewsGator subscriptions with NetNewsWire, removing all subscriptions from NetNewsWire and then importing Google Readers OPML and merging NetNewsWire and NewsGator. But where is the fun in that :)