Skip to content

Instantly share code, notes, and snippets.

@JTBrinkmann
Last active April 20, 2019 17:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JTBrinkmann/f86d52fe8dd8e76331fa4050e5fcbcbc to your computer and use it in GitHub Desktop.
Save JTBrinkmann/f86d52fe8dd8e76331fa4050e5fcbcbc to your computer and use it in GitHub Desktop.
configure a new Windows profile
# extra commandline utils
scoop install imagemagick python python2 bat caddy cmder dos2unix ffmpeg jq php sed
# extra GUI apps
scoop install jetbrains-toolbox gitkraken gimp atom sharex vlc autohotkey
# manually install whatever you need (e.g. Android Studio, IntelliJ, PHP-Storm)
jetbrains-toolbox
# install more programs using Chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n allowGlobalConfirmation
choco install mattermost-desktop resophnotes qttabbar unchecky
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iex (New-Object System.Net.WebClient).downloadstring('https://get.scoop.sh')
scoop install sudo 7zip
iwr https://gist.github.com/JTBrinkmann/f86d52fe8dd8e76331fa4050e5fcbcbc/archive/master.zip -O setup.zip
7z e .\setup.zip -osetup
sudo setup/setup.ps1
// Mozilla User Preferences
user_pref("app.normandy.first_run", false);
user_pref("browser.bookmarks.restore_default_bookmarks", false);
user_pref("browser.contentblocking.introCount", 20);
user_pref("browser.ctrlTab.recentlyUsedOrder", false);
user_pref("browser.download.panel.shown", true);
user_pref("browser.privacy.trackingprotection.menu", "always");
user_pref("browser.urlbar.placeholderName", "DuckDuckGo");
user_pref("datareporting.policy.dataSubmissionPolicyAcceptedVersion", 2);
user_pref("devtools.onboarding.telemetry.logged", true);
user_pref("network.cookie.cookieBehavior", 1);
user_pref("network.dns.disablePrefetch", false);
user_pref("network.http.speculative-parallel-limit", 0);
user_pref("network.predictor.cleaned-up", true);
user_pref("network.predictor.enabled", true);
user_pref("network.prefetch-next", true);
user_pref("plugin.disable_full_page_plugin_for_types", "");
user_pref("privacy.donottrackheader.enabled", true);
user_pref("privacy.trackingprotection.enabled", true);
# from https://www.reddit.com/r/PowerShell/comments/9ulosc/install_multiple_fonts_including_overwrite_or/e95n3cm/
Add-Type -AssemblyName System.Drawing
$FontCollection = [System.Drawing.Text.PrivateFontCollection]::new()
$args | foreach {
$fonts = Get-ChildItem -Path $_ -Include *.ttf -Recurse -File # , *.otf
echo "Installing $($fonts.count) fonts…"
$i = 1
foreach ($font in $fonts) {
echo "[$i/$($fonts.count)] $($font.Basename)"
$i++
$sysfont = "C:\Windows\Fonts\$($font.Name)"
if (Test-Path $sysfont) {
Remove-Item -Fo -Path $sysfont
}
Copy-Item -Path $font -Destination $sysfont -Force -Confirm:$false -PassThru > $null
$FontCollection.AddFontFile($font)
$RegistryValue = @{
Path = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts'
Name = $FontCollection.Families[-1].Name
Value = $font.Fullname
}
New-ItemProperty -Fo @RegistryValue > $null
}
}
# Print the current working directory, shortened to fit the prompt
function global:pshazz:prompt_pwd:prompt {
$fish_prompt_pwd_dir_length = 1
$global:pshazz.prompt_vars.path = (pwd).path.replace("$ENV:USERPROFILE", "~") -replace "(\.?[^\\]{$fish_prompt_pwd_dir_length})[^\\]*\\", '$1\'
}
echo "This script requires Powershell 5.1"
echo "currently running $($PSVersionTable.PSVersion)"
Set-ExecutionPolicy Bypass -scope CurrentUser
# fix downloading over HTTPS
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
$net = (New-Object System.Net.WebClient)
# configure taskbar
reg.exe import .\taskbar.reg
kill -ProcessName explorer -Force
# install basic tools & apps
scoop install git # needed for buckets
scoop bucket add extras
scoop install notepad2-mod firefox
# replace notepad with notepad2-mod
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "`"$((gcm notepad2.exe).Path)`" /z" /f
# install SourceCode Pro (SauceCode-Pro-NF via scoop-nerd-fonts can't be applied to console)
iwr "https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip" -O font.zip
7z e .\font.zip -ofont
.\install-fonts.ps1 ".\font\"
rm font.zip
# style powershell
## theme
scoop install pshazz concfg
concfg clean
concfg import -n solarized-dark .\source-code-pro-semibold.json
concfg tokencolor disable
## prompt_pwd plugin to show short path names,
## e.g. "~\A\R\Mozilla" instead of C:\Users\username\AppData\Roaming\Mozilla
$pshazzdir = "$((get-item (pshazz which default)).DirectoryName)\.."
copy .\prompt_pwd.ps1 $pshazzdir\plugins\
## pshazz (prompt) theme
## we modify xpander to use prompt_pwd and not use ssh and hg (to speed up profile loading time)
(cat "$pshazzdir\themes\xpander.json" `
).replace('"hg", "ssh"', '"prompt_pwd"' `
).replace('" $"', '"`n$([char]0x3BB)"' `
) > "$pshazzdir\themes\xpander-lambda.json"
# ).replace('["", "", " $"]', '["White", "Blue", "`n$([char]0x3BB)"],["Blue", "Black", "$rightarrow"]' `
pshazz use xpander-lambda
# configure firefox
kill -ProcessName firefox -Force
$ffprofiles = "$ENV:appdata\Mozilla\Firefox\Profiles"
ls $ffprofiles | foreach {
copy firefox-user.js $ffprofiles\$_\user.js
}
firefox -setDefaultBrowser "https://accounts.firefox.com/signin?service=sync&context=fx_desktop_v3&entrypoint=menupanel"
{
"font_face": "Source Code Pro Semibold",
"font_true_type": true,
"font_size": "0x18",
"font_weight": 400,
"load_console_IME": true
}
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"Hidden"=dword:00000001
"HideFileExt"=dword:00000000
"ShowSuperHidden"=dword:00000000
"DontPrettyPath"=dword:00000001
"SeparateProcess"=dword:00000001
"TaskbarGlomLevel"=dword:00000001
"MMTaskbarGlomLevel"=dword:00000001
"MMTaskbarMode"=dword:00000002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment