Add autoupdate to a plug-in

Just curious if anyone had sample or skeleton code for an auto-upgrade to add to a plug-in to enable the plug-in to notify the admin that a new version is available and automatically download and install the new version (like is done with plugins on wordpress site)?