Sunday, 6 December 2009

Bulk uploading email into Gmail

Recently I joined the hoards of people who use Gmail as their primary mail service.  It has all the bells and whistles and provides virtually unlimited space for storing email.  I won't go into all the cool features but let's just say, it rocks.

The question is, how do we get all our old email into our shiny new Gmail account?

The answer is fairly straight forward but my method requires a bit of know-how and a *NIX mail client.

First, the overview: Basically I used Alpine (the mail client formally known as 'Pine') and Gmail's IMAP abilities to bulk save the messages from the local folders to Gmail. Primarily I was concerned with my 'Sent' items from the past decade but this will work with any folder(s):

  1. Enable IMAP in Gmail.
  2. Install Alpine on your *NIX workstation or server.
  3. Configure Alpine to see to your existing email folders.
  4. Configure Alpine to talk via IMAP to Gmail:
    • Inbox: {imap.gmail.com/ssl/user=username@gmail.com}inbox
    • Collection List:
      • Server: imap.gmail.com/ssl/user=username@gmail.com
  5. Go to the folder you wish to bulk upload to Gmail.
  6. Select all messages (shortcut keys: ';' followed by 'A').
  7. Save all messages (shortcut keys: 'A' followed by 'S').
  8. Select the destination folder (shortcut keys: CTRL-T)
  9. Choose your Gmail collection and then the destination folder.
  10. Hit Enter to bulk save the messages into Gmail.
  11. Rinse and repeat for any other folders.

Using this method, I was able to bulk upload approx. 10,000 messages from the past decade of my Sent messages in approx. 1 hour (this will depend on your bandwidth, of course!).

Saturday, 5 December 2009

Enabling SNMP in Mac OS X 10.6 (Snow Leopard)

Under Snow Leopard there is a slight change to the way services are enabled.
-w       Overrides the Disabled key and sets it to false. In previous versions, this
         option would modify the configuration file. Now the state of the Disabled key
         is stored elsewhere on-disk.

So, to enable the SNMP daemon correctly:
$ sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist

Friday, 4 December 2009

The correct way to automount a Samba/CIFS share in Mac OS X

From: http://www.mac-forums.com/forums/switcher-hangout/42164-automatically-mount-samba-share.html

  1. Visit the share in question so that Mac OS X mounts it.
  2. Run “Sytem Preferences”.
  3. Select “Accounts”.
  4. Select the User you want to change by double clicking.
  5. Click on “Login Items”.
  6. Click the + button.
  7. Select the Samba/CIFS share you want to mount. It should now show as a new "Volume item".
  8. Close “System Preferences”.
  9. Beer.

Sunday, 29 November 2009

Facebook updates in your Twitter stream

If you're like me you'll find it difficult to keep a track of everyone's status - especially when they're across multiple networks. Most people tend to use Facebook but I prefer Twitter. So, what to do? Merge them, of course!

  1. First, you will need to install the RSS News Feed reader application in Facebook.
  2. Once installed, take note of the RSS feed URL.
  3. Create yourself a new Twitter account.  This account will be used to hold all your Facebok friends' updates.
  4. Create an account on Twitter Feed.
  5. Add your Facebook RSS feed URL (from step 2) to your Twitter Feed account (from step 4) and have it post to the new Twitter account you created in step 3.
  6. In your usual Twitter account simply follow the new Twitter account that should now contain all your friends' Facebook status updates.
  7. Make yourself a cup of tea.  Go on.  You've earned it.  You tech-wizard, you.

Update: To eliminate the annoying  s, you could pass it through a simple PHP filter, if you're lucky enough to have a server connected to the Interwebs on a 24x7 basis:

<?php print str_replace("&nbsp;", " ", file_get_contents("http://www.gencolee.com/fb/newsfeedrss.php?u=user_id&s=feed_id")); ?>

Tuesday, 17 November 2009

From the Archive: Turnham Green frustrations

