Delete Page Layouts / Master Pages by PowerShell Script

In one of my projects we needed a PowerShell script for deleting an unnecessary page layout for all web application. Here is the script that I wrote. This is not only for page layouts, it can be used for masterpages.