Skip to content

Instantly share code, notes, and snippets.

View jhurliman's full-sized avatar
🐨

John Hurliman jhurliman

🐨
View GitHub Profile
@jhurliman
jhurliman / ComfyUI.Dockerfile
Created August 22, 2024 02:01
ComfyUI in Docker
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION}-slim
ARG PYTORCH_INSTALL_ARGS=""
ARG EXTRA_ARGS=""
ARG USERNAME=comfyui
ARG USER_UID=1000
@jhurliman
jhurliman / MDMZ_15-jh3.json
Created August 7, 2024 00:06
MDMZ_15-jh3.json
{
"last_node_id": 797,
"last_link_id": 1712,
"nodes": [
{
"id": 79,
"type": "ADE_ApplyAnimateDiffModelSimple",
"pos": [
-0.0234637416563368,
-326.12276996452505
@jhurliman
jhurliman / l4t-version.sh
Created May 7, 2024 19:28
Extract the NVIDIA Jetson L4T <RELEASE>.<MAJOR> version from /etc/nv_tegra_release
function get_L4T_major_version_only {
# Will return the L4T <release>.<major> version (ex: "32.6" or "32.4")
local RELEASE=$(cat /etc/nv_tegra_release | grep -oP "R\d{2}" | grep -oP "\d{2}")
local MAJOR_VERSION=$(cat /etc/nv_tegra_release | grep -oP "REVISION: \d{1}\.\d{1}" | grep -oP "\d{1}.\d{1}" | grep -oP "\d{1}". | grep -oP "\d{1}")
echo "${RELEASE}.${MAJOR_VERSION}"
}
@jhurliman
jhurliman / catch2-exception-printer.cpp
Created March 8, 2024 05:53
Better C++ exception printing for Catch2
#include <cxxabi.h>
#include <typeinfo>
CATCH_TRANSLATE_EXCEPTION(const std::exception& e) {
std::string s;
int status;
const char* name = typeid(e).name();
char* realname = abi::__cxa_demangle(name, 0, 0, &status);
if (realname) {
@jhurliman
jhurliman / docker-root.sh
Created March 5, 2024 23:13
Use docker to become root on the host system
docker run -it --rm --privileged -v /:/host ubuntu chroot /host bash
@jhurliman
jhurliman / aquarium_publish.py
Last active August 31, 2023 18:07
Upload a COCO JSON dataset and inference results to Aquarium Learning
#!/usr/bin/env python3
"""Publish ground truth or inference COCO JSON labels to Aquarium."""
import argparse
import os
import typing as tp
from pathlib import Path
import aquariumlearning as al
"""
Convert a tab-separated text file list of timestamped body marker positions
from <https://accad.osu.edu/research/motion-lab/mocap-system-and-data> into an
MCAP file.
"""
import argparse
import csv
import json
import typing as tp
@jhurliman
jhurliman / sample_near_center_of_mass.py
Created July 26, 2023 17:10
[Python] sample_near_center_of_mass(mask, num_samples, distance)
from scipy.ndimage import center_of_mass
from typing import List
Vec2 = Tuple[float, float]
def sample_near_center_of_mass(
mask: NDArray[np.uint8], num_samples: int = 10, distance: float = 5
) -> List[Vec2]:
"""
@jhurliman
jhurliman / start-tensorboard.sh
Created May 4, 2023 16:44
Run a tensorboard docker service
#!/usr/bin/env bash
docker run --init \
-d \
--restart unless-stopped \
--hostname jupiter.martian.ag \
--log-opt max-size=50m \
-p 6006:6006 \
-e DOCKER_USER=$(id -un) \
-e DOCKER_USER_ID=$(id -u) \
@jhurliman
jhurliman / killgpu.sh
Created May 4, 2023 03:53
Shell alias to kill all processes using the GPU. Only for headless NVIDIA GPU machines!
alias killgpu='nvidia-smi --query-compute-apps=pid --format=csv,noheader | xargs --no-run-if-empty sudo kill'