Skip to content

Instantly share code, notes, and snippets.

View scbedd's full-sized avatar

Scott Beddall scbedd

  • Microsoft
  • Seattle, WA
View GitHub Profile
@scbedd
scbedd / retrieve_referenced_builds.py
Created June 10, 2024 21:07
Retrieve builds from a devops project
# This script REQUIRES the presence of environment variable DEVOPS_TOKEN with the necessary READ permissions.
import os
import sys
import base64
import json
import csv
from typing import List, Set, Any, Dict
from dataclasses import dataclass, asdict

Notice that pip freeze for the invoking environment remains clean.

image

And this is what it looks like on disk:

image

@scbedd
scbedd / parse_template_calls.ps1
Created February 8, 2024 01:56
Invokes template conversion tool on set of files
# example usage:
#
# ./parse_template_calls.ps1 -InputFile C:\repo\sdk-for-python\eng\pipelines\templates\stages\archetype-sdk-client.yml -RepoRoot C:\repo\sdk-for-python
# We could make the thing ascend to repo root for us, but I didn't want to fit that in this script
param(
$InputFile,
$RepoRoot = "C:/repo/sdk-for-python/"
)
@scbedd
scbedd / updates.md
Created June 2, 2023 00:26
Updates to disable tool proxy in Java CI

Swap CI to Standalone Exe Only

TestProxyManager.java

Adjust function here

    private boolean proxyIsManual() {
        return Configuration.getGlobalConfiguration().get("PROXY_MANUAL_START") != null
    }
@scbedd
scbedd / readme.md
Created May 9, 2023 21:57
Debug a node package

Basic guide to debugging with node

  • Place a debugger statement in the appropriate place within your typescript code. Say, generate_report.ts
  • Install Chrome, then open the URL chrome://inspect/ using it.
  • Click Open dedicated DevTools for Node
    • This will enable listening on the node debugging port.
  • Add --inspect to the node invocation of your actual code. EG: node --inspect ./dist/generate_report.js
  • This is extremely useful for diving into object mappings during template expansion.
@scbedd
scbedd / sort_spec_list.py
Last active April 21, 2023 22:53
Discarded Code - Sorting Spec Lists
# After writing this code, I realized that these inputs do not need to be sorted to meet my purposes for `scripts/analyze_deps.py`.
# As a result, I have removed this code from the code base, but am emplacing it here so that I can retrieve it later.
# pip install packaging
from typing import List
import re
from packaging.version import Version, parse
class SortableSpecifierSet:
def trim_spec(self, spec):
@scbedd
scbedd / azure-sdk-engsys-update.md
Last active March 8, 2022 19:29
Azure-sdk-tools revamp

Azure SDK For Python EngSys Revamp

Existing Progress At

Currently works, but has organically grown into two separate stacks that I believe best be merged.

We have some repeated code, mostly present around:

  • Requirements Parsing
  • Versioning Comparisons
@scbedd
scbedd / instructions.md
Last active November 4, 2021 14:07
Podman Installation on WSL2. Cribbed directly from text convo with @mikeharder

Podman Installation on WSL/2

Prereq:

  • Windows 10 > 19xx
  • WSL2 Configured
  • Ubuntu 20.04 Image on Windows Store. (Not Ubuntu LTS. Not plain Ubuntu)

Installed in wsl2 Ubuntu20.04 using these commands:

@scbedd
scbedd / encode-decode-qr.ps1
Created June 22, 2021 18:34
Decode QR Image Given Base64 Encoded PNG
$inputFile = "your-qr-image.PNG"
$file = "re-rewritten.txt";
$test_out = "re-out.png"
# to base64
[System.Convert]::ToBase64String((Get-Content $inputFile -AsByteStream)) | Set-Content $file
# back to bytes
[Convert]::FromBase64String((Get-Content $file)) | Set-Content $test_out -AsByteStream
@scbedd
scbedd / glob_packages_into_poetry_reqs.py
Created April 1, 2021 00:26
Get Poetry Dependencies from entire repository
import glob
import os
packages = glob.glob('C:/repo/sdk-for-python/sdk/*/*/setup.py')
for pkg in packages:
name = os.path.dirname(pkg).split(os.sep)[-1]
path = os.path.dirname(pkg.split('python/')[1]).replace(os.sep, '/')
print('{} = {{path = "{}"}}'.format(name, path))