Skip to content

Instantly share code, notes, and snippets.


Matt Lavery Matticusau

View GitHub Profile
Matticusau / FiscalCalendar.dax
Created July 1, 2020 22:58
A DAX query to add a fiscal calendar to your PowerBI dataset.
View FiscalCalendar.dax
Fiscal Calendar =
// based on
VAR BaseCalendar = CALENDAR("01/01/2010", "01/01/2025")
VAR BaseDate = [Date]
VAR YearDate = Year(BaseDate)
VAR MonthNumber = MONTH(BaseDate)
VAR FiscalYearLong = IF (MonthNumber <= 6, INT(FORMAT(BaseDate, "yyyy")), INT(FORMAT(BaseDate, "yyyy")) + 1)
Matticusau / get-sqldemos.ps1
Created June 13, 2018 03:27
Clone and extract Sql Server Samples for demos
View get-sqldemos.ps1
# clone the repo
git clone -n .\sql-server-samples
# check out the repo so you can use the demo files
cd sql-server-samples
git config core.sparsecheckout true
echo samples/features/* | out-file -append -encoding ascii .git/info/sparse-checkout
echo samples/demos/*| out-file -append -encoding ascii .git/info/sparse-checkout
git checkout
Matticusau / SqlVersionsApi-HealthCheckScript-Example.ps1
Last active June 8, 2018 14:29
Example SQL Health Check script for querying the SQL Versions API for life cycle support information
View SqlVersionsApi-HealthCheckScript-Example.ps1
# Example script for using the SQL Versions API to check the life cycle and support information of a particular SQL Version
# Further information here ->
# Live data example of a single instance
# Import the SQL Module
# NOTE: In July 2016 a new module was released therefore there are two methods of this now
# Method 1: Module as part of SQL Setup.exe
Matticusau / choco-setup-windows-tools.ps1
Last active April 20, 2018 07:16
Chocolatey install script for my common packages on Windows Server
View choco-setup-windows-tools.ps1
Author: Matt Lavery
Date: 12/04/2018
Purpose: Provides a script to install Chocolatey and my common packages for Windows Servers
Major Version: 0.1.0
Disclaimer: This script is provided "AS IS".
When Version Who What
Matticusau / ConvertPPTtoPDF.ps1
Created October 9, 2017 03:46
Convert PPTX(s) to PDF
View ConvertPPTtoPDF.ps1
# adapted from
# Powershell script to export Powerpoint Presentations to pdf using the Powerpoint COM API
# Based on a VB script with the same purpose
function Export-Presentation
Matticusau / ConvertTo-Markdown.ps1
Last active February 9, 2022 15:25 — forked from BenNeise/ConvertTo-Markdown.ps1
View ConvertTo-Markdown.ps1
Converts a PowerShell object to a Markdown table.
$data | ConvertTo-Markdown
Invoke-ScriptAnalyzer -Path C:\MyScript.ps1 | Select-Object -Property RuleName,Line,Severity,Message | `
ConvertTo-Markdown | Out-File C:\
Matticusau / FindFilesWithRegEx.ps1
Created May 8, 2017 06:44
Find files with contents matching a RegEx pattern
View FindFilesWithRegEx.ps1
$searchPath = (Get-Location).Path;
$searchRegEx = 'find this text'
Get-ChildItem -Path $searchPath -Recurse -File | % {if ((Get-Content -Path $PSItem.FullName | Out-String) -match $searchRegEx) {Write-Host $PsItem.FullName -ForegroundColor Red} else {Write-Host $PsItem.FullName -ForegroundColor green}}
Matticusau /
Last active March 21, 2017 01:20
A template that I use for my repositories to simplify development environment setup


A description of the project

System Requirements

  • WMF (PowerShell) 5.0
  • Windows Server 2012 R2, Windows 10 or greater

Required PowerShell Modules

The following PowerShell modules.