Skip to content

Instantly share code, notes, and snippets.

Check out

Pravendra Singh pravj

Check out
Block or report user

Report or block pravj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View zdiuhffiodhgoaegj.json
[{"name": "sample 1", "image": "url 1"}, {"name": "sample 2", "image": "url 2"}]
import cv2
# grayscale version of the single color image
image_gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
# bilateral filter is effective when you want to
# keep the edges sharp while removing noise
image_gray = cv2.bilateralFilter(image_gray, 10, 50, 50)
# find contour in gray scale image after applying erosion and dilation
# Reference:
from sklearn.cluster import KMeans
# word block colors (color palette)
block_colors = []
# change dimension to (width x height, color-channels)
screen = screen.reshape((screen.shape[0] * screen.shape[1], 3))
# Collect 8 major colors in the image using KMeans clustering
from gensim.models.keyedvectors import KeyedVectors
# load local word2vec model
model = KeyedVectors.load_word2vec_format(
# list of tuples containing the word and similarity score
associated_word_tuples = model.most_similar(word, topn=20)
import pytesseract
image_text = pytesseract.image_to_string(cropped_image)
import cv2
import numpy as np
# load and find the dimension attritbutes of the template image
template_img = cv2.imread('./gray-template.png', 0)
w, h = template_img.shape[::-1]
# OpenCV's template matching method
res_img = cv2.matchTemplate(
screen2, template_img, cv2.TM_CCOEFF_NORMED
import cv2
import pyautogui
# using a screen size specific region
screen = pyautogui.screenshot(region=(200, 100, 1000, 700))
screen_img_gray = cv2.cvtColor(np.array(screen), cv2.COLOR_RGB2GRAY)
pravj /
Created Jul 8, 2018
Shell script to setup Docker Community Edition on an Ubuntu:16.04
# Setup the Docker repository
echo "update apt package index"
sudo apt-get update
echo "allow apt to use HTTPS"
sudo apt-get install \
apt-transport-https \
View radio-head.js
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('click', function(e) {
var e = e || window.event,
target = || e.srcElement,
text = target.textContent || target.innerText;
if (target.tagName.toLowerCase() == 'label') {
var labels = document.querySelectorAll("label");
View radio-head.css
Hide radio button (the round disc)
we will use just the label to create pushbutton effect
input[type=radio] {
You can’t perform that action at this time.