In the summer of 2001, I used to commute to Richmond in London via Turnham Green on the District Line. I was frustrated that the Picadilly Line trains didn't stop there during the day -- when I really wanted them to. So, to find out why, I asked London Underground Limited.

I had thought that their answer had been lost in the sands of time -- but, as it turns out, it was sitting in my email archive all along. So, for posterity's sake, here it is:

Is there a reason why the Picadilly line doesnt stop at Turnham Green during normal hours?

Dear Mr Wallace

Thank you for your recent email enquiry.

The level of service provided at individual Underground stations is subject to regular review, taking into account substantial changes in demand, be they actual or perceived. Passenger opinion, including responses to origin and destination surveys, forms an essential part of the review process, as does the potential increase in passenger numbers created by expansion of residential or commercial development in the vicinity of stations.

In determining whether additional stops can be justified within an existing route, consideration has to be given to the effect on overall journey times and the availability of resources to maintain required frequencies. Since September 1996 the Piccadilly Line timetable has offered by far the most intensive service anywhere on the London Underground network. Trains are scheduled at two or three minute intervals between Arnos Grove and Acton Town for the greater part of the day, which, due to present constraints in track and signalling system capacity, can only be achieved by running non-stop between Hammersmith and Acton Town, six minutes being allowed in the schedule for this.

During early morning and late night periods, when trains on both the District and Piccadilly Lines run less frequently, Piccadilly Line trains are able to call at Turnham Green, adding one minute to the scheduled journey time between Hammersmith and Acton Town. Between 0645 and 2230 on Mondays to Fridays some three hundred and seventy Piccadilly Line trains in each direction pass through Turnham Green without a scheduled stop. Were all these trains revised to call at Turnham Green, the cumulative effect on the timetable would be an increase in the total running time equivalent to a return journey between Cockfosters and Heathrow. Unless there was a reduction in the existing frequency, two further trains and at least six extra drivers would thus be needed if Turnham Green is to be served by Piccadilly Line trains all day. On the basis of survey results to date, the marginal increase in revenue generated is unlikely to be sufficient to fund these additional resources in the foreseeable future.

Meantime, the District Line daytime service has been enhanced to provide a train about every four to six minutes between Hammersmith, Ravenscourt Park, Stamford Brook and Turnham Green, with Ealing Broadway services linking Turnham Green, Chiswick Park and Acton Town at intervals of eight to thirteen minutes. Cross platform interchange between the Piccadilly and District Lines is available at Barons Court, Hammersmith and Acton Town; since Hammersmith is a busy station in its own right, many passengers prefer to make westbound connections at Barons Court.

In exceptional circumstances, arising perhaps from a signalling or train equipment failure, Piccadilly Line trains may be diverted to run via the District Line tracks. Since there is a need to interlace with District Line trains in so doing, the number of Piccadilly Line trains in service might need to be reduced accordingly. The Line Controllers, in consultation with their District Line colleagues, can arrange for Piccadilly Line trains to call at the intermediate stations between Hammersmith and Acton Town on these occasions, if the disruption is likely to last some time. More commonly, individual Piccadilly Line trains will call at these stations to compensate for prolonged gaps in the District Line service. Piccadilly Line drivers have also been instructed to open the train doors at Turnham Green if the train has stopped in the platform because the signal ahead is displaying a red aspect.

I hope that this is of assistance.

Yours sincerely

Andrew Summers
Customer Service Centre
London Underground Limited

Wednesday, 15 July 2009

Book: The 4-hour Workweek

My copy of "The 4-hour Workweek" arrived today -- a book by my new hero, Tim Ferriss.

I'm only 50 pages into it but, so far, it's a very interesting read. I'm inspired but really trying to resist doing anything until I've finished reading it. Tough.

I'll let you know how it goes when I get to the end...

Friday, 10 July 2009

5 minute chocolate cake recipe

