Friday, June 20, 2025

 

1. Register an App in Azure AD

  • Go to: https://portal.azure.com

  • Navigate to: Azure Active Directory > App registrations > New registration

  • if you don't find it goto "Microsoft Entra ID"

  • Once inside, select App Registrations --> New Registration

  • Give it a name (e.g. Laravel Email App)

  • Redirect URI: Can be http://localhost or your app callback

2. Add API Permissions - from right side manage-->choose api permissions

  • Under "API permissions" > search "mail" and Add:

    • Mail.Send (delegated)

    • User.Read

3. Create a Client Secret -From the app registration overview page

  • Under "Certificates & secrets" > "New client secret"

  • Copy the secret value

  • client id and tenant id

Steps to Generate App Password for example@domain.com to use in laravel app, if there is MFA

 

🛠️ Sign in at: https://mysignins.microsoft.com/security-info

  1. Use example@domain.com to log in

  2. Go to Security Info > Click Add method

  3. Select App password

  4. Name it (e.g., “Laravel SMTP”) and click Next

  5. Copy the generated password – you will not be able to see it again

  6. Update your Laravel .env:


Sunday, June 8, 2025

  Step-by-Step: Install Ubuntu Using WSL on Windows

Step 1: Enable WSL and Virtual Machine Platform

Open PowerShell as Administrator and run:

wsl --install

This will install WSL 2, the latest version with full Linux kernel support.

🔸 If WSL is already installed, make sure it's version 2:

wsl --set-default-version 2

Step 2: Install Ubuntu from Microsoft Store

  1. Open Microsoft Store.

  2. Search for "Ubuntu".

  3. Choose your version (e.g., Ubuntu 22.04 LTS).

  4. Click Install.


🔹 Step 3: Set Up Ubuntu

After install:

  1. Launch “Ubuntu” from Start menu.

  2. Wait for it to extract and initialize.

  3. Create a new UNIX username and password.


  4. Step 4: Install Development Tools in Ubuntu (optional)

  5. Inside the Ubuntu terminal:

  6. sudo apt update && sudo apt upgrade -y

    sudo apt install php mysql-server composer nodejs npm git curl unzip -y

  7. composer global require laravel/installer

You need to install the “Remote - WSL” extension inside Visual Studio Code, not from the terminal.

🔹 Step-by-Step to Fix:

  1. Open VS Code

  2. Go to the Extensions view:

    • Shortcut: Ctrl + Shift + X

    • Remote - WSL

    • After Installing:

      To open a WSL Ubuntu project:

      • Press F1 or Ctrl + Shift + P

      • Type:

      • WSL: Open Folder

      🔹 2. Generate SSH Key Pair

    • ssh-keygen -t ed25519 -C "your_email@example.com"

Tuesday, June 3, 2025

Git Setup on Windows

 

1. Install Git for Windows

  • Download and install from: https://git-scm.com/

  • During setup:

    • Choose “Git from the command line and also from 3rd-party software”

    • Choose recommended defaults unless you have special needs

✅ After install, open Git Bash or CMD and run:

git --version

2. Clone Your Laravel + Vue Project

cd C:\xampp\htdocs git clone https://github.com/your-username/your-laravel-vue-project.git cd your-laravel-vue-project

Or initialize a new repo:

git init

3. Set Git User Info (if not set globally)

git config user.name "Your Name"
git config user.email "you@example.com"

4. Typical Git Workflow (Basic Commands)

ActionCommand
Stage changes        git add .
Commit changesgit commit -m "Your message"
Push to remotegit push origin main
Pull latestgit pull origin main
Check statusgit status
Switch branchgit checkout branch-name

5. Optional Git GUI Tools for Windows

If you prefer visual tools:


✅ Laravel + Git Example Setup

In C:\xampp\htdocs\your-project:


composer install npm install cp .env.example .env php artisan key:generate git init git remote add origin https://github.com/your-username/your-repo.git git add . git commit -m "Initial commit" git push -u origin main

Saturday, May 17, 2025

Install and setup docker for local projects

 Install Docker from Official Docker Repo

✅ STEP-BY-STEP TO INSTALL DOCKER & DOCKER COMPOSE (V2)

# 1. Remove any old Docker versions
sudo apt remove docker docker.io containerd runc



# 2. Set up Docker's official GPG key


sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg



# 3. Add the Docker APT repository (for Ubuntu 22.04 "jammy")
 

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  https://download.docker.com/linux/ubuntu jammy stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null



# 4. Update APT
 

sudo apt update

# 5. Install Docker Engine and CLI (this includes docker-compose v2)
 

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-c

