Skip to content

Instantly share code, notes, and snippets.

@m0rphed
Last active September 15, 2023 15:56
Show Gist options
  • Save m0rphed/933a41e846d98b57f7b70c80cc5ee789 to your computer and use it in GitHub Desktop.
Save m0rphed/933a41e846d98b57f7b70c80cc5ee789 to your computer and use it in GitHub Desktop.

Make a developer-ready Win11 from ashes (user's folder named in CP-1251 😡)

(⚠️ UNSAFE) Renaming the user home folder

Method 1: fast

  • Sign in to "broken" user account && back-up valuable data
  • Open cmd (Run as administrator)
  • net user administrator /active:yes - activate administrator account
  • Sign out from "broken" user account
  • Login under newly activated "Administrator" account (this account is windows built-in account for system administration)
  • Right click on πŸͺŸ start menu
  • ...πŸ‘‰ "Computer management" πŸ‘‰ "Local Users and Groups" πŸ‘‰ "Users"
  • ...πŸ‘‰ broken account username πŸ‘‰ Right click && Rename
  • Open This PC πŸ‘‰ "Local Drive (C:)" πŸ‘‰ "User" πŸ‘‰ broken account foldername πŸ‘‰ Right click && Rename
  • Open registry editor ("Win + R" πŸ‘‰ regedit)
  • Enter path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
  • Find the one that was created by your user (the one with some random numbers) Should look something like this
  • Change "Value data" of the ProfileImagePath key (of selected profile) to the name matching renamed user folder
  • Sign out
  • Try logging to fixed user, if everything is ok - the last step is...
  • ...disabling administrator account net user administrator /active:no

Method 2

Simply create another fresh user 🫠... there is probably no other way around.

Setting up dev environment for JavaScript, Node, Python on fixed Windows 11

Installing scoop and a few useful things

Check out up-to-date instructions for scoop installation

Simply install scoop via Powershell:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
irm get.scoop.sh | iex

Adding required buckets:

scoop install git # git is required
scoop bucket add main
scoop bucket add nerd-fonts # for good looking fonts in Terminal 
scoop bucket add extras # vscode

Modern Cross-Platform PowerShell version

Up-to-date powershell doc

Main features:

  • autocompletion
  • cross-platform
  • (maybe) sucks less than default PowerShell 5
winget search Microsoft.PowerShell # check what versions available
winget install Microsoft.PowerShell # or alt. you can `scoop install Microsoft.PowerShell.Preview` for preview version

Windows Terminal (probably installed by default) GitHub link ; Microsoft πŸ›’ link or via winget:

winget install --id Microsoft.WindowsTerminal -e

Modern UNIX-alike CLI utils && Nerd Fonts

  • bat: cat with syntax highlighting scoop install main/bat
  • lsd: (faster?) ls with syntax highlighting scoop install main/bat
  • erd: just better tree alternative scoop install main/erdtree
  • ripgrep aka rg: FASTER && cross-platform grep re-implementation scoop install main/ripgrep
  • tealdeer: TLDR manuals cli scoop install main/tealdeer
    • to finish setting up tldr - run: tldr --update

Fonts:

  • FiraCode && FiraCode Nerd Font πŸ‘‰ scoop install nerd-fonts/FiraCode ; scoop install nerd-fonts/FiraCode-NF

Set-up JS dev environment

⚠️ Do not forget to uninstall other NodeJS distributions

πŸ‘‰ nvm-windows - node version manager ported from UNIX to Windows

scoop install main/nvm

Alternatively use fnm - faster nvm impl. by Vercel devs scoop install main/fnm

nvm install --lts # installs current LTS Node.JS version
nvm use --lts # use LTS version

BTW, Welcome to the club:

node_modules is hella heavy

πŸ‘‰ optional: pnpm - just better npm 🀑

iwr https://get.pnpm.io/install.ps1 -useb | iex

πŸ‘‰ Install VSCode

  • via winget (preferred):
winget install -e --id Microsoft.VisualStudioCode
  • via scoop:
scoop install extras/vscode

πŸ‘‰ Set up git:

git config --global user.name "imanchoys"
git config --global user.email anna_ufa2004@mail.ru

πŸ‘‰ Finish setting up git with GitHub credentials via github-cli:

scoop install main/gh # install github-cli via scoop
gh auth login
gh config set -h github.com git_protocol https # optional: set protocol to HTTPS 

πŸ‘‰ (optional) πŸ‹πŸ“¦ Docker on Windows (probably require WSL2)

πŸ‘‰ (optional) Windows Subsystem for LINUX - WSL2

Set-up Python dev environment

Typical Python's environment looks like this

⚠️ Do not forget to uninstall other PYTHON distributions

πŸ‘‰ Pyenv for Windows

  • Execute following in powershell:
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"
  • Check that everything is ok: pyenv --version
  • Update mirrors list: pyenv update
  • Check all versions: pyenv install -l
  • pyenv install <version> (example: pyenv install 3.11.3) - install Python Interpreter version
  • pyenv global <version> - set GLOBAL Python Interpreter version

Creating new python virtual environment

pyenv shell 3.11.3
cd <project folder>
python -m venv .venv # create virtual environment at current folder with name '.venv'

(ℹ️) If pyenv is a "little bit broken" - try to regenerate shims: pyenv rehash - if that would not fix pyenv... ...Whell maybe it's time to PANIC 😱!

πŸ‘‰ optional Install JupyterNotebook globally for your current Python Interpreter set up by pyenv:

pip install jupyterlab

Also, to be able to access globally installed python's packages like: jupyter, ipython, ... ...it's probably useful to add this to user's Path: Environment variables

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