Skip to content

Instantly share code, notes, and snippets.

View parthpower's full-sized avatar
:shipit:

Parth Parikh parthpower

:shipit:
View GitHub Profile
#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():
#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"
@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
@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 / RPiGPIOServer.py
Last active February 18, 2016 13:03
Simple Raspberry Pi HTTP GPIO Control
__author__ = 'Parth'
import BaseHTTPServer
import urlparse
import RPi.GPIO as GPIO
PORT = 8000
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
args = {}
@parthpower
parthpower / A.py
Last active March 9, 2016 20:29
TCS CodeVita Solutions I don't remember problem statements:p
#Copyright (c) 2016 Parth V. Parikh
#Freely distributable under MIT lincese.
__author__ = 'Parth'
def alternate(num, target):
if int(num)<3:
return False
found = False
occ = []
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")
from sys import argv
import numpy as np
import cv2
if len(argv)!=5:
print("Usage: %s <height> <width> <input TXT File> <output TXT File>"%(argv[0]))
exit()
@parthpower
parthpower / VivadoCI.py
Last active June 10, 2016 13:41
A slightly modified version of https://github.com/Viq111/Vivado-CI I don't think it's "fork-able" so..Gist it is!
# -*- coding:Utf-8 -*-
# Vivado-CI Package
prog_name = "VivadoCI - Server Side"
# version:
version = 1
# By Viq - Vianney Tran
# License: Creative Commons Attribution-ShareAlike 3.0 (CC BY-SA 3.0)
# (http://creativecommons.org/licenses/by-sa/3.0/)
##############