Skip to content

Instantly share code, notes, and snippets.

@tocsoft
Last active May 22, 2020 16:25
Show Gist options
  • Select an option

  • Save tocsoft/cf67ded892e52f52a43e56b3a2df9493 to your computer and use it in GitHub Desktop.

Select an option

Save tocsoft/cf67ded892e52f52a43e56b3a2df9493 to your computer and use it in GitHub Desktop.
Installs my standard powershell profile and any extra tooling I always expect to be installed
&powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://gist.githubusercontent.com/tocsoft/cf67ded892e52f52a43e56b3a2df9493/raw/install-everything.ps1')))"
## install dotnet core
function Run-Script
{
param(
$Url
)
&powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing '$Url')))"
}
# we asume dotnet is already installed
# Run-Script "https://dot.net/v1/dotnet-install.ps1"
# dotnet tool install --global ilspycmd --version 5.0.2
Run-Script "https://gist.githubusercontent.com/tocsoft/cf67ded892e52f52a43e56b3a2df9493/raw/InstallProfile.ps1"
# dotnet tool install -g PowerShell
$install = $true
if (Test-Path -Path $PROFILE) {
$title = 'Profile already exists, we are about to over write it with the one github'
$question = 'Are you sure you want to proceed?'
$choices = '&Yes', '&No'
$decision = $Host.UI.PromptForChoice($title, $question, $choices, 1)
if ($decision -ne 0) {
$install = $false
}
}
if( $install){
$result = Invoke-WebRequest -Uri "https://gist.githubusercontent.com/tocsoft/cf67ded892e52f52a43e56b3a2df9493/raw/Profile.ps1"
if($result.StatusCode -ne 200)
{
throw "Error downloading profile from gist"
}
Set-Content -Path $PROFILE -Value $result.Content
}
# PowerShell parameter completion shim for the dotnet CLI
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
Function Set-WindowTitle
{
param (
[Parameter(
Mandatory = $true,
ValueFromPipeline = $true)]
[string]$Title
)
$host.UI.RawUI.WindowTitle = $Title
<#
.Description
Set-WindowTitle Sets the title of the current console window/tab.
.PARAMETER Title
The title to set.
#>
}
# alias Set-WindowTitle to 't'
Set-Alias -Name t -Value Set-WindowTitle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment