Skip to content

Instantly share code, notes, and snippets.

View mwallner's full-sized avatar
🧙

Manfred Wallner mwallner

🧙
View GitHub Profile
<#
.SYNOPSIS
BoxStarter script to configure Windows 10 development PC.
.DESCRIPTION
You might need to set:
Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy Bypass
@mwallner
mwallner / chronotags.ps1
Created March 15, 2023 09:39
chronologically sort git tags by commit-date
git tag -l --format="%(refname) :: %(if)%(committerdate:iso)%(then)%(committerdate:iso)%(else)%(*committerdate:iso)%(end)" | % {($r,[datetime]$t)=$_.Split("::"); @{r=$r;t=$t}} | Sort t | Select r
@mwallner
mwallner / setup-vm-winhost.ps1
Created June 13, 2022 21:12
WIndows VM Base pwsh and SSH Remoting
choco install pwsh -y
choco install ripgrep -y
choco install vscode -y
Get-WindowsCapability -Online | Where-Object {$_.Name -like 'OpenSSH*'} | Add-WindowsCapability -Online
Start-Service sshd
Set-Service sshd -StartupType Automatic
Stop-Service sshd
@mwallner
mwallner / boxstarter_host_setup.ps1
Last active July 30, 2023 19:14
psconfeu23_hostsetup
# NuGet package provider. Do this early as reboots are required
if (-not (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
Write-Host "Install-PackageProvider"
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope AllUsers -Confirm:$False
# Exit equivalent
Invoke-Reboot
}
@mwallner
mwallner / Test-ChocoTransitiveDependencyChain.ps1
Created April 20, 2022 06:34
simple script to check if a given choco package and all transitive dependencies are installed
[cmdletbinding()]
param(
$packageName
)
$ErrorActionPreference = 'Stop'
function Test-TransitiveDependencies {
[cmdletbinding()]
param($allPackages, $pkgID)
@mwallner
mwallner / Get-UglyButShortUniqueDirname.ps1
Last active May 14, 2022 02:53
create a unique directory name based of system.guid
function Get-UglyButShortUniqueDirname {
[CmdletBinding()]
param (
)
$t = "$([System.Guid]::NewGuid())".Replace("-", "")
Write-Verbose "base guid: $t"
$t = "$(0..$t.Length | % { if (($_ -lt $t.Length) -and !($_%2)) { [char][byte]"0x$($t[$_])$($t[$_+1])" } })".replace(" ", "").Trim()
wget https://download.foldingathome.org/releases/public/release/fahclient/debian-testing-64bit/v7.4/fahclient_7.4.4_amd64.deb
wget https://download.foldingathome.org/releases/public/release/fahcontrol/debian-testing-64bit/v7.4/fahcontrol_7.4.4-1_all.deb
wget https://download.foldingathome.org/releases/public/release/fahviewer/debian-testing-64bit/v7.4/fahviewer_7.4.4_amd64.deb
sudo dpkg -i --force-depends fahclient_7.4.4_amd64.deb
sudo dpkg -i --force-depends fahcontrol_7.4.4-1_all.deb
sudo dpkg -i --force-depends fahviewer_7.4.4_amd64.deb
@mwallner
mwallner / Add-TrustedHostDownloadSite.ps1
Created February 11, 2020 16:39
when using a offline VisualStudio layout, you need to ensure the host you're downloading from is "trusted"
function Add-TrustedHostDownloadSite {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]$ServerName,
[Parameter(Mandatory = $false)]
[string]$Domain = "myorg.somedomain"
)
Push-Location
@mwallner
mwallner / boxstarter-bootstrapper.md
Created February 3, 2020 19:53
using Boxstarter to overcome PowerShell v2 on Box deployments

using Boxstarter to overcome PowerShell v2 on Box deployments

Preparation (on a random host)

  • Install Chocolatey
  • choco install boxstarter -y
  • open "Boxstarter Shell"
  • create "Portable Boxstarter" see wiki
@mwallner
mwallner / cmdlettest.ps1
Created January 14, 2020 21:26
powershell cmdet vs basic function argument handling
function Get-EvilCmdLet {
[CmdletBinding()]
param(
[ValidateSet('A', 'B')]
$Category
)
Write-Output "= Get-EvilCmdLet ="
Write-Output "* PSBoundParameters"
$PSBoundParameters.Keys | % {