Skip to content

Instantly share code, notes, and snippets.

@andreyshuster
andreyshuster / gist:1eb5b349443fbd9c9087
Created July 29, 2014 09:05
pre-commit hook to check pep8
#!/bin/sh
FILES=$(git diff --cached --name-status | grep -v ^D | awk '$1 $2 { print $2}' | grep -e .py$)
if [ -n "$FILES" ]; then
pep8 -r $FILES
fi
@andreyshuster
andreyshuster / gist:8d4ff5a94f7732c826e2
Created June 25, 2014 11:58
yeoman interesting generators
npm install -g generator-webapp
npm install -g generator-chromeapp
npm install -g generator-chrome-extension
npm install -g generator-angular
@andreyshuster
andreyshuster / gist:0b2180abd23b7a7e505c
Created June 25, 2014 11:16
git use default https instead of git
git config url.https://.insteadOf git://
@andreyshuster
andreyshuster / gist:a6d8013bbe3999b126ae
Created June 17, 2014 07:34
pain and suffer with git-tf case insensitive issues
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch ''solution\Schema Objects\Programmability\Stored Procedures\dbo.Product_recommendation_insert.proc.sql''' --prune-empty --tag-name-filter cat -- --all
@andreyshuster
andreyshuster / gist:9c44205665bace9cd84c
Created June 10, 2014 12:10
find and replace in files in current folder
find . -type f -exec sed -i -e 's/<source>/<destination>/g' {} \;
- go to first char of a line and use blockwise visual mode (CTRL-V)
- go down/up until first char of all lines I want to comment out are selected
- use SHIFT-I and then type my comment character (# for ruby)
- use ESC to insert the comment character for all lines
SELECT value$ FROM sys.props$ WHERE name = 'NLS_CHARACTERSET' ;
SELECT * FROM NLS_DATABASE_PARAMETERS
git log --oneline --graph --decorate --all
@andreyshuster
andreyshuster / gist:e5e944afb1ee13c41d22
Created May 12, 2014 12:55
compare 2 text files and print lines that differs
cat file1.txt file2.txt| sort | uniq -d
@andreyshuster
andreyshuster / download_progress
Last active September 22, 2019 10:37
ajax download file with progress bar
var target = "file destination";
// check compartibility
// reset progress bar
$('.progress-bar').css('width', '0%').attr('aria-valuenow', 0);
var xhr=new XMLHttpRequest();
xhr.overrideMimeType('application/octet-stream');
xhr.open('GET', target, true);
xhr.responseType='arraybuffer';
xhr.send();
xhr.onprogress=function(e){