Skip to content

Instantly share code, notes, and snippets.

View kewalaka's full-sized avatar

Stu kewalaka

  • New Zealand
  • 21:21 (UTC +12:00)
View GitHub Profile
@kewalaka
kewalaka / action.yml
Last active June 8, 2024 00:37
using GitHub Cloud runners for E2E tests with Azure Verified Modules
# from .github/actions/e2e-testexamples/
author: AVM
name: e2e - testexamples
description: Tests the example supplied in the input. Needs checkout and Azure login prior.
inputs:
example:
description: The example directory to test
required: true
runs:
@kewalaka
kewalaka / devdrive.ps1
Created January 26, 2024 20:49
Move packages for various languages to a Dev Drive & configure environment vars
# Define the Dev Drive path
$DevDrive = "D:\packages"
# Function to display progress message
function Show-Progress($message, $color) {
Write-Host -ForegroundColor $color "Progress: $message"
}
# Create npm cache directory and set environment variable
$npmCacheDir = Join-Path $DevDrive "npm"
@kewalaka
kewalaka / Microsoft AMD puzzle.md
Last active May 27, 2023 21:57
translation of Chinese instructions from the Microsoft AMD puzzle swag from #msbuild

Nervous twelve dollars

overview

Feng Zikai, who used to be a cartoonist, praised "Twelve Twelve Pieces", which is "on top of super-flat toys and rivals chess and Go", is a kind of puzzle game that can change according to one's inclinations.

According to legend, it is a domino whose ancestor is China, so it is still called "Pandomino bone marrow" abroad. "Shao Pamino" means that five pieces are connected, because although the twelve jigsaw puzzles have different shapes, each piece occupies the same number of squares, which is five, hence the name.

In the 1940s, the "twelve nerve-wracking blocks" were favored by western mathematicians, and they vigorously advocated it, and became popular all over the world for a while. In the early 1950s, Mr. Fang Bupu, a Chinese teacher at Yixin Middle School in Shanghai, my country, transformed the popular two-dimensional "brain-wrenching twelve yuan" into a three-dimensional one, making the "twelve yuan" more heart-wrenching and more charming.

@kewalaka
kewalaka / adoagent-dockerfile
Created September 18, 2022 21:18
Docker file for an Azure DevOps self-hosted agent
FROM mcr.microsoft.com/azure-powershell
ARG TERRAFORM_VERSION="1.2.9"
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
apt-transport-https \
apt-utils \
@kewalaka
kewalaka / Get-LockedOutLocation.ps1
Created May 11, 2022 21:43
Get-LockOutLocation scans domain controller event logs to find machines where a user account is being locked out.
#Requires -Version 2.0
Function Get-LockedOutLocation
{
<#
.SYNOPSIS
This function will locate the computer that processed a failed user logon attempt which caused the user account to become locked out.
.DESCRIPTION
This function will locate the computer that processed a failed user logon attempt which caused the user account to become locked out.
The locked out location is found by querying the PDC Emulator for locked out events (4740).
@kewalaka
kewalaka / PSADT-Cheatsheet.ps1
Created February 22, 2022 02:45 — forked from leeramsay/PSADT-Cheatsheet.ps1
PSADT snippits/cheatsheet
## Commonly used PSADT env variables
$envCommonDesktop # C:\Users\Public\Desktop
$envCommonStartMenuPrograms # C:\ProgramData\Microsoft\Windows\Start Menu\Programs
$envProgramFiles # C:\Program Files
$envProgramFilesX86 # C:\Program Files (x86)
$envProgramData # c:\ProgramData
$envUserDesktop # c:\Users\{user currently logged in}\Desktop
$envUserStartMenuPrograms # c:\Users\{user currently logged in}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
$envSystemDrive # c:
$envWinDir # c:\windows
@kewalaka
kewalaka / Get-NonInheritedACLs.ps1
Last active February 7, 2022 02:30
Get-NonInheritedACLs is a script that recursively checks for directory permissions, ignoring inherited permissions except for the start folder
#
# Script that takes a start path and recursively checks for directory permissions
# Inherited permissions are ignored except for the start folder.
# Current folder progress written to the screen, output to a CSV located where the script is run from.
#
# Stu <kewalaka@gmail.com>
#
$startPath = "C:\Temp\PermTest" # CHANGE ME
$global:results = @()
@kewalaka
kewalaka / Get-WindowsDiskInfo.ps1
Created January 5, 2022 01:13
Get-WindowsDiskInfo.ps1 - used to enumerate model/manufacturer & space info about disks
$results = @()
foreach ($disk in Get-CimInstance Win32_Diskdrive) {
Write-Host "Fetching info for $($disk.DeviceID)..."
$diskMetadata = Get-Disk | Where-Object { $_.Number -eq $disk.Index } | Select-Object -First 1
# you don't get meta data back from a dynamic disk
if (!$diskMetadata) {
@kewalaka
kewalaka / Test-ADCredentials.ps1
Last active November 17, 2021 03:34
This is a simple script that can be used to interactively check an AD account
$Domain = $env:USERDOMAIN
# comment out the credential line if you want to cache this
Clear-Variable -Name Credential*
$Credential = $( Get-Credential -Message "Please provide AD credentials to test. There is no need to add the domain if it is '$Domain\'" )
if ($Credential)
{
$Context = "Domain" # Domain this is the type, not the domain name - i.e. as opposed to Local auth, or ADLS
@kewalaka
kewalaka / Find-AccountsUsingUnconstrainedDelegation.ps1
Last active October 25, 2021 00:00
This uses ADSI to find accounts that are using unconstrained delegation, use of ADSI is to allow this to run on machines that don't have the AD cmdlets installed.
# assume we're just dealing with the current domain
$SearchRoot = "DC=" + (($env:USERDNSDOMAIN).split(".") -join ",DC=")
# assume we can get a domain controller IP by grabbing the DNS setting from the interface with the default route.
$DomainControllerIP = (Get-DnsClientServerAddress -InterfaceIndex (Get-netroute -DestinationPrefix '0.0.0.0/0').ifIndex -AddressFamily IPv4).ServerAddresses | Select-Object -First 1
$DomainDN = "LDAP://$($DomainControllerIP):$($Port)/$SearchRoot"
# computers
$ldapFilter = '(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=524288))'
[System.Collections.ArrayList]$Properties = @('distinguishedname', 'samAccountName', 'objectClass', 'userAccountControl')