Skip to content

Instantly share code, notes, and snippets.

View igoravl's full-sized avatar

Igor Abade igoravl

View GitHub Profile
@igoravl
igoravl / Logger.cs
Created May 14, 2015 18:51
Color-aware custom MSBuild logger
// NOTE: You must reference the assemblies Microsoft.Build.dll and Microsoft.Build.Framework.dll
// Both can be tipically found in C:\Program Files (x86)\MSBuild\<VS version>\bin
using System;
using Microsoft.Build.Framework;
using Microsoft.Build.Logging;
namespace ColorAwareMSBuildLogger
{
public class Logger : ConsoleLogger
@igoravl
igoravl / TfsEventHandler.cs
Created August 6, 2011 00:33
Exemplo de event handler para o TFS
// Reference: Microsoft.TeamFoundation
// Reference: Microsoft.TeamFoudnation.Client
// Reference: Microsoft.TeamFoundation.Common
// Reference: Microsoft.TeamFoundation.Framework.Server
// Reference: Microsoft.TeamFoundation.Server
// Reference: Microsoft.TeamFoundation.WorkItemTracking.Client
// Reference: Microsoft.TeamFoundation.WorkItemTracking.Server.Dataaccesslayer
// Reference: Microsoft.TeamFoundation.WorkItemTracking.Server.DataServices
// Copy resulting DLL to %PROGRAMFILES%\Microsoft Team Foundation Server 2010\Application Tier\Web Services\Bin\Plugins
<?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;
@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
<#
.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]
@igoravl
igoravl / Get-IfNull.ps1
Created June 8, 2018 20:12
Function ?? (IfNull)
Function Get-IfNull($Value, $DefaultValue)
{
if($Value -eq $null)
{
return $DefaultValue
}
return $Value
}
Set-Alias '??' Get-IfNull
@igoravl
igoravl / InstallDeploymentAgent.ps1
Last active May 4, 2020 19:29
Install Azure DevOps Deployment Agent (off-line)
param (
[string]
$AgentZip = 'agent.zip',
[string]
$AgentDirectory = "$($env:SystemDrive\Agent)",
[Parameter(Mandatory=$true)]
[string]
$DeploymentPoolName,
@igoravl
igoravl / NetConnectionSharing.psm1
Created March 27, 2015 01:33
NetConnectionSharing (PowerShell Module)
#Based on code from http://superuser.com/questions/470319/how-to-enable-internet-connection-sharing-using-command-line
Function Set-NetConnectionSharing
{
Param
(
[Parameter(Mandatory=$true)]
[string]
$InternetConnection,
@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.')