This file contains hidden or 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
| # /// script | |
| # requires-python = ">=3.13" | |
| # dependencies = [ | |
| # "matplotlib>=3.10.8", | |
| # "numpy>=2.4.2", | |
| # ] | |
| # | |
| # /// | |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| ALLOWED_VALUES=("$@") | |
| while IFS='=' read -r key value; do | |
| [[ -z "$key" || "$key" =~ ^# ]] && { echo "$key"; continue; } | |
| if [ "${#ALLOWED_VALUES[@]}" -eq 0 ]; then | |
| echo "$key=$value" | |
| continue |
This file contains hidden or 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 alpine:latest AS cert-init | |
| RUN apk add openssl | |
| WORKDIR /root/ssl | |
| RUN openssl req -x509 -nodes -newkey rsa:2048 \ | |
| -keyout key.pem \ | |
| -out cert.pem \ | |
| -days 365 \ | |
| -sha256 \ | |
| -subj "/CN=localhost" \ | |
| -addext "subjectAltName=DNS:localhost,IP:127.0.0.1" |
This file contains hidden or 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
| """Utility script to export the OpenAPI spec from a FastAPI service. | |
| Usage: | |
| python3 fastapi2openapi path.to.module:app -C root/of/package --file openapi.yaml | |
| Where the unnamed argument is the location of the app (the module:app_variable). -C is the working directory to import from. And --file is the file to output. | |
| Note that the output file will be relative to the current working directory and not the location in -C. | |
| """ |
This file contains hidden or 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
| # Docker compose file for testing the build process locally | |
| services: | |
| frontend: | |
| container_name: frontend | |
| build: | |
| context: . | |
| args: | |
| - NEXT_PUBLIC_LOCAL=http://localhost:8080 | |
| ports: | |
| - "3000:3000" |
This file contains hidden or 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
| # /// script | |
| # requires-python = ">=3.11" | |
| # dependencies = [ | |
| # "pydantic", | |
| # "fastapi", | |
| # "uvicorn[standard]", | |
| # ] | |
| # /// | |
| import datetime |
This file contains hidden or 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
| """ | |
| Live utility for converting `.model_validate({...})` calls into | |
| model constructor calls with snake_case keyword arguments. | |
| The module watches itself for changes, reloads on save, transforms | |
| the code in `SAMPLE` and copies it to the clipboard. | |
| """ | |
| import importlib.util | |
| import os |
This file contains hidden or 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
| def _show_commands(): | |
| """Print the help for each of the functions.""" | |
| import inspect | |
| import tokenize | |
| import scripts as module | |
| def get_docs(fns: dict[str, str]) -> dict[str, str]: | |
| result = {} |
This file contains hidden or 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
| param($DURATION) | |
| $_POS = $DURATION.IndexOf(":") | |
| $MINS = $DURATION.SubString(0, $_POS) | |
| $SECS = $DURATION.SubString($_POS + 1, $DURATION.Length - [Int64]$_POS - 1) | |
| $TOTAL_SECS = (([Int64]$MINS) * 60) + $SECS | |
| $REMAINING_SECS = $TOTAL_SECS | |
| while ($REMAINING_SECS -gt 0) { | |
| Write-Host -NoNewLine "`rSleeping after $REMAINING_SECS seconds" | |
| Start-Sleep -s 1 | |
| $REMAINING_SECS-- |
This file contains hidden or 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
| PYTHON3_USER_SITE=$(python3 -c 'import site;print(site.USER_SITE)') | |
| [ $(python3 --version | grep '3.11') ] || (rm -rf /opt/conda & sudo add-apt-repository ppa:deadsnakes/ppa && | |
| sudo apt update && | |
| sudo apt install -yqq python3.11 python3.11-distutils && | |
| curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 && | |
| sudo update-alternatives --install /usr/bin/python3 python3 $(which python3.11) 1 && | |
| sudo update-alternatives --config python3 && | |
| python3 -m pip install -q packaging requests kaggle && | |
| # python3 -m pip config set global.extra-index-url $(python3 -c 'import subprocess, requests, re, packaging.version;cuda_version = int(next(result for result in re.findall( r"(?<=release )(\d+)|(^-1)",subprocess.check_output(r"nvcc -V", shell=True).decode(),flags=re.MULTILINE,)[0] if result));print("https://download.pytorch.org/whl/"+(sorted([version for version in re.findall(r"^\<a href=\"(cpu|cu\d+)\/torch-(\d+\.\d+\.\d+)",requests.get("https://download.pytorch.org/whl/torch_stable.html" |
NewerOlder