Skip to content

Instantly share code, notes, and snippets.

@sturadnidge
Created June 19, 2012 22:51
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 sturadnidge/2956992 to your computer and use it in GitHub Desktop.
Save sturadnidge/2956992 to your computer and use it in GitHub Desktop.
Fix UUIDs incorrectly displayed by HP iLO
var rl = require('readline');
var fs = require('fs');
var i = rl.createInterface(process.stdin, process.stdout, null);
i.question("Enter the UUID to correct: ", function(answer) {
var uuidArray = answer.split("-");
// only the first half of the UUID is wrong, so iterate
// over first 3 array values and reverse in pairs
for ( var j = 0; j < 3; j++ ) {
uuidArray[j] = uuidArray[j].match(/../g).reverse().join('');
}
var correctUUID = uuidArray.join("-").toLowerCase();
console.log();
console.log(correctUUID);
// without these 2 lines, the program would run forever
i.close();
process.stdin.destroy();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment