Skip to content

Instantly share code, notes, and snippets.

@wardpeet
Last active May 7, 2021 01:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wardpeet/0acdab55c8c3634bd3016f78fab261b1 to your computer and use it in GitHub Desktop.
Save wardpeet/0acdab55c8c3634bd3016f78fab261b1 to your computer and use it in GitHub Desktop.
setup new windows machine
# Disable executionpolicy
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
# install scoop
iwr -useb get.scoop.sh | iex
# setup applications
scoop bucket add github-gh https://github.com/cli/scoop-gh.git
scoop bucket add extras
scoop install aria2
# install all applications
scoop install curl git gpg windows-terminal nvs yarn 7zip sudo pwsh vscode slack ditto gh vim fontbase putty firefox gcloud insomnia teamviewer vlc nmap openvpn
# Exclude scoop dirs from Windows Defender
sudo Add-MpPreference -ExclusionPath "$env:USERPROFILE\scoop"
sudo Add-MpPreference -ExclusionPath "$env:ProgramData\scoop"
# Exclude node from Windows Defender
sudo Add-MpPreference -ExclusionProcess "node.exe"
# Exclude npm/yarn from Windows Defender
sudo Add-MpPreference -ExclusionPath (Resolve-Path (Join-Path (yarn global bin) '../'))
sudo Add-MpPreference -ExclusionPath "$env:APPDATA\npm-cache"
# exclude projects folder
sudo Add-MpPreference -ExclusionPath "$env:USERPROFILE\projects\*"
sudo Add-MpPreference -ExclusionPath "$env:USERPROFILE\projects\*\*"
sudo Add-MpPreference -ExclusionPath "$env:USERPROFILE\projects\*\*\*"
sudo Add-MpPreference -ExclusionPath "$env:USERPROFILE\projects\*\*\*\*"
# setup nvs
nvs add lts
nvs link lts
yarn global add windows-build-tools
yarn global add cross-env gatsby-cli gatsby-dev-cli lighthouse source-map-explorer netlify-cli
[environment]::setenvironmentvariable('PATH', "$env:PATH;" + (yarn global bin), 'USER')
# Install python to make sure v3 is installed
scoop install python
# Enable ssh-agent
sudo Set-Service ssh-agent -StartupType Manual
# open powershell and install pshazz
pwsh scoop install pshazz
pshazz use ys
# Use ssh server from windows
[environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')
# Git
git config --global core.editor vim
git config --global core.fileMode false
git config --global core.eol lf
git config --global core.autocrlf false
git config --global user.name "<name>"
git config --global user.email "<email>"
git config --global cmder.status false
git config --global diff.tool vimdiff
git config --global merge.tool vimdiff
git config --global pull.ff only
git config --global alias.save "!git add -A && git commit -m 'SAVEPOINT'"
git config --global alias.undo "reset HEAD~1 --mixed"
git config --global alias.wipe "!git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard"
git config --global alias.stash-all "stash save --include-untracked"
git config --global alias.sync "!git fetch upstream && git pull --ff-only upstream $(git branch --show-current)"
# Setup gpg
git config --global commit.gpgsign true
git config --global gpg.program (scoop which gpg)
gpg --full-generate-key
gpg --armor --export ward@coding-tech.com | clip
ssh-keygen -t rsa -b 4096 -C "<email>"
cat $env:USERPROFILE/.ssh/id_rsa.pub | clip
ssh -T git@github.com
# setup gh cli
gh config set git_protocol ssh
# Long Paths
sudo Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
# Install WSL
## Enable virutal machine platform
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
## Enable wsl
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
--- reboot
wsl --set-default-version 2
@1mike12
Copy link

1mike12 commented Aug 7, 2020

yo you know this is public right?

@wardpeet
Copy link
Author

wardpeet commented Aug 7, 2020

Yes, what's wrong with this script? I don't immediately see a security risk here. You're probably talking about my email and name. I've removed them but still they still need both keys.

@1mike12
Copy link

1mike12 commented Aug 14, 2020

aint nothin wrong with the script, just wanted to point out that yo, you know this is public right?

@wardpeet
Copy link
Author

OK thank you :) :🤗 You scared me 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment