Skip to content

Instantly share code, notes, and snippets.

View igoravl's full-sized avatar

Igor Abade igoravl

View GitHub Profile
@igoravl
igoravl / Get-TfsGitRepositorySetting.ps1
Created February 9, 2023 05:21
Gets the settings of a Git repository in Azure DevOps Services, using cmdlets from TfsCmdlets
<#
.SYNOPSIS
Gets the settings of a Git repository.
#>
Function Get-TfsGitRepositorySetting {
[CmdletBinding()]
Param (
# Specifies the name of the setting to retrieve. If not specified, all settings are returned.
[Parameter(Position = 0)]
[SupportsWildcards()]
@igoravl
igoravl / Set-TfsGitRepositorySetting.ps1
Last active February 9, 2023 06:05
Modifies the settings of a Git repository in Azure DevOps Services, using cmdlets from TfsCmdlets
#requires -Modules TfsCmdlets
<#
.SYNOPSIS
Modifies the settings of a Git repository.
#>
Function Set-TfsGitRepositorySetting {
[CmdletBinding(SupportsShouldProcess = $true)]
Param (
# Specifies the name of the setting to modify.
@igoravl
igoravl / create-terraform-storage-account.bicep
Last active May 4, 2023 02:15
Create a storage account for subsequent Terraform usage
@description('Specifies the name of the Azure Storage account.')
param storageAccountName string
@description('Specifies the name of the blob container.')
param containerName string = 'tfstate'
@description('Specifies the location in which the Azure Storage resources should be deployed.')
param location string = resourceGroup().location
@description('Specifies the SKU for the Storage Account.')
@igoravl
igoravl / Script.ps1
Last active August 25, 2023 13:40
Ordena arquivos COBOL do Mercantil
class MBStringComparer : System.Collections.IComparer {
[int] Compare([object] $x, [object] $y) {
if($x.Contains('/'))
{
$x = $x.Substring($x.LastIndexOf('/') + 1)
}
if($y.Contains('/'))
{
@igoravl
igoravl / pre-commit
Created June 17, 2024 22:36
Pre-commit hook to require UTF-8 BOM encoding in PowerShell scripts
#!/bin/bash
# Função para verificar BOM UTF-8
check_bom() {
local file=$1
if [[ $(head -c 3 "$file") == $'\xEF\xBB\xBF' ]]; then
return 0
else
return 1
fi
@igoravl
igoravl / GetTerminalWindowHandle.cs
Created July 8, 2024 03:04
GetTerminalWindowHandle.cs
private static IntPtr GetTerminalWindowHandle()
{
try
{
var currentProcess = Process.GetCurrentProcess();
do
{
var parentProcess = GetParentProcess(currentProcess.Handle);