Skip to content

Instantly share code, notes, and snippets.

View mkwatson's full-sized avatar

Mark Watson mkwatson

View GitHub Profile
# Base URL and HTTP method
# Query Parameters:
# - teamId=110 is for the Orioles
# - daysBack=-6 gathers data for the previous week
curl -G 'https://bdfed.stitch.mlbinfra.com/bdfed/stats/player' \
--data-urlencode 'stitch_env=prod' \
--data-urlencode 'season=2023' \
--data-urlencode 'sportId=1' \
--data-urlencode 'stats=season' \
def analyze_stats(stats):
insights = ''
if stats['orioles']['batting_average'] > stats['diamondbacks']['batting_average']:
insights += 'The Orioles have a higher batting average than the Diamondbacks. '
else:
insights += 'The Diamondbacks have a higher batting average than the Orioles. '
if stats['orioles']['slugging_percentage'] > stats['diamondbacks']['slugging_percentage']:
insights += 'The Orioles have a higher slugging percentage than the Diamondbacks. '
else:
{
"data": {
"offer": {
"offer": {
"id": "58950f92-62f2-4de8-b9df-744202c7cd42",
"pathSegment": "dub-nation-deals-b5a6e0b",
"offerShape": "event",
"status": "draft",
"selections": {
"views": [
query GetOffer($offerPathSegment: String!, $limit: Int!, $offset: Int = 0, $searchQuery: String, $minPrice: Int, $maxPrice: Int, $startDate: DateTime, $endDate: DateTime, $level1Filter: String, $level2Filter: String, $showAda: Boolean, $eventSort: EventSelectionsSort, $eventView: EventSelectionsView, $tickets: Int, $rootOfferId: UUID, $appliedCodes: [String!]) {
offer {
offer(pathSegment: $offerPathSegment, rootOfferId: $rootOfferId, appliedCodes: $appliedCodes) {
...offerInfo
__typename
children(limit: $limit, offset: $offset, searchQuery: $searchQuery, minPrice: $minPrice, maxPrice: $maxPrice, startDate: $startDate, endDate: $endDate, level1Filter: $level1Filter, level2Filter: $level2Filter, showAda: $showAda, eventSort: $eventSort, eventView: $eventView, tickets: $tickets) {
limit
offset
total
results {
from playwright.sync_api import Playwright, sync_playwright, expect
def run(playwright: Playwright) -> None:
browser = playwright.chromium.launch(headless=False)
context = browser.new_context()
page = context.new_page()
page.goto("https://www.nba.com/warriors/tickets/dub-nation-deals-activate-your-offer")
import json
import requests
from bs4 import BeautifulSoup
url = 'https://www.espn.com/nba/game/_/gameId/401360739'
soup = BeautifulSoup(requests.get(url).text, 'html.parser')
play_by_play = soup.find("div", {"data-plays": True}).attrs['data-plays']
print(json.dumps(json.loads(play_by_play), indent=2))
curl 'https://core-hsr.duneanalytics.com/v1/graphql' \
--data-raw $'
{
"operationName": "FindResultDataByResult",
"variables": { "result_id": "f0de20b7-fad3-4b20-adcd-4f8885292b7c" },
"query":"query FindResultDataByResult($result_id: uuid\u0021) {\\n query_results(where: {id: {_eq: $result_id}}) {\\n id\\n job_id\\n error\\n runtime\\n generated_at\\n columns\\n __typename\\n }\\n get_result_by_result_id(args: {want_result_id: $result_id}) {\\n data\\n __typename\\n }\\n}\\n"}
'
curl 'https://services.bovada.lv/api/v1/login' \
-H 'authority: services.bovada.lv' \
-H 'sec-ch-ua: "Google Chrome";v="93", " Not;A Brand";v="99", "Chromium";v="93"' \
-H 'x-captcha-token: 03AGdBq24EpCDwSJ6OYHgLmncLaWITuN95KGivyeuOqE7oySi0TNxFUnOkJ6V0LdaQQovtmMG3anY9V_zdnPJ4lyruQ16KAs5VJMcqywS3tCyiVQzxh23sylGIxF_C3hjtMFPXC2u6zptAzxWS_9jQhRfYivwaYZga9vCQ8FRP42uw3NzYqln6JCGJO7acZGTi4PQQE8yQqc58Vwz4EAaBUew-oF3qf0o866UUSpUjFGQF6QvcN151-xSCxjm-4BvyZl6rPFpW3zff55t9eimtW7rtTByTn_6aaFeyrMuV2lIu9Kt--MZc06_5AGd9PP6kDg0Hp9sFWHjMotiLp-1o9xdAYpGcC57ReCdPR7WDBpMVQ6mLELBnU-BrhIxcmdTi9anNH3Oc5jb0et00pnsmaQt8VqvcIaMI_WSCI8qVASwphioyEZqf0nZoAv2sGg9lBAKmgCB3WuYeRXGanDzXoz0FVHNGVSK7oQ' \
-H 'dnt: 1' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36' \
-H 'elastic-apm-traceparent: 00-3699c33d9b3958d0e6a5c1aba6d5b3ef-39fb1f3626aa8a8b-00' \
-H 'x-channel: desktop' \
-H 'content-type: application/js
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
@mkwatson
mkwatson / golf.sh
Last active July 16, 2021 17:52
Search US golf courses with jq
# You might want to download all_course_ratings.json locally first
# QUESTION: What's the jq command to only return the TeeRows for TeeName=White and Gender=Male for a given course?
# Below is the query to return all tee rows for a course, in this case Peacock Gap Golf Club:
curl https://golfcourses.s3.us-west-1.amazonaws.com/all_course_ratings.json | \
jq '
.[] |
select(