Wednesday, October 29, 2025

AWS Data Lifecycle Manager (DLM) setup for automated EC2 backups

Step 1: Choose “Custom policy” (as shown)

Keep:

  • Custom policy → selected

  • Policy typeEBS snapshot policy
    Then click Next step 🟧

Step 2: Target Resource Type

  • Resource type: Select Volume

  • Target resource tags:
    Add the tag you used on your EC2 volume, for example:

    • Key: Backup

    • Value: Daily

Only the volumes with this tag will be backed up automatically.

Step 3: Configure Schedule

  • Schedule name: Daily-EC2-Backup (or Weekly if preferred)

  • Frequency: Every 24 hours (for daily) or Every 7 days (for weekly)

  • Start time: Choose off-peak (e.g., 02:00 UTC)

  • Retention type: “Count”

  • Retain: 7 snapshots (automatically delete older ones)

Enable these options:

  • Copy tags from source

  • Exclude boot volumes (optional — keep unchecked if you want full backups including OS)

Step 4: IAM Role

If this is your first lifecycle policy:

  • Choose “Create new role for this policy”
    AWS will auto-generate permissions for DLM to create/delete snapshots.

Step 5: Review and Create

  • Review your policy summary (target tag, schedule, retention, IAM role)

  • Click Create Policy

Verification

After 24 hours (or at next schedule), go to:
👉 EC2 → Snapshots
You’ll see entries like:

“Created by EC2 Lifecycle Policy: Daily-EC2-Backup”

That confirms your automation works.


Tuesday, October 28, 2025

Push your local project to your own GitHub account


Step 1 — Check current remote

Run this in your project folder:

git remote -v

You’ll probably see something like:

origin  https://github.com/username/reponame (fetch)
origin  https://github.com/username/reponame (push)

 Step 2 — Set the correct remote for the username
git remote set-url origin https://github.com/username/reponame.git
 
 Step 3 — Verify the change

Run again:

git remote -v

You should see:

origin  https://github.com/username/reponame (fetch)
origin  https://github.com/username/reponame (push)
Step 4 — Set your identity (you already did this, but just to confirm)
git config user.name "username"
git config user.email "email@gmail.com"

Step 5 — Push to GitHub

Now push the main branch:

git push -u origin main

If prompted for credentials:

  • Username:

  • Password: your GitHub Personal Access Token (PAT) (not your GitHub password)

👉 Create one here: https://github.com/settings/tokens

When creating the token:

  • Choose “Fine-grained personal access token”

  • Grant Repository → Read and write access

  • Copy and paste it when Git asks for your password.


Set up GIT Personal Access Token Steps

 Go to GitHub.com → Settings → Developer settings → Personal access tokens → tokens (classic)

Generate new token with repo permissions

Copy the token

paste it as password during git push -u origin main

valid for 30 days

Saturday, September 6, 2025

Steps to setup phpmyAdmin after LAMPP stack setup using ubuntu

 You’re using Ubuntu with a LAMPP stack (Linux + Apache + MySQL + PHP). Let’s walk through installing and securing phpMyAdmin step by step:


🔹 1. Update system

sudo apt update && sudo apt upgrade -y

🔹 2. Install phpMyAdmin

sudo apt install phpmyadmin -y

👉 During installation, it will ask:

  • Web server to configure automatically → choose apache2

  • Configure database for phpMyAdmin → select Yes

  • Set a phpMyAdmin application password (this is for phpMyAdmin’s own database user, not MySQL root).


🔹 3. Enable Apache configuration

If it didn’t auto-enable, manually link phpMyAdmin to Apache:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo systemctl reload apache2

🔹 4. Enable required PHP extensions (LAMPP often needs this)

Make sure these are enabled:

sudo apt install php-mbstring php-zip php-gd php-json php-curl -y
sudo phpenmod mbstring
sudo systemctl restart apache2

🔹 5. Access phpMyAdmin

Now open in your browser:

http://your-server-ip/phpmyadmin

Example:

http://34.199.91.21/phpmyadmin

Login using your MySQL root (or another MySQL user you created).


🔹 6. (Optional) Enable root login if blocked

