Skip to content

Instantly share code, notes, and snippets.

View gbuktenica's full-sized avatar

Glen Buktenica gbuktenica

  • Perth, Western Australia
View GitHub Profile
@gbuktenica
gbuktenica / bastion.cmd
Last active February 11, 2022 04:07
Connect to Bastion via Native client
# https://docs.microsoft.com/en-us/azure/bastion/connect-native-client-windows
# NOTE - NEEDS BASTION STANDARD SKU
# run once
choco install azure-cli -y
az extension add --name ssh
# Connect
az login --tenant "<tenantid>"
az account set --subscription "<Bastion Subscription ID>"
@gbuktenica
gbuktenica / comment
Created February 10, 2022 05:40
Create colourised "comments" in bash output
https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
echo "$(tput setaf 1)Red text$(tput sgr 0)"
echo "Normal text"
echo "$(tput setaf 2)Green text$(tput sgr 0)"
echo "Normal text"
echo "$(tput setaf 3)Yellow text$(tput sgr 0)"
echo "Normal text"
echo "$(tput setaf 4)Blue text$(tput sgr 0)"
echo "Normal text"
@gbuktenica
gbuktenica / Start-ProcessTimeout.ps1
Created January 18, 2022 07:29
Start-ProcessTimeout
function Start-ProcessTimeout {
<#
.SYNOPSIS
Start a Windows Process and stop it if it runs longer than a timeout.
.EXAMPLE
Start-ProcessTimeout -FilePath "C:\windows\notepad.exe" -TimeOut 10
Opens Notepad and then closes after 10 seconds.
.EXAMPLE
Start-ProcessTimeout -FilePath "C:\windows\notepad.exe" -TimeOut 10 -ArgumentList "Example.txt"
Opens Notepad and the Example text file and then closes after 10 seconds.
@gbuktenica
gbuktenica / LICENSE
Created January 11, 2022 03:20
Basic comercial license
License
Copyright (c) <YEAR> <COPYRIGHT HOLDER>
All rights reserved. No part of this software may be reproduced, stored in a
retrieval system, or transmitted in any form or by any means, electronic,
mechanical, photocopying, recording, or otherwise, without the prior permission
of the copyright owner.
The above copyright notice and this permission notice shall be included in all
@gbuktenica
gbuktenica / test.json
Created December 15, 2021 03:47
Minimal test ARM Template
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"environmentPrefix": {
"type": "string"
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
@gbuktenica
gbuktenica / ADR.md
Last active December 1, 2021 03:44
Architecture Decision Records

ARD XXX Title

Status

What is the status? Options: Proposed, Accepted, Rejected, Deprecated, Superseded

Context

What is the issue that we're seeing that is motivating this decision or change?

@gbuktenica
gbuktenica / chvt.sh
Last active November 24, 2021 03:56
How to switch between multiple Linux TTY windows
# By default there are 7 ttys (TeleTYpewriter) in Linux: tty1, tty2 ....tty7
# To change to tty2 press:
# CTRL + ALT + Function2 or in a ssh window:
sudo chvt 2
# To check which tty is current
tty
# Expected result
# /dev/tty2
@gbuktenica
gbuktenica / Test-LastRun.ps1
Created August 4, 2021 05:52
Tests if this function has been called earlier than a date object.
function Test-LastRun {
<#
.SYNOPSIS
Tests if this function has been called earlier than a date object.
.EXAMPLE
Test-LastRun -RunSince ((Get-Date).AddDays(-30))
if this script has been run in the last 30 days it will return $true
if this script has not been run in the last 30 days it will return $false
.NOTES
License : MIT License
@gbuktenica
gbuktenica / ARM_Schemas.md
Last active July 23, 2021 01:44
How to update the schema for Azure ARM templates
@gbuktenica
gbuktenica / Set-CredSsp.ps1
Last active August 17, 2021 10:53
Allow connections to computers that have not been patched for CredSSP
# Details on CredSSP https://support.microsoft.com/en-us/topic/credssp-updates-for-cve-2018-0886-5cbf9e5f-dc6d-744f-9e97-7ba400d6d3ea
# Patch https://support.microsoft.com/en-us/topic/april-17-2018-kb4093120-os-build-14393-2214-e902ffe0-783a-c091-6f99-bf1105f0b75e
# Details on CredSSP https://support.microsoft.com/en-us/topic/credssp-updates-for-cve-2018-0886-5cbf9e5f-dc6d-744f-9e97-7ba400d6d3ea
# Patch https://support.microsoft.com/en-us/topic/april-17-2018-kb4093120-os-build-14393-2214-e902ffe0-783a-c091-6f99-bf1105f0b75e
$Key = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP"
# Force Updated Clients: 0
# Mitigated: 1
# Vulnerable: 2