Skip to content

Instantly share code, notes, and snippets.

View JohnLBevan's full-sized avatar
🏠
Working from home

John Bevan JohnLBevan

🏠
Working from home
View GitHub Profile
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[String]
$PrivateLinkDnsForwarderIpAddress
)
$privatelinkDomains = @("azure-automation.net",
"database.windows.net",
"sql.azuresynapse.net",
@rohancragg
rohancragg / rgc_homesetup
Last active June 26, 2023 03:57
Home Setup
# Windows Subsystem for Linux
wsl --install -d Ubuntu
# winget
# work / tools
winget install -s winget --id Microsoft.Powershell
winget install -s winget --id Git.Git
winget install -s winget --id 7zip.7zip
winget install -s winget --id Foxit.FoxitReader
# winget install -s winget --id Microsoft.EdgeWebView2Runtime
@pio2pio
pio2pio / main.tf
Created May 25, 2020 12:11
Terraform template remove empty lines and comment lines starting with '#' symbol
variable "match_comment" { default = "/(?U)(?m)(?s)(^#.*$)/" }
variable "match_empty_line" { default = "/(?m)(?s)(^[\r\n])/" }
resource "helm_release" "myapp" {
name = "myapp"
chart = "${path.module}/charts/myapp"
values = [
replace(
replace(
templatefile("${path.module}/templates/values-override.yaml.tpl", {
@ausfestivus
ausfestivus / AzureRegionData.md
Last active March 21, 2024 16:56
A list of the Azure regions

List of Azure Regions

A list of all the region names and locations for Azure

Creating the list

You can recreate the list anytime using this command:

az account list-locations -o table
@FlogDonkey
FlogDonkey / Move TempDB.sql
Last active March 21, 2024 11:52
New and improved Move TempDB script. Captures xp_cmdshell value before execution and resets it post-execution. Allows for dynamic drive allocation in case of company policy of leaving some set percent of drive available for future growth. Also includes improved error handling and validation, as well as a @debug mode, allowing us to run the scrip…
/*
Snippet is nuts and bolts for creating/moving to an isolated tempdb drive.
After you run this, SQL Server must be restarted for it to take effect
*/
DECLARE @DriveSizeGB INT = 40
,@FileCount INT = 9
,@InstanceCount TINYINT = 1
,@VolumeBuffer DECIMAL(8, 2) = .8 /* Set to amount of volume TempDB can fill. */
,@RowID INT
,@FileSize VARCHAR(10)
@JohnLBevan
JohnLBevan / Copy-DirectoriesOnly.ps1
Created May 23, 2019 11:28
Robocopy command to copy entire directory structure without files
$source = '\\path\to\source'
$destination = '\\path\to\dest'
robocopy "$source" "$destination" /zb /e /xf *
<#
See https://ss64.com/nt/robocopy.html for notes
/zb - If you get access denied on a folder, try using backup mode to access it (see http://www.rainingforks.com/blog/2015/suggested-robocopy-switches-explained.html for detail)
/e - Copy subfolders (/s), including empty ones.
/xf * - exclude files matching a filename pattern; in this case any filename, so only copy directories
Note: dest will contain the child folders of source; not source itself.
@gene1wood
gene1wood / bitwarden-amazon-aws-credential-setup.md
Last active March 22, 2024 22:53
How to get BitWarden to differentiate between amazon.com consumer retail logins, AWS root logins and AWS IAM user logins

Here's how to get BitWarden to treat these three different types of Amazon logins as separate

  • amazon.com consumer retail business login
  • AWS root user login (AWS logins that use an email address)
  • AWS IAM user login (AWS logins that use a username)

amazon.com consumer retail

  • Set URI 1 to Exact with a value of

    https://www.amazon.com/ap/signin?_encoding=UTF8&ignoreAuthState=1&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.com%2F%3Fref_%3Dnav_custrec_signin&switch_account=

@dungam
dungam / Dark Custom.xml
Created June 26, 2018 21:31
Programmer's Notepad - Customized Dark Theme
<UserSettings>
<override-colours caret="e6e6fa" indentGuides="282828" />
<override-classes>
<style-class name="default" font="Monaco" back="272828" fore="fafafa" />
<style-class back="222222" fore="666666" name="linenumbers"></style-class>
<style-class name="comment" fore="d500d5"/>
<style-class name="keyword" fore="f47a00" bold="true"/>
<style-class name="string" fore="5fff61" />
<style-class name="number" fore="fafafa" />
<style-class name="identifier" fore="fddf39" />
@mklement0
mklement0 / Test-WinCredential.ps1
Last active March 20, 2024 02:45
Test-WinCredential: PowerShell function for validating Windows domain / local user credentials.
<#
Prerequisites: Windows PowerShell 5.1, PowerShell (Core) (v6+) - MAY work in earlier versions
License: MIT
Author: Michael Klement <mklement0@gmail.com>
DOWNLOAD and INSTANT DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/83e8e6a2b39ecec7b0a14a8e631769ce/raw/Test-WinCredential.ps1 | iex
@nohwnd
nohwnd / Uninstall-Pester.ps1
Last active March 14, 2024 13:57
Remove built-in version of Pester 3 (or -All) from Windows 10 Program Files and Program Files (x86).
#Requires -RunAsAdministrator
function Uninstall-Pester ([switch]$All) {
if ([IntPtr]::Size * 8 -ne 64) { throw "Run this script from 64bit PowerShell." }
#Requires -RunAsAdministrator
$pesterPaths = foreach ($programFiles in ($env:ProgramFiles, ${env:ProgramFiles(x86)})) {
$path = "$programFiles\WindowsPowerShell\Modules\Pester"
if ($null -ne $programFiles -and (Test-Path $path)) {
if ($All) {