Skip to content

Instantly share code, notes, and snippets.

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

Brett Miller brettmillerb

🏠
Working from home
View GitHub Profile
@brettmillerb
brettmillerb / DockerFile
Created April 5, 2019 21:59
Pwsh Dockerfile
# escape=`
ARG fromTag=latest
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore
# Use server core as an installer container to extract PowerShell,
# As this is a multi-stage build, this stage will eventually be thrown away
FROM ${WindowsServerCoreRepo}:${fromTag} AS installer-env
ARG PS_VERSION=6.2.0
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/PowerShell-${PS_VERSION}-win-x64.zip
@brettmillerb
brettmillerb / Get-AzCachedAccessToken.ps1
Created March 15, 2019 13:22
Get-AzCachedAccessToken
function Get-AzCachedAccessToken {
<#
.SYNOPSIS
Get the Bearer token from the currently set AzContext
.DESCRIPTION
Get the Bearer token from the currently set AzContext. Retrieves from Get-AzContext
.EXAMPLE
Get-AzCachedAccesstoken
@brettmillerb
brettmillerb / snippets.json
Created March 2, 2019 12:42
Powershell Snippets
{
/*
// Place your snippets for PowerShell here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
function Get-MsTeamsGroupId {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true,
Position=0,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[ValidateNotNullOrEmpty()]
[string]
$TeamName
function Backup-Profile {
[CmdletBinding()]
param (
[string]
$Path = "C:\support\git\gitwork\profile",
[switch]
$Push
)
@brettmillerb
brettmillerb / 1. LabBuild.ps1
Last active February 13, 2019 22:11
Lab Build
Configuration LabBuild {
param (
[Parameter()]
[ValidateNotNull()]
[PSCredential]$Credential = (Get-Credential -Credential 'Administrator')
)
Import-DscResource -Module PSDesiredStateConfiguration, xActiveDirectory
node $AllNodes.NodeName {
{
"files.defaultLanguage": "powershell",
"window.zoomLevel": -1,
"editor.renderWhitespace": "all",
"powershell.integratedConsole.focusConsoleOnExecute": false,
@brettmillerb
brettmillerb / Git-Whoami.ps1
Created January 14, 2019 14:28
Git Whoami
# Stolen from here: https://github.com/petere/git-whoami/blob/master/git-whoami
function Git-Whoami {
$author = git config user.name
$email = git config user.email
[pscustomobject]@{
Author = $author
Email = $email
}
}
@brettmillerb
brettmillerb / OBSSetup.md
Last active March 13, 2019 19:48
Setting up OBS

OBS Configuration

  • Download and install OBS from OBS Download
  • Disable Hardware Acceleration in Chrome
    - Open Chrome
    - Settings
    - Search for Hardware Acceleration
    - Turn off 'Use hardware acceleration when available'
    - Relaunch Chrome
    
@brettmillerb
brettmillerb / Get-TwitchEvent.ps1
Created January 11, 2019 16:04
Twitch User Events
function Get-TwitchEvent {
[CmdletBinding(DefaultParameterSetName = 'Standard')]
param (
[Parameter(Mandatory,
ParameterSetName = 'Standard')]
[string]
$UserName,
[Parameter(Mandatory,
ParameterSetName = 'Pipeline',