Skip to content

Instantly share code, notes, and snippets.

@mpottinger
mpottinger / depth_webcam_demo.py
Created December 11, 2025 00:06
CoreML Depth Anything V2 - Real-time Webcam Demo for macOS
"""
CoreML Depth Anything V2 - Real-time Webcam Demo
Captures frames from webcam and runs real-time depth estimation using
Apple's CoreML Depth Anything V2 model. Press 'q' to quit.
Requirements: pip3 install opencv-python pillow numpy coremltools huggingface_hub
Model: apple/coreml-depth-anything-v2-small
"""
// ------------------------------------------------------------
// LivePlugin: Jetty HTTP Command Server (IDE control) – FULL VERSION
// Writes its listening port to jetbrains_automation.port file in project root.
// CORS fixed for browser HTML UI.
// Now includes comprehensive run tabs API endpoints.
// -- MODIFIED: 'Agent Terminal' is now its own bottom-aligned tool window. --
// ------------------------------------------------------------
//
// ── Jetty & Jakarta Servlet JARs ──
// add-to-classpath $HOME/.m2/repository/org/eclipse/jetty/jetty-server/11.0.15/jetty-server-11.0.15.jar
@mpottinger
mpottinger / autocomplete_groq.zip
Created May 13, 2025 00:23
autocomplete_inline_live_plugin_kotlin
This file has been truncated, but you can view the full file.
PK
ӆ�Zautocomplete_groq/lib/PKӆ�Z+autocomplete_groq/lib/autocomplete_groq.jar}zeP�K�-�]�����ہ@��vp'���� �����-h�w�W3�N�����Wݫ���]{��KEb>�J�BQRC�YVI�UQLIVJR]�EQ�} �Nqb\A��eE��ajb�A�m�s�p�
BE����/�����x�_�?/p�q1��cq��iRW�� C�<�F���QcM^>���J��d�`��iO���/��f�\���di6��|t!A�#�p��{r�Ov
`�C���5�����z��q�2��5��5���q�|���8�&2��l%�ϲI��C�i"�[�Y}��a3�d��.�lq.}2����O��[��+o�)M>�X��3��C�������=ZX�郜3��/ZU2X�)'���[Ig��?C�����~Zȯȓ1.��ϕ�����t��"�RlJfLݣ $h� JU}� ���.(�N��r2HE�-�۱a=���8ح5j�� D��t T����3�qGw� ʓ铹�u�A��������U^������y��A��Z����Ԙ8��h{I�_����tl�=��`����0
�XH�v��S4��������׍T����� G*vc'�N$w�e��i��U���z)����ă��ւ?�e|OA� D�?
�vb�M,���̵�e�7g �E��?��u�,F�Q�����,I���j2�jtI*w��ɍ�ˎOY�/��n�YN�~ӯS�������u~mlV @����)��;��{#�kϒ�@�繡pȭ� ���ec�`�yM�Dy�Ҍb_���C��:j�<�fmBߕ&��\���oF���Vk1�19��L�q�<��3�A@i=�(v�xy1�� �L`�:� ��]g�)�|8
$��G�^
#sl�魖����!3�D+ M"�a]��{ v���.4f�h�t߸\e.�����
import json
from flask import Flask, request, render_template_string
app = Flask(__name__)
HTML = '''
<!DOCTYPE html>
<html lang="en">
<head>
import os
import sys
import openai
# for openai
openai.api_key = "<your openai api key>"
tokens_used = 0
def get_reply(messages):
#include "VDBVolume.h"
// OpenVDB
#include <openvdb/Types.h>
#include <openvdb/math/DDA.h>
#include <openvdb/math/Ray.h>
#include <openvdb/openvdb.h>
#include <Eigen/Core>
#include <algorithm>
// Raycast render of the tsdf volume given a projection matrix and a camera pose
// The camera pose is the pose of the camera in the world coordinate system
// The projection matrix is the projection matrix of the camera
// The output is a vector of pixels, each pixel is a vector of 3 floats
std::vector<std::vector<float>> VDBVolume::Raycast(const Eigen::Matrix4d &projection,
const Eigen::Matrix4d &camera_pose) {
// Get the "unsafe" version of the grid accessors
auto tsdf_acc = tsdf_->getUnsafeAccessor();
auto weights_acc = weights_->getUnsafeAccessor();
auto colors_acc = colors_->getUnsafeAccessor();
namespace vdbfusion {
VDBVolume::VDBVolume(float voxel_size, float sdf_trunc, bool space_carving /* = false*/)
: voxel_size_(voxel_size), sdf_trunc_(sdf_trunc), space_carving_(space_carving) {
tsdf_ = openvdb::FloatGrid::create(sdf_trunc_);
tsdf_->setName("D(x): signed distance grid");
tsdf_->setTransform(openvdb::math::Transform::createLinearTransform(voxel_size_));
tsdf_->setGridClass(openvdb::GRID_LEVEL_SET);
weights_ = openvdb::FloatGrid::create(0.0f);
@mpottinger
mpottinger / Global keyboard hook for OSX
Created August 8, 2022 23:22 — forked from quietcricket/Global keyboard hook for OSX
OSX global keyboard hook. Requires root privileges.
// alterkeys.c
// http://osxbook.com
//
// Complile using the following command line:
// gcc -Wall -o alterkeys alterkeys.c -framework ApplicationServices
//
// You need superuser privileges to create the event tap, unless accessibility
// is enabled. To do so, select the "Enable access for assistive devices"
// checkbox in the Universal Access system preference pane.
@mpottinger
mpottinger / ViewController.swift
Created February 22, 2022 15:48 — forked from yusuke024/ViewController.swift
Recording video with AVAssetWriter
import UIKit
import AVFoundation
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
switch AVCaptureDevice.authorizationStatus(for: .video) {
case .notDetermined: