Skip to content

Instantly share code, notes, and snippets.

View jimmytuc's full-sized avatar
💭
I may be slow to respond.

Foo jimmytuc

💭
I may be slow to respond.
  • Viet Nam
View GitHub Profile
@jimmytuc
jimmytuc / RunScheduler.php
Created February 26, 2018 07:47 — forked from robbydooo/RunScheduler.php
Heroku Laravel Scheduler
<?php
/**
This Scheduler will run once every minute unlike the Heroku scheduler which only runs every 10 mintues.
To use this scheduler with Laravel 5.4+ add this file to /app/Console/Commands/RunScheduler.php
Register this file in app/Console/Kernel.php
@jimmytuc
jimmytuc / nextTick.js
Created July 23, 2017 05:31 — forked from mmalecki/nextTick.js
process.nextTick vs setTimeout(fn, 0)
for (var i = 0; i < 1024 * 1024; i++) {
process.nextTick(function () { Math.sqrt(i) } )
}
@jimmytuc
jimmytuc / README.md
Created July 5, 2016 23:34 — 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

@jimmytuc
jimmytuc / php
Last active October 14, 2015 04:07
PHP str_replace customization to adapt multi array element passing as argument1 & argument2
function p_str_replace($argFind, $agrReplace, $theString) {
$needle_replace = $theString; // handle the string need to be replace
array_walk($argFind, function($val, $key) use(&$needle_replace, $agrReplace) {
$needle_replace = call_user_func_array('str_replace', array($val, $agrReplace[$key], $needle_replace));
});
return $needle_replace;
}
// testing purpose
$the_str = array(
@jimmytuc
jimmytuc / parse.js
Last active August 29, 2015 14:22 — forked from stephenfeather/parse.js
// Copyright Stephen Feather and other contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//