Randomly create a time.Sleep in Golang

To randomly create a time.Sleep in Golang you can use the code snippet below. You may want to simulate a load in your web server and have an arbitrary seconds or minutes before getting the reply. rand.Seed(time.Now().UnixNano()) delta := rand.Intn(60 + 1) // randomly generates numbers 1 to 60 time.Sleep(time.Duration(delta) * time.Second) // sleep and […]

Continue Reading…

HTML drop-down placeholder

Do you ever wanted to have an HTML drop-down with default selected value (placeholder) that the user cannot re-select once they selected any valid value options? It can be done easily by adding selected and disabled attributes on the option element. Code Snippet <div class="row form-group"> <label class="col-12 pl-0">Status</label> <select class="form-control col-12"> <option value="" selected="selected" […]

Continue Reading…

Create Android Studio Shortcut on Ubuntu 18.04

You can easily create an Android Studio shortcut by creating an desktop entry using the following the steps below. In this guide, my Android Studio is installed in /opt/android-studio folder. Your folder location may differ. 1. Open terminal and type cd ~/.local/share/applications 2. Create a .desktop file using your favorite text editor nano android-studio.desktop 3. […]

Continue Reading…

How to change Full Disk Encryption (LUKS) password on Ubuntu 18.04

Did you enabled the full disk encryption (LUKS) on Ubuntu 18.04? I would like to share how you can change the LUKS password. LUKS stands for Linux Unified Key Setup developed in 2004 by Clemens Fruhwirth. Similarly, Apple’s macOS have FileVault and BitLocker for Microsoft Windows operating system. In the terminal you can check the […]

Continue Reading…

Bring Your Old Laptops Back In Service With Light-Weight Linux Distribution

Revive your old laptop back in service using Lubuntu a light-weight version of Ubuntu. I bought this Lenovo IdeaPad S10-3 in 2012 when I was working in Muscat, Oman. This netbook has a blazing Intel Atom processor 1.66GHz, a 2GB DDR3 RAM, and 10″ LCD screen. I was initially thinking of giving it away because […]

Continue Reading…

Completely Delete USB Flash Drive Partition in MacOS using diskutil

You may want to completely erase the partition table of your USB flash drive including the boot record. In macOS you do easily do that using diskutil. During this COVID-19 lockdown in Malaysia, I wanted to use my weekend time in installing Linux on an old laptop. It turns out that old laptop only support […]

Continue Reading…