Skip to content

Instantly share code, notes, and snippets.

View tamzid2001's full-sized avatar
:atom:
Working from home

Tamzid Ullah tamzid2001

:atom:
Working from home
View GitHub Profile
@tamzid2001
tamzid2001 / fanduel_automation.js
Last active May 30, 2026 23:12
Fanduel Automation
async function fanduel() {
// var response = await request.get(`https://sportsbook.draftkings.com/leagues/basketball/nba`);
// var $ = cheerio.load(response);
// var buttonLength = 0;
// var c;
// $("#fittPageContainer > div:nth-child(2) > div > div:nth-child(6) > div > div.PageLayout__Main > section.Card.Card--PlayByPlay > div > nav > ul > li").each((index, element)=>{
// c = $(element).find('button');
// });
//executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", userDataDir: '/Users/tamzidullah/Library/Application Support/Google/Chrome/Tamzid'
const browser = await puppeteer.launch({ headless: false});
@tamzid2001
tamzid2001 / pivots.js
Last active June 22, 2023 23:56
Pivotal Moments within a Basketball Game
function pivots(n, s) {
var pivots = [];
for(var i = 0; i < n.length - 5; i++) {
//console.log(n[i]);
if(n[i].diff < 0 && n[i+1].diff > 0 && n[i+2].diff > 0 && n[i+3].diff > 0 && n[i+4].diff > 0 && n[i+1].diff === 2 && n[i+2].diff === 1 && n[i+3].diff === 2 && n[i+4].diff === 3) {
pivots.push({
team: `${s}`,
quarter: n[i+4].quarter,
time: n[i+4].time,
seconds: n[i+4].seconds,
@tamzid2001
tamzid2001 / winner.js
Created June 8, 2023 03:07
Determine Ball Game Winner in Javascript
function determineWinner(a, h) {
var softmax;
var swinner;
for(var x = 0;x < a.length - 2;x++) {
softmax = Math.E ** a[x+2].difference / ((Math.E ** a[x+2].difference) + (Math.E ** a[x+1].difference) + (Math.E ** a[x].difference));
if(a[x+2].difference > a[x+1].difference && a[x+1].difference > a[x].difference && softmax < 0.85) {
swinner = 'away';
} else {
swinner = '';
}
@tamzid2001
tamzid2001 / differentials.js
Created June 5, 2023 02:37
Create a Point Differentials Object
//basketball object
var testscore = [[0,2],[0,4],[0,6],[2,6]];
console.log(calculateDiff(testscore, 0));
function calculateDiff(s,t) {
scoreDiff = [];
for(var x = 0;x < s.length - 1;x++){
currentAwayScore = s[x][0];
transitionScoreAway = s[x+1][0];
currentHomeScore = s[x][1];
transitionScoreHome = s[x+1][1];