Skip to content

Instantly share code, notes, and snippets.

@psydvl
Last active March 28, 2024 13:52
Show Gist options
  • Save psydvl/8b2bf876b8e64a699d4afd178fd06ea4 to your computer and use it in GitHub Desktop.
Save psydvl/8b2bf876b8e64a699d4afd178fd06ea4 to your computer and use it in GitHub Desktop.
My Windows minimal post-install (probably abandoned)

Install programms and neccesesary tools in Windows

Scoop.sh | Winget.run | winget

To run init.ps1, you should execute next two lines

Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iwr -useb git.io/psydvl-win | iex

Script also doing little $PROFILE (both PowerShell 5&7) enhancement with functions:
search ~L78
status ~L84
update ~L89
runjupyter=rj ~L100 ~L115
websearch ~L117
To be contiued...

try {
$(winget -v)
}
catch {
Write-Output @"
Install winget first
https://docs.microsoft.com/windows/package-manager/winget/#install-winget
"@
#$(New-Object -ComObject Wscript.Shell).Popup("Install winget first")
exit
}
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') # iwr -useb get.scoop.sh | iex
scoop install aria2 7zip zstd
scoop install busybox sudo file vim
scoop install nvs # should I replace it with https://volta.sh/ ?
scoop install adb scrcpy
# scoop install nvs ↑↑
nvs add lts
nvs use lts
scoop install yarn # yarn need nodejs to be installed
scoop bucket add extras
scoop install ventoy notepad3 zoom
scoop install powertoys sumatrapdf treesize-free wiztree picpick # zeal
<#
!WARNING
_winget_ not provide any way to call app from PS1 and update process sometimes broke app state
Should I move Zoom here?...
#>
(
"Mozilla.FirefoxDeveloperEdition", # Personal
"KeeWeb.KeeWeb",
"Telegram.TelegramDesktop",
"SearchDeflector.SearchDeflector",
"Deezer.Deezer",
"Git.Git", # Dev
"GoLang.Go",
"Anaconda.Miniconda3",
"Microsoft.VisualStudioCode",
"Microsoft.WindowsTerminal", # is it already installed on Win 11?
"Meld.Meld",
"AdGuard.AdGuard", # Tools
"Joplin.Joplin",
"Adobe.AdobeAcrobatReaderDC",
"Microsoft.PowerShell",
"Transmission.Transmission", #, "PicoTorrent.PicoTorrent"
"eloston.ungoogled-chromium",
"WhatsApp.WhatsApp",
"Discord.Discord",
"Nvidia.GeForceNow", # Entertainment
"Valve.Steam",
"None"
) | ForEach-Object {winget install -e --id $_}
# "Microsoft.VisualStudioCode"
Write-Output y | conda update --all
Write-Output y | conda install jupyter numpy pandas
conda init powershell
( # "Microsoft.VisualStudioCode"
"ms-vscode.powershell",
"firefox-devtools.vscode-firefox-debug",
"shd101wyy.markdown-preview-enhanced",
"ms-python.python",
"gamunu.vscode-yarn",
"golang.go"
) | ForEach-Object { code --install-extension $_ }
$_profile = @'
nvs use lts
Write-Output "'search' 'status' 'update' 'runjupyter'='rj' 'search'"
function search {
Write-Output "Winget:"
winget search $args
Write-Output "Scoop:"
scoop search $args
}
function status {
nvs outdated
scoop status
winget upgrade
}
function update {
nvs outdated
nvs upgrade
scoop update
scoop update *
scoop cleanup *
scoop cache rm *
winget upgrade --all
conda update --all
}
function runjupyter {
if(!$args) {
Push-Location \work\mini\jupyter
} else {
Push-Location $args[0]
}
$current_WindowTitle = $host.UI.RawUI.WindowTitle
$host.UI.RawUI.WindowTitle = "Jupyter (running...)"
try { # try-finally help go back to start directory even if Ctrl-C placed
jupyter notebook
} finally {
$host.UI.RawUI.WindowTitle = $current_WindowTitle
Pop-Location
}
}
Set-Alias -Name rj -Value runjupyter
function websearch {
Start-Process ("https://www.google.com/search?q=" + $args)
}
'@
(
$PROFILE, #default PowerShell 5 profile
$(pwsh.exe -NoProfile -Command 'echo $PROFILE') # PowerShell 7 profile
) | ForEach-Object {
if (-not (Test-Path -Path $_ -PathType leaf)) {
New-Item -Path $_ -ItemType "file" -Force
}
Write-Output $_profile >> $_
}
sudo `
Set-ItemProperty Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
-Name RealTimeIsUniversal
-Value 1
$(New-Object -ComObject Wscript.Shell).Popup(@"
Reenable "Set time automaticly" option in Time & Language in Options (Win+i)
"@)
# linking (default) pwsh5 profile to pwsh7 # now only write same text just in case
# keep here for possible future mindchanging
# sudo New-Item -Name $(pwsh.exe -NoProfile -Command 'echo $PROFILE') -ItemType SymbolicLink -Value $PROFILE
# $(New-Object -ComObject Wscript.Shell).Popup(@"
Write-Output @"
Installation succeded
You can map 'Caps Lock' to Win+Space as language changer via PowerToys app
For update run: ``update``
For jupyter run: ``runjupyter`` or ``rj``
Maybe I(you?) need to: move Win.Terminal to Win+1, set Powershell_7 by default, and font size to 10
"@
#"@)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment