Skip to content

Instantly share code, notes, and snippets.

View anvk's full-sized avatar
⌨️
coding my way through life

Alexey Novak anvk

⌨️
coding my way through life
View GitHub Profile
@anvk
anvk / ocr.markdown
Created February 17, 2017 20:04 — forked from henrik/ocr.markdown
OCR on OS X with tesseract

Install ImageMagick for image conversion:

brew install imagemagick

Install tesseract for OCR:

brew install tesseract --all-languages

Or install without --all-languages and install them manually as needed.

@anvk
anvk / .gitconfig
Created January 27, 2017 17:49
Terminal - SourceTree
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
@anvk
anvk / subl.sh
Created October 21, 2015 17:58
Alias for Sublime 3
# For Windows
alias subl='/c/Program\ Files/Sublime\ Text\ 3/subl.exe'
@anvk
anvk / promises_generators.js
Created June 2, 2016 19:53
Sequential execution of Promises using generators and co()
function asyncFunc(e) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(e), e * 1000);
});
}
const arr = [1, 2, 3];
co(function* () {
let result = [];
@anvk
anvk / flac_to_mp3.sh
Last active May 26, 2016 19:25
Flac to MP3 converstion with FFMPEG
for a in *.flac; do
ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}"
done
@anvk
anvk / promises_recursion.js
Created May 26, 2016 19:24
Sequential execution of Promises using Recursion
function asyncFunc(e) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(e), e * 1000);
});
}
const arr = [1, 2, 3];
function workMyCollection(arr, results = []) {
return new Promise((resolve, reject) => {
@anvk
anvk / debounceN.js
Last active October 20, 2015 13:21
Execute function N times per threshold
/*
* func - function to be called
* threshold - time period in milliseconds
* N - how many function calls will be allowed to execute
*/
var debounceN = function(func, threshold, N) {
var counter = 0;
return function f() {
@anvk
anvk / debounce.js
Last active October 20, 2015 12:44
Execute function not often than wait time period
/*
* func - function you want to debounce
* wait - time period in milliseconds
* immediate - boolean if you want to execute function right away
*/
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {