Skip to content

Instantly share code, notes, and snippets.

To capture a video stream from a Logitech C270 HD Webcam using libusb, you'll need to interface with the webcam's USB Video Class (UVC) interface, as the C270 is a UVC-compliant device. Below is a step-by-step guide to achieve this. Note that this process requires familiarity with C/C++ programming, USB protocols, and handling video data (e.g., MJPEG or YUYV formats). The approach assumes you're working on a Linux system, as libusb is commonly used there, but it can be adapted for other platforms.Prerequisites

  1. Install libusb: Ensure libusb-1.0 is installed (sudo apt install libusb-1.0-0-dev on Debian/Ubuntu or equivalent).
  2. Development Environment: Set up a C/C++ environment with a compiler (e.g., gcc) and necessary headers.
  3. Permissions: Ensure you have permissions to access the webcam (e.g., add your user to the video group or run as root, though root is not recommended).
  4. Dependencies: Optionally, install v4l2loopback to create a virtual video device for testing or piping the stream to other appl
@d0rc
d0rc / quantum-2d-square-potential.py
Created January 22, 2025 19:36
quantum-2d-square-potential.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
if __name__ == '__main__':
# Constants and parameters
hbar = 1.0 # Reduced Planck's constant
m = 1.0 # Particle mass
V0 = 1.0 # Barrier height
@d0rc
d0rc / mcts-llm.go
Created October 25, 2024 01:36
searching text space
package main
import (
"math"
"github.com/d0rc/mcts"
"time"
)
// Sequence and other types remain as provided
type Sequence struct {
@d0rc
d0rc / crop-tolerance.go
Created October 11, 2024 19:34
removeBordersWithTolerance...!
func removeBordersWithTolerance(inputPath, outputPath string, tolerance, minBorderWidth int) error {
// Open the input file
file, err := os.Open(inputPath)
if err != nil {
return err
}
defer file.Close()
// Decode the image
img, format, err := image.Decode(file)
@d0rc
d0rc / sampler-batcher-4.py
Created October 1, 2024 03:15
build all tree of possible sequences
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
import numpy as np
from scipy.special import softmax
from scipy.stats import entropy
from collections import deque
import os
# ANSI color codes
BLUE = "\033[94m"
@d0rc
d0rc / php.go
Created September 25, 2024 02:08
php subset parser / lexer in go
package main
import (
"fmt"
"strconv"
)
// TokenType represents the type of a token
type TokenType int

The Role of GTO Strategies in Poker:

Balancing Strategic Play with Biological Risk-Seeking

Introduction

In the world of poker, players often find themselves navigating a fine line between strategic play based on mathematical models and decisions influenced by biological and emotional factors. While it is tempting to focus on interpersonal dynamics and risk-seeking behavior, research has shown that Game Theory Optimal (GTO) strategies are not dependent on opponent modeling. This essay explores the importance of maintaining a clear distinction between playing poker as a strategic game and engaging in a social learning process driven by biological and emotional factors.

Poker as a Strategic Game

from flask import Flask, request, send_file
import torch
from diffusers import FluxPipeline
from io import BytesIO
import ssl
import os
app = Flask(__name__)
# Initialize the pipeline
package main
import (
"bytes"
"fmt"
"html/template"
"io/ioutil"
"log"
"os"
"path/filepath"
@d0rc
d0rc / sos-id.go
Created September 12, 2024 10:00
package main
import (
"crypto/md5"
"encoding/hex"
"flag"
"fmt"
"io/ioutil"
"path/filepath"
"sort"