Skip to content

Instantly share code, notes, and snippets.

View hasmukhlalpatel's full-sized avatar

Hasmukh Patel hasmukhlalpatel

View GitHub Profile
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Last active January 19, 2025 22:11
Gitlab apis to access repos

Define your GitLab details

$GitLabToken = "YOUR_PERSONAL_ACCESS_TOKEN"  # Replace with your GitLab Personal Access Token
$GitLabApiUrl = "https://gitlab.com/api/v4"  # GitLab API URL (use your GitLab instance URL if self-hosted)
$GroupId = "YOUR_GROUP_ID"  # Replace with the GitLab group ID (or use "YOUR_USER_ID" for personal projects)

Set the local directory where you want to clone/pull repositories

$LocalDirectory = "C:\path\to\your\projects"
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Last active July 3, 2024 18:35
write a Regex to find "Assert.AreEqual(1,a);" and replace to "Assert.That(1==a);"

#Regex find and replace

You can use the following Regex pattern to find instances of Assert.AreEqual(1,a); and replace them with Assert.That(1==a);.

Here is the Regex pattern for finding the exact match:

regex Copy code

Assert\.AreEqual\(([a-zA-Z_][a-zA-Z0-9_]*),\s*([a-zA-Z_][a-zA-Z0-9_]*)\);
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Last active August 2, 2024 08:35
Using Microsoft Graph API with a Certificate

Using Microsoft Graph API with a Certificate

1. Create and Export a Certificate

First, create a self-signed certificate and export it:

# Create a self-signed certificate
$cert = New-SelfSignedCertificate -DnsName "yourdomain.com" -CertStoreLocation "Cert:\CurrentUser\My" -FriendlyName "GraphAPICert"

# Export the certificate to a .pfx file
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Last active May 17, 2024 22:14
Sending email though powershell with Microsoft Graph

# Configuration
$clientId = " "          # Replace with your client ID from Azure Portal
$clientSecret = " "  # Replace with your client secret from Azure Portal
$tenantId = " "          # Replace with your tenant ID
$recipientEmail = " "  # Replace with the recipient's email address
$fromEmail = " " # Replace with the email address sending the email

@hasmukhlalpatel
hasmukhlalpatel / readme.md
Created November 8, 2023 23:43
How To Install Kubernetes on Ubuntu

How To Install Kubernetes on Ubuntu

See full Step-By-Step Guide

Prerequisites:

  • Hardware Requirement:
    • For Master:
      • RAM: 2 GB
      • CPU: 2 Cores
    • For Slave:
  • RAM: 1 GB
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Last active November 7, 2023 14:06
How to make Multiple Operating Systems Bootable in ONE USB drive

How to make Multiple Operating Systems Bootable in ONE USB drive

Links

  • YouTube - How to in this YouTube tutorial, we explore the process of creating a multi-boot USB drive that can load multiple operating systems. This is a handy tool for anyone interested in operating system testing, data recovery, or just the convenience of having multiple OS options on the go. Whether you're a tech enthusiast, a professional IT administrator, or just a curious novice, this video is your go-to guide to making your USB drive a powerhouse of operating system versatility.
  • Download Vetoy : A software to install on USB drive.
  • Gitgub page
  • latest Vetoy download from Github
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Last active April 3, 2023 16:16
Get Auth token using PowerShell

Get Auth token using powershell

$body = @{ grant_type='client_credentials'
      client_id='{your client Id}'
      client_secret='{secret hash}'}

$contentType = 'application/x-www-form-urlencoded' 

$authTokenUrl = 'https://login.microsoftonline.com/{tenantId}/oauth2/token'
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Created April 1, 2023 16:53
Generate a self-signed certificate using PowerShell script

Generate a self-signed certificate using powershell script

You can use the following PowerShell script to create a self-signed certificate for the local machine name that will be valid for three years:

New-SelfSignedCertificate -CertStoreLocation Cert:LocalMachine\My -DnsName $env:computername -FriendlyName "$env:computername WinRM SelfSigned Cert" -NotAfter (Get-Date).AddYears(3)

You can use the following PowerShell script to create a self-signed certificate for the local machine name that will be valid for three years:

New-SelfSignedCertificate -CertStoreLocation Cert:LocalMachine\My -DnsName "localhost" -FriendlyName "localhost WinRM SelfSigned Cert" -NotAfter (Get-Date).AddYears(3)