Skip to content

Instantly share code, notes, and snippets.

View Splaxi's full-sized avatar

Mötz Jensen Splaxi

  • Essence Solutions P/S
  • Denmark
  • X @splaxi
View GitHub Profile
@Splaxi
Splaxi / vdi-file-compacting.md
Created October 6, 2017 07:01 — forked from kuznero/vdi-file-compacting.md
How to compact VirtualBox's VDI file size?

Source: StackOverflow

1. Run defrag in the guest (Windows only)

2. Nullify free space:

With a Linux Guest run this:

sudo dd if=/dev/zero | pv | sudo dd of=/bigemptyfile bs=4096k
sudo rm -rf /bigemptyfile
@Splaxi
Splaxi / format-cbh.ps1
Last active October 7, 2018 21:56 — forked from potatoqualitee/format-cbh.ps1
reformat and standardize comment based help in powershell
function Get-Header ($text) {
$start = $text.IndexOf('<#')
$temp = $start - 2
if($temp -gt 0) {
$text.SubString(0, $start - 2)
}
else {
""
}
}
@Splaxi
Splaxi / helptest.ps1
Last active October 19, 2018 05:24 — forked from nohwnd/helptest.ps1
Automatic example testing
$excludeCommands = @(
"Invoke-D365SCDPBundleInstall"
)
$commandsRaw = Get-Command -Module d365fo.tools
if ($excludeCommands.Count -gt 0) {
$commands = $commandsRaw | Select-String -Pattern $excludeCommands -SimpleMatch -NotMatch
}
@Splaxi
Splaxi / testing examples code
Created October 8, 2018 06:38 — forked from SQLDBAWithABeard/testing examples code
testiong examples code
$Function = 'Get-DbcCheck'
Describe "$Function" {
Context "Checking $Function Examples" {
$Examples = Get-Help $Function -Examples
foreach ($examplecode in $Examples.examples.example.Code) {
It "Example Code $examplecode should not throw" {
{$examplecode} | Should -Not -Throw
}
@Splaxi
Splaxi / gist:6d746acc56f48c3c044ecdee03ab1f08
Created October 8, 2018 07:12 — forked from NakedPowerShell/gist:9711e57e18fa4c4cd0fed148497f900e
Script to generate all the exploration I normally do when I want to install a new PowerShell module
Function Show-ModExplore {
<#
.SYNOPSIS
Generate all the exploration I normally do when I want to install a new PowerShell module
.DESCRIPTION
Script to generate all the exploration I normally do when I want to install a new PowerShell module
@Splaxi
Splaxi / AuthNtoAzureADwithPShellandADALHelperLib.ps1
Created February 5, 2020 12:56 — forked from darrenjrobinson/AuthNtoAzureADwithPShellandADALHelperLib.ps1
AuthN to AzureAD using PowerShell and AzureAD PSM ADAL Helper Lib
# Hack to ignore versioning of the dll file and folder structure
$folderName = (Get-ChildItem -Path "C:\Program Files\WindowsPowerShell\Modules\AzureAD\2.0.*\Microsoft.IdentityModel.Clients.ActiveDirectory.dll").Directory.Name | Sort-Object -Descending | Select-Object -First 1
# ADAL Helper Lib
Add-Type -Path "c:\Program Files\WindowsPowerShell\Modules\AzureAD\$folderName\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
# Azure tenant
$tenant = ""
# Application ID for Powershell client
$client_Id = "1950a258-227b-4e31-a9cf-717495945fc2"
# Login URI
@Splaxi
Splaxi / download-latest-release.ps1
Last active May 31, 2024 23:15 — forked from MarkTiedemann/download-latest-release.ps1
Download latest GitHub release via Powershell
# Download latest dotnet/codeformatter release from github
$repo = "jgm/pandoc"
$filenamePattern = "*x86_64.zip"
$pathExtract = "C:\Tools\pandoc"
$innerDirectory = $true
$preRelease = $false
if ($preRelease) {
$releasesUri = "https://api.github.com/repos/$repo/releases"
@Splaxi
Splaxi / ModuleFast.ps1
Last active May 17, 2021 17:49 — forked from JustinGrote/ModuleFast.ps1
A high performance Powershell Gallery Module Installer
Add-Type -AssemblyName System.Web
Add-Type -AssemblyName System.Net.Http
$ENV:PATH="$ENV:PATH;C:\Temp\d365fo.tools\nuget"
#requires -version 5
<#
.SYNOPSIS
High Performance Powershell Module Installation
.DESCRIPTION
This is a proof of concept for using the Powershell Gallery OData API and HTTPClient to parallel install packages