Cover

Random or Secrets which module to use for critical information?

It’s easy to generate random numbers using the random module in Python. And we always do it when it’s required to send an OTP or a secret token to the user. The following code is the way we do it usually. import random random.randint(100000, 999999) This should generate a 6 digit random OTP code. But, according to the offical documentation of python secrets module, it’s not recommended to use the random module for generating passwords, account authentication, security tokens and related secrets. Instead secrets module is recommended. Which is designed for security or cryptography. ...

January 24, 2023 · 2 min · Nazrul
Cover

How to copy files from and to remote server with 'rsync' in linux?

When it comes to copying/moving files from local machine to server and vice-versa, rsync is a fast and versatile option comparing to other protocols like scp, sftp etc. rsync comes pre-installed to many linux distros and MacOS. But, if it’s not pre-installed in your system you can install it using your distro package manager. Here I am gonna put the command for Ubuntu and it’s other flavours since, I am using Ubuntu at the moment. ...

April 8, 2022 · 1 min · Nazrul
Cover

How to cherry pick a range/list of commits in GIT?

Cherry-Pick Without question, cherry-pick is a powerful tool in git. It enables you to pick a commit and add that on top of the current HEAD. In some cases, it may just save you from a terrible mistake while resolving some conflicts or unwanted commit merges. For switching branches and to bring commit/commits to the new branch cherry-pick is the best and easiest option you have. Now, let’s say you have switched to a new branch from an old branch that you were working on. And now you want to cherry-pick some commits from the old one to the new one. What do you usually do? ...

January 31, 2022 · 2 min · Nazrul