Skip to content

Instantly share code, notes, and snippets.

@ericchansen
Last active May 9, 2023 17:26
Show Gist options
  • Save ericchansen/f70b33b5a39bc757f186d4b473d3a6f1 to your computer and use it in GitHub Desktop.
Save ericchansen/f70b33b5a39bc757f186d4b473d3a6f1 to your computer and use it in GitHub Desktop.
Install useful stuff on Windows
# Make powershell awesome.
Install-Module -Scope CurrentUser -SkipPublisherCheck -Name posh-git -Force
Install-Module -Scope CurrentUser -SkipPublisherCheck -Name PSReadLine -Force
# Create your profile if it doesn't exist.
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
Set-Content -Path $Profile -Value "oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json' | Invoke-Expression"
# Install Azure.
Install-Module -Name Az
# Setup Git.
# git config --global user.email "ericchansen@gmail.com"
# git config --global user.name "Eric Hansen"
# git config --global core.editor "code-insiders --wait"
# Setup WSL2.
wsl --set-default-version 2
wsl --update
wsl --install -d Ubuntu-22.04
# Make sure Windows runs the SSH agent automatically.
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent
# Turn off USB selective suspend for all power plans.
$guid_usb_settings = "2a737441-1930-4402-8d77-b2bebba308a3"
$guid_usb_selective_suspend_settings = "48e6b7a6-50f5-4782-a5d4-53bb8f07e226"
$results = POWERCFG /LIST
foreach ($line in $results) {
$split_line = $line.Split()
if ($split_line[2] -eq "GUID:") {
$guid_power_plan = $split_line[3]
POWERCFG /SETACVALUEINDEX $guid_power_plan $guid_usb_settings $guid_usb_selective_suspend_settings 0
POWERCFG /SETDCVALUEINDEX $guid_power_plan $guid_usb_settings $guid_usb_selective_suspend_settings 0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment