Skip to content

Instantly share code, notes, and snippets.


Gavin Campbell gavincampbell

View GitHub Profile
gavincampbell / gist:72a485049ab2b0dba3ea34655607b5c3
Last active Jun 25, 2020
Update a markdown file to use hugo figure shortcode instead of markdown img links
View gist:72a485049ab2b0dba3ea34655607b5c3
sed -i 's/!\[\(.*\)\] \?(https:\/\/.*\/\(.*\))/{{< figure src="\2" caption="\1" >}}/g'
gavincampbell /
Last active Jun 19, 2020
setting up minikube on a new Centos 7.8 VM
  1. set up network with nmcli/nmtui/whatever
  2. sudo yum update
  3. sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
gavincampbell / azuredeploy.json
Last active Jun 1, 2020
Example code and tests for creating conditional NSG rules using optional parameters
View azuredeploy.json
"$schema": "",
"contentVersion": "",
"parameters": {
"vnetName": {
"type": "string"
"vnetAddressPrefix": {
"type": "string"
View sql-2019-win-2019.json
"variables": {
"build_location": "uksouth",
"build_vm_size": "Standard_DS2_v2",
"sp_client_id": "{{env `PACKER_CLIENT_ID`}}",
"sp_client_secret": "{{env `PACKER_CLIENT_SECRET`}}",
"sp_tenant_id": "{{env `PACKER_TENANT_ID`}}",
"sp_subscription_id": "{{env `PACKER_SUBSCRIPTION_ID`}}",
"output_resource_group" : "packer-vm-images",
"output_image_name_prefix" : "sql-2019-win-2019"
gavincampbell /
Last active Oct 10, 2019
Resources for talk on Disposable Development Environments from SQL Relay 2019
gavincampbell / WinRM-HTTPS.ps1
Created Feb 19, 2019 — forked from TechIsCool/WinRM-HTTPS.ps1
A simple Powershell WinRM-HTTPs setup
View WinRM-HTTPS.ps1
Write-Output "Disabling WinRM over HTTP..."
Disable-NetFirewallRule -Name "WINRM-HTTP-In-TCP"
Disable-NetFirewallRule -Name "WINRM-HTTP-In-TCP-PUBLIC"
Get-ChildItem WSMan:\Localhost\listener | Remove-Item -Recurse
Write-Output "Configuring WinRM for HTTPS..."
Set-Item -Path WSMan:\LocalHost\MaxTimeoutms -Value '1800000'
Set-Item -Path WSMan:\LocalHost\Shell\MaxMemoryPerShellMB -Value '1024'
Set-Item -Path WSMan:\LocalHost\Service\AllowUnencrypted -Value 'false'
Set-Item -Path WSMan:\LocalHost\Service\Auth\Basic -Value 'true'
gavincampbell /
Last active Nov 23, 2018 — forked from jrouleau/
Amazon Linux AMI Install HAProxy From Source (1.7.0 release pre configured). chmod +x then ./
PRE_PACK="openssl-devel pcre-devel make gcc"
# Setup Colours
gavincampbell / packer-iam-policy.json
Last active Oct 9, 2018
AWS policy for Packer including S3 access
View packer-iam-policy.json
"Version": "2012-10-17",
"Statement": [
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
gavincampbell / misc.ps1
Last active May 26, 2020
Powershell Aides-Mémoire
View misc.ps1
#Creating a pscredential from a username:password pair in a single line:
$Creds = New-Object System.Management.Automation.PSCredential ($User, $(ConvertTo-SecureString $Password -AsPlainText -Force))
#Self signed wildcard certificate
New-SelfSignedCertificate -Subject *.my.domain -DnsName my.domain, *.my.domain -CertStoreLocation Cert:\LocalMachine\My -NotAfter (Get-Date).AddYears(10)
# trusting the PS gallery so we can install packages unattended, e.g. for DSC
Install-PackageProvider NuGet -Force -Scope CurrentUser
Import-PackageProvider NuGet -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
#generating Random String
$someRandomLetters = -join ((65..90) + (97..122) | Get-Random -Count 20 | % {[char]$_})
gavincampbell / DeleteSpecifiedResourceGroup.ps1
Created Sep 8, 2017
Azure Automation Runbook to parse a VSTS merge commit hook and delete the resource group corresponding to the source branch identified therein.
View DeleteSpecifiedResourceGroup.ps1
if ($WebhookData){
$requestBody = (ConvertFrom-Json -InputObject $WebhookData.RequestBody)
$refspec = $requestBody.resource.SourceRefName
$branchName = $requestBody.resource.SourceRefName.Split("/")[-1]
You can’t perform that action at this time.