Skip to content

Instantly share code, notes, and snippets.

View Tridy's full-sized avatar

Tridy

  • Stockholm, Sweden
  • 04:44 (UTC +02:00)
View GitHub Profile
@Tridy
Tridy / restapi-azure-devops-csharp.md
Created March 26, 2025 18:24
Azure DevOps Rest API Downloading All Attachments using C#

Downloading all attachments from Azure DevOps project using REST API Version 7.1

Using C#, Refit

It worked for me when I was exporting work items from one tenant to another.

I am using Refit with this in C#

  1. Get the workitems that have attachments and attachment ids:
@Tridy
Tridy / apim-set-pending-revisions-to-failed.ps1
Last active July 12, 2024 14:24
In Azure API Management sets all of the Pending Developer Portal revisions statuses from Pending to Failed
$subscriptionId = "-GUID-"
$resourceGroupName = "-STRING-"
$apimName = "-STRING-"
$tokenResponse = az account get-access-token --resource https://management.azure.com | ConvertFrom-Json
$accessToken = $tokenResponse.accessToken
$baseUrl = "https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.ApiManagement/service/${apimName}"
$url = "${baseUrl}/portalRevisions?api-version=2022-08-01"

from Windows Run dialog:

Classic context menu:

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

Windows 11 "new" context menu:

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

@Tridy
Tridy / IDesignExample.md
Last active October 17, 2022 21:54
An example of the Mermaid script to use for making similar graphs that are used in IDesign documentation for use cases.

A Mermaid diagram used to create a diagram used in describing the use cases in IDesign documentation:

flowchart TD
    Start((start)) --> RequestAssign(Request Assign\nTradesman)
    RequestAssign --> VerifyRequest(Request Assign\nTradesman)
    VerifyRequest --> Validation{  }
    Validation --> |Not Valid| Error(Error)
 Validation --> |Valid| AssignToProject(AssignT to Project)
@Tridy
Tridy / GitAmendOneCommit.ps1
Created October 17, 2022 07:41
Amend multiple Git commits with one line
git checkout yourBranch
git reset $(git merge-base main $(git branch --show-current))
git add -A
git commit -m "one commit on yourBranch"
git push -f
@Tridy
Tridy / GetIpCountry.ps1
Last active October 9, 2022 07:29
Get the external IP and the country using PowerShell
$json = (Invoke-WebRequest -uri "https://location-api.f-secure.com/v1/ip-country").Content | ConvertFrom-JSON
Write-Output $json.ip
Write-Output $json.country