This file contains 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 Luhn = { | |
// length of our number (check digit included) | |
length: 10, | |
pow2: [0, 2, 4, 6, 8, 1, 3, 5, 7, 9], | |
// compute check digit | |
checksum: function (x) { | |
var sum = 0; | |
var n; | |
var odd = false; | |
for (var i = x.length - 1; i >= 0; --i) { |
This file contains 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
SET GLOBAL innodb_flush_log_at_trx_commit=2; | |
//Make your inserts | |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
This file contains 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
SHOW TABLE STATUS FROM `DatabaseName` LIKE 'TableName' ; |
This file contains 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
// Set a fake timeout to get the highest timeout id | |
var highestTimeoutId = setTimeout(";"); | |
// clear all timeouts with an id between 0 and highestTimeoutId | |
for (var i = 0 ; i < highestTimeoutId ; i++) { | |
clearTimeout(i); | |
} |
This file contains 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
/** | |
A pseudo random integer between 0 and MAX_VALUE according to a number n, | |
returns always the same pseudo random number when giving the same n and MAX_VALUE | |
*/ | |
function pseudoRandomLCG(n, MAX_VALUE){ | |
var a = 25214903917; var c = 11; | |
var m = Math.pow(2,32); | |
var x = 0; | |
for(var i = 0;i<n;i++){ | |
x = (a+x*c) %m; |