Created
June 19, 2012 22:51
-
-
Save sturadnidge/2956992 to your computer and use it in GitHub Desktop.
Fix UUIDs incorrectly displayed by HP iLO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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