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 crypto = require('crypto'); | |
function divisible(hash, mod) { | |
/* Reduce the hash digit by digit to stay in the signed 32-bit integer range. */ | |
var val = hash.split('').reduce(function(r,d) { | |
return ((r << 4) + parseInt(d,16)) % mod ; }, 0); | |
return val == 0; | |
} | |
function genCrashpoint(serverSeed, clientSeed) { |
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 rpcuser = ''; | |
var rpcpass = ''; | |
// Maximum number of inputs per transaction. | |
var maximumInputs = 32; | |
// Maximum number of transaction to generate; | |
var maximumTransactions = 5; | |
function getfee(inputs) { |
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
#!/usr/local/bin/gnuplot | |
reset | |
set terminal png size 1920,1200 | |
set output "moneypot-profit.png" | |
set xlabel "Time" | |
set ylabel "Profit" | |
set title "MoneyPot - Profit" | |
set xtics 2592000 # 30 days in seconds |
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
SELECT vs.* FROM | |
GENERATE_SERIES(1e6::bigint, (SELECT max(id) FROM games)) vs | |
LEFT JOIN games ON vs = games.id | |
WHERE games.id IS null; |
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
#!/usr/local/bin/gnuplot | |
reset | |
set terminal png size 1920,1200 | |
set output "moneypot-wagered.png" | |
set title "MoneyPot - Wagered and profit" | |
set xlabel "Time" | |
set xtics 2592000 # 30 days in seconds |
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
#!/usr/local/bin/gnuplot | |
reset | |
# set terminal png size 1280,600 | |
# set output "moneypot-houseedge.png" | |
set terminal svg enhanced size 1920 1080 | |
set output "moneypot-houseedge.svg" | |
set ylabel "house edge %" | |
set xlabel "cashout multiplier" |
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 fs = require('fs'); | |
var readline = require('readline'); | |
var fp = process.argv[2]; | |
var st = fs.createReadStream(fp, 'utf8'); | |
var rl = readline.createInterface({input: st}); | |
rl.on('line', function(line) { | |
var fields = line.split(','); | |
var id = parseInt(fields[0]); |
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 _ = require('lodash'); | |
var a = [0.2,0.1]; | |
var b = [10,30]; | |
var a0 = 1 - _.reduce(a, function(s, n) { return s + n; }); | |
function concave(x) { | |
var result = a0 * Math.log(1 - x); | |
for (var i = 0; i < a.length; ++i) | |
result += a[i] * Math.log(1 + b[i] * x); |
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
WITH t AS | |
(SELECT | |
user_id, | |
(COALESCE(sum(cash_out - bet), 0::numeric) | |
+ COALESCE(sum(bonus), 0::numeric))::bigint AS gross_profit, | |
(COALESCE(sum(cash_out), 0::numeric) | |
+ COALESCE(sum(bonus), 0::numeric) | |
- COALESCE(sum(bet), 0::numeric))::bigint AS net_profit, | |
COUNT(*) AS games_played | |
FROM plays |
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
data Bit = I | O | |
deriving Show | |
type Bits = [Bit] | |
factorial :: Integer -> Integer | |
factorial 0 = 1 | |
factorial n = n * factorial (n-1) | |
binom :: Integer -> Integer -> Integer |
OlderNewer