Skip to content

Instantly share code, notes, and snippets.

View mkirlin's full-sized avatar

Michael Gandhi-Kirlin mkirlin

View GitHub Profile
@mkirlin
mkirlin / fbb_schedule_generator.py
Created October 20, 2023 04:15
FBB Schedule Generator
import itertools
import random
# Define the team names, divisions, positions from the previous year, and designated rivals
teams = [
{"name": "Team A", "division": 1, "position": 1, "rival": "Team B"},
{"name": "Team B", "division": 1, "position": 2, "rival": "Team A"},
{"name": "Team C", "division": 1, "position": 3, "rival": "Team D"},
{"name": "Team D", "division": 1, "position": 4, "rival": "Team C"},
{"name": "Team E", "division": 2, "position": 1, "rival": "Team F"},
@mkirlin
mkirlin / yahoo-google-sheets-script.py
Created October 4, 2023 20:35
ChatGPT script for pulling transactions from Yahoo fantasy sports API
import requests
from urllib.parse import urlencode
import gspread
from oauth2client.service_account import ServiceAccountCredentials
# Define your API credentials
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
redirect_uri = "YOUR_REDIRECT_URI" # You set this when registering your app
access_token = None
@mkirlin
mkirlin / sample.py
Last active February 28, 2020 19:59
def list_available_params(self):
"""Iterates over Odin query methods and creates a list of available queries for a
client. Any methods added to this class will be included in this response if they
are prefaced with "_get_".
Returns:
list -- list of strings corresponding to methods on this class that are prefaced
with "_get_", excluding "_get_odin_info"
"""
method_list = [
@mkirlin
mkirlin / send_groupme_message_with_notifications.py
Created February 20, 2020 20:33
An attempt at sending a message to a GroupMe group that includes @mentions for users.
def _send_message(bot, message_to_send):
attachments = _format_attachments(bot, message_to_send)
print(attachments)
response = requests.post(
f"{GROUPME_URL}/bots/post",
params={"token": GROUPME_TOKEN},
data = {
"bot_id": bot.get("bot_id"),
"text": message_to_send,
"attachments": attachments
@mkirlin
mkirlin / install-pre-commit.sh
Last active August 31, 2016 22:01 — forked from stefansundin/install-pre-commit.sh
Git pre-commit check to stop accidental commits to master and develop branches. There is also a variant with a core.whitespace check.
#!/bin/sh
# This script will install a Git pre-commit hook that stop accidental commits to master and develop branches.
# There is also a variant that includes a core.whitespace check. See pre-commit-2 below.
# Install in current Git repo:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh
# Install with core.whitespace check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-2
# Install with core.whitespace check and EOF-newline-check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-3
# Install only core.whitespace check: