Skip to content

Instantly share code, notes, and snippets.

View rodmhgl's full-sized avatar
🐒
Just monkeyin' around

Rod Stewart rodmhgl

🐒
Just monkeyin' around
View GitHub Profile
@rodmhgl
rodmhgl / Data.xml
Last active April 2, 2018 16:02
XPath Troubleshooting
<?xml version="1.0" encoding="utf-8"?>
<bpr:release xmlns:bpr="http://www.blueprism.co.uk/product/release">
<bpr:name>BPRelease v3</bpr:name>
<bpr:release-notes>
</bpr:release-notes>
<bpr:created>2018-03-31 04:20:16Z</bpr:created>
<bpr:package-id>4</bpr:package-id>
<bpr:package-name>BPRelease_Info Troubleshooting</bpr:package-name>
<bpr:user-created-by>admin</bpr:user-created-by>
<bpr:contents count="2">
@rodmhgl
rodmhgl / AssignmentComparison.ps1
Created June 8, 2018 14:11
Demonstrates assigning object collection with Array addition versus Direct Assignment
$blah = get-childitem -Path c:\temp -Directory
$AddedTicks = Measure-Command -Expression {
$AddedToArray = @()
foreach ($b in $blah) {
$myOBJ = New-Object System.Object
$myOBJ | Add-Member -Type NoteProperty -Name IsBlah -Value $b.BaseName
$AddedToArray += $myOBJ
}
} | Select-Object Ticks
@rodmhgl
rodmhgl / Install-Terraform.ps1
Created February 10, 2022 23:18
Downloads and installs Terraform. $tfPath will be added to PATH permanently via registry settings - run as Administrator.
$pathKey = 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment'
$tfFilename = 'terraform_1.1.5_windows_amd64.zip'
$tfURL = "https://releases.hashicorp.com/terraform/1.1.5/$tfFilename"
$tfPath = 'C:\tf'
Invoke-WebRequest $tfURL -UseBasicParsing -OutFile $tfFilename
Expand-Archive ".\$tfFilename" -DestinationPath $tfPath -Force
$oldpath = (Get-ItemProperty -Path $pathKey -Name PATH).path
@rodmhgl
rodmhgl / setenv.sh
Last active September 6, 2023 22:21
Export environment variables matching a string to a file to be sourced later
#!/usr/bin/env bash
# pilfered from a MSFT AKS tutorial and tweaked
if [ "$#" -ne 2 ]; then
echo "Will export env variables that end with <search_string>"
echo "Usage: $0 <search_string> <output_filename>"
exit 1
fi