Skip to content

Instantly share code, notes, and snippets.

View gbiz123's full-sized avatar

Greg Bizup gbiz123

View GitHub Profile
@gbiz123
gbiz123 / ImageProcessChain.java
Created November 16, 2024 14:34
Clean Java OpenCV Code With Chained Calls!
package processor.computer_vision;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Scalar;
@gbiz123
gbiz123 / downsample.py
Last active July 29, 2024 02:46
Downsample Binary Pytorch Dataset Down To Size Of Smallest Class
import torch
from torch.utils.data import ConcatDataset, DataLoader, Dataset, Subset
import torchvision
import numpy as np
import matplotlib.pyplot as plt
import time
import os
from PIL import Image
from tempfile import TemporaryDirectory
import random
@gbiz123
gbiz123 / typehint_sqlalchemy_join.md
Last active January 8, 2024 23:17
How to Properly Type Hint SQLAlchemy Join Queries

How to Type Hint SQLAlchemy Join Queries

This Gist will show you how and why to properly type hint your SQLAlchemy join queries. Typehinting join queries is not well documented or discussed as of yet, but I'm here to change that.

If you are converting your ORM models to dictionaries, you are missing out!

If you aren't typehinting in SQLAlchemy, you're missing out on all the powerful ORM features that will speed your development and help prevent bugs. Properly typehinted Python code will give you specific benefits including:

  • Autocompletion of fields
  • Static analysis and linting
  • Clean code