Port php mysql scripts to php 7.0 from 5.x version

2018-04-23 2 min read Learning
Recently I got a script or series of scripts that were written for PHP 5.6x and hence used mysql_connect which as you know by now does not work with PHP 7.0. Since there were number of scripts, I thought it would be waste of time to change them manually and wrote a script to fix them. If you have similar situation then probably this few lines could help you. Since my scripts did not use all the functions so I did not put the sed commands for all of them but you get the idea 🙂 Continue reading

bash debug – log all executed commands

2014-02-03 1 min read bash
Screenshot of a Bash 3.1 session demonstrating its particularities. Shows exporting a variable, alias, type, Bash’s kill, environment variables PS1, BASH_VERSION and SHELLOPTS, redirecting standard output and standard error and history expansion. A POSIX session is launched from a normal session. Finally, the POSIX session kills itself (since just “exit” would be too boring). (Photo credit: Wikipedia) Whenever I am writing a script in perl or bash, I always wish that there Continue reading

Monitor your system with sysusage.

2013-12-02 2 min read Fedora
First some information on sysusage: Description : SysUsage continuously monitor your systems informations and generate periodical graph reports using rrdtool or javascript jqplot library. All reports are shown throught a web interface. SysUsage grabs all system activities using Sar and system commands allowing you to keep tracks of your computer or server activity during his life. It is a great help for performance analysis and resources management. The threshold notification can alarm you when the system capabilities are Continue reading

phpmyadmin access problem and change server from URL

2012-09-30 1 min read Database Fedora
I was having issues with one of the phpmyadmin setups. The first server defined in the config file was not accessible and the theme that I was using was not allowing me to change the server from the first page. This resulted in a state where I was not able to access phpmyadmin in any way. I could not connect to any of the servers. And thus had to hack my way in to phpmyadmin to find out how to connect to other servers from URL. Continue reading

Oracle Select the top 5 queries

2012-02-27 1 min read Database
Here are one sql script that I found some time back. This will be listing the top 5 SQL queries in Oracle. SET linesize 300 SET PAGESIZE 200 select * from (select sql_text, sql_id, elapsed_time, cpu_time, user_io_wait_time from sys.v_$sqlarea order by 5 desc) where rownum < 6; quit; Related articles SQL Fiddle (thinkvitamin.com) New Oracle E-Book (arnoldit.com) All about Security – SQL Injection (tkyte.blogspot.com)

BASH Script Performace

2012-01-06 2 min read bash Learning
Today we will look at some bash code snippests and the performance issues. Lets first look at the problem and the implemented solution: Problem: We needed to log the output of the ps command for all the process’s. This was required to be done on per minute basis and the output was required in comma separated files. So, here is what was implemented: pslog=`ps -e -opid,ppid,user,nlwp,pmem,vsz,rss,s,time,stime,pri,nice,pcp:u,args|grep -v PID|sort -r -k 13,13` OLD_IFS=$IFS IFS=$'\n' logarr=( $pslog ) for LOGLINE in ${logarr[@]} do LOGLINE=`echo $LOGLINE|awk '{OFS=" Continue reading

Backup of files in the directory.

2011-12-01 2 min read bash Learning Linux
I was working on some scripts and the changes that I was making in the scripts was very dynamic, which I did want to keep backing up in the version control system. But for the peace of my mind, I wanted to keep a copy of the scripts, whenever it was in working state. Since I had multiple files, so it would make more sense to have a script that could copy all the files in the current directory to “old” directory without over-writing the existing files. Continue reading
Older posts