Skip to content

Instantly share code, notes, and snippets.

@echo off
setlocal EnableExtensions EnableDelayedExpansion
echo ============================================================
echo Comfy install (winget) + CUDA checks
echo ============================================================
REM --- Magnet link placeholder ---
REM Replace with the actual magnet you want to open after qBittorrent install.
REM Keep it quoted; the script uses PowerShell to avoid cmd escaping issues.
@venetanji
venetanji / install_comfy.ps1
Created January 8, 2026 14:47
Powershell script to install comfyui with cuda
$ErrorActionPreference = 'Stop'
function Write-Section([string]$Message) {
Write-Host "\n== $Message ==" -ForegroundColor Cyan
}
function Refresh-Path {
$machinePath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
$userPath = [System.Environment]::GetEnvironmentVariable('Path', 'User')
$env:Path = "$machinePath;$userPath"
# PolyU Bad Weather Arrangements: The Pseudocode Adventure!
def polyu_bad_weather(signal, time_lowered_or_cancelled):
"""
signal: "T8" (Typhoon Signal No. 8 or higher), "RED", "BLACK", "EXTREME"
time_lowered_or_cancelled: time (in 24hr, e.g., 6.30, 10.45, 12.00)
"""
# During these signals, campus is a ghost town!
if signal in ["T8", "RED", "BLACK", "EXTREME"]:
@venetanji
venetanji / comfyui_tool.py
Created March 21, 2025 00:48
Comfyui tool for crewai
from typing import Type
import websocket #NOTE: websocket-client (https://github.com/websocket-client/websocket-client)
import uuid
import json
import urllib.request
import urllib.parse
from crewai.tools import BaseTool
from pydantic import BaseModel, Field
from datetime import datetime
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, LCMScheduler, AutoencoderTiny
import numpy as np
import torch
import cv2
from PIL import Image
# load control net and stable diffusion v1-5
controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
pipe = StableDiffusionControlNetPipeline.from_pretrained(
"lykon/dreamshaper-8-lcm", controlnet=controlnet, torch_dtype=torch.float16, safety_checker = None
#!/bin/bash
# Step 0: Ensure .cache and .local link are symlinks
if [ ! -L ~/.cache ]; then
# create the directory if it doesn't exist
mkdir -p /vast/${USER}/.cache
ln -s /vast/${USER}/.cache ~/.cache
fi
if [ ! -L ~/.local ]; then
# Define the installation path
INSTALL_PATH="/vast/${USER}/comfyui/"
# create directory if it doesn't exist
mkdir -p "${INSTALL_PATH}"
# create comfyui_models.txt if it doesn't exist
if [ ! -f "${INSTALL_PATH}/comfyui_models.txt" ]; then
# get the default modles file from gist: https://gist.githubusercontent.com/venetanji/7be194b3f943ff0597fa11f37d14fc1b/raw/881b73837a643db008fc13f503464a746b931eb5/comfyui_models.txt
curl -s https://gist.githubusercontent.com/venetanji/7be194b3f943ff0597fa11f37d14fc1b/raw/881b73837a643db008fc13f503464a746b931eb5/comfyui_models.txt > "${INSTALL_PATH}/comfyui_models.txt"
# Stable Cascade
#https://huggingface.co/stabilityai/stable-cascade/resolve/main/comfyui_checkpoints/stable_cascade_stage_c.safetensors
# dir=models/checkpoints
# out=stable_cascade_stage_c.safetensors
#https://huggingface.co/stabilityai/stable-cascade/resolve/main/comfyui_checkpoints/stable_cascade_stage_b.safetensors
# dir=models/checkpoints
# out=stable_cascade_stage_b.safetensors
#https://huggingface.co/stabilityai/stable-cascade/resolve/main/controlnet/canny.safetensors
# dir=models/controlnet
@venetanji
venetanji / ndi-asyncio
Last active December 12, 2023 16:54
ndi asyncio opencv
import sys
import numpy as np
import cv2 as cv
import NDIlib as ndi
import re
import asyncio
from pythonosc import udp_client
from facenet_pytorch import MTCNN
from hsemotion.facial_emotions import HSEmotionRecognizer
import torch
import cv2
import asyncio
import time
# open camera and get video capture object
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
# set camera resolution
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
size=10
cap.set(cv2.CAP_PROP_BUFFERSIZE,size)