Skip to content

Instantly share code, notes, and snippets.

View heaths's full-sized avatar

Heath Stewart heaths

View GitHub Profile
@heaths
heaths / workspace-dependencies.rs
Last active February 27, 2024 09:27
Rust script to verify that package dependencies are inherited from single workspace.
#!/usr/bin/env -S cargo +nightly -Zscript
---
[package]
edition = "2021"
[dependencies]
cargo-util-schemas = "0.1.0"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114"
toml = "0.8.10"
@heaths
heaths / DataProtection.psm1
Created October 9, 2023 07:42
DPAPI PowerShell Module
#Requires -Version 6.0
using namespace System.Security.Cryptography
using namespace System.Text
function Protect-Data {
[CmdletBinding(DefaultParameterSetName = 'Path')]
[OutputType([byte[]])]
param (
[Parameter(ParameterSetName = 'Value', Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
@heaths
heaths / Test-ContentLinks.ps1
Last active June 8, 2023 20:40
Simple PowerShell script to extract and test URLs in text files.
@heaths
heaths / msistate.go
Created April 19, 2023 00:29
Get the Windows Installer product assignment for products related by UpgradeCode
//go:build windows
package main
import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
@heaths
heaths / winverify.go
Last active April 19, 2023 00:28
Check Authenticode signature on Windows with Go
//go:build windows
package main
import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
@heaths
heaths / requirements.txt
Created April 3, 2023 21:32
Simple script to clean up test projects for CLU and QA
azure-identity==1.12.0
azure-ai-language-conversations==1.0.0
azure-ai-language-questionanswering==1.1.0
@heaths
heaths / main.rs
Last active February 4, 2023 01:24
Deserialize an autorest readme.md file
use clap::Parser;
use markdown::{tokenize, Block, Span};
use serde::Deserialize;
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
fn main() {
let args = Args::parse();
let mut f = File::open(args.file).expect("failed to open autorest config");
@heaths
heaths / main.go
Last active November 16, 2022 18:05
Prompt for input and cache during template execution
package main
import (
"bufio"
"bytes"
"fmt"
"log"
"os"
"strings"
"text/template"
@heaths
heaths / main.rs
Last active October 3, 2022 17:47
Shows how to read a property value from an MSI on any platform using Rust
use std::path::PathBuf;
use std::result::Result;
use std::{error::Error, ops::Index};
use clap::{arg, command, value_parser, Arg};
use msi::{self, Expr, Select, Value};
fn main() -> Result<(), Box<dyn Error>> {
let matches = command!()
.arg(
@heaths
heaths / Get-ExportedTypes.ps1
Created September 28, 2022 18:30
Gets exported types from one or more assemblies.
[CmdletBinding(DefaultParameterSetName = 'Path')]
param (
[Parameter(ParameterSetName = 'Path', Position = 0, Mandatory = $true)]
[string[]] $Path,
[Parameter(ParameterSetName = 'LiteralPath', Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[Alias('PSPath')]
[string[]] $LiteralPath
)