Skip to content

Instantly share code, notes, and snippets.

View PureMath86's full-sized avatar

Bryan Arnold PureMath86

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PureMath86
PureMath86 / pdf_table_with Tesseract
Created September 27, 2017 22:23 — forked from jaganadhg/pdf_table_with Tesseract
Extract Data from PDF table using Python Image. Image Magick and tesseract
#Refer http://craiget.com/extracting-table-data-from-pdfs-with-ocr/
import Image, ImageOps
import subprocess, sys, os, glob
# minimum run of adjacent pixels to call something a line
H_THRESH = 300
V_THRESH = 300
def get_hlines(pix, w, h):
"""Get start/end pixels of lines containing horizontal runs of at least THRESH black pix"""
@PureMath86
PureMath86 / mouse_logger.pyw
Created October 9, 2017 06:00
mouse_logger
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pynput.mouse import Listener
import logging
from importlib import reload
reload(logging)
logging.basicConfig(filename="mouse_log.txt",
@PureMath86
PureMath86 / key_logger.pyw
Last active October 9, 2017 08:48
key_logger
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pynput.keyboard import Key, Listener
import logging
from importlib import reload
log_dir = ""
reload(logging)
@PureMath86
PureMath86 / mouseXY.py
Created October 12, 2017 18:44
mouseXY
import pyautogui
def mouse_now():
print('Press Ctrl-C to quit.')
try:
while True:
# Get and print the mouse coordinates.
x, y = pyautogui.position()
positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
@PureMath86
PureMath86 / frame_clipboard.py
Created November 1, 2017 06:28
frame_clipboard
import pandas as pd
import pyperclip
import io
def frame_clipboard():
s = pyperclip.paste()
clip_df = pd.read_table(io.StringIO(s))
return clip_df

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@PureMath86
PureMath86 / rotate_img.py
Created March 5, 2018 20:22
rotate_img.py
# import packages
from PIL import Image
import os
import argparse # build command-line interfaces
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-d",
"--directory",
@PureMath86
PureMath86 / ocr.py
Created March 5, 2018 20:23
ocr.py
# import the necessary packages
from PIL import Image # get image from disk in PIL format
import pytesseract # python "wrapper" of Google's Tesseract binaries
import argparse # build command-line interfaces
import cv2 # opencv-python
import os # operating system
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()