Skip to content

Instantly share code, notes, and snippets.

View Mohammad-Reihani's full-sized avatar

Mohammad Reihani Mohammad-Reihani

View GitHub Profile
what is this shit?
@Mohammad-Reihani
Mohammad-Reihani / grid_points_generator.py
Last active July 24, 2024 08:51
A Python script to generate and save grid points within a specified area, with configurable spacing and minimum distance from walls
import json
def generate_grid_points(x_length_cm, y_length_cm, points_in_x, points_in_y, min_dist_x_cm, min_dist_y_cm):
# Generate points along x and y axes with minimum distance from the walls
x_points = [int(round(i * (x_length_cm / (points_in_x - 1)))) for i in range(points_in_x)]
y_points = [int(round(i * (y_length_cm / (points_in_y - 1)))) for i in range(points_in_y)]
# Filter out points that are too close to the walls
x_points = [x for x in x_points if min_dist_x_cm <= x <= x_length_cm - min_dist_x_cm]
y_points = [y for y in y_points if min_dist_y_cm <= y <= y_length_cm - min_dist_y_cm]
@Mohammad-Reihani
Mohammad-Reihani / starship.toml
Last active August 27, 2025 20:37
Starship configuration file | Reproduced Kali's default PS1 prompt
# ~/.config/starship.toml
add_newline = true
continuation_prompt = "[▸▹ ](dimmed white)"
format = """[┌──\\(](bold green)$username[㉿](bold green)$hostname[\\)-\\[](bold green)$time[\\]-\\[](bold green)$directory[\\]](bold green)\
(\n[│](green)( $python) |( $git_branch$git_commit$git_state))
[└](bold green)$cmd_duration[─](bold green)[\\$ ](bold blue)"""
right_format = '''$battery'''
@Mohammad-Reihani
Mohammad-Reihani / START-VMwareVMs.ps1
Created August 9, 2024 16:20
Auto start VMware VMs with powershell script
# VMware Startup PowerShell Script
# This script starts multiple VMware virtual machines in the background
# and handles lock file removal if necessary.
# ---- Configuration ----
$vmrunPath = "C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe"
$logFile = Join-Path $PSScriptRoot "vm_startup_log.txt"
$delay = 50 # Delay between starting VMs (in seconds)
# ---- VM Paths ----
@echo off
code "%cd%"
<#
.SYNOPSIS
Auto-login to IUST captive portal.
.DESCRIPTION
Set your credentials below, or leave blank to be prompted.
#>
# ========== CONFIG ==========
$Username = "" # e.g. "student123"
@Mohammad-Reihani
Mohammad-Reihani / do.md
Created July 28, 2025 20:51
ssh-copy-id in Powershell and cmd

Powershell

type $env:USERPROFILE\.ssh\yourkey.pub | ssh user@ipaddress  "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

CMD

type %USERPROFILE%\.ssh\id_ed25519_tunnel.pub | ssh user@host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
@Mohammad-Reihani
Mohammad-Reihani / buildAndSave.sh
Created July 31, 2025 16:56
Build docker image and save
#!/bin/bash
# === Configuration ===
IMAGE_NAME="react-native-android-builder"
IMAGE_TAG="latest"
IMAGE_FILE="$IMAGE_NAME.tar.xz"
DOCKERFILE_PATH="Dockerfile"
BUILD_CONTEXT="."
# === Build ===
@Mohammad-Reihani
Mohammad-Reihani / WhatIsIdea.md
Created August 12, 2025 23:06
Better Login MOTD with picture

Pictured MOTD

Want your server to greet you with a nice picture (ASCII/ANSI art) when you SSH in? This guide shows how to generate different-width ASCII art pieces and automatically show the best-fitting one on login.


Prerequisites

  • A terminal that supports ANSI escape sequences (most modern terminals do).
  • SSH access to the server.