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 / 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!
###############################################################################
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.
from pydantic import BaseModel, ConstrainedStr, StrictStr
class MyStr(ConstrainedStr):
to_upper = True
class Foo(BaseModel):
x: str
class Bar(BaseModel):
x: MyStr
@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="-"
@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 / split_columns_hobolink_export_2.csv
Created November 27, 2020 20:30
Another glitchy hobolink output
@dwreeves
dwreeves / definitions.py
Last active May 17, 2020 00:51
Module for `import_census_tract_data`, a function that allows for easy import of Census data into a Pandas DataFrame format.
"""
Definitions of various constants. Adjust based on project structure and needs.
"""
import os
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Files and Directories
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.