Author Archives: admin

SQL Server: test queries without cache


Posted in Uncategorized | Leave a comment

Spring Boot: run WAR/JAR with specific profiles

java,other -jar spring-app.war Spring Profiles

Posted in Spring, Spring Boot | Leave a comment

GIT: conflict resolve on pull or merge

Theirs on top git pull -s recursive -X theirs <remote> <branch> git merge -s recursive -X theirs <branch> My on top git pull -s recursive -X ours <remote> <branch> git merge -s recursive -X ours <branch>

Posted in git | Leave a comment

git: file history with diff

Show diff ONLY for src/main/resources/file.xml git log -p src/main/resources/file.xml Show diff for ALL FILES that touches src/main/resources/file.xml git log -p –full-diff src/main/resources/file.xml

Posted in git | Leave a comment

async.js – download multiple files from multiple urls to first success

var async = require(’async’);   var files = [’file1′,’file2′,’file3′]; var urls = [’url1′,’url2′,’url3′];   var down = function(url, file, callback) { setTimeout(function(){ var r = Math.random() >= 0.5; console.log(’— end ‘+file+’, ‘+url+’, ‘+r); callback(r); }, 1000); };   async.concat(files, function(file, callback){ async.someSeries(urls, function(url, callback1){ down(url, file, function(isOk){ callback1(null, isOk); }); }, function(err, r){ callback(err, r); [...]

Posted in JavaScript, async.js | Leave a comment

SSH Tunneling with plink

To make local port 1234 forwarding to remote hostA port 21: plink -v -C -N -L 1234:hostA:21 user@hostB Now You can connect to localhost:1234 to access hostA:21 by tunnel created with hostB. To accept connection from other hosts (not local only): plink -v -C -N -L user@hostB

Posted in plink, ssh | Leave a comment

HTTPS Redirect with exclude

Example how to redirect to HTTPS, but excluding .well-know/* directory. <VirtualHost *:80> ServerAlias RedirectMatch 301 ^/((?!\.well-known).*)$$1 </VirtualHost>

Posted in Uncategorized | Leave a comment

node.js – port test

require(’portscanner’).checkPortStatus( 80, ’′ , function(error, status) { console.log(status) })

Posted in node.js | Leave a comment

async.js: parallel get

/** * jednoczesne wywolanie GET’ow na adresy * zwracana jest tablica odpowiedzi w callbacku * jako drugi parametr lub error jako pierwszy */ var parallelGets = function(urls, callback) { var calls ={ return function(callback){ $.get(url, function(data){ callback(null, data); }).fail(function(jqXHR){ callback(jqXHR); }); }; }); async.parallel(calls, function(err, res){ if(err) { callback(err); } else { callback(null, res); [...]

Posted in JavaScript, async.js | Leave a comment

RxJava .reduce()

Observable.from(new Integer[]{1,2,3,4,5}) .reduce(new Func2<Integer, Integer, Integer>() { @Override public Integer call(Integer t1, Integer t2) { return t1+t2; } }).subscribe(new Action1<Integer>() { @Override public void call(Integer t) { // t = 15 } });

Posted in Java, RxJava | Leave a comment