Skip to content

Instantly share code, notes, and snippets.

View zabih-alipour's full-sized avatar
🏠
Working from home

Zabihullah Alipour zabih-alipour

🏠
Working from home
View GitHub Profile
@zabih-alipour
zabih-alipour / Hibernate_query_statistics
Last active September 2, 2021 16:21
Log hibernate query statistics and query parameter
############################################# Hibernate query statistics #################################################
### For use in spring boot
spring.jpa.properties.hibernate.generate_statistics=true
### For use in hibernate config
hibernate.generate_statistics=true
### Log parameters
logging.level.org.hibernate.stat=debug
@zabih-alipour
zabih-alipour / CurlRequestCall
Created April 26, 2019 04:36
Repeat request calling for n times with curl
curl -X POST http://localhost:8081/api/v1/users?[0-100] -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '{ "name": "2Mohammad", "email": "Asghar2" }'
# View git log
* git log --pretty=oneline // show log in one line
* git log --pretty=format:"%h : %an : %ar : %s" // version : user : date : commit message
@zabih-alipour
zabih-alipour / gist:7bec86c6a62e224c64d681365b31e6e3
Created October 6, 2018 07:23
Attach idea debagger to maven testcase
mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" -Dtest=BankAccountTest test
0. SSH to server
1. Edit /opt/bitnami/apps/jenkins/jenkins_home/config.xml
2. set userSecurity to false: <userSecurity>false</userSecurity>
3. delete
<authorizationStrategy> and <securityRealm>
4. /etc/init.d/bitnami restart
@zabih-alipour
zabih-alipour / gist:fe40f6f1eee7d8c5581657eabfd61929
Created September 24, 2017 05:20
Fix SQL Injection using Oracle Database Code
Execute Immediate Statement
Secure Usage
//---------------------------------------------------
--Execute Immediate - named parameter
sqlStmt := 'SELECT emp_id FROM employees WHERE emp_email = :email';
EXECUTE IMMEDIATE sqlStmt USING email;
--Execute Immediate - positional parameter
sqlStmt := 'SELECT emp_id FROM employees WHERE emp_email = :1 and emp_name = :2';
git config --global core.editor "vim"
@zabih-alipour
zabih-alipour / gist:bac559c028bb63342190382f6c8d71e8
Created July 18, 2017 04:39
playframwork application tips
//---------
run tests whitout go to activator console with additional config parameter:
$ activator clean -Dhibernate.hbm2ddl.auto=create "test-only UserControllerTest"
//--------- deploy with publish
& activator publish;
//--------- deploy with jar file(first create zip file and should be extract and run)
$ activator clean dist;