Skip to content

Instantly share code, notes, and snippets.

View gbiz123's full-sized avatar
๐Ÿ”
Keep it simple, stupid

Greg Bizup gbiz123

๐Ÿ”
Keep it simple, stupid
View GitHub Profile
@gbiz123
gbiz123 / gist:2ea60569c172dd72e2def96625fd9ea7
Last active January 5, 2026 22:46
Create a bootable backup image of a linux system remotely using RSYNC
You may have a linux system you wish to recreate repeatedly on bare metal.
The best way to do this is to create a bootable image of your system.
Typically, you would accomplish this with `dd` locally.
If the system you want to back up is a remote server, you can use `rsync`.
First, find the device on the remote server you want to back up using `lsblk`:
```
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 50.9M 1 loop /snap/snapd/25577
loop1 7:1 0 73.9M 1 loop /snap/core22/2139
@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