Ingredients
  • 4 tablespoons self-raising flour
  • 2-4 tablepoons sugar (depending on how sweet you like it)
  • 2 tablespoons cocoa
  • 1 egg
  • 3 tablespoons milk
  • 3 tablespoons oil
  • 3 tablespoons chocolate chips (optional)
  • a small splash of vanilla extract
  • 1 large coffee mug

Steps
  1. Add dry ingredients to mug, and mix well. Add the egg and mix thoroughly.
  2. Pour in the milk and oil and mix well. Add the chocolate chips (if using) and vanilla extract, and mix again.
  3. Put your mug in the microwave and cook for 3 minutes on high.
  4. The cake will rise over the top of the mug -- dont be alarmed!
  5. Allow to cool for 2 minutes.
  6. Eat with ice cream.


Update: Corrected recipe to use tablespoons instead of teaspoons and added the use of self-raising flour from numerous recommendations on the net.

Monday, 11 May 2009

Weekly cooking routine

You know how it is: you get home from work, it's dinner time, no one knows what they want to have for dinner and any recipes you can be bothered to cook are missing a vital ingredient or two.  A quick trip to the shop is needed... or maybe takeaway would be easier?

Sound familiar?

Until recently, this was true for us.  Until we came up with a plan. Many people have said they're impressed with the plan, which I find surprising.  It's mainly common sense and most people, I'm sure, would say, "Duh!" -- but here it is anyway:
  1. Find seven recipes for the next seven evening meals.  Write the meals down and stick them on the fridge (or somewhere else convenient).
  2. Add the ingredients you'll need for those recipes to your weekly shopping list.
  3. Buy the ingredients from the supermarket, or wherever.
  4. When you've unpacked the shopping, check the meat and set a rough order for the meals using the expiry date as a guide.
I told you it was simple.  Now when you get home in the evenings it should be very simple to decide what to have for dinner and all the ingredients should be at hand.

Tips:
  • If you make more than you need for the odd meal or two, you could save yourself a night or two of cooking.

Pros:
  • It's a simple decision when it's time to eat.  Just take a look at the fridge and pick a meal.  Hey, it's like a menu at a restaurant!
  • You can try out exotic and interesting recipes instead of eating the same meals week after week.  I really enjoy using our cookbooks every day instead of just for dinner parties.
  • Shopping trips become quicker and more purposeful.  No more wandering the aisles aimlessly looking for inspiration.
  • You'll find that your culinary skills will improve.  Practise makes perfect!

Cons:
  • It's not much fun coming up with seven meals in a single sitting.  You could try splitting it out across the week so when shopping day comes you don't have to do it all at once.

Sunday, 8 March 2009

Integrating Mail.app and Things

Things, by Cultured Code, is a great task management application that runs on the Mac and iPhone and is really helping me keep a track of all the things I need to get done, at home and at work.

What would be handy is if I could easily turn an email into a new to-do inside Things.

