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 / 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;
git config --global core.editor "vim"
@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';
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: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
# 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 / 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" }'
@zabih-alipour
zabih-alipour / Debian Repository List
Created June 9, 2019 11:23
Get all repositories list in debian
grep ^[^#] /etc/apt/sources.list /etc/apt/sources.list.d/*
WITH cte AS (
SELECT current_date - (n || ' day')::INTERVAL AS date
FROM generate_series(0, 29) n
)
SELECT date
FROM cte
SELECT s.schemaname,
s.relname AS tablename,
s.indexrelname AS indexname,
pg_relation_size(s.indexrelid) AS index_size,
s.idx_scan
FROM pg_catalog.pg_stat_user_indexes s
JOIN pg_catalog.pg_index i ON s.indexrelid = i.indexrelid
WHERE s.idx_scan > 0 -- has never been scanned
AND 0 <>ALL (i.indkey) -- no index column is an expression
AND NOT i.indisunique -- is not a UNIQUE index