Skip to content

Instantly share code, notes, and snippets.

View anujonthemove's full-sized avatar
Working

Anuj Khandelwal anujonthemove

Working
View GitHub Profile
@anujonthemove
anujonthemove / Birds-Eye-View Transformation.pdf
Last active April 29, 2024 01:07
Bird's eye view perspective transformation using OpenCV
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anujonthemove
anujonthemove / cuda-cudnn-export-paths.txt
Last active April 20, 2024 20:53
Export paths for CUDA and cuDNN.
export CUDA_HOME=/usr/local/cuda
export PATH=/usr/local/cuda/bin:$PATH
export CPATH=/usr/local/cuda/include:$CPATH
export LIBRARY_PATH=/usr/local/cuda/lib64:$LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
@anujonthemove
anujonthemove / opencv-videocapture-useful-properties.txt
Last active April 5, 2024 14:24
A handy list of VideoCapture object parameters taken from official OpenCV docs.
CAP_PROP_POS_MSEC =0, //!< Current position of the video file in milliseconds.
CAP_PROP_POS_FRAMES =1, //!< 0-based index of the frame to be decoded/captured next.
CAP_PROP_POS_AVI_RATIO =2, //!< Relative position of the video file: 0=start of the film, 1=end of the film.
CAP_PROP_FRAME_WIDTH =3, //!< Width of the frames in the video stream.
CAP_PROP_FRAME_HEIGHT =4, //!< Height of the frames in the video stream.
CAP_PROP_FPS =5, //!< Frame rate.
CAP_PROP_FOURCC =6, //!< 4-character code of codec. see VideoWriter::fourcc .
CAP_PROP_FRAME_COUNT =7, //!< Number of frames in the video file.
CAP_PROP_FORMAT =8, //!< Format of the %Mat objects returned by VideoCapture::retrieve().
CAP_PROP_MODE =9, //!< Backend-specific value indicating the current capture mode.
@anujonthemove
anujonthemove / .bashrc
Last active October 9, 2023 04:16
virtualenvwrapper settings for .bashrc
# Install virtualenv, virtualenv wrapper
# sudo pip3 install virtualenv virtualenvwrapper
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
export WORKON_HOME=$HOME/.virtualenvs
# export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
@anujonthemove
anujonthemove / remove.sh
Created October 2, 2023 16:19
An unresolvable problem occurred while calculating the upgrade.
# All thanks to a thread in this forum: https://askubuntu.com/questions/360293/could-not-calculate-the-upgrade-what-happened
#!/bin/bash
apt update
apt upgrade
cat /var/log/dist-upgrade/apt.log | egrep -o "^Broken\s[a-z:\.0-9-]*" | sed 's/Broken //' | sed 's/:amd64//' > packages.txt
sort -u packages.txt > packages_sorted.txt
while read line; do
apt remove -y $line
done < packages_sorted.txt
@anujonthemove
anujonthemove / write-video-decorator.py
Last active August 9, 2023 10:52
OpenCV Python Video Writer
import cv2
import datetime
print(cv2.__version__)
def video_writer_decorator(func):
def wrapper(cap):
w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = int(cap.get(cv2.CAP_PROP_FPS))
@anujonthemove
anujonthemove / commit-emojis.md
Created June 11, 2023 04:33 — forked from georgekrax/commit-emojis.md
List of emojis for GitHub commit messages
Emoji Purpose MD Markup Prefix
📄 Generic message :page_facing_up:
📐 Improve the format / structure of the code / files :triangular_ruler: [IMPROVE]:
Improve performance :zap: [IMPROVE]:
🚀 Improve something (anything) :rocket: [IMPROVE]:
📝 Write docs :memo: [PROD]:
💡 New idea
import pyautogui
import time
#user note:
# cursor will keep moving on 2 diagonals of a 5x5 square and cilcking - better to position it inside the terminal from which this script is triggered
#pyautogui.FAILSAFE = False # uncomment this if you want to disable the pause script if cursor in corner feature
while True:
pyautogui.move(-5,5)
pyautogui.click()
@anujonthemove
anujonthemove / setup-venv.sh
Last active January 16, 2023 01:22
Steps to setup Python 3 virtual environment and virtual environment wrapper.
# Commands to install virtual environments
# With this setup, all your virtual environments will be placed
# at one place inside .virtualenvs folder under home directory in Linux
sudo apt update
sudo pip install virtualenv virtualenvwrapper
# open .bashrc file and copy paste the following lines below:
# virtualenv and virtualenvwrapper
@anujonthemove
anujonthemove / check-gpu-access-tensorflow.py
Created December 17, 2022 01:26
Check if TensorFlow can access GPU
import tensorflow as tf
from tensorflow.python.client import device_lib
print(tf.test.is_gpu_available())
print(tf.config.experimental.list_physical_devices('GPU'))
print(device_lib.list_local_devices())