Skip to content

Instantly share code, notes, and snippets.

@trbarron
trbarron / handler.py
Last active February 13, 2023 23:07
little selenium thing to find Jack a top golf reservation
import time
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from twilio.rest import Client
# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
# os.environ['TWILIO_ACCOUNT_SID']
# This is a script to find the answer to the Riddler.
# https://fivethirtyeight.com/features/can-you-hunt-for-the-mysterious-numbers/
import random, time
def find_1_digit_factors(target):
factors = []
for value in range(1, 10):
if (target % value == 0):
factors.append(value)
from itertools import permutations
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
num_rings = 5
def find_config(num_rings):
rings = [i for i in range(num_rings)]
for i in range(num_rings-1):
def eval_equation(braces, input):
# Takes in input as a list of numbers
# Takes in braces as a list of "-1"s (closed |'s) and 1's (opened |'s)
# Returns the evaluation
eq = ""
for i in range(num_braces):
import pandas as pd
import itertools, time, string
fname = "enable1.txt"
def read_in_word_list(fname):
data = []
with open(fname, "r") as word_list:
for w in word_list:
w = w.rstrip('\n')
Sub csv()
Dim MyFileName As String
Dim CurrentWB As Workbook, TempWB As Workbook
Set CurrentWB = ActiveWorkbook
ActiveWorkbook.ActiveSheet.UsedRange.Copy
Set TempWB = Application.Workbooks.Add(1)
With TempWB.Sheets(1).Range("A1")
import pickle
import peloton
username = "username_1"
workouts = peloton.PelotonWorkout.list()
with open(username+".pkl","wb") as f:
pickle.dump(workouts,f)
import math, random
import matplotlib.pyplot as plt
import matplotlib.cm as cm
plt.style.use('dark_background')
def create_point():
x = random.random()
y = random.random()
return x,y
import random
max_outs = 3
innings = 9
game_num = 100000 #num games to run for each matchup
def batter_up(batting_power,batting_perc,i_bases,i_outs):
hit = random.random() < batting_perc
if hit:
if batting_power == 1: