Skip to content

Instantly share code, notes, and snippets.

View MahdadGhasemian's full-sized avatar

Mahdad Ghasemian MahdadGhasemian

View GitHub Profile
@MahdadGhasemian
MahdadGhasemian / README.md
Last active October 29, 2026 07:04
Recovering a VMware VM with a damaged virtual disk

VMware Recovery and Independent Cloning

Two guides for VMware Workstation VMs:

  • Recover a damaged VM — vmware-vm-recovery.md: recover a disk/snapshot chain that QEMU can still read. This is not a universal corruption repair.
  • Create an independent clone — independet-vm-clone.md: consolidate the selected disk state into an independent VMDK, create a new VM, and update Ubuntu's identity.

Use the recovery guide when the existing VM has disk problems. Use the cloning guide when the disk chain is readable and you want a separate VM. After recovery, you can also use the cloning guide to create another independent VM.

Before either procedure: fully shut down the source VM, close VMware, and preserve the original files until the resulting VM is verified.

@MahdadGhasemian
MahdadGhasemian / kubernetes-certificate-renewal.md
Created October 3, 2026 04:00
Fixing expired Kubernetes control-plane certificates and restoring kubectl access by renewing certs, restarting static pods, and verifying the cluster.

Kubernetes Certificate Renewal Guide

Problem

Kubernetes certificates expire, causing kubectl connection failures and API errors. Unlike TLS verification skipping (which only bypasses server checks), expired administrator and client certificates prevent cluster access entirely.

Solution Overview

Renew certificates using kubeadm on each control-plane node. Since CA certificates remain valid until 2035, you only need to renew the signed certificates. This process temporarily interrupts the API on each node.


@MahdadGhasemian
MahdadGhasemian / chinese_on_ubuntu.md
Last active August 25, 2026 02:20
Chinese On Ubuntu

Install Chinese keyboard layout and activate it

On Ubuntu, install the IBus Chinese engine:

sudo apt update
sudo apt install ibus-libpinyin
@MahdadGhasemian
MahdadGhasemian / how_to_prepare_for_blindness.md
Last active August 19, 2026 04:07
How to prepare for blindness ?

How to prepare for blindness ?

VMware

  • Disable all keyboard's shortcut on host os

Voice Assistant and Screen Readers (Ubuntu 24 26)

@MahdadGhasemian
MahdadGhasemian / open-in-vs-code-via-right-click.md
Last active July 13, 2026 04:25
Open Selected Folder in VS Code via Right Click (Ubuntu)

Open Selected Folder in VS Code from Nautilus (Ubuntu)

A simple Nautilus script to add an "🔷 Open in VS Code" option to the right-click menu.

This works without installing any extra extensions or Python packages.

Features

  • ✅ Open a selected folder directly in VS Code
  • ✅ Right-click a file → open its parent folder in VS Code
@MahdadGhasemian
MahdadGhasemian / backup_mysql.sh
Created May 4, 2026 17:59
Mysql Backup Script
#!/bin/bash
DATE=$(date +"%Y%m%d")
BACKUP_DIR="/backup/mysql"
BACKUP_ARCHIVE_DIR="/backup/mysql_archive"
LOG_DIR="/backup/backup_logs"
MYSQL_USER="backup_user"
MYSQL_PASSWORD="tr -cd 'a-zA-Z0-9' </dev/urandom | head -c '65' ; echo '@'"
MYSQL=/usr/bin/mysql
MYSQLDUMP=/usr/bin/mysqldump
@MahdadGhasemian
MahdadGhasemian / proxy_and_offline_setup.md
Last active March 30, 2026 13:38
Working in Restricted Networks: Proxies, APT, Docker & Offline Installs

Working in Restricted Networks: Proxies, APT, Docker & Offline Installs


🌐 APT Proxy

⚠️ TODO: Add configuration for HTTP/HTTPS proxy in APT (/etc/apt/apt.conf.d/)


@MahdadGhasemian
MahdadGhasemian / screen_keep_process_alive.md
Created March 9, 2026 11:08
Screen: Never Lose a Process Again

Screen: Never Lose a Process Again

If you’ve ever started a long-running task—like a database migration— only to have your terminal or SSH connection drop, screen is your lifesaver. It keeps processes running in the background so you don’t have to babysit your terminal.


1. Create a Session

Start a named session so you can easily reattach later:

@MahdadGhasemian
MahdadGhasemian / dns-debugging-cheatsheet.md
Last active March 5, 2026 13:28
A handwritten reference on Iranian DNS hosts, alongside practical DNS notes for Ubuntu, Kubernetes, and Kubespray, including troubleshooting tips.

Iranian DNS servers list (domestic)

DNS Server Status
217.218.155.155 OK
217.218.127.127 OK
46.209.209.209 FAILED
185.161.112.33 OK
@MahdadGhasemian
MahdadGhasemian / installing-postman.md
Created February 7, 2026 05:44
Installing Postman on Ubuntu/Gnome
  1. Download Postman from: Postman x86_64

  2. Extract it:

tar -xzf ./postman-linux-x64.tar.gz
  1. Move to /opt