Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Zabihullah Alipour zabih-alipour

🏠
Working from home
View GitHub Profile
View gist:9c0db907448ee34f774b207b08bc40e1
All settingd:
mysql -uroot -p -A -e"SHOW VARIABLES;" > ~/MySQLCurrentSettings.txt
Global SEttings:
mysql -uroot -p -A -e"SHOW GLOBAL VARIABLES;" > ~/MySQLCurrentSettings.txt
Session Settings:
mysql -uroot -p -A -e"SHOW SESSION VARIABLES;" > ~/MySQLCurrentSettings.txt
@zabih-alipour
zabih-alipour / gist:0ddb67601b1ec4c1eeb98a94c29de8fa
Last active Sep 7, 2020
Add a progress in output in NodeJs
View gist:0ddb67601b1ec4c1eeb98a94c29de8fa
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(`waiting.... ${progressNumber}`);
View gist:e5388f7237bcf0c21040f2948442519d
Create file if not exists: /etc/apt/apt.conf.d/proxy.conf
Add your proxy info into file, like:
Acquire::http::Proxy "http://user:password@proxy.server:port/";
Acquire::https::Proxy "http://user:password@proxy.server:port/";
@zabih-alipour
zabih-alipour / gist:0ef4b19914f794befafeeafc21e87a76
Created Nov 9, 2019
Copy all specific type file to another folder
View gist:0ef4b19914f794befafeeafc21e87a76
find . -maxdepth 4 -name "*.pdf" -type f -print0 | xargs --null -I {} cp -rf {} ~/Documents/cp_calibre_pdf/
View Find unused indexes in postgres
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
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