Skip to content

Instantly share code, notes, and snippets.

View MomenFathi's full-sized avatar

LyJoker MomenFathi

View GitHub Profile
@MomenFathi
MomenFathi / WPF_UI_for_Python.py
Last active September 5, 2017 13:56 — forked from SteveGilham/gist:1df41d2e7d92fba0a763
WPF UI for Python
# Reference the WPF assemblies
import clr
clr.AddReferenceByName("PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
clr.AddReferenceByName("PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
import System.Windows
# Initialization Constants
Window = System.Windows.Window
Application = System.Windows.Application
Button = System.Windows.Controls.Button
@MomenFathi
MomenFathi / WPF_Example.py
Last active September 5, 2017 13:54 — forked from SteveGilham/gist:335e15f5aa4bbf579184
WPF for Python Example
from wpf import *
# Create window
my_window = Window()
my_window.Title = 'Welcome to IronPython'
# Create StackPanel to Layout UI elements
my_stack = StackPanel()
my_stack.Margin = Thickness(15)
my_window.Content = my_stack
@MomenFathi
MomenFathi / test.py
Created February 16, 2017 19:38 — forked from christianroman/test.py
Bypass Captcha using 10 lines of code with Python, OpenCV & Tesseract OCR engine
import cv2.cv as cv
import tesseract
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE)
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY)
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz")
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD)
tesseract.SetCvImage(gray,api)
print api.GetUTF8Text()