Skip to content

Instantly share code, notes, and snippets.

@ngstigator
Last active November 1, 2022 19:48
Show Gist options
  • Save ngstigator/1f04c66662e8f4f5f5811fc50d3550f9 to your computer and use it in GitHub Desktop.
Save ngstigator/1f04c66662e8f4f5f5811fc50d3550f9 to your computer and use it in GitHub Desktop.

Windows 10

Setup

Chocolatey

Package management

  • choco install <PACKAGE_NAME>
  • choco list --local-only
  • choco outdated
  • choco upgrade <PACKAGE_NAME>

Useful packages

  • php 7.3.21
  • poshgit 0.7.3.1
  • quicklook 3.6.9
  • slack 4.8.0
  • sops 3.5.0
  • spotify 1.1.39.612
  • vagrant 2.2.9
  • virtualbox 6.1.10
  • vlc 3.0.11
  • vscode 1.47.3
  • keepassx 2.0.3
  • GoogleChrome 84.0.4147.135
  • dropbox 106.4.368
  • Firefox 79.0
  • 7zip 19.0
  • argocd 1.6.1
  • awscli 2.0.41
  • bitwarden-cli 1.11.0
  • brave 1.12.114
  • calibre 5.0.1
  • composer 6.0.0
  • discord 0.0.306.20200621

Enable SSH

Services -> OpenSSH -> Automatic

Start ssh-agent

Get-Service -Name ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent

Stop Git from asking for SSH key passphrase all the time

$Env:GIT_SSH=$((Get-Command -Name ssh).Source)

Save SSH key passphrase

git config --global core.sshCommand C:\\Windows\\System32\\OpenSSH\\ssh.exe

Hyper-V

Enable

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Disable

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

List VM networking

arp -a

Edit VM settings

Administrator:

vmconnect localhost <VM_NAME> /edit

Get product key

(Get-WmiObject -query select * from SoftwareLicensingService).OA3xOriginalProductKey

ENVIRONMENT VARIABLES

  • refreshenv (an alias for Update-SessionEnvironment)
  • C:\Program Files\Git\usr\bin (allows using apps like which, vim, grep ...etc)

Check endpoint ports

Test-NetConnection -ComputerName api.ecr.us-west-2.amazonaws.com -Port 443

Hosts file

C:\Windows\System32\drivers\etc\hosts

WSL

Configuration

in your WSL instance and then restarting it will allow you to apply Linux permissions:

/etc/wsl.conf

[automount]
enabled = true
options = "metadata,umask=22,fmask=11"

.profile Note: Bash on Windows does not currently apply umask properly.

if [[ "$(umask)" = "0000" ]]; then
  umask 0022
fi

Remount drive with permissions and metadata

sudo umount /mnt/d
sudo mount -t drvfs D: /mnt/d -o metadata

list distros

wsl -l -v

Start specific distro

wsl -d Ubuntu-20.04 #start distro

Shutdown specific distro

wsl -d Ubuntu-20.04 --shutdown #shutdown distro

Reclaim RAM

echo 1 > /proc/sys/vm/compact_memory
echo 1 > /proc/sys/vm/drop_caches

Set Windows home directory shortcut

In .bash_aliases add:

alias winhome='cd $(wslpath "$(wslvar USERPROFILE)")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment