Skip to content

Instantly share code, notes, and snippets.

@ToroNZ
ToroNZ / runbook.ps1
Last active January 24, 2024 03:17
Luke's Dakara script
# This runbook deletes all resource groups under a management group except for the ones with a specific tag.
<#
.SYNOPSIS
Deletes all resource groups under a management group except for the ones with a specific tag.
.DESCRIPTION
This script deletes all resource groups under a specified management group except for the ones with a specific tag. It can also delete policy assignments and subscription role assignments if specified.
.PARAMETER ManagementGroupId
The ID of the management group to delete resource groups under. WARNING: This script will delete all resource groups under the specified management group except for the ones with the specified tag. Make sure you have specified the correct management group ID, or you may accidentally delete resources that you did not intend to delete.
@ToroNZ
ToroNZ / README.md
Created October 24, 2023 19:33 — forked from izzyleung/README.md
Mullvad WireGuard Public Key API (Upload and Revoke)

Generate a new pair of keys via wg

wg genkey | tee privatekey | wg pubkey > publickey

Upload the newly generate key to Mullvad

curl https://api.mullvad.net/wg/ -d account=YOUR_ACCOUNT_NUMBER --data-urlencode pubkey="$(cat publickey)"
@ToroNZ
ToroNZ / hello-world.ps1
Created August 16, 2023 02:57
powershell hello there
Write-Host "Hello-World!"
@ToroNZ
ToroNZ / dagster.yaml
Created April 18, 2023 02:24
Dagster Agent config - local launcher
instance_class:
module: dagster_cloud.instance
class: DagsterCloudAgentInstance
dagster_cloud_api:
agent_token: <YOUR_AGENT_TOKEN>
deployment: prod
user_code_launcher:
module: dagster_cloud.workspace.user_code_launcher
@ToroNZ
ToroNZ / endorsment-key.sh
Last active January 17, 2023 12:46
TPM2 read the endorsement key, creating one if it does not already exist
#!/bin/sh
if [ "$USER" != "root" ]; then
SUDO="sudo "
fi
$SUDO tpm2_readpublic -Q -c 0x81010001 -o ek.pub 2> /dev/null
if [ $? -gt 0 ]; then
# Create the endorsement key (EK)
$SUDO tpm2_createek -c 0x81010001 -G rsa -u ek.pub
@ToroNZ
ToroNZ / copy_az_devops_vars.py
Created July 18, 2022 05:08
Migrate/Copy Azure Devops Variable Groups from a JSON file (plenty of room for improvement)
import json
import argparse
from azure.cli.core import get_default_cli
# TODO: Wrap all required calls login/fetch/upload into a single call of this script or if you have time perform lookups and offer CLI style options
# Store JSON file from AZ CLI as: 'az pipelines variable-group show --group-id 136 --org "https://dev.azure.com/ORG/" --project "PROJECT NAME" --output json>136.json'
# Run as: 'python3 az-devops-import-variables.py -s 136.json -id 150 -project "project-uid" -org "https://dev.azure.com/ORG/"'
parser = argparse.ArgumentParser(description="Azure DevOps Variable import", formatter_class=argparse.RawTextHelpFormatter)
@ToroNZ
ToroNZ / az_aks_blob_helpers.sh
Created July 14, 2022 23:32
Access Azure resources from managed identities
#Get Token using Azure scope
curl -s 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fmanagement.azure.com%2F' -H Metadata:true
#Get Token using storage scope
curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fstorage.azure.com%2F' -H Metadata:true -s
#^Could use jq if/when available
# Store the token in variable
ACCESS_TOKEN="RESPONSE_TOKEN"
@ToroNZ
ToroNZ / http-get.js
Last active July 13, 2022 06:06
JS HTTP Call Example
const https = require('https');
const options = {
hostname: 'portal-uat-v5.australiansuper.com',
port: 443,
path: '/',
method: 'GET'
};
const req = https.request(options, (res) => {
@ToroNZ
ToroNZ / Get-Certificate.ps1
Created July 12, 2022 10:01
Powershell - Check/Get SSL/TLS Certificate
using namespace System.Net.Sockets
using namespace System.Net.Security
using namespace System.Security.Cryptography.X509Certificates
function Test-ServerSSLSupport {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[string]$HostName,
@font-face {
font-family: "";
/* Add other properties here, as needed. For example: */
/*
font-weight: 100 900;
font-style: normal italic;
*/
src: url(data:application/octet-stream;base64,d09GMgABAAAAAIkEABEAAAABZMwAAIifAAEFYAAAAAAAAAAAAAAAAAAAAAAAAAAAGoEWG4GHIhyoDAZgAIlkCGwJnBURCAqDqiCC9HEBNgIkA5FUC4hsAAQgBYcfB6BZDIE9W4REcYRc91sVOei5balkI7jSUiObOzXM9NzGrxiNVraKsc2i2e0A09W/V8r+//9PPioyZhpI221DABHxihdighyybiQTgiOMmwxTwtQomSSMIDikaBD6ZHsMraI3EZcglpOTsHWewixaJTiW3HRHRW27SMdEHtwhEZmd+MSPJY2E9hTV6ajmlRBTY7s71eC/A5vMe3HzsY4WtLM1qcZ0lBnNLKwYJxpyMI3XHH7Ejs9VrZDtXMp3w4yONTVPt2JKYs1p+68m+7e2jvIwny9W9J+ePtCNrKxk3rgQ/DfyyV7QCNfIvsynP2wMSZkN4j+kSIqE0eD5qztx3CB7uZKKxRGBNz2Gz+S+sgtiHUK1cQRvT5LjmzCdVPovjc/WGLsGhKRUk2GPflJB38XzH1m9h/cJ8peJ+Xl+bn/OfW/jLdnIGD1AqWi7wYrZWMVHPnZjkVNSidQm2sBqYoB08x8cZMIuhJGEBEgY2fsyN1lAJuwwZKoMRVmKRZzVtlgcY4Q6imt3W59dv7V2bD/W96rgZoQFlPOXzMJtfy2tVCCkgQ/VYT7p1DLMnn/8aeIy/TJlGX72/dhK4zshpclOQojcObk0uTQZjAyiS0dz/5mXnWRpdrIUoA9Iyp4VxJZIncKWVVVZVTUAjnTm/0iWSSatgL2CBZHNZ3OSCcE9xKZ79ceuD9r//