Skip to content

Instantly share code, notes, and snippets.


Richard Fennell rfennell

View GitHub Profile
rfennell / Remove-DeletedGitBranches.ps1
Last active Jul 6, 2022
A PowerShell script to do a git fetch with a prune then also delete any local branches of the same name
View Remove-DeletedGitBranches.ps1
Write-Host "Getting list of branches"
$output = [string] (& git.exe branch 2>&1)
$mainbranch = "main"
rfennell / fixalias.ps1
Created Jul 1, 2022
A script to update a Hugo content file to provide an alias that matches a Wordpress permalink
View fixalias.ps1
$basepath = "C:\tmp\bmBlog\content"
$files = Get-ChildItem -path $basepath -Filter "*.md" -Recurse | % { $_.FullName}
foreach ($file in $files) {
$f = get-item $file
$content = (Get-Content -path $f.FullName)
foreach ($l in $content) {
rfennell / AZDO-StageDependencyVariables.yml
Last active Jun 30, 2022
Azure DevOps Pipelines Stage Dependency Variables Usage Demo
View AZDO-StageDependencyVariables.yml
- name: Value
type: boolean
default: true
vmImage: ubuntu-latest
rfennell / CommitToThisRepo.ps1
Created Jan 19, 2018
PowerShell script add a commit to the current repo for use inside a VSTS CI/CD process
View CommitToThisRepo.ps1
$file = "",
$text = "Automated edit",
$wi = "#13 #14"
"Set config"
git config --global "builduser@dummy.local" # any values will do, if missing commit will fail
git config --global "Build user"
rfennell / blog2md.js
Created Jun 25, 2022
A quick edit to the blog2md ( tools to place exported posts from a multi site WordPress Server in folders based on the sub site name
View blog2md.js
'use strict';
Usage: blog2md b|w <BLOGGER/WordPress BACKUP XML> <OUTPUT DIR>
const fs = require('fs');
const os = require('os');
rfennell / Unregister-Agent.ps1
Created Dec 20, 2019
Finds an Azure Build agent, takes it off line then removes it registration
View Unregister-Agent.ps1
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps PAT token")]
[parameter(Mandatory = $true, HelpMessage = "URL of Azure DevOps instance e.g.")]
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps Agent Pool name")]
$pool ,
[parameter(Mandatory = $true, HelpMessage = "Based name for agent to search for e.g MyAgent as part of B1MyAgent-123")]
$agentBaseName ,
rfennell / Azure-DevOps-Variables-Sample-yml
Created May 5, 2022
Example of how to pass variables between Azure DevOps stages
View Azure-DevOps-Variables-Sample-yml
vmImage: windows-latest
- name: system.debug
value: true
- stage: Stage1
rfennell / add_issue_to_project
Created Oct 15, 2021
A GitHub Actions workflow to add any newly created issues to a Project within a GitHub user (pro or free) account as opposed to a GitHub Enterprise the main sample
View add_issue_to_project
name: Add Issue to project
types: [opened]
runs-on: ubuntu-latest
- name: Get project data
rfennell / Update-AppConfig.ps1
Created Feb 13, 2018
PowerShell script to update an app.config file based on a parameters.xml
View Update-AppConfig.ps1
function Update-AppConfig
[parameter(Mandatory = $true, HelpMessage = "Name of app.exe.config file")]
[parameter(Mandatory = $false, HelpMessage = "Name of parameters.xml file")]
[string]$ParametersFile = "parameters.xml"
rfennell / Set-Azure DevOpsBrnachPolicies.ps1
Created Nov 12, 2021
Set Azure DevOps All Repositories Branch policies
View Set-Azure DevOpsBrnachPolicies.ps1
[parameter(Mandatory=$true,HelpMessage="The target Azure DevOps Instance")]
[parameter(Mandatory=$true,HelpMessage="The new project name")]
[parameter(Mandatory=$true,HelpMessage="A PAT with access to target org")]