By default, MySQL root may be set to auth_socket instead of a password. Fix:

sudo mysql -u root

Inside MySQL shell:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_strong_password';
FLUSH PRIVILEGES;
EXIT;

Now login in phpMyAdmin with root / your_strong_password.


🔹 7. Secure phpMyAdmin

Since phpMyAdmin is a common attack target:

  • Change the URL alias (instead of /phpmyadmin/dbadmin123):

    sudo nano /etc/apache2/conf-available/phpmyadmin.conf
    

    Replace /phpmyadmin with /dbadmin123, then:

    sudo systemctl reload apache2
    
  • Restrict access by IP (allow only your IP).


✅ Done! You now have phpMyAdmin running on your LAMPP server.



Set up a permanent system user access token for WhatsApp Cloud API

To set up a permanent system user access token for WhatsApp Cloud API in Meta Business Manager, here’s the step-by-step process:


🔹 Step 1. Go to Business Settings


🔹 Step 2. Create a System User

  1. Under Users → System Users.

  2. Click Add.

  3. Give it a name (example: MedicalSupplierz_API_User).

  4. Choose Role = Admin (so it has full permissions).

  5. Save.


🔹 Step 3. Assign Assets to the System User

  1. After creating the system user, select it.

  2. Click Add Assets.

  3. Assign your WhatsApp Business Account (WABA).

  4. Give it permissions:

    • whatsapp_business_messaging

    • whatsapp_business_management.


🔹 Step 4. Generate a Permanent Access Token

  1. Still inside the system user, click Generate New Token.

  2. Choose your app (the one connected to WhatsApp Cloud API).

  3. Select permissions:

    • whatsapp_business_messaging

    • whatsapp_business_management.

  4. Generate token → it will look like:

    EAAG...long-string...ZDZD
    

⚠️ Copy it immediately — Meta only shows it once.


🔹 Step 5. Use the Token in Your Code

In your .env file:

WHATSAPP_ACCESS_TOKEN=EAAG...long-string...ZDZD

Use it in your API calls:

curl -i -X POST \
  https://graph.facebook.com/v20.0/{{PHONE_NUMBER_ID}}/messages \
  -H "Authorization: Bearer $WHATSAPP_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "messaging_product": "whatsapp",
        "to": "965XXXXXXXX",
        "text": { "body": "Hello from MedicalSupplierz!" }
      }'

🔹 Step 6. Token Lifetime & Refresh

  • System user tokens are long-lived (permanent), but they can be invalidated if:

    • You remove the system user.

    • You change business security settings.

  • Best practice: Store the token securely and rotate it periodically.


✅ After this, you’ll have a permanent token that won’t expire every 24 hours, unlike the test tokens.



 

Friday, August 1, 2025

Steps to Connect to VPN and RDP from ubuntu device to windows



Step 1) Setup Forticlient

https://www.fortinet.com/support/product-downloads#vpn

download deb forticlient vpn package for linux

 


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Step 2) From the Applications, click open "Forticlient"

"Edit VPN Connection" dialog box opens up

VPN : SSL-VPN, fill up the details Connection Name, Description, Remote Gateway, port No: and Save
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Step 3)  1. Install RDP Client on Ubuntu
Recommended tool: Remmina (GUI RDP client)
sudo apt update
sudo apt install remmina -y

2.Open terminal and run remmina

In Remmina:

    Click + to create a new connection.

    Set:

        Protocol: RDP - Remote Desktop Protocol

        Server: IP address or hostname of the remote Windows machine

        Username: Your Windows user

        Password: Your Windows password

    Click Connect.



Monday, July 21, 2025

Create .pem file from .ppk using puttygen software in windows for SSH access from cmd

 

Convert .ppk to unencrypted .pem

If .pem is encrypted and .ppk works, you can convert .ppk to a new .pem: 

  1. Open PuTTYgen 

  1. Click Load → Load your .ppk file 

  1. Go to ConversionsExport OpenSSH key 

  1. Save as something like oxfordAIU_unencrypted.pem 

  1. Try SSH again: 

  2.  

    ssh -i path\to\pem user@ip_address

     

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."
      
    •