Skip to content

Instantly share code, notes, and snippets.

@promto-c
promto-c / gsplat-from-multiview-workflow.md
Created January 11, 2026 18:02
Step-by-step workflow: multi-view photos → COLMAP camera poses → Brush Web GSplat training → export and view .ply.
@promto-c
promto-c / torch_device_info.py
Last active January 9, 2026 21:19
Minimal cross-platform PyTorch device info.
import torch
print("PyTorch version:", torch.__version__)
# CUDA / ROCm (both use torch.cuda API in PyTorch)
# ------------------------------------------------
has_cuda_api = torch.cuda.is_available()
cuda_version = torch.version.cuda
rocm_version = torch.version.hip # None if not ROCm build
@promto-c
promto-c / pyqt_react_splitscreen_qwebchannel_demo.py
Created January 9, 2026 20:12
PyQt + React splitscreen desktop demo using QWebEngineView and QWebChannel, showing bidirectional communication between native PyQt widgets and a React + Tailwind UI.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Copyright (C) 2026 promto-c
Permission Notice:
- You are free to use, copy, modify, and distribute this software for any purpose.
- No restrictions are imposed on its use.
- Credit is appreciated but not required.
- Use at your own risk; this software is provided "AS IS", without any warrantyexpress or impliedincluding, but not limited to, warranties of merchantability or fitness for a particular purpose.
- This notice does not apply to any third-party libraries or dependencies; those are subject to their respective licenses.
@promto-c
promto-c / rdp_curve_simplifier_demo.py
Created December 8, 2025 19:26
Interactive PyQt visualizer for the Ramer–Douglas–Peucker (RDP) curve simplification algorithm. Includes live controls for epsilon, noise, point count, distance mode, threshold band visualization, and real-time plotting.
"""Copyright (C) 2025 promto-c
Permission Notice:
- You are free to use, copy, modify, and distribute this software for any purpose.
- No restrictions are imposed on its use.
- Credit is appreciated but not required.
- Use at your own risk; this software is provided "AS IS", without any warranty — express or implied — including, but not limited to, warranties of merchantability or fitness for a particular purpose.
- This notice does not apply to any third-party libraries or dependencies; those are subject to their respective licenses.
"""
@promto-c
promto-c / silhouettefx_viewer_stream_mode.py
Created October 26, 2025 11:01
A SilhouetteFX Python utility that manages the viewer’s stream mode (Left, Right, or Left-Right) and preserves selection by reselecting linked items in the opposite view.
"""Copyright (C) 2025 promto-c
Permission Notice:
- You are free to use, copy, modify, and distribute this software for any purpose.
- No restrictions are imposed on its use.
- Credit is appreciated but not required.
- Use at your own risk; this software is provided "AS IS", without any warranty — express or implied — including, but not limited to, warranties of merchantability or fitness for a particular purpose.
- This notice does not apply to any third-party libraries or dependencies; those are subject to their respective licenses.
"""
import fx
@promto-c
promto-c / silhouettefx_scripts_toggle_stabilize.py
Created March 13, 2025 20:16
SilhouetteFX's Script - Sets the selected layer (or its parent if it's a shape) as the stabilize layer, clears it if it's the active layer, and centers the selection in the viewer.
"""Copyright (C) 2020 promto-c
Permission Notice:
- You are free to use, copy, modify, and distribute this software for any purpose.
- No restrictions are imposed on the use of this software.
- You do not need to give credit or include this notice in your work.
- Use at your own risk.
- This software is provided "AS IS" without any warranty, either expressed or implied.
- This license does not cover any third-party libraries or dependencies used in this software. Those libraries are subject to their respective licenses.
"""
@promto-c
promto-c / text_similarity_mapper.py
Last active November 12, 2024 09:49
Python function to map strings in one list to the closest matches in another based on similarity scores. Useful for cases requiring best-effort text alignment, such as matching filenames or finding similar text patterns.
"""Copyright (C) 2024 promto-c
Permission Notice:
- You are free to use, copy, modify, and distribute this software for any purpose.
- No restrictions are imposed on the use of this software.
- You do not need to give credit or include this notice in your work.
- Use at your own risk.
- This software is provided "AS IS" without any warranty, either expressed or implied.
"""
from difflib import SequenceMatcher
@promto-c
promto-c / 3d_rendering_mvp_explanation.md
Created September 28, 2024 21:55
Explanation of the Model-View-Projection (MVP) matrix in 3D graphics programming. Covers the breakdown of Model, View, and Projection matrices, their roles, and how they are combined for 3D rendering.

Model-View-Projection (MVP) Matrix in 3D Graphics

In 3D graphics programming, MVP stands for Model-View-Projection matrix. It is a transformation matrix that combines three separate transformations—Model, View, and Projection—into a single matrix to convert 3D coordinates into 2D screen coordinates for rendering.

Components of MVP

1. Model Matrix (M)

  • Represents the transformation of an object from model space to world space.
  • This matrix is used to position, rotate, and scale the model within the world.
  • Example transformations include:
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
import category_encoders as ce
import time
# Load the dataset
file_path = 'car1.csv'
@promto-c
promto-c / nuke_node_alignment.py
Created July 12, 2024 19:48
Python script for aligning selected nodes in Nuke horizontally or vertically based on user preferences. Includes functionality to toggle alignment and retrieve grid spacing settings from Nuke's preferences.
import nuke
from typing import List, Tuple
class NodeAlignment:
"""Handles the alignment of nodes in Nuke."""
DEFAULT_SPACING = 100
@staticmethod