Skip to content

Instantly share code, notes, and snippets.

View neofreko's full-sized avatar

Akhmad Fathonih neofreko

View GitHub Profile

Keybase proof

I hereby claim:

  • I am neofreko on github.
  • I am neofreko (https://keybase.io/neofreko) on keybase.
  • I have a public key ASBOuUtqWIaiFCPUC_qesLBjMUSCr05Tjiaw2BZgk0j_vgo

To claim this, I am signing this object:

@neofreko
neofreko / image_has_sentence.rb
Created April 25, 2018 03:55
extract sentence using rtesseract
# brew install tesseract
# gem install rtesseract
# gem install mini_magick
#
# example:
# puts image_has_sentence?('/Users/me/Pictures/hi.png', 'hello world')
require 'rtesseract'
require 'mini_magick'
Wed Apr 25 07:10:44 UTC 2018
@neofreko
neofreko / wait-until-async.js
Created June 1, 2018 01:16
wait until condition becomes truthy. Inspired by former works or wait-until libraries and tutorials.
const waitUntil = async (asyncCondition, timeoutMs) => {
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
const intervalMs = 1000;
const startTime = Date.now();
const result = await asyncCondition();
const endTime = Date.now();
const timeSpentMs = endTime - startTime;
console.log(`checking waitUntil condition, timeout in: ${timeoutMs}ms`);