ompose-plugin -y
 

--------------------

6. Verify Docker is installed

docker --version

7. Verify Docker Compose V2 is working
docker compose version
 

8. Start Docker service (if not running)

sudo systemctl start docker
sudo systemctl enable docker
 

9. Test Docker Compose by running a sample container

mkdir ~/docker-test && cd ~/docker-test
echo -e "services:\n  hello:\n    image: hello-world" > docker-compose.yml
docker compose up
 

🚀 Next Steps: Run Laravel Project in Docker

✅ 1. Directory Structure (example)

/var/www/html/example.com/
├── docker-compose.yml
├── Dockerfile
├── .env
├── app/
├── public/
├── vendor/
├── ...
 

✅ 2. Basic docker-compose.yml Example

version: '3.8'

services:
  app:
    build:
      context: .
    container_name: laravel_app
    ports:
      - "8000:8000"
    volumes:
      - .:/var/www/html
    working_dir: /var/www/html
    command: php artisan serve --host=0.0.0.0 --port=8000
    depends_on:
      - db

  db:
    image: mysql:5.7
    container_name: mysql_db
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: laravel
      MYSQL_USER: laravel
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - dbdata:/var/lib/mysql

volumes:
  dbdata:


✅ 3. Basic Dockerfile

 

FROM php:8.1-cli

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git unzip curl libzip-dev zip && \
    docker-php-ext-install zip pdo pdo_mysql

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Set working directory
WORKDIR /var/www/html
 

✅ 4. Run the Laravel App 

----------------------------------------

docker compose up --build
--------------------------------------------

 

Wednesday, April 30, 2025

How to get your open AI API Key

 

✅ Step-by-Step Guide to Get Your API Key

  1. Go to the OpenAI Platform
    🔗 https://platform.openai.com

  2. Sign in / Sign up

    • Log in with your existing account, or

    • Create a new account using your email, Google, or Microsoft account.

  3. Go to API Keys

  4. Generate a New API Key

    • Click the "+ Create new secret key" button.

    • Give it a name (optional, for your reference).

    • Copy and store the key safely — you will only see it once.

       

      5. Authenticate: Navigate to your project root in the terminal Export your OpenAI API key:

    Bash
    export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
    
    (You can get your API key from the OpenAI platform.)
    • Run: Navigate to your project root in the terminal and type codex followed by your request in natural language. For example:
      Bash
      codex "Explain this repo to me."
      
    •  

Sunday, April 20, 2025

Codex CLI - Your coding agent from open AI

 

The OpenAI Codex CLI is a command-line tool that brings the power of OpenAI's language models directly to your terminal, acting as a lightweight coding agent. Here's a breakdown of what it is and what you can do with it:

Key Functionality:

  • Natural Language to Code: You can describe what you want to build, fix, or understand in plain English, and Codex CLI will translate that into code.
  • Code Editing and Generation: It can read, modify, and even run code on your local machine.
  • Multimodal Inputs: Beyond text, it can understand screenshots and diagrams to help generate or edit code accordingly.
  • Integration with Your Workflow: It runs entirely in your terminal, allowing for quick iteration without switching contexts.
  • Configurable Automation: It offers three approval modes to control how hands-on you want to be:
    • Suggest (default): Proposes edits and shell commands, requiring your approval before execution.
    • Auto Edit: Automatically applies file edits but asks for approval before running shell commands.
    • Full Auto: Autonomously reads, writes, and executes commands within a sandboxed, network-disabled environment.
  • Version Control Awareness: It warns you before entering "Auto Edit" or "Full Auto" if your directory isn't under version control.

What You Can Do With It:

  • Build Features Faster: Describe the functionality you need, and let Codex CLI generate the code.
  • Squash Bugs: Ask it to identify and fix errors in your code.
  • Understand Unfamiliar Code: Have it explain the logic and structure of existing codebases.
  • Refactor and Clean Up Code: Instruct it to improve the quality and readability of your code.
  • Write Tests: Ask it to generate unit tests for your code.
  • Set Up Migrations, Batch Rename Files, and Update Imports: Automate common development tasks.
  • Use Repository Markdown for Context: It can understand and utilize information in your project's markdown files.

Getting Started:

  1. Install: Open your terminal and run:
    Bash
    npm install -g @openai/codex
    
  2. Authenticate: Export your OpenAI API key:
    Bash
    export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
    
    (You can get your API key from the OpenAI platform.)
  3. Run: Navigate to your project root in the terminal and type codex followed by your request in natural language. For example:
    Bash
    codex "Explain this repo to me."
    
  4. Switch Modes (Optional): Use flags like --auto-edit or --full-auto to change the automation level.

