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.

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

  • MySQL

    How to update values of a column from one table to another?

    13.08.2021 1 minute read

    Sometimes, I come across situations where I would need to update a newly added in a pivot table and this query does come in handy:Hope you found this useful too!

  • DevOps

    View your wget progress even after closing your SSH session

    13.08.2021 1 minute read

    Few days back, I ran a command to download a file and accidentally closed the SSH client.I logged in again and checked the list of active processes and thankfully, the process was still running except that I wasn't able to know the current progress of it.So, I did a little research and found a way to view the progress, so I tried the following command:And, I was able to view it's current download progress again.Hope this helps you out!

  • VSCode

    How to switch between integrated terminal and editor in Visual Studio Code?

    21.07.2021 1 minute read

    While, I'm trying to adjust myself to using Visual Studio Code, I found it quite annoying that there isn't a shortcut to switch focus between the editor and the integrated terminal. For a guy, like me, who makes use of the keyboard all the time, that's pretty important.I did some research and found a way on how to do it. Just type and type and add these lines:Save the file and now, you'll be able to switch between the two by pressing keys.Hope you found this tip useful!

  • VSCode

    Quick Search for file in your workspace in Visual Studio Code

    09.07.2021 1 minute read

    Recently, started using Visual Studio Code as I'm yet figure out a way to install Sublime Text on Void Linux (using it as my current daily driver).I'm always used to looking for my files using keyboard shortcuts in Sublime Text and I was kind of surprised this feature isn't enabled by default in Visual Studio Code.Anyway, after a little digging, I found out that adding this line to your file would allow you to look for files in your workspace:And, now try and you'll be able to search for your file(s) easily.Hope you found this tip useful!

  • DevOps

    Redirect from HTTP to HTTPS in Apache VirtualHosts

    09.07.2021 1 minute read

    Here's a simple technique on how I learned to redirect a site from HTTP to HTTPS automatically using Apache's VirtualHost configuration.Go to your configuration file or and modify your configuration to something like this:Save the file and check if the configuration is correct before your restart the server:If you get the message, , then go ahead and restart the server:Now, your visitors will be redirected from HTTP to HTTPS automatically!Hope you found this tip useful!

  • DevOps

    How to setup rsync with passwordless SSH on UNIX/Linux?

    03.07.2021 2 minutes read

    Tired of ensuring if whether each file in every server is synced? Planning on doing automated backups? If so, then this technique should come in handy for you.Interested? Then follow the steps below:Check if rsync over SSH worksBefore you start, please ensure that you can to your intended server over using a password. With the following example, you can just send a simple file over to the intended server and see if it works or not:Once you execute this command on the terminal, it'll prompt you for a password on the remote server, if it does, then it works.Generate SSH KeysIf you want to do a passwordless SSH, you need to generate public and private SSH keys on the local server by typing the following command on the terminal:If you're prompted to enter a passphrase, just hit and proceed until the key is generated. Once the keys are generated, they'll be in the directory on your local server.Copy public key to remote serverUsing , you can copy the public key to the remote server:Once executed, you'll be prompted to enter the password of the account on the remote server and if successful, the public key will be copied to the remote server and will be stored in it's appropriate location.Perform Rsync over passwordless SSHIf you've come this far, then you should be able to SSH to the remote server without entering the password:If it works, then perform the operation again (above) and this time, it shouldn't prompt you to enter any password.Hope you liked reading this short article!

  • VIM

    Prevent VIM from creating swapfiles

    03.07.2021 1 minute read

    I like VIM and use it regularly to write and edit code on a daily basis but I always find the creation of files really annoying.If you find them annoying too, you disable them temporarily in the editor, like this:Or if you want to disable it permanently, just add this line in your file:Don't get me wrong, I'm not saying that you should dislike files because if the editor crashes or your computer/server crashes in midway, those files can save your progress.Hope you found this tip useful!