Welcome to Make IT Easy

About life,code and experiences

Some things I learnt

Helpful Linux Commands

# Find all symbolic links in the directory  # .(dot) – search starting from the current dir  # maxdepth – adjust this to search recursively – this searches 5 levels deep  find . -maxdepth 5 -type l -ls

SQL Server shrinking log file size

This is a quick post to show how to shrink the size of the log file for a database. Be extremely careful when doing this and always backup the entire database. Try on a test database or server first. Do this at your own risk. — database name = MyDatabaseName — the database log file… read more »

Installing nodejs on CentOS 7 with NVM

Using NVM(Node Version Manager) we can have multiple nodejs versions and switch between them quickly. I am doing this on CentOS 7. # install nvm curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash # open a new terminal and check the version nvm –version # install latest node LTS and check version nvm install –lts node –version npm… read more »

Virtualbox Set date and time manually

This post is about setting time manually on a Linux VM independent of the host machine. Virtualbox automatically syncs VM time to the host machine and sometimes the guest additions will do this as well. I am doing this on the below Host OS: Windows 10 Guest OS: CentOS 7 Guest VM Name: CentOS 7… read more »

Kill all PHP, ngix, mysql processes

Note: Please use with caution. I am not responsible if you mess up your production server. You have been warned ! # kill all PHP Processes kill $(ps aux | grep ‘[p]hp’ | awk ‘{print $2}’) # kill all Nginx Processes kill $(ps aux | grep ‘[n]ginx’ | awk ‘{print $2}’) # kill all MySQL… read more »

MSSQL: Session and Request info, Blocking sessions

Here is a list of queries that can be helpful if you are trying to troubleshoot locks and blocking sessions on SQL server. — to get session and connections on the server SELECT * FROM sys.dm_exec_sessions AS sess JOIN sys.dm_exec_connections AS conn ON ( sess.session_id = conn.session_id ); — another command to see details EXEC… read more »

SQL Server: Refresh View Metadata

After making changes to tables, you may need to refresh the metedata of the views pointing to those tables. To refresh the metadata of all views in the database, use this USE {database name here} GO DECLARE @sqlcmd NVARCHAR(MAX) = ” SELECT @sqlcmd = @sqlcmd + ‘EXEC sp_refreshview ”’ + name + ”’;’ FROM sys.objects… read more »

Windows 10 multiple monitor backgrounds

The Appearance and Customization panel is hidden in Win 10 and cannot be accessed from the Control Panel ( why Microsoft ? ) You can use a handy command to gain access and then set different desktop backgrounds for each of your monitors. Open a command prompt and type and hit enter – a new… read more »

SQL substring replacement

There are times when you need to replace only a part of the string in the database column. You can use the stuff() function in MSSQL or insert() function in MySQL MSSQL Definition: STUFF ( string , start , length , replaceWith ) Example: select stuff(‘My Original String’, 4, 8, ‘Replaced’); Output: My Replaced String… read more »

Centos7 cleaning boot partition

Boot partition might be full as it stores old kernels etc. To clean it up and store only the latest 2 kernels do the below Take a backup of your /boot partition somewhere first edit /etc/yum.conf and set installonly_limit=2  # install yum utilities  yum install yum-utils # cleanup old kernels  package-cleanup –oldkernels –count=2