Important Considerations:

  • Experimental: Codex CLI is currently an experimental project and may have bugs or undergo changes.
  • Local Operation: Your source code never leaves your local environment unless you explicitly choose to share it.
  • Open Source: The project is open source, and you can find the repository on GitHub (https://github.com/openai/codex).
  • API Key Required: You need an active OpenAI API key to use the CLI.
  • Model Usage: By default, it uses the o4-mini model for speed, but you can specify other available models using the -m flag (e.g., codex -m o3).

In essence, the OpenAI Codex CLI aims to streamline your development workflow by bringing AI-powered coding assistance directly to your terminal, allowing you to interact with your codebase in a more intuitive and efficient way.

Thursday, March 6, 2025

Steps to set up docker in your localhost

 Reference - 

https://docs.docker.com/engine/install/ubuntu/

 

-

1) git clone the code repository that is dockerised

2) cd to git repo 

3) Set up Docker's apt repository

4) 

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
 
5) # Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
 
6) Install the Docker packages
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
7) Verify that the installation is successful by running the hello-world image:
         sudo docker run hello-world
Go to that git folder and run 
8) sudo docker compose -f docker-compose.yml up -d --build 
 
 
--------------------------------------------------------
fix this Error --- An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 32EE5355A6BC6E42 
---------------------------------------------------------------
1)open your terminal
2) wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
3) If the first method does not work, try this method.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 32EE5355A6BC6E42
 

Sunday, February 16, 2025

Upgrade AWS instance and Ubuntu Commands to check system resources

 Check system resources:

lscpu # Check CPU details
free -h # Check RAM
df -h # Check storage

Step 1: Check Instance Compatibility

  1. Login to AWS Console → Go to EC2 Dashboard.
  2. Select your t2.large instance.
  3. Click on Instance SettingsChange Instance Type.
  4. Check if c6i.4xlarge is available in the same Availability Zone.
    • If not, you may need to create a new instance and migrate your data.

     

    Step 2: Stop the Instance

  5. Go to EC2 Dashboard.
  6. Select the t2.large instance.
  7. Click Instance StateStop Instance.
    • ⚠️ Warning: Stopping the instance will cause temporary downtime.

Step 3: Change Instance Type

  1. Select your stopped t2.large instance.
  2. Click on ActionsInstance SettingsChange Instance Type.
  3. From the dropdown, select c6i.4xlarge.
  4. Click Apply.

Step 4: Start the Upgraded Instance

  1. Select your instance.
  2. Click Instance StateStart Instance.
  3. Verify that your application is working as expected.

  1.  


Wednesday, January 29, 2025

AI - Run an LLM locally on your laptop

 1) Google Ollama
2) Download Ollama and Install
3) Go to model section and choose a model you like
4) I chose deepseek-R1-Distill-Qwen-7B
5) Copy paste the command and run it on your terminal

Monday, January 13, 2025

Certified in Advanced SQL from Stanford Online

 


Steps to Explore and Enroll in Free Stanford Courses:

  1. Visit the Stanford Online Platform:

    • Open
    • https://online.stanford.edu/explore?filter[0]=free_or_paid%3Afree&keywords=Computer&items_per_page=12&page=1
  2. Use Filters to Customize Your Search:

    • On the left side, apply filters like:
      • Cost: Select "Free" to filter out paid courses.
      • Keywords: Use terms like "Computer Science," "Data," or "Technology" for focused results.
  3. Browse Available Courses:

    • Scroll through the results to find courses that interest you, such as topics in SQL, AI, cloud computing, or programming.
  4. Select a Course:

    • Click on a course to view its details, including:
      • Course description
      • Start dates
      • Instructor credentials
      • Time commitment
  5. Check Prerequisites (if any):

    • Ensure the course suits your current knowledge level.
  6. Enroll in the Course:

    • Click the "Enroll Now" or "Sign Up" button. You may need to create a free Stanford Online account or log in with an existing one.
  7. Access Course Materials:

    • Once enrolled, you'll be redirected to the course dashboard. Access videos, readings, and assignments from there.
  8. Complete the Course:

    • Stay consistent with the course schedule. Participate in quizzes or projects as needed.
  9. Earn a Certificate (Optional):

    • For free courses, certificates may not always be provided. If offered, ensure you meet the completion criteria.
  10. Apply the Knowledge:

  • Use your new skills in personal or professional projects. Highlight them on your resume or LinkedIn profile for added impact.


Now I know what it feels like to get hacked!!!!

 
            


Lesson Learned - Ensure you have a STRONG PASSWORD for DB