Skip to content

Instantly share code, notes, and snippets.

View dwreeves's full-sized avatar

Daniel Reeves dwreeves

  • Battery
  • Boston, MA
View GitHub Profile
@dwreeves
dwreeves / necro.py
Created May 30, 2018 22:50
MTG Necropotence Utility Curve
from random import shuffle
import csv
###############################################################################
## PARAMETERS
###############################################################################
# STARTING HANDS
# Cards are ordinally ranked from 1 (best) to 99 (worst)
@dwreeves
dwreeves / mic-fix
Created August 11, 2022 16:08
OSX Monterey fix for auto-adjusting volumes with Bluetooth microphones. Add me to your `~/.local/bin` and `chmod +x ~/.local/bin`
#!/bin/bash
set -eo pipefail
function maybe_make_a_volume_adjustment {
volume=`osascript -e "input volume of (get volume settings)"`;
(( vol_adj=((volume+50)/2-volume)/5 ));
if [ ${vol_adj} -lt 0 ]
then
sign="-"
from pydantic import BaseModel, ConstrainedStr, StrictStr
class MyStr(ConstrainedStr):
to_upper = True
class Foo(BaseModel):
x: str
class Bar(BaseModel):
x: MyStr
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dwreeves
dwreeves / profile-dbt-versions.sh
Last active April 1, 2024 16:35
Memory profiling for dbt-core versions
#!/bin/bash
set -euxo pipefail
###############################################################################
# Notes:
# - Caveat emptor. Script is presented as is, no warranty expressed, etc.
# - Requires uv to be installed
# - Set the environment variables + any other env vars you need to run dbt.
# - This script will delete your .venv; be careful. Set env vars correctly!
###############################################################################