Skip to content

Instantly share code, notes, and snippets.

View CallumJHays's full-sized avatar

Cal Hays CallumJHays

View GitHub Profile
@CallumJHays
CallumJHays / README.md
Last active May 14, 2025 02:56
AWS CLI Rds-Data Query to CSV using jq

AWS CLI Rds-Data Query to CSV using jq

Bash script for using awscli rds-data cli for querying RDS db and outputting to CSV with jq

Usage

DB_NAME=my-db \
SQL_FILE=./my-query.sql \
RDS_CLUSTER_ARN=arn:aws:rds:::cluster: \
@CallumJHays
CallumJHays / Dockerfile
Created November 9, 2023 23:38
Poetry 1.7 Bug Report
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
RUN apt update -y && \
# python3 is 3.10 in ubuntu 22.04
apt install -y python3 python3-pip curl && \
apt clean -y
ARG POETRY_VERSION
RUN curl -sSL https://install.python-poetry.org | python3 - --version ${POETRY_VERSION}
ENV PATH "/root/.local/bin:$PATH"
@CallumJHays
CallumJHays / README.md
Last active January 20, 2026 19:24
lazy_executor_map

lazy-executor-map

This gist provides a function that acts like concurrent.futures.ThreadPoolExecutor.map(fn, it), but it extracts it lazily rather than eagerly.

Works with both ThreadPoolExecutor and ProcessPoolExecutor.

Usage

@CallumJHays
CallumJHays / SymbolicMatrixFunction.py
Last active April 21, 2025 22:34
SymbolicMatrixFunction class for sympy that addresses https://github.com/sympy/sympy/issues/23221
from typing import Any, Collection, Dict
from sympy import Expr, MatrixExpr, Basic, MatrixSymbol, sin, Matrix, Tuple, Function, solve, ImmutableDenseMatrix, Symbol, symbols, StrPrinter, Eq, randMatrix, cos, MatMul, Derivative, Integral, ShapeError
from sympy.core import cacheit
from sympy.core.sympify import _sympify
from sympy.core.symbol import Str
import unittest
__all__ = ["SymbolicMatrixFunction", "solve_with_sym_matrices"]
@CallumJHays
CallumJHays / Annotation_Runtime_Validation.py
Last active January 3, 2021 02:00
`typing.Annotation` example for runtime validation via type-hints
from typing_extensions import Annotated as An
from runtype_validation import validate, InRange
@validate
def test_fn(a: An[int, InRange(0, 100)], b: An[float, InRange(0, 1)]):
pass
test_fn(50, 0.5) # works
try:
test_fn(0.5, 0.5) # TypeError: Expected a to have type <class 'int'> but got <class 'float'>
@CallumJHays
CallumJHays / README.md
Last active December 15, 2020 23:59
Micropython-stubber failing firmware
#!/bin/bash
ssh ubuntu@54.206.64.114 'bash ~/delivery-webapp/scripts/on_server.sh && exit'
from socketIO_client import SocketIO, BaseNamespace
import logging
logging.getLogger('socketIO-client').setLevel(logging.DEBUG)
device_info = {
'name': "PYTHON TEST DEVICE",
'secret': "lmaolmao",
'width': 360,
'height': 240