Setup a new device with Windows 11 Home Edition without a Microsoft account

Prerequisite: Make sure you’re disconnected from the internet. This includes any hardwired connection.

When you’re asked to choose a home country, press Shift + F10. This will open the command prompt window.

In the command prompt window, you need to run the BypassNRO.cmd script file, located in C:\Windows\System32\OOBE

As a part of the process, your device will be restarted.

Automating Let’s Encrypt certificate Renewal using Certbot

Here, we’ll learn how to automate Let’s Encrypt’s SSL certificates using certbot. These instructions can be modified to automate any command.

Service unit file

A service unit file needs to be created at:

Description=Let's Encrypt certificate renewal using certbot

ExecStart=certbot renew --quiet --agree-tos
ExecStartPost=service nginx restart

Timer unit file

The plan is to run the above renewal command every few weeks, as well as 15 minutes after the system boots up.

For this, a timer unit file needs to be created with the same name at:

Description=Timer for Let's Encrypt's certificates renewal



Enable the timer

The timer can be enabled by the command:
systemctl enable --now certbot-renewal.timer

References: The steps above have been referenced from:

Creating custom permalinks for certain categories in WordPress

We had to create a custom permalink for a certain category, this is how it’s done.

For a certain client, we had to create a custom permalink structure for a certain category of posts. We could’ve created a custom post type and that would’ve accomplished that task as well. However, that was out of the scope of the project.

Here is what we ended up with:

