Skip to content

Instantly share code, notes, and snippets.

@ECHO OFF
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
:CONFIRM
echo Are you sure to lock this folder? (Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
@pknowledge
pknowledge / Python_Abstract_Classes_example.py
Created September 17, 2018 23:19
Python Abstract Classes Example
from abc import ABC, abstractmethod
class Shape(ABC):
@abstractmethod
def area(self): pass
@abstractmethod
def perimeter(self): pass
class Square(Shape):
def __init__(self, side):
@pknowledge
pknowledge / InstallingNemoClaw.md
Last active April 11, 2026 11:44
Installing NemoClaw

Installing NemoClaw

1. Prerequisites

Before starting, ensure you have these components installed on your Windows host:

  • WSL2: Open PowerShell as Administrator and run wsl --install. Ensure you are using a modern distribution like Ubuntu 22.04 or 24.04.
  • Docker Desktop: Download and install Docker Desktop.
    • In Docker Settings, go to Resources > WSL Integration and ensure your Ubuntu distro is toggled ON.
  • NVIDIA API Key: Go to build.nvidia.com, sign up for a free account, and generate an API key (it will start with nvapi-).
@pknowledge
pknowledge / Find_and_Draw_Contours_using_OpenCV_Python.py
Created June 19, 2019 16:38
OpenCV Python Tutorial For Beginners - Find and Draw Contours with OpenCV in Python
import numpy as np
import cv2
img = cv2.imread('baseball.png')
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(imgray, 127, 255, 0)
contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
print("Number of contours = " + str(len(contours)))
print(contours[0])
@pknowledge
pknowledge / adaptive_thresholding_opencv_python.py
Created April 28, 2019 22:26
Adaptive Thresholding Image - OpenCV Python
import cv2 as cv
import numpy as np
img = cv.imread('sudoku.png',0)
_, th1 = cv.threshold(img, 127, 255, cv.THRESH_BINARY)
th2 = cv.adaptiveThreshold(img, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY, 11, 2);
th3 = cv.adaptiveThreshold(img, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 11, 2);
cv.imshow("Image", img)
cv.imshow("THRESH_BINARY", th1)
@pknowledge
pknowledge / docker-compose.yaml
Created February 26, 2024 16:36
Run Microsoft Azure SQL Edge using docker compose
version: '3.8'
services:
sql:
image: mcr.microsoft.com/azure-sql-edge
container_name: sql
ports:
- "1433:1433"
environment:
ACCEPT_EULA: "1"
@pknowledge
pknowledge / canny_edge_detection_in_opencv.py
Created May 24, 2019 23:48
Canny Edge Detection in OpenCV Python
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread("lena.jpg")
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
canny = cv2.Canny(img, 100, 200)
titles = ['image', 'canny']
images = [img, canny]
@pknowledge
pknowledge / eye_detection.py
Created September 7, 2019 15:38
OpenCV Python Tutorial For Beginners - Eye Detection Haar Feature based Cascade Classifiers f
import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye_tree_eyeglasses.xml')
cap = cv2.VideoCapture('test.mp4')
while cap.isOpened():
_, img = cap.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.1, 4)
@pknowledge
pknowledge / detector.py
Created August 31, 2019 15:24
OpenCV Python Tutorial For Beginners - Road Lane Line Detection with OpenCV (Part 3)
import matplotlib.pylab as plt
import cv2
import numpy as np
def region_of_interest(img, vertices):
mask = np.zeros_like(img)
#channel_count = img.shape[2]
match_mask_color = 255
cv2.fillPoly(mask, vertices, match_mask_color)
masked_image = cv2.bitwise_and(img, mask)
@pknowledge
pknowledge / shape_detection_using_opencv_python.py
Created July 3, 2019 22:29
Simple shape detection Opencv with Python
import numpy as np
import cv2
img = cv2.imread('shapes.jpg')
imgGrey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
_, thrash = cv2.threshold(imgGrey, 240, 255, cv2.THRESH_BINARY)
contours, _ = cv2.findContours(thrash, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
cv2.imshow("img", img)
for contour in contours: