Skip to content

Instantly share code, notes, and snippets.

View sathish-io's full-sized avatar

Sathish Kandasamy sathish-io

View GitHub Profile
@sathish-io
sathish-io / MySQL_ignore_case_table_name
Created October 20, 2013 07:30
MySQL_ignore_case_table_name
MySQL Table names in Linux is case sensitive.
To disable it, set property lower_case_table_names=1 in /etc/my.cnf file under "[mysqld]" section, as shown below,
==================
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
@sathish-io
sathish-io / Find process listening at port 8080 on Mac OS X
Created March 2, 2014 20:39
Find process listening at port 8080 on Mac OS X
Here is the command to find out the process # that is listening at the givne port(say 8080) in on Mac OS X,
lsof -n -i4TCP:8080 | grep LISTEN
this will return below sample o/p,
java 41038 user1 54u IPv6 0x68e4c014dcuy8y0 0t0 TCP *:http-alt (LISTEN)
@sathish-io
sathish-io / How to check high response HTTP calls from JBoss access log file
Last active July 2, 2019 11:04
How to check high response HTTP calls from JBoss access log file
How to check high response HTTP calls from JBoss access log file
Response time is last field in the access log, and below command will show calls that took more than 5 seconds.
cat access.log | awk -F " " '{ if ($NF > '5') {print $0}}'
@sathish-io
sathish-io / Linux - Find files that are older than 1 day
Created May 2, 2014 13:27
Linux - Find files that are older than 1 day
Find files that are older than 1 day with file name 'LOGFILE', and delete them.
find /var/log/ -type f -mtime +1 -name '*LOGFILE*' -exec rm {} \;
We can put this delete command in a script say deleteOldLogs.sh and add it in cron entry to run every day,
crontab -l
0 0 * * * /usr/sathish/Scripts/deleteOldLogs.sh
@sathish-io
sathish-io / Oracle escaping '&' character
Created May 5, 2014 07:38
Oracle escaping '&' character
some times, you are in need of doing DML operation that involves strings with & sign in it.
Oracle sql clients treats this as a substitution variables and prompts you to enter value.
For example when you run below select statement; it prompts you to enter value for "T".
select 'A&T' from dual;
To disable this you can disable substitution variables for your session using "SET DEFINE OFF"
Note: & is the default value for DEFINE.
SET DEFINE OFF
@sathish-io
sathish-io / Start and Stop PostgreSQL Service on Windows command line
Created May 5, 2014 08:04
Start and Stop PostgreSQL Service on Windows command line
NET START postgresql-x64-9.3 (64-bit windows)
NET STOP postgresql-x64-9.3 (64-bit windows)
NET START postgresql-9.3 (32-bit windows)
NET STOP postgresql-9.3 (32-bit windows)
Note: This is for Windows 7. Replace 9.3 with your version of PostgreSQL version.
@sathish-io
sathish-io / Taking heap dump in JVM
Created May 6, 2014 08:29
Taking heap dump in JVM
To troubleshoot memory leak related issues in java based application, we are in need of analyzing the JVM heap dump to understand potential objects that are causing the problem.
To take the heap dump below command helps,
jmap -dump:format=b,file=jvm_heap_dump.hprof {PID}
This will create file with name - jvm_heap_dump.hprof
Then, we can use eclipse Memory Analyzer(MAT) to analyze the dump.
@sathish-io
sathish-io / Maven cheat sheet
Last active July 2, 2019 11:03
Maven cheat sheet
To download souce,
mvn dependency:sources
To start spring boot app:
mvn spring-boot:run
To run single test:
mvn -Dtest=TestCircle test
To remote debug maven test case, run with below option,
@sathish-io
sathish-io / Basic postgresql commands
Created September 3, 2014 17:23
Basic postgresql commands
Basic postgresql commands:
\l - to list all database.
\db - to list all tables in a db.
\d <tablename> - to describe a table
Create new database
@sathish-io
sathish-io / AWK script to get standard deviation
Last active October 21, 2024 13:25
Basic linux commands
AWK script to get min, max, sum, average, standard deviation for numbers:
cat data.txt | awk -F ":" 'BEGIN {max = 0; min = 999999; sum = 0; sumsq = 0} { x= ($NF + 0); sum += x; sumsq += x*x; if(x > max)max = x; if(x < min) min = x} END { print "Min: ", min, " Max: ",max, " Sum: ", sum, " Average: ", sum/NR , " Std Dev: ", sqrt(sumsq/NR - (sum/NR)^2) }'
Assume you have data.txt that has following data set,
2
3
6
8
11