Skip to content

Instantly share code, notes, and snippets.

View travisjungroth's full-sized avatar

Travis Jungroth travisjungroth

View GitHub Profile
@travisjungroth
travisjungroth / qwixx.py
Last active June 26, 2023 21:12
The Qwixx dice game in Python. Made to be used with reinforcement learning.
from __future__ import annotations
from abc import abstractmethod
from contextlib import suppress
from dataclasses import dataclass, field
from enum import Enum
from itertools import accumulate, chain
from random import choice, randrange
from typing import ClassVar, Container, Iterable, Literal, Optional, Protocol
@travisjungroth
travisjungroth / emojify
Last active July 14, 2022 16:17
Script to convert image files to the Slack suggest format: 128x128 PNG with transparent background.
#!/bin/zsh
# this requires imagemagick to run
# brew install imagemagick && brew install ghostscript
# on Mac, download then run `mv ~/Downloads/emojify /user/local/bin/emojify`
# emojify file [output-name]
# examples
# emojify ~/Downloads/img.png winky-face
# emojify ~/Downloads/winky-face.jpg
@travisjungroth
travisjungroth / post-commit.sh
Created January 23, 2023 04:29
Run the pre-commit tool and commit any changes. Save to .git/hooks/post-commit or add as a line.
#!/usr/bin/env bash
messages=$(git log --format=%s -3)
repeated="autocommit
autocommit
autocommit"
if [ "$messages" = "$repeated" ]; then
echo "3 times, enough already."
exit 1
fi
season team date rating elo
1871 ATL 1871-10-07 1478.511 1478.809
1871 CHC 1871-10-30 1471.351 1471.722
1871 CL1 1871-09-27 1425.456 1425.26
1871 FW1 1871-08-29 1420.555 1421.763
1871 NY2 1871-10-18 1446.61 1445.148
1871 PH1 1871-10-30 1481.406 1481.057
1871 RC1 1871-09-15 1430.404 1431.09
1871 TRO 1871-10-23 1445.928 1445.261
1871 WS3 1871-09-29 1449.779 1449.89
@travisjungroth
travisjungroth / baseball_last_names.py
Last active February 5, 2025 19:04
What last name has appeared in the MLB each year for the longest time?
from collections import defaultdict
import pandas as pd
# Data is from seanlahman.com
people = pd.read_csv(
"People.csv",
encoding="latin-1",
low_memory=False