Posts

In WSL How to create database , Update Password and connect the database in any application

Image
  Make sure, we have postgres installed, run below query to verify that. Run the below command to install  pg_ctlcluster utility command : sudo apt install postgresql postgresql-contrib Run the below command to start the postgresql manually Run the below command to postgres user sudo -i -u postgres psql Run command createdb my_database to create a new database Run the command psql -l to list the list of database  From your current prompt ( postgres@...$ ), enter the PostgreSQL shell: psql Now, paste this command to change the password for postgres user  ALTER USER postgres WITH PASSWORD 'your_secure_password'; Now we can see like below Type \q to exits the PostgreSQL shell and brings you back to the Linux terminal  I installed the below extension in visual studio Select postgresSQL and provide the database details with password and click on Connect button. Now, we can see the database details inside visual studio Lets Thank you!

How to generate a secure value for JWT_SECRET

How to Create a High-Strength JWT_SECRET A secure secret must be long, random, and unpredictable . Simple phrases, dictionary words, or short strings are easily brute-forced or cracked using common tables. A good secret should be at least 32 bytes long (which results in a longer Base64 string) and generated using a cryptographically secure pseudo-random number generator (CSPRNG). Generating a Strong Secret Use your operating system's built-in cryptographic tools to generate the string. On Linux/macOS (Bash): The openssl rand command is a reliable way to generate a strong random string. The -base64 32 flag generates 32 cryptographically random bytes and encodes them in Base64 for safe use in environment files. Bash openssl rand -base64 32 On Windows (PowerShell): PowerShell offers a secure way to generate byte arrays using the .NET Framework's RNGCryptoServiceProvider . This ensures the randomness is suitable for cryptographic purposes. PowerShell $bytes=New-Object Byte[] ...

How to move WSL from one drive to another drive

Image
 Hi, let's see how to move the WSL from C Drive to D Drive. Run the below command to check the WSL list Create a new folder inside D Drive Run command  wsl --export Ubuntu D:\wsl\ubuntu.tar to export ubuntu as tar file to D drive Un register ubuntu, using command wsl --unregister Ubuntu Move the ubuntu from the tar file to D Drive Run the below command to set ubuntu as default distro Run the below command to view the list of wsl distro. Now, we can see the ext4 file is moved to the D Drive. Thank you!.

Remove existing repository association in GIT

Image
  Use command  git remote -v to check which git repository the project is associated with, it will give output like below Use command  git remote remove origin , to remove the existing git remote association Use again  git remote -v ,   now you can see that association will be removed.

Install NVM in WSL and Node

 You can install NVM (Node Version Manager) in WSL pretty easily. Here’s the step-by-step: 1. Open your WSL terminal (For example, Ubuntu). 2. Install required dependencies sudo apt update sudo apt install curl wget git -y 3. Download and install NVM Run the official install script: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash (Replace v0.39.7 with the latest version if needed: https://github.com/nvm-sh/nvm/releases ) 4. Load NVM into your shell After installation, add this to the end of your ~/.bashrc (or ~/.zshrc if you use Zsh): export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" Then reload your shell: source ~/.bashrc 5. Verify NVM installation nvm --version 6. Install Node.js using NVM Install latest LTS version: nvm install --lts Install a specific version:...

How to use Localxpose alternative to ngrox

Image
Hi,   lets see how to use localxpose in linux machine Install Localxpose using below command   Create a account in localxpose( https://localxpose.io/ ) and copy access token from ( https://localxpose.io/dashboard/access)   Run the below command and it will ask to provide the access token, paste it. Now, run the below command to access the localhost 4000 using public URL.   It will provide the public URL. with this public URL we can access the localhost 4000 site.

How to check the storage details of WSL

Image
Run the below command to view the WSL Storage details  # Show disk usage of root filesystem df -h / # Show usage of all mounted filesystems df -h # Check disk usage of home directory du -sh ~ Output is like below