Skip to content

Instantly share code, notes, and snippets.

@aquacash5
Last active January 19, 2024 17:15
Show Gist options
  • Save aquacash5/a42dfb736c7cd49533c0b33ef2f03214 to your computer and use it in GitHub Desktop.
Save aquacash5/a42dfb736c7cd49533c0b33ef2f03214 to your computer and use it in GitHub Desktop.
New Windows Installation
tap "aws/tap"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
brew "act"
brew "[email protected]"
brew "[email protected]"
brew "awscli"
brew "bash"
brew "pkg-config"
brew "cmake"
brew "composer"
brew "coreutils"
brew "gnu-sed"
brew "gource"
brew "graphviz"
brew "jq"
brew "k6"
brew "magic-wormhole"
brew "make"
brew "[email protected]"
brew "nvm"
brew "openjdk"
brew "openssl@3"
brew "qt"
brew "qt@5"
brew "rustup-init"
brew "zlib"
brew "aws/tap/aws-sam-cli"
cask "cscreen"
cask "dbeaver-community"
cask "discord"
cask "docker"
cask "font-fira-code"
cask "libreoffice"
cask "ngrok"
cask "postman"
cask "slack"
cask "typora"
cask "whatsapp"
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
Function Touch-File {
$file = $args[0]
if ($null -eq $file) {
throw "No filename supplied"
}
if (Test-Path $file) {
(Get-ChildItem $file).LastWriteTime = Get-Date
}
else {
New-Item -ItemType File -Force -Path $file
}
}
Touch-File $PROFILE.CurrentUserAllHosts
# Write out Powershell Profile
@"
# Powershell Profile
# Aliases
Set-Alias touch Touch-File
# Alias Fuctions
Function ll { Get-ChildItem -Force $args }
Function which(`$name) { Get-Command `$name | Select-Object -ExpandProperty Definition }
Function ytmp3 { youtube-dl --extract-audio --audio-format mp3 --output "%(title)s.%(ext)s" `$args }
Function git-branch-cleanup { git branch | %{ `$_.Trim() } | ?{ `$_ -notmatch '(^\*|master|dev)' } | %{ git branch -D `$_ } }
# Functions
Function Touch-File
{
`$file = `$args[0]
if(`$file -eq `$null) {
throw "No filename supplied"
}
if(Test-Path `$file) {
(Get-ChildItem `$file).LastWriteTime = Get-Date
} else {
New-Item -ItemType File -Force -Path `$file
}
}
Function Get-Visual-Studio {
Write-Host "Loading Visual Studio Environment ... " -NoNewline
# https://patrickwbarnes.com/articles/using-msbuild-with-powershell/
#
# Find vswhere (installed with recent Visual Studio versions).
#
if ($vsWhere = Get-Command "vswhere.exe" -ErrorAction SilentlyContinue) {
$vsWhere = $vsWhere.Path
}
elseif (Test-Path "${env:ProgramFiles}\Microsoft Visual Studio\Installer\vswhere.exe") {
$vsWhere = "${env:ProgramFiles}\Microsoft Visual Studio\Installer\vswhere.exe"
}
elseif (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe") {
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
}
else {
Write-Error "vswhere not found. Aborting." -ErrorAction Stop
}
#
# Get path to Visual Studio installation using vswhere.
#
$vsPath = &$vsWhere `
-latest `
-products * `
-requires Microsoft.Component.MSBuild `
-property installationPath
if ([string]::IsNullOrEmpty("$vsPath")) {
Write-Error "Failed to find Visual Studio installation. Aborting." -ErrorAction Stop
}
#
# Make sure the Visual Studio Command Prompt variables are set.
#
if (-not (Test-Path env:LIBPATH)) {
# Load VC vars
Push-Location "${vsPath}\VC\Auxiliary\Build"
try {
cmd /c "vcvarsall.bat x64&set" |
ForEach-Object {
if ($_ -match "=") {
$v = $_.split("=")
Set-Item -Force -Path "ENV:\$($v[0])" -Value "$($v[1])"
}
}
}
finally {
Pop-Location
}
}
Write-Host "FOUND" -ForegroundColor "Green"
}
# Fast node manager (fnm) integration
fnm completions --shell powershell | Out-String | Invoke-Expression
fnm env --use-on-cd | Out-String | Invoke-Expression
"@ | Out-File -FilePath $PROFILE.CurrentUserAllHosts
# Windows Feature
Enable-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform" -NoRestart
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
# Openssl Agent
Set-Service -Name ssh-agent -Status Running -StartupType Automatic
# Winget
Function winst { winget install --silent --id $args }
## General applications
winst CodeSector.TeraCopy
winst CPUID.CPU-Z
winst Discord.Discord
winst ExpressVPN.ExpressVPN
winst Giorgiotani.Peazip
winst Greenshot.Greenshot
winst KDE.Krita
winst Mozilla.Firefox
winst Notepad++.Notepad++ --architecture x86
winst SlackTechnologies.Slack
winst Valve.Steam
winst VideoLAN.VLC
winst WinDirStat.WinDirStat
winst WinSCP.WinSCP
#winst <paint.net https://github.com/microsoft/winget-pkgs/issues/18945>
## CLI
winst magic-wormhole.magic-wormhole
winst stedolan.jq
## Development
#https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022
winst Microsoft.VisualStudio.2022.BuildTools --override "--quiet --wait --includeRecommended --add Microsoft.VisualStudio.Workload.NodeBuildTools;Microsoft.VisualStudio.Workload.MSBuildTools;Microsoft.VisualStudio.Workload.VCTools"
winst dbeaver.dbeaver
winst Docker.DockerDesktop
winst EvanCzaplicki.Elm
winst Git.Git
winst Graphviz.Graphviz
winst Insomnia.Insomnia
winst Kitware.CMake
winst Microsoft.PowerShell
winst Microsoft.Sysinternals.ProcessExplorer
winst Microsoft.VisualStudioCode
winst Python.Python.3.10
winst Rustlang.Rustup
# Chocolatey
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
## Chocolatey Features
choco feature enable -n useRememberedArgumentsForUpgrades
choco feature enable -n allowGlobalConfirmation
## General applications
cinst paint.net
## CLI
cinst ffmpeg
cinst nano
cinst grep
## Development
cinst ngrok
cinst wixtoolset
# Rust setup
rustup toolchain install beta
rustup toolchain install nightly
rustup default beta
## Rust apps
cargo install fnm
# Python setup
python -m pip install pipx
python -m pipx ensurepath
## pipx
python -m pipx install black
python -m pipx install poetry
# Node Setup
fnm install --lts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment