Skip to content

Instantly share code, notes, and snippets.

View flcdrg's full-sized avatar

David Gardiner flcdrg

View GitHub Profile
@flcdrg
flcdrg / Get-ClassicRelease.ps1
Created June 5, 2023 10:51
Azure DevOps REST APIs
Param(
[string]$organisation,
[string]$project,
[int] $releaseId,
[string]$token
)
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "",$token)))
# https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/releases/{releaseId}?approvalFilters={approvalFilters}&propertyFilters={propertyFilters}&$expand={$expand}&$topGateRecords={$topGateRecords}&api-version=7.0
@flcdrg
flcdrg / Convert-VariableGroup.ps1
Last active September 16, 2022 06:44
PowerShell script to convert an Azure DevOps Pipeline variable group to the equivalent YAML
<#
.SYNOPSIS
Convert Azure Pipelines Variable Group to YAML
.DESCRIPTION
Reads a variable group from an Azure DevOps pipeline library and converts it into the equivalent YAML
.NOTES
Requires the Azure CLI, with the azure-devops extension installed. eg. `az extension add --name azure-devops`
@flcdrg
flcdrg / .profile
Created February 24, 2022 01:42
WSL .profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
@flcdrg
flcdrg / git-configuration.sh
Last active April 26, 2023 11:22
Git config (including WSL2)
git config --global core.editor "code --wait"
git config --global fetch.prune true
git config --global push.autoSetupRemote true
# Beyond Compare
git config --global diff.tool bc
git config --global difftool.bc.path /mnt/c/Program\ Files/Beyond\ Compare\ 4/BComp.exe
git config --global merge.tool bc
git config --global mergetool.bc.path /mnt/c/Program\ Files/Beyond\ Compare\ 4/BComp.exe
@flcdrg
flcdrg / post-install.ps1
Last active March 25, 2024 01:44
Post install
# PowerShell modules. Run this from elevated PowerShell 7
# Remove preinstalled Pester
$module = "C:\Program Files\WindowsPowerShell\Modules\Pester"
takeown /F $module /A /R
icacls $module /reset
icacls $module /grant "*S-1-5-32-544:F" /inheritance:d /T
Remove-Item -Path $module -Recurse -Force -Confirm:$false
# Modules
@flcdrg
flcdrg / ohmyposh.json
Last active August 11, 2022 00:30
Oh My Posh theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#fa3b3b",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
@flcdrg
flcdrg / settings.json
Last active January 3, 2023 03:59
Windows Terminal
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command":
{
"action": "copy",
"singleLine": false
@flcdrg
flcdrg / CreateVSTSItems.ps1
Created June 22, 2018 06:28
Migrate Redmine issues to Visual Studio Team Services work items
param(
$user, # "VSTS username - doesn't need @domain suffix"
$token, # VSTS personal access token
$project, # the VSTS project to create items in
$vstsAccountName, # the bit before .visualstudio.com
$csvFile, # path to the .csv file
$redmineIssueUrl # URL to legacy redmine server. eg. https://redmine/issues
)
$ErrorActionPreference = "Stop"
@flcdrg
flcdrg / moderation.md
Last active December 16, 2023 23:26
Chocolatey Moderation

Please resolve these to allow this package to be approved:

  • tools\VERIFICATION.txt should contain instructions on how the user can independently verify that the embedded file is the same as available for download from the original site.
  • Remove tools\chocolateybeforemodify.ps1 as it isn't being used
  • Remove tools\LICENSE.txt and tools\VERIFICATION.txt as they are only required when embedding files in the package
  • If you are the software author, please confirm that via a comment here. Alternatively, if you are not the software author, put your own name in the owners field.
  • Remove the file ReadMe.md
  • Remove the file update.ps1
  • Add minimum version numbers for package dependencies
  • Run the PowerShell code to remove comments from scripts
@flcdrg
flcdrg / Create-Groups.ps1
Created October 12, 2017 22:45
TeamCity
$data = @{
"GROUP_KEY" = "Group Description"
}
$user = "xxxxxx"
$password = "xxxxxx"
$pair = "$($user):$($password)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))