$ uv run magic.py "Houston Astros"
Reading inline script metadata from: magic.py
The magic number for the Houston Astros is 12.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from botocore.config import Config | |
from . import config | |
r2 = boto3.client( | |
service_name="s3", | |
endpoint_url=config.R2_S3_ENDPOINT, | |
aws_access_key_id=config.R2_ACCESS_KEY_ID, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// yarn add commandbar or npm install commandbar --save | |
import { useEffect } from 'react' | |
import { init as initCommandBar } from 'commandbar' | |
const COMMANDBAR_ORG = | |
process.env.COMMANDBAR_ORG || process.env.NEXT_PUBLIC_COMMANDBAR_ORG | |
function useCommandBar({ org = COMMANDBAR_ORG, userId, userMeta = {} }) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# custom sqlalchemy column type for a pendulum datetime - https://pendulum.eustace.io/ | |
from datetime import datetime | |
import pendulum | |
import sqlalchemy as sa | |
from sqlalchemy.types import TypeDecorator as _TypeDecorator | |
from sqlalchemy_utils.types.scalar_coercible import ScalarCoercible as _ScalarCoercible |
#til #git #github
curl -u amcclosky:<personal access token> https://api.github.com/repos/amcclosky/baseball/events
curl -u amcclosky:<personal access token> -X POST -d '{"ref":"refs/heads/recover-office-hours", "sha":"d460395af3337bc6b71fd19b154f831ecc6cfa01"}' https://api.github.com/repos/amcclosky/baseball/git/refs
github - How to recover from a git push -force? - Stack Overflow
A sqlalchemy model mixn, GlobalIdMixin
which provides a global roughly time-ordered identifier and an obfuscated version of the global id for public consumption.
Makes use of python-ulid, PL/sql ULID and hashids-python.
ULID is a format for k-ordered distributed id generation. i.e. you can generate a random unique id with no central coordination and later be able to mostly sort the ids by the time they were generated.
If ids are generated within the same second on different instances they could be out of order within that second.
Source of this code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mcr.microsoft.com/vscode/devcontainers/python:3.7 | |
# Docker script args, location, and expected SHA - SHA generated on release | |
ARG USERNAME=vscode | |
ARG USER_UID=1000 | |
ARG USER_GID=$USER_UID | |
ARG DOCKER_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/docker-debian.sh" | |
ARG DOCKER_SCRIPT_SHA="dev-mode" | |
ARG ENABLE_NONROOT_DOCKER="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CSVImportMixin: | |
"""Adds from_csv to a SQLAlchemy model class.""" | |
__tablename__ = None | |
__upsert_keys__ = ("id",) | |
@classmethod | |
def _columns(cls): | |
_columns = get_columns(cls) | |
return [c for c in _columns] |
NewerOlder