Skip to content

Instantly share code, notes, and snippets.

View parthpower's full-sized avatar
:shipit:

Parth Parikh parthpower

:shipit:
View GitHub Profile
from sys import argv
import cv2
import numpy as np
def genTxtFile(imageFilePath,txtFilepath):
inputImage = cv2.imread(imageFilePath)
grayInputImage = cv2.cvtColor(inputImage,cv2.COLOR_RGB2GRAY)
try:
txtFile = open(txtFilepath,"w")
@parthpower
parthpower / !URL Content Size.md
Last active February 18, 2016 12:57
URL Content Size

URL Content Size

Get the size of every URL content within a page. It uses CROS proxy https://cors-anywhere.herokuapp.com/ for making HEAD request to the destination URL. Similar to Search Result Size but this works on all pages.

Quick Start

  • Create a bookmark and set the content of bookmarklet as the URL. (Keep that bookmark in the bookmarkbar)
  • Go to any web page with links, and click that bookmark.

Known Issues

  • It doesn't work on all URLs.
  • The size of the web page may not be exact same because of dynamically loading XHRs.
@parthpower
parthpower / !Search Result Size.md
Last active February 18, 2016 12:59
Search Result Size

Search Result Size

Stable Optimized version of URL Content Size for Google Search Results.

What is this?

Get the size of each Google search result before visiting the site. It uses CROS proxy https://cors-anywhere.herokuapp.com/ for making HEAD request to the destination URL.

Quick Start

  • Create a bookmark and set the content of bookmarklet as the URL. (Keep that bookmark in the bookmarkbar)
  • On search result page of Google, click on that bookmark and see the magic.

Known Issues

  • It doesn't work on all URLs due to Refused to get unsafe header "content-length" exception.
@parthpower
parthpower / !WhatsApp Emoji Bomber.md
Last active July 19, 2023 13:51
WhatsApp Emoji Bomber
@parthpower
parthpower / !WhatsApp On Web Monitor.md
Last active January 19, 2024 14:14
Simple JS to monitor offline and online time of a contact.

WhatsApp On Web Monitor

What It does

It gives notifications when someone goes online or offline or typing. Open chat of the contact you want to monitor and start script.

Simple Way

@parthpower
parthpower / DefinationFromGoogle.py
Last active April 3, 2017 17:54
Grabs Definition section from Google search result!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! It works actually!
import requests
import BeautifulSoup
from sys import argv
word = "tied"
if __name__ == "__main__":
if len(argv)>2:
word = argv[1]
data = requests.get("https://www.google.com/search?q=definition+%s"%word)
@parthpower
parthpower / find_by_identifier.py
Last active December 20, 2015 23:44
Function to get string between start identifier and end identifier string.
#Released under MIT license.
__author__ = 'Parth Parikh'
__license__ = 'MIT'
def find_by_identifier(data,startIdentifier,endIdentifier):
result = []
identLen = len(startIdentifier)
##First check
##print(identLen)
startIdentIndex = -1
#Author: Parth Parikh
#Distributed under MIT license
import serial
import pynmea2
import datetime
from dateutil import tz
LOG_FILE = datetime.datetime.now().strftime('%d_%m_%Y_%H_%M_%S')+"_gps_log.csv"
LOG_FILE_RAWPACKET = datetime.datetime.now().strftime('%d_%m_%Y_%H_%M_%S')+"_gps_raw_log.txt"
#author: Parth Parikh
#Distributed under MIT License
#Simple Serial CSV Logger
import serial
import datetime
LOG_FILE = datetime.datetime.now().strftime('%d_%m_%Y_%H_%M_%S')+"_log.csv"
BAUD = 9600
def available_ports():
@parthpower
parthpower / imgtocoe.py
Last active April 4, 2017 20:59
Simple gray scale image data to COE file convertor for Xilinx Block Memory initialization
__author__ = 'Parth Parikh'
import sys
import cv2
def help1():
print "Usage: imgtocoe <image path> <output name>"
exit()
if len(sys.argv) <3: