Skip to content

Instantly share code, notes, and snippets.

View shofetim's full-sized avatar

Jordan Schatz shofetim

View GitHub Profile
@shofetim
shofetim / README.md
Created March 24, 2016 23:06 — forked from dannguyen/README.md
Using Google Cloud Vision API to OCR scanned documents to extract structured data

Using 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

@mars
mars / reactjs-filepicker.js
Last active March 8, 2018 05:09
Use Filepicker.io with React.js (v0.14, ES2015, & JSX)
/*
Filepicker lib must be loaded from script tag in HTML:
<script type="text/javascript" src="//api.filepicker.io/v2/filepicker.js"></script>
*/
class FilepickerInput extends React.Component {
componentDidMount() {
const filepickerElement = this.refs.filepicker;
if (typeof filepicker !== 'undefined') {
// Single-page app integration: https://developers.filepicker.com/docs/support/integration/117
@martinklepsch
martinklepsch / logging.cljc
Last active October 22, 2018 18:27
simple Clojurescript logging using Google Closure logging tools
;; This previously was CLJX but has now been updated to use cljc. Thanks @caskolkm
;; https://gist.github.com/caskolkm/39d823f5bac7051d3062
(ns app.logging
(:refer-clojure :exclude [time])
(:require #?(:clj [clojure.tools.logging :as log]
:cljs [goog.log :as glog]))
#?(:cljs (:import goog.debug.Console)))
#?(:cljs
anonymous
anonymous / gist:005640fb943434d247f4
Created December 4, 2014 19:52
Harvest: list running co-worker timers

With [Basic Auth][basic], who are your [co-workers][people]:

$ curl -H 'Authorization: Basic …' -H 'Accept: application/json' https://example.harvestapp.com/people
>   jq 'map(select(.user.is_active)) | map(.user | {first_name: .first_name, last_name: .last_name, id: .id})'
[
  {
    "id": 1234,
    "last_name": "Alice",
    "first_name": "Bobsdaughter"

},

@ustun
ustun / gist:523bab8ea50b1cf7aa52
Created November 23, 2014 18:47
Download all Clojure/conj 2014 videos
youtube-dl -citk --max-quality mp4 http://www.youtube.com/playlist?list=PLZdCLR02grLoc322bYirANEso3mmzvCiI
@john2x
john2x / 00_destructuring.md
Last active April 23, 2024 13:18
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

(ns blog.errors.core
(:require-macros
[cljs.core.async.macros :refer [go]]
[blog.utils.macros :refer [<?]])
(:require
[cljs.core.async :refer [>! <! chan close!]]))
;; convert Node.js async function into a something
;; that returns a value or error on a channel
(defn run-task [f & args]
@chuckreynolds
chuckreynolds / wordpress-change-domain-migration.sql
Last active February 10, 2023 18:56
UPDATE: Use WP-CLI find-replace command to edit URLs in your database. https://developer.wordpress.org/cli/commands/search-replace/ Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: al…
/* Use WP-CLI instead https://developer.wordpress.org/cli/commands/search-replace/ */
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */
@Chouser
Chouser / externs_for_cljs.clj
Created June 17, 2013 13:44
Generate an externs.js file for arbitrary JS libraries for use in advanced Google Closure compilation, based on the ClojureScript code that uses the libraries.
(ns n01se.externs-for-cljs
(:require [clojure.java.io :as io]
[cljs.compiler :as comp]
[cljs.analyzer :as ana]))
(defn read-file [file]
(let [eof (Object.)]
(with-open [stream (clojure.lang.LineNumberingPushbackReader. (io/reader file))]
(vec (take-while #(not= % eof)
(repeatedly #(read stream false eof)))))))
@willurd
willurd / web-servers.md
Last active April 25, 2024 09:21
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000