Skip to content

Instantly share code, notes, and snippets.

@ijin82
Last active June 30, 2024 14:33
Show Gist options
  • Save ijin82/7b46480a293b2c1b500a4c234bcc18d1 to your computer and use it in GitHub Desktop.
Save ijin82/7b46480a293b2c1b500a4c234bcc18d1 to your computer and use it in GitHub Desktop.
Usual Win apps quick install (PowerShell)
## Administrator powershell console needed
##
## Install choco: https://chocolatey.org/install
## Packages: https://chocolatey.org/packages
## List all installed: choco list --local-only
## Upgrade all installed: choco upgrade all
##
##
## Usage instructions:
## cd $HOME
## Allow script execurion: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
## Check policies: Get-ExecutionPolicy -List
## Get this file: wget https://gist.githubusercontent.com/ijin82/7b46480a293b2c1b500a4c234bcc18d1/raw/583d74f77d3148b6f841b2b9b079acaf231ed2cf/choco_install.ps1 -OutFile choco_install.ps1
## Run script: .\choco_install.ps1
## Remove file: Remove-Item choco_install.ps1
## Check outdated packages: choco outdated
## Coding
choco install vim --yes --force
choco install git --yes --force
choco install bulk-crap-uninstaller --yes
#choco install nodejs-lts --version=14.19.0
#choco install nodejs-lts --version=16.18.1
#choco pin add -n=nodejs-lts --version=16.18.1
choco install nodejs-lts --version=18.20.3
choco pin add -n=nodejs-lts --version=18.20.3
## BUILD FIX (powershell): $env:NODE_OPTIONS = "--openssl-legacy-provider"
## Utils
choco install 7zip --yes --force
choco install vlc --yes --force
choco install foobar2000 --yes --force
choco install Far --yes --force
choco install telnet --yes --force
choco install sumatrapdf --yes --force
choco install qbittorrent --yes --force
## Once install only
choco install skype --yes --force
choco uninstall skype -n --skipautouninstaller
choco install vscode --yes --force
choco uninstall vscode -n --skipautouninstaller --yes
choco install paint.net --yes --force
choco uninstall paint.net -n --skipautouninstaller --yes
## ConEmu Special version (before screen + mc bug)
choco install conemu --version=20.11.1.0 --allow-downgrade --yes
choco pin add -n=conemu --version=20.11.1.0
## windows terminal
choco install microsoft-windows-terminal
## VitualBox + Vagrant special (working) versions
## Remove pin (for upgrade): choco pin remove --name="package-name"
choco install virtualbox --version=6.1.22 --allow-downgrade --yes
choco pin add -n=virtualbox --version=6.1.22
choco install vagrant --version=2.2.18.20210807 --allow-downgrade --yes
choco pin add -n=vagrant --version=2.2.18.20210807
## Win 10, PowerShell, check if local port is not busy (available for mapping etc.)
##
## Usage instructions:
## cd $HOME
## Allow script execurion: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
## Check policies: Get-ExecutionPolicy -List
## Get this file: wget https://gist.githubusercontent.com/ijin82/7b46480a293b2c1b500a4c234bcc18d1/raw/446269b99d23f445b1d13e12d07eebdeee7e3e74/port_check.ps1 -OutFile port_check.ps1
## Run script:
## Check one single port: .\port_check.ps1 12345
## Check ports range: .\port_check.ps1 12345 12350
## Check ports range + show each port status: .\port_check.ps1 12345 12350 -ShowAll
## Remove file: Remove-Item port_check.ps1
param (
[Parameter(Mandatory=$true)]
[ValidateRange(1, 65535)]
[Int]
$portNumber = 0,
[Parameter(Mandatory=$false)]
[ValidateRange(1, 65535)]
[Int]
$portNumberScanTo = 0,
[Parameter(Mandatory=$false)]
[Switch]
$ShowAll
)
function checkPort($portNumber) {
$processId = (Get-NetTCPConnection | where Localport -eq $portNumber | Select -First 1 -expand OwningProcess)
if ($processId) {
$processName = (Get-Process -Id $processId | Select -expand ProcessName)
echo "Port [$portNumber] is BUSY with process id [$processId] named [$processName]"
} else {
if ($ShowAll) {
echo "Port [$portNumber] is NOT busy and ready to use"
}
}
}
if ($portNumberScanTo -and $portNumber -lt $portNumberScanTo) {
for ($i = $portNumber; $i -le $portNumberScanTo; $i++) {
checkPort($i)
}
} else {
checkPort($portNumber)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment