Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Zabih Alipour zabih-alipour

🏠
Working from home
Block or report user

Report or block zabih-alipour

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Calendar with CTE in postgresSQL
WITH cte AS (
SELECT current_date - (n || ' day')::INTERVAL AS date
FROM generate_series(0, 29) n
)
SELECT date
FROM cte
@zabih-alipour
zabih-alipour / Debian Repository List
Created Jun 9, 2019
Get all repositories list in debian
View Debian Repository List
grep ^[^#] /etc/apt/sources.list /etc/apt/sources.list.d/*
@zabih-alipour
zabih-alipour / Hibernate_query_statistics
Last active Jun 9, 2019
Log hibernate query statistics and query parameter
View Hibernate_query_statistics
############################################# 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 Apr 26, 2019
Repeat request calling for n times with curl
View CurlRequestCall
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 gist:9c710206220b5a8066880a5fd5ce12d4
# 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 Oct 6, 2018
Attach idea debagger to maven testcase
View gist:7bec86c6a62e224c64d681365b31e6e3
mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" -Dtest=BankAccountTest test
View Reset jenkins password
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 Sep 24, 2017
Fix SQL Injection using Oracle Database Code
View gist:fe40f6f1eee7d8c5581657eabfd61929
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';
View gist:bac559c028bb63342190382f6c8d71e8
//---------
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;
You can’t perform that action at this time.