Skip to content

Instantly share code, notes, and snippets.

View igoravl's full-sized avatar

Igor Abade igoravl

View GitHub Profile
@igoravl
igoravl / Script.ps1
Last active August 25, 2023 13:40
Ordena arquivos COBOL do Mercantil
View Script.ps1
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 / create-terraform-storage-account.bicep
Last active May 4, 2023 02:15
Create a storage account for subsequent Terraform usage
View create-terraform-storage-account.bicep
@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 / 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
View Set-TfsGitRepositorySetting.ps1
#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 / Get-TfsGitRepositorySetting.ps1
Created February 9, 2023 05:21
Gets the settings of a Git repository in Azure DevOps Services, using cmdlets from TfsCmdlets
View Get-TfsGitRepositorySetting.ps1
<#
.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 / Post-Message-to-AzDO-Webhook.ps1
Created April 3, 2021 00:36
Post authenticated message to Azure DevOps Incoming Webhook
View Post-Message-to-AzDO-Webhook.ps1
Param
(
# URL to the Azure DevOps incoming webhook endpoint. Expected format is
# https://dev.azure.com/<org>/_apis/public/distributedtask/webhooks/<svc-trig>/?api-version=6.0-preview.
[uri]
$Url,
# Shared secret used to sign the JSON payload. Must be the same value supplied during
# the creation of the Incoming Webhook service connection
[string]
@igoravl
igoravl / InstallDeploymentAgent.ps1
Last active May 4, 2020 19:29
Install Azure DevOps Deployment Agent (off-line)
View InstallDeploymentAgent.ps1
param (
[string]
$AgentZip = 'agent.zip',
[string]
$AgentDirectory = "$($env:SystemDrive\Agent)",
[Parameter(Mandatory=$true)]
[string]
$DeploymentPoolName,
@igoravl
igoravl / azure-pipelines.yml
Created April 29, 2020 19:55
Whitelist build agent on demand when pushing to ACR with firewall enabled
View azure-pipelines.yml
trigger:
- master
resources:
- repo: self
variables:
azureSubscription: '<azure-subscription>'
dockerRegistryServiceConnection: '<service-connection>'
imageRepository: '<repository-name>'
@igoravl
igoravl / Get-IfNull.ps1
Created June 8, 2018 20:12
Function ?? (IfNull)
View Get-IfNull.ps1
Function Get-IfNull($Value, $DefaultValue)
{
if($Value -eq $null)
{
return $DefaultValue
}
return $Value
}
Set-Alias '??' Get-IfNull
@igoravl
igoravl / ResolveServerAddress.psm1
Created January 24, 2017 17:11
Checks whether the IP address of the given server has changed since the last time this script was called
View ResolveServerAddress.psm1
<#
.SYNOPSIS
Checks whether the IP address of the given server has changed since the last time this script was called
#>
Function Resolve-ServerAddress
{
Param
(
[Parameter(Mandatory=$true, Position=0)]
[string]
View surround_img_tags_with_figure.php
<?php
function surround_img_tags_with_figure( $content )
{
$content = preg_replace(
'/<p>((<a.+?\>)?<img.*title=\"([^\\"]+)\".*?>(<\/a>)?)<\/p>/',
'<p><figure>$1<figcaption>$3</figcaption></figure>',
$content);
return $content;