Skip to content

Instantly share code, notes, and snippets.

@jonmatthis
jonmatthis / quine.py
Last active May 15, 2023 14:00
quine
import os
from datetime import datetime
from pathlib import Path
from typing import List
class Quine:
"""
A class to represent a Quine.
@jonmatthis
jonmatthis / pinecone_generative_qa_w_open_ai_example.py
Last active March 23, 2023 17:11
refactor of pinecode OpenAI tutorial for clarity and to run as a script with nice print statements
# originally based on - https://docs.pinecone.io/docs/gen-qa-openai
# Do the QuickStart first to get set up with Pinecone - https://docs.pinecone.io/docs/quickstart
import subprocess
from pinecone import Index
try:
import os
from time import sleep
import openai
@jonmatthis
jonmatthis / simplest_opencv_webcam_display.py
Last active December 17, 2022 18:19
simple video display with opencv
"""
Connect to camera at port '0' and display in a loop - close with ESC
requires `opencv-python` or `opencv-contrib-python`
note - should run in any environment that can run `freemocap` stuff
"""
import time
import cv2
import numpy as np
@jonmatthis
jonmatthis / simple_mediapipe_video_annotator.py
Created May 20, 2022 16:20
simple script to load in a video (or connect to a webcam), annotate it with `mediapipe` data, and save it out in the same directory as the original video
#to install dependencies:
# pip install opencv-python
# pip install mediapipe
import cv2
import mediapipe as mp
from pathlib import Path
run_mediapipe = True