Skip to content

Instantly share code, notes, and snippets.

View tabs-not-spaces's full-sized avatar
💀
Always working from home

Ben R. tabs-not-spaces

💀
Always working from home
View GitHub Profile
@tabs-not-spaces
tabs-not-spaces / chrome-install.ps1
Created March 15, 2019 07:27
Install the latest version of chrome - every time. without fail.
try {
Write-Host "downloading installer.."
$chromeUri = "https://dl.google.com/chrome/install/latest/chrome_installer.exe"
$bitsJob = Start-BitsTransfer -Source $chromeUri -Destination "$env:Temp\$(split-path $chromeUri -leaf)"
if (Test-Path -Path "$env:Tempchrome_installer.exe") {
Write-Host "Installer downloaded successfully..`nInstalling application"
$proc = Start-Process -FilePath "$env:Tempchrome_installer.exe" -ArgumentList "/silent /install" -Wait
$fileDetectPath = "${env:ProgramFiles(x86)}\Google\Chrome\Application\Chrome.exe"
Write-Host "Looking for installation files: $fileDetectPath.."
if (Test-Path -Path "$fileDetectPath") {
function Watch-BitsTransfer {
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[guid]$JobId
)
$perc = 0
while ($perc -le 100 ) {
$jobState = Get-BitsTransfer -JobId $JobId | Select-Object BytesTransferred, BytesTotal
$percentCompleteState = ($jobState.BytesTransferred / $jobState.BytesTotal * 100)
@tabs-not-spaces
tabs-not-spaces / vscode-extension-list.md
Last active March 13, 2022 08:36
a list of extensions I use in VS Code

VSCode extension list (current as of March 2022)

  • aaron-bond.better-comments
  • alefragnani.project-manager
  • AwesomeAutomationTeam.azureautomation
  • bierner.emojisense
  • bierner.markdown-checkbox
  • codespaces-contrib.codeswing
  • codezombiech.gitignore
  • CoenraadS.bracket-pair-colorizer-2
@tabs-not-spaces
tabs-not-spaces / GraphBatchHandler.ps1
Created November 9, 2021 01:43
template for batch handling
$objects = (0..273)
$batchValue = 20
$result = New-Object System.Collections.ArrayList
$id = 1
for ($i = 0; $i -lt $objects.Count; $i += $batchValue) {
$start = $i + 1
$end = ($i + 19) -gt $objects.Count ? $objects.count : $i + 19
$progressParams = @{
Activity = "Testing.."
Status = "Processing batch $start - $end of $($objects.count)"
if ($PSVersionTable.PSEdition -ne "Core") {
if ($myInvocation.Line) {
&"$env:ProgramFiles\PowerShell\7\pwsh.exe" -NonInteractive -executionPolicy Bypass -NoProfile $myInvocation.Line
}
else {
&"$env:ProgramFiles\PowerShell\7\pwsh.exe" -NonInteractive -executionPolicy Bypass -NoProfile -file "$($myInvocation.InvocationName)" $args
}
exit $lastexitcode
}
A few handy detection functions that I use every day
@tabs-not-spaces
tabs-not-spaces / Get-TenantIdFromDomain.ps1
Created September 4, 2018 06:17
Get-TenantIdFromDomain
function Get-TenantIdFromDomain {
param (
[Parameter(Mandatory = $true)]
[string]$FQDN
)
try {
$uri = "https://login.microsoftonline.com/$($FQDN)/.well-known/openid-configuration"
$rest = Invoke-RestMethod -Method Get -UseBasicParsing -Uri $uri
if ($rest.authorization_endpoint) {
$result = $(($rest.authorization_endpoint | Select-String '\w{8}-\w{4}-\w{4}-\w{4}-\w{12}').Matches.Value)
$script:tick = [char]0x221a
$hashPath = "$env:SystemDrive\hwhash.csv"
function Install-PreReq {
[cmdletbinding()]
param (
[Parameter(Mandatory = $true)]
[string[]]$reqs,
[Parameter(Mandatory = $false)]
[ValidateSet('Module', 'Script')]

Test Report: DriveMaps_Validation

  • Date: 2021-01-04
  • Time: 14:18:17

Expand the following summaries for more details:

Environment:
@tabs-not-spaces
tabs-not-spaces / monokai-pro-colourscheme.json
Last active November 24, 2020 12:19
monkai colour theme for Microsoft Terminal!
// Place this at the bottom of the "schemes" array in your profiles.json for the win.
{
"background": "#2d2a2e",
"black": "#2d2a2e",
"blue": "#FC9867",
"brightBlack": "#727072",
"brightBlue": "#FC9867",
"brightCyan": "#78DCE8",
"brightGreen": "#a9dc76",
"brightPurple": "#AB9DF2",