Skip to content

Instantly share code, notes, and snippets.

SHIFT+ALT+F (or press F1 and type Format and select Format Document).
# Create a profile (cookbook)
inspec init profile SQLServerSecurity
# check profile is valid
insec check SQLServerSecurity
# Run single inspec.rb file
inspec exec mytest.rb
# Run a profile
@Staggerlee011
Staggerlee011 / Markdown-By-Example
Created December 11, 2017 15:27
Collection of Markdown syntrax by example
# Markdown By Example
> - [Block-Elements](#block-elements)
> Block elements are standard text blocks
> - [Headers](#headers)
> - [Links](#links)
> - [Text](#text)
> - [Lists](#lists)
> - [Tables](#tables)
> - [Quotes](#quotes)
@Staggerlee011
Staggerlee011 / Choco Software Install
Last active December 5, 2022 23:25
Chocolatey install and basic configuration for any workstation i use
#Requires -RunAsAdministrator
<#
Workstation Configuration
Uses chocolately to install a standard set of software used regularly
view log: C:\ProgramData\chocolatey\logs\chocolatey.log
@Staggerlee011
Staggerlee011 / pre-commit PowerShell git Hook
Created January 1, 2018 21:54
Example of a pre-commit hook using powershell used in Blog post:
write-output "This is a pre-commit powershell call"
write-output "======================================="
Import-Module -Name PSScriptAnalyzer
$changes = git diff --name-only
$output = @()
foreach ($change in $changes)
{
## SQL Server Linux
docker run --name sqlserver -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Pa$$w0rd' -p 1433:1433 -d microsoft/mssql-server-linux
## SQL Server Windows
docker run --name sqlserver -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Pa$$w0rd' -p 1433:1433 -d microsoft/mssql-server-windows-developer
## Postgres
docker run --name postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres
## Neo4j (connect via http://localhost:7474 with U/P neo4j/neo4j
@Staggerlee011
Staggerlee011 / FindAzureimageName.ps1
Last active May 20, 2019 14:16
Find Azure image name in PowerShell
# Connect-AzureRmAccount
$location = "West Europe"
$publisher = "MicrosoftSQLServer"
$offer = "SQL2014SP2-WS2012R2"
$sku = "Standard"
Get-AzureRmVMImagePublisher -Location $location | where-object {$_.PublisherName.Contains("SQLServer")}
#Get-AzureRmVMImageOffer -Location $location -PublisherName $publisher
#Get-AzureRmVMImageSku -Location $location -PublisherName $publisher -Offer $offer
#Get-AzureRmVMImage -Location $location -PublisherName $publisher -Offer $offer -Skus $sku
@Staggerlee011
Staggerlee011 / example_download_storage_file
Created September 19, 2018 14:07
Download file from Azure using CLI
$container_name = 'sqlbackups'
$blob_name = 'mydb-2018-9-19-7-32.bacpac'
$destination_file = 'c:\temp\mybackup.bacpac'
$storage_account = ''
$storage_key = ''
az storage blob download `
--container-name $container_name `
--name $blob_name `
--file $destination_file `
@Staggerlee011
Staggerlee011 / Azure-DevOps-BuildTemplate-Folder-Example
Created June 3, 2019 09:17
Azure DevOps - Build - Calling a template in a folder
resources:
repositories:
- repository: templates #Name of repo
type: git
name: templates
jobs:
- template: terraform/azureterraform.yml@templates # Name of folder (Terraform in the example) and name of file (azureterraform.yml in the example)