Skip to content

Instantly share code, notes, and snippets.

@morganrallen
Created May 15, 2013 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morganrallen/5587161 to your computer and use it in GitHub Desktop.
Save morganrallen/5587161 to your computer and use it in GitHub Desktop.
Open Stava upload new content page when Garmin Edge 305 is plugged in. NodeJS, node-udev
#!/usr/bin/env node
var udev = require("udev");
var monitor = udev.monitor();
monitor.on("add", function(device) {
// change vendor and model IDs to match your device if not Garmin Edge 305
if(device.ID_VENDOR_ID === "091e" && device.ID_MODEL_ID === "0003") {
require("child_process").spawn("xdg-open", ["http://app.strava.com/upload/garmin_new"], {
env: process.env
});
};
});
@morganrallen
Copy link
Author

Only tested on Linux. I'd imagine if udev compiles on OSX changing xdg-open to just open will allow it to work there also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment