Skip to content

Instantly share code, notes, and snippets.

View fslef's full-sized avatar

fslef fslef

  • Microsoft
  • France
View GitHub Profile
@fslef
fslef / Set-ScriptExecutionPreference.ps1
Created November 5, 2024 08:46
Set-ScriptExecutionPreference
function Set-ScriptExecutionPreference {
<#
.SYNOPSIS
Sets the script execution preference.
.DESCRIPTION
The Set-ScriptExecutionPreference function sets the script execution preference. It supports three levels of verbosity: "Information", "Verbose", and "Debug".
.PARAMETER ExecutionPreference
The execution preference to be set. It can be one of the following: "Information", "Verbose", "Debug". Default is "Information".
@fslef
fslef / Contributing.md
Created March 15, 2024 10:07
Contribution Guidelines to projects

Contributing to [ProjectName]

We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:

  • Reporting a bug
  • Discussing the current state of the code
  • Submitting a fix
  • Proposing new features
  • Becoming a maintainer

We Develop with Github

@fslef
fslef / New-File.ps1
Created June 26, 2023 13:38
New-File
function New-File {
param (
$Path
)
if (Get-Item $path -ErrorAction Ignore) {
Write-Verbose "File $path already exists."
}
else {
New-Item -Path $path -ItemType File | Out-Null
@fslef
fslef / New-Folder.ps1
Last active June 26, 2023 13:37
New-Folder
function New-Folder {
param (
[Parameter(Position = 0, Mandatory = $true)]
[string]
$Path
)
if (Get-Item $path -ErrorAction Ignore) {
Write-Verbose "Folder $path already exists."
}
# # Import the DotFiles
$helpersPath = Join-Path $PSScriptRoot "helpers"
Get-ChildItem -Path $helpersPath -Filter *.ps1 | ForEach-Object { . $_.FullName }
@fslef
fslef / Connect-ToAzureSubscription.ps1
Last active June 26, 2023 13:14
Connect-ToAzureSubscription
function Connect-ToAzureSubscription {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, Position = 0)]
[ValidateNotNullOrEmpty()]
[guid]$TenantId,
[Parameter(Mandatory = $true, Position = 1)]
[ValidateNotNullOrEmpty()]
[guid]$SubscriptionId,
@fslef
fslef / Write-OutputPadded.ps1
Last active November 5, 2024 08:45
Write-OutputPadded
function Write-OutputPadded {
<#
.SYNOPSIS
Writes colorized and formatted output to the console.
.DESCRIPTION
The Write-OutputPadded function writes colorized and formatted output to the console. It supports indentation, centering, and different types of messages (Error, Warning, Success, Information, Data, Debug, Important).
.PARAMETER Text
The text to be written to the console.