Skip to content

Instantly share code, notes, and snippets.

@jeremybeavon
jeremybeavon / gist:e566b6a0106a90ec7e83cbf3d65b4ed6
Last active July 13, 2019 20:28
Install and run az2tf in a container
export DEBIAN_FRONTEND=noninteractive
apt-get update
# Install git: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
apt-get -y install git-all
# Check out az2tf
cd /home
git clone https://github.com/andyt530/az2tf.git
# Install Azure CLI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest
apt-get -y install curl apt-transport-https lsb-release gnupg
curl -sL https://packages.microsoft.com/keys/microsoft.asc | \
using System.Net;
using System.Security;
public static class SecureStringHelper
{
public static SecureString ToSecureString(this string plaintext)
{
return new NetworkCredential("N/A", plaintext).SecurePassword;
}
@jeremybeavon
jeremybeavon / all_index_usages.sql
Created May 1, 2018 01:17
Find the usages of all indexes in a database
select OBJECT_NAME(ius.object_id) as "Object Name",
i.name as "Index Name",
user_seeks,
user_scans,
user_lookups,
user_updates
from sys.dm_db_index_usage_stats as ius
inner join sys.indexes as i on i.object_id = ius.object_id
and i.index_id = ius.index_id
where OBJECTPROPERTY(ius.object_id,'IsUserTable') = 1
@jeremybeavon
jeremybeavon / LocalGroupPolicyEditor.txt
Created August 18, 2017 05:08
Open Local Group Policy editor
gpedit.msc
@jeremybeavon
jeremybeavon / MsBuildServiceBusLogger.csproj
Last active August 15, 2017 05:04
Powershell task runner that outputs to a service bus
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7A85FC1A-9ED6-4E26-865B-E2063C3F4000}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MsBuildServiceBusLogger</RootNamespace>
@jeremybeavon
jeremybeavon / bond.ps1
Last active July 13, 2017 20:04
Powershell music :)
$A = 220
$Asharp = 233
$B = 247
$C = 262
$Csharp = 277
$D = 294
$Dsharp = 311
$E = 164
$F = 175
$Fsharp = 184
@jeremybeavon
jeremybeavon / multipleVMs.json
Last active January 28, 2022 07:05
ARM template for deploying multiple VMs from a custom image
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"VnetResourceGroup": {
"type": "string"
},
"VnetName": {
"type": "string"
},
@jeremybeavon
jeremybeavon / lockfile.bat
Created March 6, 2017 22:05
Locks a file
( >&2 pause ) >> %1
<# ======================================================================================================
Purpose: To configure a Windows 2012 Guest.
Author: Michael Kenning (mjkenning@gmail.com)
Version: 1.33 (15 May 2014)
Notes: Be sure to change variables in the 2012variables.ps1 file.
Be sure that VM has NIC plugged in or NIC configuration will fail.
=========================================================================================================
#>
@jeremybeavon
jeremybeavon / createcert.ps1
Last active September 22, 2020 18:06
Create self-signed certificate and with new CA
# Create CA
makecert -n "CN=MyCA" -r -sv MyCA.pvk MyCA.cer -b 12/01/2016 -e 01/02/2017
# Create IIS-Cert, signed by CA cert
makecert -pe -iv MyCA.pvk -n "CN=mymachinename" -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localmachine -sky exchange -ic MyCA.cer IIS-mymachinename.cer -b 12/01/2016 -e 01/02/2017
# Create pfx file for the CA cert
pvk2pfx -pvk MyCA.pvk -pi MyCA -spc MyCA.cer -pfx MyCA.pfx -f
# Need to export the new key from the LocalMachine Personal certificates