Skip to content

Instantly share code, notes, and snippets.

@anvk
anvk / deleteAllGitBranchesExceptOfDevelop
Created May 1, 2018
Delete all Git local branches except of develop
View deleteAllGitBranchesExceptOfDevelop
git branch | grep -v "develop" | xargs git branch -D
@anvk
anvk / aliases.sh
Created Nov 16, 2017
Alias commands
View aliases.sh
alias gti='git'
alias ll='ls -la'
alias mymongo='mongod --dbpath /Users/anvk/Documents/mongo.data/db/'
alias mypsql='postgres -D /usr/local/var/postgres'
alias mychange='git add . && git commit -m "change" && git rebase -i HEAD~2 && git push -f --set-upstream origin'
alias mykillemmulator='$ANDROID_HOME/platform-tools/adb -s emulator-5554 emu kill'
alias mypush='git push -f -u origin HEAD'
alias myrebase='git checkout develop && git fetch upstream && git pull upstream develop && git checkout - && git rebase develop'
@anvk
anvk / psql_useful_stat_queries.sql
Last active Dec 2, 2021
List of some useful Stat Queries for PSQL
View psql_useful_stat_queries.sql
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@anvk
anvk / GIF-Screencast-OSX.md
Created Apr 11, 2017 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@anvk
anvk / ocr.markdown
Created Feb 17, 2017 — forked from henrik/ocr.markdown
OCR on OS X with tesseract
View ocr.markdown

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 Jan 27, 2017
Terminal - SourceTree
View .gitconfig
[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 / promises_generators.js
Created Jun 2, 2016
Sequential execution of Promises using generators and co()
View promises_generators.js
function asyncFunc(e) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(e), e * 1000);
});
}
const arr = [1, 2, 3];
co(function* () {
let result = [];
@anvk
anvk / promises_recursion.js
Created May 26, 2016
Sequential execution of Promises using Recursion
View promises_recursion.js
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 / promises_reduce.js
Last active Nov 12, 2021
Sequential execution of Promises using reduce()
View promises_reduce.js
function asyncFunc(e) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(e), e * 1000);
});
}
const arr = [1, 2, 3];
let final = [];
function workMyCollection(arr) {
@anvk
anvk / flac_to_mp3.sh
Last active May 26, 2016
Flac to MP3 converstion with FFMPEG
View flac_to_mp3.sh
for a in *.flac; do
ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}"
done