megacolorboy

Hey there,
I'm Abdush Shakoor.

A not-so-typical software engineer & designer with a knack for problem solving and building stuff for fun.

  • DevOps

    Extract private key and certificate from .pfx file

    12.03.2022 1 minute read

    Ever wondered what's a file? It's just a combination of both private key and the certificate and this file is usually used in Microsoft IIS Servers.However, you can't use this file in Linux servers as both private key and the certificate are supposed to be individual files.Here's how you can extract both private key and certificate files:Hope this tip helps you out!

  • Tutorial

    Install NGINX and PHP on Windows

    27.02.2022 3 minutes read

    Thought of writing a small tutorial on how to install NGINX and PHP on Windows. You can also use this as a reference if you wanted to install them on Windows Server too. NoteThis tutorial won't teach you how to configure both PHP and NGINX configurations as there are a lot of tutorials focusing on that topic.Setting up NGINXDownload NGINX for WindowsGo to directory and create a folder named .Unzip the downloaded file in directory.Go to and create two new folders named and .To test, if it's working, double-click on and type in the browser. You should be able to see a Welcome page.Kill the NGINX process from Task Manager.Setting up PHPDownload PHP 8.1 for Windows.Go to directory and create a folder named or if you wanted to have multiple versions, .Unzip the downloaded file in directory.Add PHP to your system environment variables by adding the path Open Command Prompt and type . You see should be able to see the version if it's installed correctly.Run NGINX and PHP as separate servicesGenerally, it's good practice to run both PHP and NGINX as background services or else, you might have to start the processes manually every time the server goes down.As I was looking for a way to do that, I stumbled upon this post on StackOverflow and it was quite helpful.Install NSSM Service ManagerNSSM Service Manager is a free open-source alternative that helps you create a service with the help of GUI. Below are the steps that I followed:Download NSSM Service ManagerGo to directory and create a folder named .Unzip the downloaded file in directory.Install NGINX as a serviceOpen Command Prompt as an Administrator.Go to directory.Type Define the path of the file.Click on .Press and type .Look for and start the service.Open your browser and type to see if it's working correctly.Install PHP as a serviceOpen Command Prompt as an Administrator.Go to directory.Type Define the path of the file.Add the arguments: Click on .Press and type .Look for and start the service.Useful commands while using NSSMTest to see if it works!Before you proceed with the following steps, ensure that you include the files from the folder in your file.Add the following line to your file:Go to directory and create .Go to and create directory.Refer to the sample configuration provided and make the necessary changes.To enable the site, you have to create a symlink: .Ensure the configuration doesn't have any errors by typing in directory.Restart the NSSM service.Add an entry in your hosts file: .And you're done! TipIf you get a "Connection Refused" or error that is similar to that, it's most probably due to firewall or maybe the PHP service isn't running.Sample NGINX Virtual Host ConfigurationConclusionIf you've gotten this far, give yourself a pat in the back.Hope you've found this tutorial useful and please share it with your friends and colleagues if they really need it!

  • Databases

    Install MariaDB 10.3 on Void Linux

    16.01.2022 2 minutes read

    I tried to find a proper guide on how to install MySQL 8.0 on Void Linux but I couldn't really find any. So, I thought of installing MariaDB 10.3 on my laptop instead.Don't worry about using MariaDB as it meets the same standard enterprised requirements as MySQL. The only difference is that MySQL belongs to Oracle and MariaDB is for people who wanted to get out of Oracle's hands.Anyway, let's get started.PrerequisitesNeed to have root privileges in order to install packages.Basic know-how of Void Linux and it's package manager.Alright, go ahead and follow these steps one-by-one:1. Install MariaDBType the following command to install the package:2. Initialize MySQL data directoryThe following command will initialize a MariaDB data directory and create system tables in the MySQL database, if they are not present.The options used:: The login user name to use for running the process. The path to the MariaDB installation directory.: The path to the MariaDB directory.To know more about it, you can refer to MariaDB's documentation.3. Enable MySQL serviceIf you are used to Ubuntu or CentOS, enabling services in Void Linux is a bit different but quite simple. Once a process is symlinked, it will start on boot and restarts if it stops unless you stop the service deliberately.Type the following command to enable the service:4. Start MySQL serviceType the following command to start the service:To confirm, if the service is running, type the following:And you'll see something like this: 5. Secure MySQL installationIt's recommended to secure your installation, so type the following command:Once the command is executed, you'll be prompted with a few questions, respond according to your needs and you're done!6. Test MariaDB connectionNow, all you have to do is, try to log in to your database by typing the following:Once executed, it would prompt you for your password (which you must have set in the previous step and if you are able to log in, you are good to go!Hope this guide helps you out!

  • Terminal

    Count the number of word occurences in a text file using grep

    16.01.2022 1 minute read

    If you are using a GUI based application like Microsoft Word of Google Docs, it would be easier for you to know the number of word occurences in a file. But what if you are in a terminal? That's where both and comes handy tools.Let's say you have the following text:Now, you can use the and tool to count the number of times appears in the file:Hope this helps you out!

  • VIM

    Count the number of matches of a pattern in VIM

    16.01.2022 1 minute read

    You can the count the number of matches of a pattern by using the flag while using the substitute command. Try the following command:If you want to know on how many lines it matches, just omit the flag:Hope this tip helped you out!

  • Linux

    How to create an ISO image from CDs/DVDs?

    23.10.2021 1 minute read

    I used to create ISO images using DAEMON Tools but I wanted to try something different and see if there's a way to create it using the Linux CLI.Turns out, you can do in just a single line using the utility like so:The stands for input file and stands for output file.Looks like, I don't have to use DAEMON Tools for stuff like this, I guess.Hope you found this tip useful!

  • Linux

    How to identify which Linux distribution is running in your system?

    02.10.2021 1 minute read

    If you've read my earlier post, I was using Ubuntu, at that time, and I thought that was how you identify which distro is running in your system but using is not always going to work as some distributions may not have it installed.Try the following command to identify the distribution you are running in your system:And you'll get the following output:Hope this helps you out!

  • Linux

    Truncate a file using redirection in Linux

    02.10.2021 1 minute read

    Simply put, sometimes, there are situations in where you just want to clear the contents of a file without deleting it.This could be for many reasons like to avoid permission related issues, or maybe the file could be having useless logs that amasses to a size that measures in GBs.So, the easiest solution is to clear it away from a terminal is by shell redirection like so:Let me break down the command here:The symbol means and doesn't produce any output.The '>' symbol is used for redirecting the output of the preceding command (in this case, it's empty!) is the file that you want to truncate. If it doesn't exist, the file will be created.Alternatively, you can do the same by using the command to output the contents of the device (which only contains a EOL character) to empty a file:Hope this comes in handy!

  • Linux

    Display list of files with their extension and file sizes

    20.09.2021 1 minute read

    Last month, I was trying to free up some space in my company servers and I realized that there were a lot of files taking up a lot of space.So, I wrote the following command to list files by their extension:And later to determine which files are the largest, I executed this command to sort the list by file size:Hope this tip helps you too! 😄