add_filter( 'category_link', 'custom_category_permalink', 10, 2 );
function custom_category_permalink( $link, $cat_id ) {
    $slug = get_term_field( 'slug', $cat_id, 'category' );
    if ( ! is_wp_error( $slug ) && 'testimonials' === $slug ) {
        $link = home_url( user_trailingslashit( '/testimonials/', 'category' ) );
    return $link;

add_action( 'init', 'custom_rewrite_rules' );
function custom_rewrite_rules() {
        'top' // The rule position; either 'top' or 'bottom' (default).

        'top' // The rule position; either 'top' or 'bottom' (default).

This is just a starting point. Going through the WordPress Codex, you will find that the possibilities are endless.

References: The snippet above has been referenced from:


Cleaning up the boot partition on Ubuntu

As a part of maintenance, we will learn how to remove old kernels from an Ubuntu machine

Here’s how to clean your boot partition on Ubuntu or similar Debian based systems

Reboot the machine

It is important that the latest kernel is in use while cleaning up the old kernels. A simple reboot will ensure that the latest kernel is in use.

Check the current kernel version

The current kernel version can be checked using the following command:

uname -r

Show a list of installed kernels

Next, we need to fetch a list of all the installed kernels. This can be obtained using the following command:

dpkg --list 'linux-image*' | grep ^ii

Alternatively, an easier form would be:

sudo dpkg --list 'linux-image*' | awk '{ if ($1=="ii") print $2}' | grep -v `uname -r`

Remove the old kernels

We now need to remove the unused kernels from the step above. The following command needs to be executed for every unused version:

sudo apt purge linux-image-VERSION

Remove dependencies

With the old kernels removed, we now need to remove the dependencies by using:

sudo apt --purge autoremove

Update grub

Finally, we need to update grub to use the latest kernel.

sudo update-grub

And that should be it!

Disclaimer: The steps above have been tested with Ubuntu 18.xx and above. Replace apt with apt-get for older versions.

References: The steps above have been referenced from:

  1. StackOverflow (
  2. github (

Regular expression for matching an email address

A single RegEx to rule all email address validations

Effort has been made to keep the regex as language-agnostic as possible. This can be modified depending on the need.

The RegEx is as follows:



While the RegEx looks overly complicated and verbose, it can be broken down to simpler units as follows:

  • ([a-zA-Z0-9_-]+) : A word containing one or more characters that can be alphanumeric, as well as be and ‘underscore’ or a ‘hyphen’.
  • ([\.\+]?[a-zA-Z0-9_-]+)* : This is a repeat of the the first part, prefixed with a ‘dot’ or a ‘plus’ sign. This block can be repeated any number of times, including zero.
  • \@ : The ‘at’ symbol.
  • ([a-zA-Z0-9]+[\.\-])+ : The domain name, can contain ‘hyphens’ or ‘dots’, but not both consecutively.
  • ([a-zA-Z]{2,5}) : The TLD. Change this as per requirement.


The Wikipedia entry on email addresses gives us the acceptable formats.

Disable apps via adb (without root)

Here we learn to disable apps on aftermarket or stock ROMs without rooting

On your Android phone, most apps can be disabled by going to Settings > Apps. However, there are a few pesky apps that can’t be disabled via this method, and they need something a bit more sophisticated.

Often times, this is just bloatware that you want to get rid of.

To disabled the apps, you’ll have to connect the phone to your PC using the adb mode.

Once connected, issue the following command

pm disable <>

This might not work on some OEM ROMs. If this is the case, try

pm disable-user <>

IF this doesn’t work, try this

pm disable-user --user 0 <>

This should do the trick, and the package should now be disabled.


You migh also want to clear the user data for the app. This is especially true if you’re disabling bloatware.

While still connected over ADB, and preferably after disabling the app, issue the following command

pm clear <>

Unless the vendor has specifically disabled clearing the app data via ADB (Oppo, for example), the command above should have cleared the data

Mounting another disk as ext4 in WSL2

Here we learn how to create a virtual disk meant to be mounted in WSL.


On my development machine, I run various WSL (now WSL2) instances. I needed to have a common disk that would store all the code and can be mounted on the different instances.

While this could’ve been done by regular folders as well, the performance of the NT file system is abysmal when it comes to a large number of tiny files (node_modules anyone?). This meant that that this common disk had to be an ext4 disk.


  • Windows: Create a file.
  • WSL: Format the file as ext4.
  • WSL: Mount the file as a disk.


Create a file

A dummy file can be created on windows using fsutil.

fsutil file createNew <call-this-file-whatever-you-want> <size-in-bytes>

For this example, the file we’ll use will be called development.ext4 with a size of 16GB

fsutil file createNew development.ext4 17179869184

Format the file as ext4

Now, this (empty) file needs to be formatted as ext4. In WSL, this can be done by the following command:

mkfs.ext4 -b 1024 <location-for-development.ext4>

This formats the empty file as a virtual disk with an ext4 file system with a block size of 1024.

(Optional) Remove reserved blocks:

tune2fs -m 0 <location-for-development.ext4>

(Optional) Increase throughput:

tune2fs -o journal_data_writeback <location-for-development.ext4>

Mount the file as a disk

Now, the file simply needs to be mounted inside WSL as a disk. This can be done using the following command:

sudo mount -t ext4 <location-for-development.ext4> <mount-point>

For me, the mount point was /projects, hence the command above becomes

sudo mount -t ext4 <location-for-development.ext4> /projects

With this, the file will be mounted at /projects, and now can be treated as a regular file/disk.


This works for me. However, I can’t get this to automount via fstab due to limitations with WSL. For the time being, I’ve created an entry in /etc/fstab in WSL, and mounting it using the windows task scheduler using:

sudo mount --all

Now, when I need to back up my projects, backing up a single file (development.ext4) is going to be a lot simpler than backing up multiple individual files (a VCS is a better fit for that anyway)

Hope this helps someone, cheers!

How to be a Search Engine Guru

The year was 1990. Archie, a simple FTP indexer was introduced to the world.  Later, Veronica & Jughead joined the pack.

These can safely be called as the first search engines that were introduced to computer users (they were pretty sparse and specific back then).

Fast forward 20 years.

Today, and I think I speak for many users around the world as well, one of the first things I do, when I open my browser, is open Google (I mean it’s already there, my homepage. Well, you know what I mean). Heck, I’m not even finished typing and it starts displaying results, and pretty relevant at that!

But, even though Google and the others are constantly improving their algorithms to improve the quality & relevancy of their results, intelligent searches are still a big problem.

What I mean is, that at the end of the day, the search engine is still robotic and non-intelligent. It works on a set of rules. And given that this set of rules is expanding, even as we speak, guessing what the user wants to search (and the exact result he’s expecting) is gonna take a considerable amount of time.

But let’s not get into the mechanics of that. This article focuses on building better search terms or query strings so that searches deliver the most desired result possible. Let’s face it, 99% people don’t care how many updates does Google release in a year, or whether they’re on Dominic, Caffeine, Vince, Panda (recently Penguin) or the fact that Google aims at each page being rendered in under half a second, they want relevant results.

So, here’s what you can do to make your searches worthwhile:

  1. Use exact phrases when looking for something specific : Using the EXACT phrase while searching for things like error message, slogan, quote, etc. generally gives a higher and to the point result.
  2. Be easy on the grammar : Grammar is necessary for humans to comprehend language. But when it comes to search, grammar is not necessarily required. In fact, results can be quite different when omitting purely grammatical words. This is because each extra word, is extra works for the search engine .. ie .. it’ll take into account that word too. (Weird example, but works .. I’ll come up with a better one soon)
  3. Structure your query : To get relevant results, it is important that you structure your query in some way. The search engine works on patterns. So make one that gives the most satisfactory result, and save yourself some headache.
    For example, I usually like to keep the subject keyword and the beginning of the query. I’ve found that this filters results quickly, and even helps auto-complete to get relevant results.
  4. The search engine is a computer program, treat it that way : While semantic searches are on their way, at the end of the day, like I said earlier, the search engine is still a computer program. If you ask it something like “What is the correct way to do push ups”, it won’t go through a bunch of fitness columns. It will search for articles that have a similar title, or have this in the article body. So don’t ask questions from search engines and expect accurate answers. If you ARE getting them, it’s probably because someone has written about it somewhere, not because the search engine understands it.
  5. Look for alternatives : Personally, I’ve almost always used Google. And although it still remains my first choice in search engines, recently I’ve started looking into alternatives. Some quite popular, like Bing, some not so popular, like Duck Duck Go. The quality and relevancy of the results is varied across all these search engines.

I’ll add more points here as I come across some more patterns.

I’d also like to state that the intent of this article was to focus on improving search results and hence improve user experience and save sometime while doing that. I hope it is taken in that spirit.

Take Care !