Tuesday, June 3, 2014

How to set up executing PHP script before Java app on NGINX

Script should return 403 error to say server to proceed with tomcat proxy pass.
    location / {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass   unix:/run/php5-tomcat.sock;
            fastcgi_index  index.php;
            root /var/www/php;
            include     fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  $document_root/script.php;
            error_page 403 = @tomcat;
            fastcgi_intercept_errors on;
    }

    location @tomcat {
        proxy_pass http://127.0.0.1:8080;
    }

Tuesday, October 22, 2013

Restore Amazon S3 Object Archived to Glacier From Command Line

You need to download perl file s3curl.pl https://github.com/rtdp/s3curl Command:
perl s3curl.pl --id reng --post -- --data-binary "<RestoreRequest><Days>30</Days></RestoreRequest>" http://bucketname.s3.amazonaws.com/filename?restore; done

Friday, October 12, 2012

Friday, August 5, 2011

How to disable ehcache

-Dnet.sf.ehcache.disabled=true

Friday, June 17, 2011

How to SVN merge from command line

svn merge -r52164:52167 svn+ssh://www.example.com/test

Tuesday, May 10, 2011

How to make redirect for some URL with parameters to other URL with different parameters

if ($args = "id=115&typeId=14") {
rewrite ^ http://www.example.com/main/newsfeed/xml?hash=gdsgsdgf permanent;
}

Wednesday, March 23, 2011

How to export to CSV in PostgreSQL with psql in cmd

psql -U postgres -c "COPY (select 'a', ',b') TO STDOUT WITH CSV HEADER" database