Skip to content

Instantly share code, notes, and snippets.

View antlypls's full-sized avatar
🤘

Anatoliy Plastinin antlypls

🤘
View GitHub Profile
guard 'process', :name => 'shrink-images', :command => 'ruby resize-mobile-images.rb mobileretina' do
watch /^images\/mobileretina\/.+/
end
@mixin mobile_bg($file){
background-image: image-url('mobile/standard/#{$file}');
@media screen and (-webkit-min-device-pixel-ratio: 2) {
background-image: image-url('mobile/retina/#{$file}');
background-size: image-width('mobile/standard/#{$file}') image-height('mobile/standard/#{$file}');
}
}
// Usage
require 'spec/support/grep_matcher'
describe do
disallow_presence_of pattern: "send(.*#",
location: "app/",
description: "Do not use dynamic method invocations",
failure: "Please change dynamic method call to something more sane."
end
@antlypls
antlypls / README.md
Created May 2, 2016 21:38 — forked from dannguyen/README.md
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs

@antlypls
antlypls / booklet.sh
Created February 28, 2011 08:44
transforms pdf to booklet layout (two pages side by side) fixed version of http://lembra.wordpress.com/2010/02/21/create-a-script-to-print-a-pdf-booklet/ required packages: pdftk and pdfjam (as well as tex-live, pdflatex required by pdfjam)
#!/bin/bash
FILE=$(echo $1 | sed 's/.pdf//')
echo "$ pdfcrop $FILE.pdf --margins 12"
pdfcrop $FILE.pdf --margins 12
echo "$ pdftops $FILE-crop.pdf"
pdftops $FILE-crop.pdf
#!/bin/bash
if [ -z "$1" ] ; then
echo 'Project name is empty'
exit 1
fi
PROJECT_NAME="$1"
SCALA_VERSION="${2-2.11.8}"
SCALATEST_VERSION="${3-2.2.6}"