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.

  • 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! 😄

  • JavaScript

    How to fetch a JSON object from an array of JSON objects by property value?

    13.08.2021 1 minute read

    Say, for example, you have an array of JSON objects that contains the following data:Hmm, that's pretty basic but how will get the information of "Bob Smith" using his email? Well, that's where the method comes into the picture.Try reading the Mozilla Documentation on and implement the following:This works fine on all browsers except Internet Explorer (I mean, it sucks anyways!), which is okay!Hope you found this useful!

  • Git

    How to use GitHub Personal Access Token to authenticate your git commits?

    13.08.2021 1 minute read

    On November 2020, GitHub had announced that they would no longer accept basic username/password to authenticate git commits and it would be deprecated by Mid 2021.Instead, they recommend you to authenticate your git commits using a Personal Access Token from your GitHub account.Generate a personal access tokenUnset your credentials from your remote repository: Login to your GitHub account and go to Settings Then navigate to Developer Settings -> Personal Access TokensClick on Generate new tokenGive a name to your Personal Access Token and the necessary permissions required.Once done, hit on Generate tokenThe token will be shown once, so make sure to copy it and store it somewhere that you can remember.Update your remote repositoryOnce you've generated a token, you just have to update your remote repository by following the below steps:1. Update remote repository URL2. Just git pull onceNow, just perform operation once and you should be good:Hope this helps you out!