Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Rush adamrushuk

View GitHub Profile
@adamrushuk
adamrushuk / deploy_aks_periscope.sh
Created Sep 26, 2022
AKS Periscope Kustomize Deployment Script
View deploy_aks_periscope.sh
#!/usr/bin/env bash
# AKS Periscope Kustomize Deployment Script
# This script will do the following:
# - create a SAS token valid for 60 minutes
# - deploy AKS Periscope into your cluster
# - collect and save logs into the storage account specified
# Set some variables for where you want the logs uploaded to:
@adamrushuk
adamrushuk / aks-disk-detach-wait.ps1
Last active Sep 23, 2022
AKS Disk Detach Wait Scripts
View aks-disk-detach-wait.ps1
# get disk for aks to check attachment state during disk expansion
# vars
$subscriptionName = ""
$aksClusterName = ""
$aksClusterResourceGroupName = ""
$pvcName = ""
# login
Connect-AzAccount -UseDeviceAuthentication
@adamrushuk
adamrushuk / Clear-DeletedBranches.ps1
Created May 29, 2021
Clear deleted git branches
View Clear-DeletedBranches.ps1
function Clear-DeletedBranches {
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')]
[Alias("cdb")]
param(
[Parameter(Mandatory = $false)]
[string]
$GitDir = $PWD
)
$defaultBranch = ((git symbolic-ref --short refs/remotes/origin/HEAD) -split "/")[1]
@adamrushuk
adamrushuk / expand_k8s_pvc.sh
Created Nov 2, 2020
Testing process to expand k8s PVCs without losing data
View expand_k8s_pvc.sh
# Testing process to expand k8s PVCs without losing data
#region Install
# Check the current cluster
kubectl config current-context
# Add bitnami repo
helm repo list
helm repo add bitnami https://charts.bitnami.com/bitnami
View packer_v1.6.0_20200625-1233.log
2020/06/25 12:34:07 [INFO] Packer version: 1.6.0 [go1.13.12 linux amd64]
2020/06/25 12:34:07 Checking 'PACKER_CONFIG' for a config file path
2020/06/25 12:34:07 'PACKER_CONFIG' not set; checking the default config file path
2020/06/25 12:34:07 Attempting to open config file: /home/adamr/.packerconfig
2020/06/25 12:34:07 [WARN] Config file doesn't exist: /home/adamr/.packerconfig
2020/06/25 12:34:07 Setting cache directory: /mnt/c/Users/adamr/code/Packer-Templates/azure-test/packer_cache
2020/06/25 12:34:07 Creating plugin client for path: /usr/local/bin/packer
2020/06/25 12:34:07 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-builder-azure-arm"}
2020/06/25 12:34:07 Waiting for RPC address for: /usr/local/bin/packer
2020/06/25 12:34:07 packer-builder-azure-arm plugin: [INFO] Packer version: 1.6.0 [go1.13.12 linux amd64]
View set_gitlab_pipeline_status.sh
#!/bin/bash
# Set GitLab pipeline status
# vars
GITLAB_URL="https://gitlab.domain.com"
GITLAB_TOKEN="<your_access_token>"
# status can be one of: running, pending, success, failed, canceled, skipped, created, manual
STATUS="success"
# get required info
@adamrushuk
adamrushuk / Publish-AzDOArtifactFeed.ps1
Created Jun 20, 2019
Publish a PowerShell Module to an Internal Azure DevOps Artifacts feed
View Publish-AzDOArtifactFeed.ps1
[CmdletBinding()]
param (
[string]$AzDOAccountName = 'adamrushuk',
[string]$AzDOArtifactFeedName = 'dev',
[string]$AzDOPat,
[string]$ModuleFolderPath = (Join-Path -Path $env:SYSTEM_ARTIFACTSDIRECTORY -ChildPath "PowerShellPipeline\PSModule\PSvCloud")
)
# Variables
$feedUsername = 'NotChecked'
@adamrushuk
adamrushuk / KeePass.ps1
Created Mar 17, 2019
KeePass PowerShell examples
View KeePass.ps1
#Requires -RunAsAdministrator
# Testing KeePass automation against KeePass v2.39.1
# Vars
$masterKeyCredential = New-Object -TypeName 'PSCredential' -ArgumentList ('KPMasterUser', (ConvertTo-SecureString -String 'Passw0rd123!' -AsPlainText -Force))
$repoPath = 'C:\Code\KeePass\KeePassDB'
$databaseName = 'KeePassDatabase'
$databasePath = Join-Path -Path $repoPath -ChildPath "$databaseName.kdbx"
$databaseProfileName = 'KeePassDatabaseProfile01'
$testGroupName = 'TestAccounts'
@adamrushuk
adamrushuk / ConfigureAzureForSecureTerraformAccess.ps1
Created Feb 17, 2019
Configures Azure for secure Terraform access. Loads Azure Key Vault secrets into Terraform environment variables for the current PowerShell session.
View ConfigureAzureForSecureTerraformAccess.ps1
<#
.SYNOPSIS
Configures Azure for secure Terraform access.
.DESCRIPTION
Configures Azure for secure Terraform access using Azure Key Vault.
The following steps are automated:
- Creates an Azure Service Principle for Terraform.
- Creates a new Resource Group.
- Creates a new Storage Account.
@adamrushuk
adamrushuk / 01-Boxstarter.ps1
Last active Jul 14, 2021
New Computer Configuration Scripts - run each script in order
View 01-Boxstarter.ps1
# Install Boxstarter and Chocolatey
Set-ExecutionPolicy -ExecutionPolicy "RemoteSigned" -Verbose
. { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
# Set Explorer options
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -DisableOpenFileExplorerToQuickAccess -DisableShowRecentFilesInQuickAccess -DisableShowFrequentFoldersInQuickAccess -DisableExpandToOpenFolder -DisableShowRibbon
# Set Taskbar options
Set-TaskbarOptions -Size Large -Lock -Dock Bottom -Combine Always