Skip to content

Instantly share code, notes, and snippets.

@dsetzer
dsetzer / default-martingale.js
Last active March 31, 2023 12:22
default martingale script from bustabit converted to bustadice.
const config = {
baseBet: { value: 100, type: 'balance', label: 'Base bet' },
payout: { value: 2, type: 'multiplier', label: 'Payout' },
stop: { value: 1e8, type: 'balance', label: 'Stop if bet >' },
loss: { value: 'increase', type: 'radio', label: 'On Loss', options: {
base: { type: 'noop', label: 'Return to base bet' },
increase: { value: 2, type: 'multiplier', label: 'Increase bet by' }
}},
win: { value: 'base', type: 'radio', label: 'On Win', options: {
base: { type: 'noop', label: 'Return to base bet' },
@dsetzer
dsetzer / cumulativeProbs.js
Created July 29, 2022 13:02
Probability functions (codex generated)
// Cumulative Geometric Probability
function getGeoProb(p, n) {
return (1 - Math.pow(p, n)) / (1 - p);
}
// Cumulative Hypergeometric Probability
function getHyperProb(N, n, K, k) {
return getCombin(K, k) * getCombin(N - K, n - k) / getCombin(N, n);
}
@dsetzer
dsetzer / README.md
Created January 26, 2023 20:50 — forked from fahadysf/README.md
A multiprocess task broker which accepts and provides status reports for tasks using JSON REST API calls.

Multiprocess Task Broker with REST API

This gist shows and example or an asynchronous multiprocess task broker which can take job requests and report on running jobs via a minimal REST API.

Adapted from https://gist.github.com/nitaku/10d0662536f37a087e1b

All of the caveats from the original author still apply.

@dsetzer
dsetzer / climb3-v1.5-sim-dice.js
Last active January 15, 2023 14:07
climb3-v1.5 script for dice with included sim mode.
var config = {
baseBet: { label: 'Base Bet', type: 'balance', value: 1000 },
minPayout: { label: 'Target Min', type: 'multiplier', value: 1.08 },
maxPayout: { label: 'Target Max', type: 'multiplier', value: 50.00 },
divPayout: { label: 'Target Div', type: 'multiplier', value: 0.80 },
compRate: { label: 'Compound %', type: 'multiplier', value: 0.02 },
compStep: { label: 'Compound At', type: 'multiplier', value: 1.10 },
betSpeed: { label: 'Bet Speed', type: 'multiplier', value: 100 },
simMode: { label: 'Sim Mode', type: 'checkbox', value: true },
simBal: { label: 'Sim Balance', type: 'balance', value: 1000000 }
@dsetzer
dsetzer / default-bab-mart-bustadice.js
Last active January 11, 2023 13:59
Bustadice's default martingale script is less configurable than bustabit's so I made a bustadice version out of it. (this is for use on bustadice).
var config = {
baseBet: { value: 100, type: 'balance', label: 'base bet' },
stopBet: { value: 1e8, type: 'balance', label: 'stop if bet >' },
basePayout: { value: 2, type: 'multiplier' },
stopPayout: {value: 20,type: 'multiplier',label: 'stop if payout >'},
lossBet: {
value: 'increase', type: 'radio', label: 'Bet On Loss',
options: {
base: { type: 'noop', label: 'Return to base bet' },
increase: { value: 2, type: 'multiplier', label: 'Multiply bet by' },
@dsetzer
dsetzer / Pattern-System-v1.4.js
Last active December 19, 2022 11:14
Dynamic Pattern System v1.4 work in progress prototype for bustabit/bustadice scripts.
// ----------------------- V1.4 -------------------------
// This utility function will check an array of game results for a given pattern and return the most recent occurrence of a
// match. The pattern is specified using a regex-style syntax that uses the available tokens defined in the token list. The
// token list is an array of objects containing a token letter and a callback function that is used to check if the game results
// match the specified condition. It returns an array containing the game result objects for the matched results.
function checkPattern(pattern, results, tokens){
let tokenLetters = pattern.match(/\w/g);
let filteredTokens = tokens.filter((token) => tokenLetters.includes(token[0]));
let res = results.map((r, i) => (`[${i}${filteredTokens.filter((e) => e[1](r)).map((e) => (e[0])).join('')}]`)).reverse().join('');
@dsetzer
dsetzer / Array.prototypes.js
Last active September 25, 2022 05:15
A set of Array utils which I use (It should be noted that some are dependent on others)
// Calculates the sum of the items in the array.
// The sum is the result of adding all the items together.
Array.prototype.sum = function(){
return this.reduce((a, b) => a + b);
}
// Checks whether the specified item is present in the array.
Array.prototype.contains = function (item) {
return this.find(x => x === item) !== undefined;
}
@dsetzer
dsetzer / ResolveKeyWorkers.js
Last active July 25, 2022 20:10
Partial Private Key Solver
async function resolveKeyWorkers(brokenKey, startIter, numWorkers) {
var updateFrequency = 100000 * Number(numWorkers);
var splitKey = brokenKey.split("?");
var iteratorStart = Number(startIter) || Math.pow(58, (splitKey.length - 2));
var duration = Math.pow(58, (splitKey.length - 1));
var workers = [];
var latestStatus = null, latestUpdate = 0;
var statusUpdate = function (info) {
if (!latestStatus || info[0] > latestStatus[0]) {
latestStatus = info;
@dsetzer
dsetzer / bab_to_ether-dice.js
Created March 21, 2021 22:36
Script wrapper for running bustabit scripts on ether-dice. This expects the bustabit script to be standard format where bets are placed at GAME_STARTING event. Scripts with everything in GAME_ENDED will skip endlessly. Also don't expect any Ruzli scripts to work, it's a miracle those run to begin with.
engine.bet=function(e,n){this.nextBet={value:e,target:n}},engine.getState=(()=>{}),engine.cashOut=(()=>{});const gameResultFromHash=()=>{},SHA256=()=>{};engine.history={first(){let e=engine.nextResult;if(e||(e=engine.getLastGamePlayed),e){let n={id:e.id,hash:e.hash,bust:e.crash};return["NOT_PLAYED","SKIPPED"].includes(engine.getLastGamePlay)||(n.wager=e.wager,e.cashout<=e.crash&&(n.cashedAt=e.cashout)),n}return{id:0,hash:"none",bust:0,wager:0,cashedAt:0}}};const log=console.log,stop=engine.stop,userInfo={get uname(){},get balance(){return engine.getBalance}};engine.on("script_started",()=>{setTimeout(async()=>{for(;;)engine.nextBet=null,engine.nextResult=null,await engine.emit("GAME_STARTING"),null!==engine.nextBet?(engine.emit("BET_PLACED",{uname:"temp",wager:engine.nextBet.value,payout:engine.nextBet.target}),engine.nextResult=await engine.placeBet(engine.nextBet.value,engine.nextBet.target)):engine.nextResult=await engine.skip(),engine.emit("GAME_STARTED"),"WON"===engine.getLastGamePlay&&engine.emit("CASHE
@dsetzer
dsetzer / daffie-v4.0-stable.js
Last active December 7, 2021 01:39
bustadice script
const DEBUG = !0
const BET_BALANCE = 0.03 // max bankroll available to bet with
const MAX_CUT_OFF = 1.5
const MIN_CUT_OFF = 1.08
const BET_SPEED = 300
const iskips = 20
const hmrsv = 3
let prevresults = [];
let previous_losses = [];
let loseStreak = 0;