This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIImage+ImageEffects.m | |
// AnimationExamples | |
// | |
// Created by Timothy Patrick Johnson on 7/3/13. | |
// Copyright (c) 2013 Meister. All rights reserved. | |
// | |
#import "UIImage+ImageEffects.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# build the environment | |
mkdir tessenv; cd tessenv | |
TROOT=`pwd` | |
mkdir $TROOT/stockfonts; mkdir $TROOT/build; mkdir $TROOT/build/eng | |
echo "Environment built" | |
# Get the stock english fonts from Google (old, but they work) | |
cd $TROOT/stockfonts | |
GET http://tesseract-ocr.googlecode.com/files/boxtiff-2.01.eng.tar.gz > boxtiff-2.01.eng.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tornado.ioloop | |
import tornado.web | |
import urllib2 as urllib | |
from PIL import Image | |
from cStringIO import StringIO | |
import numpy as np | |
import tesserwrap | |
import cv2 | |
class MainHandler(tornado.web.RequestHandler): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OCR { | |
private static final String INPUT = "C:/captcha/ex.png"; | |
private static final String OUTPUT = "C:/captcha/captcha-out.png"; | |
private static final String TESSERACT_BIN = "C:/Program Files/Tesseract-OCR/tesseract.exe"; | |
private static final String TESSERACT_OUTPUT = "C:/captcha/out.txt"; | |
private static final int WHITE = 0x00FFFFFF, BLACK = 0x00000000; | |
public static void main(String... args) throws Exception { | |
BufferedImage image = ImageIO.read(new FileInputStream(INPUT)); | |
int average = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Country code | |
CC="MX" | |
URL="https://smp-device-content.apple.com/static/region/v2/config.json" | |
HOME_PAGE="https://www.apple.com/mx/apple-pay" | |
FOUND=false | |
function check { | |
RET=$(curl -s $URL | jq .SupportedRegions.$CC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm | |
yum install postgresql93 postgresql93-server postgresql93-contrib postgresql93-devel postgis2_93 postgis2_93-utils | |
#Configure PostgreSQL | |
chkconfig postgresql-9.3 on | |
service postgresql-9.3 initdb | |
service postgresql-9.3 start | |
# Create PostGIS template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OCR { | |
private static final String INPUT = "C:/captcha/ex.png"; | |
private static final String OUTPUT = "C:/captcha/captcha-out.png"; | |
private static final String TESSERACT_BIN = "C:/Program Files/Tesseract-OCR/tesseract.exe"; | |
private static final String TESSERACT_OUTPUT = "C:/captcha/out.txt"; | |
private static final int WHITE = 0x00FFFFFF, BLACK = 0x00000000; | |
public static void main(String... args) throws Exception { | |
BufferedImage image = ImageIO.read(new FileInputStream(INPUT)); | |
int average = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Paperclip | |
class Blur < Processor | |
def initialize file, options = {}, attachment = nil | |
super | |
@format = File.extname(@file.path) | |
@basename = File.basename(@file.path, @format) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSString (Concatenation) | |
- (NSString *):(NSString *)a; | |
- (NSString *):(NSString *)a :(NSString *)b; | |
- (NSString *):(NSString *)a :(NSString *)b :(NSString *)c; | |
- (NSString *):(NSString *)a :(NSString *)b :(NSString *)c :(NSString *)d; | |
- (NSString *)concat:(NSString *)strings, ...; |
NewerOlder