Skip to content

Instantly share code, notes, and snippets.

View glennsarti's full-sized avatar
✍️
Writing code that's soon to be legacy...

Glenn Sarti glennsarti

✍️
Writing code that's soon to be legacy...
View GitHub Profile
@glennsarti
glennsarti / server.rb
Last active July 20, 2022 05:51
Run Tasks Mock Server
require 'webrick'
require 'net/http'
require 'json'
require 'securerandom'
POST_PATH_RE = /\/(?'result'pass|fail|random|invalid|none|actual|seccomp|costmgmt)(?:$|-(?'delay'[\d]+))/.freeze
LOGS_PATH_RE = /\/logs\/(?'id'[a-zA-Z\-0-9]+$)/.freeze
$pending_jobs = []
$exit_now = false
@glennsarti
glennsarti / theproblem.yaml
Created September 8, 2021 07:04
TelstraPurpleBlog-DynamicMatrix
os: ['windows-latest', 'ubuntu-latest']
ruby: ['2.4', '2.5', '2.7']
command: ['... run all tests ...']
@glennsarti
glennsarti / install-telstra-nic-trigger.ps1
Created January 29, 2021 06:56
Telstra Network Trigger
#requires -Version 7.0
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if (-not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Throw "This script must be run elevated!"
Exit 1
}
$BT = Get-Module -name 'BurntToast' -ListAvailable -ErrorAction SilentlyContinue
if ($null -eq $BT) {
@glennsarti
glennsarti / Audit Litmus.ps1
Last active October 31, 2019 02:57
Audit modules for litmus
Import-Module powershell-yaml
$repos = @('puppetlabs-accounts',
'puppetlabs-acl',
'puppetlabs-apache',
'puppetlabs-apt',
'puppetlabs-azure',
'puppetlabs-bootstrap',
'puppetlabs-chocolatey',
'puppetlabs-concat',
C:\Source\tmp\process_spawn> be ruby test.rb
*** back ticks
hello " world
*** %x
hello " world
*** capture3
hello "\"" world
@glennsarti
glennsarti / RunAppXProgram.ps1
Created July 12, 2019 02:51
Activate an AppX program by name
param($AppXID)
$AppXPackage = Get-AppxPackage $AppXID
$AppXManifest = Get-appxpackagemanifest $AppXPackage
$AppXModelID = $AppXPackage.PackageFamilyName + "!" + $AppXManifest.package.applications.application.id
$csharp = @"
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace RunAppX
@glennsarti
glennsarti / PDK MSI Test Pilots.md
Last active June 21, 2019 03:20
PDK MSI Test Pilots

Date - 21 Jun 2019

Thankyou

Firstly, thankyou for testing this out for me!!

What is this?

The install/uninstall/upgrade process for PDK can be very slow on Windows, particularly on VMs and AntiVirus products. So as part of https://tickets.puppetlabs.com/browse/PDK-1360 we looked at how to make the MSI experience much faster. After much work

# Copy the source files
$WIX = 'C:\Program Files (x86)\WiX Toolset v3.11'
& robocopy "C:\Source\VanagonSource\SourceDir" "C:\Source\Vanagon\SourceDir" /s /e /copy:dat /r:1 /w:1 /MIR
& robocopy "C:\Source\VanagonSource\wix" "C:\Source\Vanagon\wix" /s /e /copy:dat /r:1 /w:1 /MIR
& cmd /c del C:\Source\Vanagon\*.* /q
Push-Location C:\Source\Vanagon

Scenarios:

Default - No change to the TokenOperations.FoldableRegions metjhod

No Dupe - Removed the check for duplicate regions (Test case had none)

No Dupe or Sort - Removed the check for duplicate regions and removed the region sorting

FOLDABLEREGIONS ... - These metrics came from calling the FoldableRegions method

$Script:PuppetConsoleURI = 'https://fill.this.in' # e.g. 'https://peconsole.company.local';
$Script:PuppetConsoleUsername = 'username';
$Script:PuppetConsolePassword = 'password' # Cleartext
Function Get-PuppetLoginToken() {
$body = @{
'username' = $Script:PuppetConsoleUsername;
'password' = $Script:PuppetConsolePassword;
'redirect' = '/'
}