Skip to content

Instantly share code, notes, and snippets.

View vTuanpham's full-sized avatar
💭

Tuan Pham vTuanpham

💭
View GitHub Profile
@vTuanpham
vTuanpham / connect_webcam.sh
Last active March 27, 2024 10:10
Stream windows webcam directly on wsl.
#!/bin/bash
# Script to download, unzip, and run a Windows executable from WSL with error handling
# Function to download and extract cam2ip
download_and_extract_cam2ip() {
local download_url="https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-64bit-cv2.zip"
local target_directory="wsl_utils"
local zip_file="${target_directory}/cam2ip-1.6-64bit-cv2.zip"
local executable_file="${target_directory}/cam2ip-1.6-64bit-cv/cam2ip.exe"
@vTuanpham
vTuanpham / code_filters.py
Last active October 14, 2023 16:54
Check if a large string contain possible code snippet or not
import re
from typing import Tuple
def code_likelihood_score(text) -> Tuple[int, list]:
# Calculate a score based on code-like elements
score = 0
code_elements = [
';', '{', '}', 'function', 'class', 'var', 'int', 'void', 'public',
'import', 'for', 'while', 'elif', 'switch', 'case', 'break',