-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
143 lines (122 loc) · 11 KB
/
Copy pathsetup.ps1
File metadata and controls
143 lines (122 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Install PowerShell modules early to avoid https://github.com/badrelmers/RefrEnv/issues/9
# https://github.com/ralish/PSDotFiles
# https://github.com/RaphGL/tuckr https://github.com/RaphGL/Tuckr/issues/92
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
# https://github.com/dahlbyk/posh-git/issues/891
Install-Module -Name posh-git
# Installing my scoop and packages from it
irm get.scoop.sh | iex
'extras', 'games' | % { scoop bucket add $_ }
scoop bucket add bash "https://github.com/scillidan/scoop-bash"
scoop bucket add TXG0Fk3_Asterism "https://github.com/TXG0Fk3/Asterism"
scoop bucket add torokoshka-scoop "https://github.com/soredake/torokoshka-scoop"
# FFmpeg: workaround for https://github.com/microsoft/winget-cli/issues/3601 https://stackoverflow.com/questions/34491244/environment-variable-is-too-large-on-windows-10
scoop install refrenv bray-terminal
# Developer Mode is needed to create symlinks without admin rights
# NOTE: https://github.com/microsoft/winget-cli/issues/3601 https://github.com/microsoft/winget-cli/issues/361
gsudo reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
# Installing software
# TODO: winget is not installing fonts to $env:LOCALAPPDATA\Microsoft\Windows\Fonts, report
#winget source add --name winget-extras --type Microsoft.PreIndexed.Package --arg "https://winget.tplant.com.au/cache"
#winget install --force -h hack-nerd-font
# Sandboxie + Office >=2019 compatibility https://www.reddit.com/r/Office365/comments/1krbgmw/comment/myc40tu/ https://github.com/sandboxie-plus/Sandboxie/issues/4593 https://github.com/sandboxie-plus/Sandboxie/issues/4606
winget install --no-upgrade -h --accept-package-agreements --accept-source-agreements --exact office WingetPathUpdater gsudo Stacher.Stacher yt-dlp-nightly StefanSundin.Superf4 ente-auth openhashtab ayugram BillStewart.SyncthingWindowsSetup LocalSend.LocalSend topgrade-rs.topgrade uv telegram lycheeverse.lychee yt-dlp.FFmpeg itch.io taiga nomacs.nomacs dupeguru Bitwarden.Bitwarden file-converter peazip temurin-jdk-25 openrgb google-play-games unifiedremote sandboxie-classic Mozilla.Firefox NTKERNEL.WireSockVPNClient Chocolatey.Chocolatey steam Ryochan7.DS4Windows AppWork.JDownloader google-drive gog wiztree eaapp protonvpn msedgeredirect afterburner rivatuner bcuninstaller everything shixinhuang99.Czkawka.Tauri.FFmpeg RamenSoftware.Windhawk ente-photos quickshare PowerSoftware.AnyBurn Xanashi.Icaros HermannSchinagl.LinkShellExtension parsec volumelock syncplay warp Stretchly.Stretchly PSerban93.Achievements xp8k0hkjfrxgck 9nmqc2ssjx24 9n8g7tscl18r 9pm9dfqrdh3f xpfftq032ptphf xp99vr1bpsbqj2 xp9cdqw6ml4nqn xpfm11z0w10r7g xp8jrf5sxv03zm xpdp2qw12dfsfk xpdccppsk2xpqw xpdnx7g06blh2g 9nvjqjbdkn97 9nc73mjwhsww xpdc2rh70k22mn 9p8ltpgcbzxd 9pmz94127m4g xpfm5p5kdwf0jp xp89dcgq3k6vld 9p4clt2rj1rs 9pc2t04g3v9c
# NOTE: Pinned to 5.1.4 due to https://github.com/qbittorrent/qBittorrent/issues/24397
# TODO: switch to plain non lt2 package when bug is fixed, https://github.com/qbittorrent/qBittorrent/issues/24689
winget install --no-upgrade -h --accept-package-agreements --accept-source-agreements --exact qBittorrent.qBittorrent.lt2 --version "5.1.4"
# Interactive tor browser installation
# NOTE: install silently when https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/issues/41138 is implemented
winget install --no-upgrade --interactive --accept-package-agreements --accept-source-agreements --exact TorProject.TorBrowser
# https://github.com/microsoft/winget-pkgs/issues/106091 https://github.com/microsoft/vscode/issues/134470
# https://github.com/microsoft/vscode/blob/9d43b0751c91c909eee74ea96f765b1765487d7f/build/win32/code.iss#L81-L88
winget install --no-upgrade -h --accept-package-agreements --accept-source-agreements vscode --custom "/mergetasks='!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath'"
# https://github.com/SpotX-Official/SpotX
iex "& { $(iwr -useb 'https://raw.githubusercontent.com/SpotX-Official/SpotX/refs/heads/main/run.ps1') } -confirm_spoti_recomended_over -confirm_uninstall_ms_spoti -new_theme -topsearchbar -newFullscreenMode -podcasts_on -block_update_on -cache_limit 5000"
# Chocolatey stuff
# https://github.com/shinchiro/mpv-winbuild-cmake/issues/317
# https://github.com/shinchiro/mpv-winbuild-cmake/issues/793
# https://github.com/mpv-player/mpv/issues/17121
gsudo choco install -y mpvio.install
# Installing Hack font
# https://github.com/microsoft/winget-pkgs/issues/17547
oh-my-posh font install hack
# Installing python tools packages
# 'git+https://github.com/arecarn/dploy.git'
# 'git+https://github.com/iamkroot/trakt-scrobbler.git'
# 'trakt-scrobbler', 'dploy' | % { uv tool install $_ }
'dploy', 'shiradl' | % { uv tool install --managed-python $_ }
# https://github.com/iamkroot/trakt-scrobbler/issues/354
uv tool install --managed-python --prerelease allow trakt-scrobbler
# Add uv bin dir to PATH
# TODO: request env refresh in powershell
uv tool update-shell
# Refreshing PATH env
# . "$HOME/refrenv.ps1"
refrenv.ps1
# Dotfiles preparations
# https://github.com/arecarn/dploy/issues/8
New-Item -Path $env:APPDATA\trakt-scrobbler, $env:APPDATA\mpv\scripts -ItemType Directory -Force | Out-Null
# https://github.com/microsoft/terminal/issues/2933 https://github.com/microsoft/terminal/issues/14730 https://github.com/microsoft/terminal/issues/17455
Remove-Item -Path $env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json; New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json -Target $HOME\git\dotfiles_windows\dotfiles\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
# https://github.com/microsoft/intelligent-terminal
Remove-Item -Path $env:LOCALAPPDATA\Packages\Microsoft.IntelligentTerminal_8wekyb3d8bbwe\LocalState\settings.json; New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\Packages\Microsoft.IntelligentTerminal_8wekyb3d8bbwe\LocalState\settings.json -Target $HOME\git\dotfiles_windows\dotfiles\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
# Linking dotfiles
gsudo dploy stow $HOME\git\dotfiles_windows\dotfiles $HOME
# mpv plugins installation
curl -L --create-dirs --remote-name-all --output-dir $env:APPDATA\mpv\scripts "https://codeberg.org/jouni/mpv_sponsorblock_minimal/raw/branch/master/sponsorblock_minimal.lua" "https://raw.githubusercontent.com/zenwarr/mpv-config/master/scripts/russian-layout-bindings.lua" "https://github.com/CogentRedTester/mpv-sub-select/raw/master/sub-select.lua" "https://raw.githubusercontent.com/d87/mpv-persist-properties/master/persist-properties.lua"
curl -L --create-dirs --remote-name-all --output $env:APPDATA\mpv\scripts\reload.lua "https://raw.githubusercontent.com/4e6/mpv-reload/refs/heads/master/main.lua"
# NOTE: will not be needed after next mpv release
curl -L "https://github.com/tsl0922/mpv-menu-plugin/releases/download/2.4.1/menu.zip" -o "$HOME\Downloads\mpv-menu-plugin.zip"
# 7z e "$HOME\Downloads\mpv-menu-plugin.zip" -o"$env:APPDATA\mpv\scripts" -y
Expand-Archive -Force "$HOME/Downloads/mpv-menu-plugin.zip" -DestinationPath "$env:APPDATA\mpv\scripts"
Move-Item -Force "$env:APPDATA\mpv\scripts\menu\*" "$env:APPDATA\mpv\scripts"
Remove-Item -Recurse -Path "$env:APPDATA\mpv\scripts\menu"
# Misc
trakts autostart enable
# Set static IP
$env:currentNetworkInterfaceIndex = (Get-NetRoute | Where-Object { $_.DestinationPrefix -eq "0.0.0.0/0" -and $_.NextHop -like "192.168*" } | Get-NetAdapter | Where-Object { $_.Status -eq "Up" }).InterfaceIndex
gsudo {
# https://stackoverflow.com/a/53991926
New-NetIPAddress -InterfaceIndex $env:currentNetworkInterfaceIndex -IPAddress 192.168.0.145 -AddressFamily IPv4 -PrefixLength 24 -DefaultGateway 192.168.0.1
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses 1.1.1.1, 1.0.0.1
}
# https://remontka.pro/wake-timers-windows/
# https://www.elevenforum.com/t/enable-or-disable-to-allow-wake-timers-in-windows-11.7010/
powercfg /SETDCVALUEINDEX SCHEME_CURRENT 238c9fa8-0aad-41ed-83f4-97be242c8f20 bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d 0
powercfg /SETACVALUEINDEX SCHEME_CURRENT 238c9fa8-0aad-41ed-83f4-97be242c8f20 bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d 0
# Various settings & tasks
gsudo {
# Needed only on IoT Enterprise
# https://www.elevenforum.com/t/enable-or-disable-reserved-storage-in-windows-11.21389/
dism /Online /Set-ReservedStorageState /State:Enabled
# Disable hypervisor boot
# https://stackoverflow.com/a/35812945
# https://github.com/microsoft/WSL/issues/9695
# https://bytejams.com/help/hvci.html
# https://learn.microsoft.com/en-us/windows/security/hardware-security/enable-virtualization-based-protection-of-code-integrity?tabs=security
# https://learn.microsoft.com/en-us/windows/deployment/windows-autopatch/manage/windows-autopatch-hotpatch-updates
bcdedit /set hypervisorlaunchtype off
# Upgrade everything with topgrade task
Unregister-ScheduledTask -TaskName "Upgrade everything" -Confirm:$false
Register-ScheduledTask -Principal (New-ScheduledTaskPrincipal -UserID "$env:USERDOMAIN\$env:USERNAME" -RunLevel Highest) -Action (New-ScheduledTaskAction -Execute (where.exe /R "$env:LOCALAPPDATA\Microsoft\WindowsApps" pwsh.exe)[0] -Argument "-WindowStyle Minimized $HOME\git\dotfiles_windows\scripts\upgrade-all.ps1") -TaskName "Upgrade everything" -Settings (New-ScheduledTaskSettingsSet -StartWhenAvailable -RunOnlyIfNetworkAvailable) -Trigger (New-ScheduledTaskTrigger -Weekly -DaysOfWeek Friday -At 12:00)
}
# Battling wifi adapter problems
# https://www.reddit.com/r/techsupport/comments/1citkz6/comment/mcu02xr/
# Disable USB Selective Suspend on current power profile
powercfg /SETACVALUEINDEX SCHEME_CURRENT 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0
powercfg /SETDCVALUEINDEX SCHEME_CURRENT 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0
# Disable "Allow the computer to turn off this device to save power" only for TP-Link Wireless USB Adapter
gsudo {
$adapter = Get-NetAdapter -InterfaceDescription "TP-Link Wireless USB Adapter*" | Get-NetAdapterPowerManagement
$adapter.AllowComputerToTurnOffDevice = 'Disabled'
$adapter | Set-NetAdapterPowerManagement
}
# https://github.com/Jorman/Scripts?tab=readme-ov-file#addqbittorrenttrackerssh
# https://github.com/Jorman/Scripts/blob/master/AddqBittorrentTrackers/AddqBittorrentTrackers.sh.readme.md
git clone "https://github.com/Jorman/Scripts" "$HOME/git/Jorman-Scripts"
New-Item -ItemType Directory -Force -Path "$HOME/.local/bin" | Out-Null
(Get-Content "$HOME/git/Jorman-Scripts/AddqBittorrentTrackers/AddqBittorrentTrackers.py" -Raw) `
-replace 'qbt_host\s*=.*', 'qbt_host = "http://127.0.0.1"' `
-replace 'qbt_port\s*=.*', 'qbt_port = "8080"' `
-replace 'qbt_username\s*=.*', 'qbt_username = "admin"' `
-replace 'qbt_password\s*=.*', 'qbt_password = "adminadmin"' | Set-Content "$HOME/.local/bin/AddqBittorrentTrackers.py"