Of course, Google to the rescue and I discovered a couple of scripts that utilise Mail.app's bundle (plugin) functionality and SIMBL that do just that.

  1. Quit both Mail.app and Things
  2. Download and unzip this file to ~/Library/Mail/Bundles (you may need to create this directory if it doesn't exist)
  3. Download and unzip this file to ~/Library/Application Support/SIMBL/Plugins (you may also need to create this directory if it doesn't already exist)
  4. Open Terminal and execute the following command:
    $ defaults write com.apple.mail EnableBundles -bool YES
  5. Start mail.app and Things.  (Things needs to be running to accept the incoming messages)
Whilst in mail.app, pressing CTRL-CMD-S (^⌘S) will add an new item into the Things inbox with the subject of the highlighted message as the title and a link in the notes area to the email itself.

Thanks go to "fedex" for his scripts and, of course, Cultured Code for their awesome software.

Synchronising multiple 1password keychains without MobileMe

Agile Web Solutions, the authors of 1password, don't recommend that you use MobileMe (the-service-formally-known-as .Mac) for synchronising the keychain.


The instructions I followed uses iDisk to synchronise the keychain but I used my recently added SSH filesystem.


This is the same system I use for keeping Things synchronised across multiple Macs.

Thursday, 5 March 2009

Automatic synchronisation of OS X Addressbook without enabling Yahoo!

Update: Snow Leopard (10.6) has this built-in so there's no need for these instructions unless you're running Leopard (10.5) or lower. The following command will ensure this runs periodically:
$ /System/Library/PrivateFrameworks/GoogleContactSync.framework/Versions/A/Resources/gconsync --sync com.google.ContactSync --periodic

I am using Google Sync Services exclusively to synchronise between two MacBook Pros and an iPhone.

The one caveat is that to enable Addressbook synchronisation you have to enable, say, Yahoo! synchronising before the iSync client will allow synchronisations to occur.

Oh, and it's a manual process to launch iSync client.

This is an ugly hack to an otherwise elegant solution.  I don't like it.

So I went trawling the Internet to see if I could solve it.

I found an extremely informative post that outlines a lot of the work required.  Then, a sprinkle of launchd to make it all work.

Here's how it's done:

  1. Add a new "google" device in your devices list:
    $ defaults write ~/Library/Preferences/com.apple.iPod Devices -dict-add google '{ "Device Class" = iPod; "Family ID" = 10001; }'
  2. Launch Address Book and open the Preference pane. The Google contact sync option should appear.
  3. Register the sync client. Open a terminal and type the following:
    $ /System/Library/PrivateFrameworks/GoogleContactSync.framework/Versions/Current/Resources/gconsync --register 1
  4. Create the file, ~/Library/Preferences/com.google.GoogleContactSync.plist:
    {user = "username@gmail.com";}
  5. Add a password item to your keychain with the following values:
    Keychain Item Name:GoogleContactSyncService
    Account Name: username@gmail.com
    Password: password
  6. Create a Launch Agent. I have set the interval time to 300 seconds (5 mins). Obviously, it can be changed to something different. eg: ~/Library/LaunchAgents/com.example.gsync.plist:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>Label</key>
        <string>com.example.gsync</string>
        <key>ProgramArguments</key>
        <array>
          <string>/System/Library/PrivateFrameworks/GoogleContactSync.framework/Versions/A/Resources/gconsync</string>
          <string>--sync</string>
          <string>com.google.ContactSync</string>
          <string>--report</string>
          <string>1</string>
          <string>--entitynames</string>
          <string>"com.apple.contacts.Contact,com.apple.contacts.Email Address,com.apple.contacts.IM,com.apple.contacts.Phone Number,com.apple.contacts.Street Address"</string>
        </array>
        <key>StandardErrorPath</key>
        <string>/tmp/gsync.error</string>
        <key>StandardOutPath</key>
        <string>/tmp/gsync.log</string>
        <key>LowPriorityIO</key>
        <true/>
        <key>Nice</key>
        <integer>1</integer>
        <key>StartInterval</key>
        <integer>300</integer>
      </dict>
    </plist>
  7. Add the agent:
    $ launchctl load ~/Library/LaunchAgents/com.example.gsync.plist
  8. Reboot. (Yes, it's required. The program, when launched from launchd, won't find the password until you've rebooted. I'm sure there's a way to do it without, but I don't know what that is.)
  9. You can kick off a sync run manually by running:
    $ launchctl start com.example.gsync
    ... or you can wait the interval period for the next run.

Thursday, 26 February 2009

Automatic mounting of SSH filesystems in OS X

Getting your MacFUSE SSH filesystem to mount automatically on login isn't Voodoo, but it is Magick.

Here's how it's done using launchd:

Create a Properties List file under, ~/Library/LaunchAgents:

eg: ~/Library/LaunchAgents/com.example.sshfs.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>com.example.sshfs</string>
    <key>ProgramArguments</key>
    <array>
      <string>/opt/local/bin/sshfs</string>
      <string>user@example.com:path/to/share</string>
      <string>/path/to/mountpoint</string>
      <string>-f</string>
      <string>-o</string>
      <string>auto_cache,reconnect,volname=friendly_name</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

We can now load this into launchd by running,
$ cd ~/Library/LaunchAgents 
$ launchctl load com.example.sshfs.plist

Your SSH filesystem should now be mounted.
$ mount
    .
    .
    .
user@example.com:path/to/share on /path/to/mountpoint (fusefs, nodev, nosuid, synchronous, mounted by user)

Wednesday, 18 February 2009

Postbox

Firefox is to the web as Postbox is to ... email. I won't go into any details, there are plenty of reviews out on the Internet already, but here's a little nugget I discovered:

To increase the sanity of threaded conversations so that the originating message is at the top:
  • Tools → Options → Advanced → Config Editor
  • Search for: mail.conversation_display.reverse
  • Toggle value
  • Restart

Thursday, 5 February 2009

Yammer as a colaboration tool

Yammer is a new tool that we're playing with at work. 


It's like a mash-up of a micro-blogger (eg: Twitter) and an instant messenger (eg: MSN) but more organisation orientated.


To avoid having to run another program to keep a track of the posts, you can integrate with your favourite IM client. 


Just visit, https://www.yammer.com/account/im and follow the instructions.


We are planning to take an RSS feed of the posts and, using hash tags, produce time lines of product launch sequences, etc.

CLI tweets

Another quicky - Twittering from the command line:

$ curl --basic --user "username:password" --data-ascii "status=Twittering from the commandline" "http://twitter.com/statuses/update.json"

Wrapped in a very simple script:

#!/bin/bash

if [ ${#} -gt 0 ]; then
   STATUS="${*}"
else
   STATUS="$(cat -)"
fi

curl --basic --user "username:password" --data-ascii "status=${STATUS}" "http://twitter.com/statuses/update.json"

Wednesday, 4 February 2009

Flushing DNS cache on Mac OS X

This is quick post to capture a command that I sometimes need but always have to look up. 


It flushes the DNS cache on the local OS X instance.



$ dscacheutil -flushcache

Saturday, 31 January 2009

Izzard - in the bag!

Ha!!  We finally got real tickets for Eddie Izzard's Stripped tour.  The tickets are for December 3rd 2009 at the 02 Arena.

Man, that's going to be a long wait.

Thursday, 29 January 2009

Adding a shortcut key for Mail.app in OS X

At work I am forced to live with Microsoft Exchange and, consequently, Entourage on the Mac.

It's not the worst piece of software but I have now been trained to use CMD-Enter* as a shortcut for sending a composed message.

This only becomes a problem when I go to send a personal email using Mail.app. Mac OS X keyboard shortcuts to the rescue!

  • System preferences -> Keyboard & mouse.
  • Keyboard shortcuts.
  • Add application -> Mail.
  • Enter "Send" (without the quotes) as the menu item.
  • Enter your preferred shortcut.  (CMD-Enter* in this case).

On the next restart of Mail.app it will use the new shortcut.

*Where CMD is the ⌘ key.

Thursday, 22 January 2009

British rail... problem solved!

I reckon I've just solved the biggest problem that plagues British Rail* today.


It's a very simple solution and it costs next to nothing.


Are you ready?


... Change the timetables.


The trains obviously can't keep up with the current one.


The biggest problem commuters have is missing connections. If the timetables were scheduled better, commuters would be able to calculate their journeys more reliably. An added side effect is that, all of a sudden, rail company reliability statistics would be up and cancellations down. The trains are already overcrowded (this solution doesn't resolve that, but British Rail* aren't doing anything about it either) and already running on a delayed schedule.


Nothing actually changes -- except the advertised times. People would be less frustrated with the system when faced with a realistic timetable. I don't think this is a unique idea. I certainly don't think solves all the problems. But it is a cheap, easy solution to rail customer satisfaction levels.


*There's no single entity running all the trains any more. This should really be addressed to all the individual train companies that make up "British Rail".