Skip to content

Instantly share code, notes, and snippets.

Avatar

Igor Abade igoravl

View GitHub Profile
@igoravl
igoravl / NetConnectionSharing.psm1
Created Mar 27, 2015
NetConnectionSharing (PowerShell Module)
View NetConnectionSharing.psm1
#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 / Post-Message-to-AzDO-Webhook.ps1
Created Apr 3, 2021
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 / azure-pipelines.yml
Created Apr 29, 2020
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 / InstallDeploymentAgent.ps1
Last active May 4, 2020
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 / Get-IfNull.ps1
Created Jun 8, 2018
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 Jan 24, 2017
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;
@igoravl
igoravl / TfsEventHandler.cs
Created Aug 6, 2011
Exemplo de event handler para o TFS
View TfsEventHandler.cs
// 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
@igoravl
igoravl / Logger.cs
Created May 14, 2015
Color-aware custom MSBuild logger
View Logger.cs
// 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 / ApplySystemFontToForm.cs
Created Apr 15, 2015
Apply system font to Windows Forms Dialog
View ApplySystemFontToForm.cs
using System;
using System.Drawing;
using System.Windows.Forms;
namespace SampleForms
{
public partial class SampleForm : Form
{
public SampleForm()
{