Skip to content

Instantly share code, notes, and snippets.

View georgismitev's full-sized avatar

Georgi Mitev georgismitev

  • Zurich, Switzerland
View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

require 'base64'
require 'open-uri'
require 'net/http'
require 'net/https'
require 'json'
class OCR
attr_reader :api_key, :image_url
def self.scan(api_key:, image_url:)
@georgismitev
georgismitev / README.md
Created March 24, 2016 20:49 — 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

@georgismitev
georgismitev / gist:88a40e28f09578f9f6e0
Created January 1, 2016 15:35 — forked from billhathaway/gist:c8467ebcd2aa8c21d2d2
golang testing bufio.Scanner and strconv.Atoi versus fmt.Scan
package main
// These benchmarks are used to compare how fast it is to read a set of space separated numbers from a string
// using different techniques.
// The primary motiviation for this came when writing some code for hackerrank and realizing that the parsing of numbers
// for large input sets was actually the bottleneck
//
// For stable results, it is recommended to increase the runtime allocated for benchmarking, such as
// go test -v -run none -bench . -benchtime 5s
using System;
public class Program
{
public class Heap
{
int[] heap;
int elements;
public void Swap(ref int a, ref int b)
using System;
public class Program
{
public class Heap
{
int[] heap;
int elements;
//will have children nodes arr[2*i + 1] and arr[2*i + 2],
@georgismitev
georgismitev / git.migrate
Created November 19, 2015 14:39 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
using System;
public class Program
{
public class TreeNode
{
public int Value;
public TreeNode Left;
public TreeNode Right;
public TreeNode(int val)
using System;
public class Program
{
public class DoubleLinkedListNode
{
public DoubleLinkedListNode Next;
public DoubleLinkedListNode Prev;
public DoubleLinkedListNode Child;
public int Value;
RAILS_ENV=production rake db:setup
# produces the error below.....hmmm.....it's a no-worky
psql:/yourprojectpath/yourproject/db/structure.sql:29: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
# hstore postgresql extension needs to be installed, so....
sudo apt-get install postgresql-contrib
# now your extension should be available to enable so log in with psql
psql -d yourproject_production -U yourdbuser -W