Skip to content

Instantly share code, notes, and snippets.

@kvnbias
Last active August 2, 2023 08:18
Show Gist options
  • Save kvnbias/1098e9d76dc8df7a162ab04da817f5a2 to your computer and use it in GitHub Desktop.
Save kvnbias/1098e9d76dc8df7a162ab04da817f5a2 to your computer and use it in GitHub Desktop.
Windows Notes & Settings

Windows 10 Disable Auto-Close quotes

Settings > Time & Language > Language > Preferred Languages > Remove Language or change language by ALT+Shift

380951774

Hosts File

c:\windows\system32\drivers\etc\hosts

WIndows 10 Invert Mouse

  1. Open Powershell as an administrator

  2. Run

    Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
  3. Verify that all mice devices have had their FlipFlopWheel attributes set to 1

    Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0

    Optional

    Change DPI to 1600 and windows sensitivity to 6

  4. Reboot

Windows 10 Prevent Hash Sum Mismatch on Vagrant

DISM /Online /Disable-Feature:Microsoft-Hyper-V
bcdedit /set hypervisorlaunchtype off

CONS

  • Will prevent containers to be created by docker & kubernetes on the main machine

Reverse

DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
bcdedit /set hypervisorlaunchtype auto

Might want to check these: https://docs.microsoft.com/en-us/windows/wsl/install-win10

Windows 10 CRLF warning

  • Set LF as your line ending default.
git config --global core.eol lf
  • Set autocrlf to false to stop converting between windows style (CRLF) and Unix style (LF)
git config --global core.autocrlf false
  • Convert CRLF to LF
# .gitattributes
# These files are text and should be normalized (Convert crlf => lf)
*.php text
*.css text
*.js text
*.json text
*.svg text
*.htm text
*.html text
*.xml text
*.txt text
*.ini text
*.inc text
*.pl text
*.rb text
*.py text
*.scm text
*.sql text
.htaccess text
*.sh text

# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
*.pyc binary

Windows 10 VSCode settings.json

Ctrl+Shift+P: >Preferences: Open Settings (JSON)

{
    "editor.renderWhitespace": "all",
    "workbench.colorCustomizations": {
        "sideBarSectionHeader.border": "#00000060",
        "editorWidget.background": "#101010",
        "editor.findMatchBackground": "#101010",
        "editor.findMatchBorder": "#101010",
        "editor.inactiveSelectionBackground": "#101010",
        "editor.lineHighlightBackground": "#101010",
        "editorGroup.emptyBackground": "#101010",
        "editorGroupHeader.tabsBackground": "#101010",
        "editorSuggestWidget.background": "#101010",
        "list.activeSelectionBackground": "#101010",
        "list.hoverBackground": "#101010",
        "tab.hoverBackground": "#101010",
        "badge.background": "#191919",
        "button.background": "#191919",
        "editor.findMatchHighlightBackground": "#191919",
        "editorGroup.dropBackground": "#191919",
        "editor.background": "#191919",
        "list.inactiveSelectionBackground": "#191919",
        "tab.activeBackground": "#191919",
        "activityBar.background": "#A39065",
        "dropdown.background": "#A39065",
        "list.dropBackground": "#A39065",
        "panel.dropBackground": "#A39065",
        "sideBar.dropBackground": "#A39065",
        "menu.selectionBackground": "#A39065",
        "progressBar.background": "#A39065",
        "sideBarSectionHeader.background": "#A39065",
        "titleBar.activeBackground": "#A39065",
        "activityBarBadge.background": "#282828",
        "editor.selectionBackground": "#282828",
        "editorSuggestWidget.selectedBackground": "#282828",
        "input.background": "#282828",
        "menu.background": "#282828",
        "menubar.selectionBackground": "#282828",
        "panel.background": "#282828",
        "sideBar.background": "#282828",
        "tab.inactiveBackground": "#282828",
        "scrollbarSlider.activeBackground": "#ede44742",
        "menu.foreground": "#d7dce2",
        "titleBar.activeForeground": "#d7dce2",
        "activityBar.foreground": "#191919",
        "sideBarSectionHeader.foreground": "#191919",
        "sideBarTitle.foreground": "#191919",
        "tab.activeForeground": "#d7dce2",
        "panelTitle.activeBorder": "#00000000",
        "tab.activeBorder": "#00000000",
        "editorWidget.resizeBorder": "#00000000",
        "menu.selectionForeground": "#d7dce2",
        "menubar.selectionForeground": "#d7dce2",
        "editorSuggestWidget.highlightForeground": "#d7dce2",
        "notificationLink.foreground": "#d7dce2",
        "list.activeSelectionForeground": "#d7dce2",
        "list.inactiveSelectionForeground": "#d7dce2",
        "sideBar.foreground": "#dde5d7",
        "list.highlightForeground": "#d7dce2",
        "textLink.foreground": "#d7dce2",
        "pickerGroup.foreground": "#d7dce2",
        "editorWidget.border": "#d7dce2",
        "settings.modifiedItemIndicator": "#d7dce2",
        "settings.headerForeground": "#d7dce2",
        "breadcrumb.activeSelectionForeground": "#d7dce2",
        "statusBar.background": "#101010",
        "terminal.ansiBlack": "#101010",
        "terminal.ansiRed": "#141414",
        "terminal.ansiGreen": "#191919",
        "terminal.ansiBrightBlack": "#A39065",
        "terminal.foreground": "#A39065",
        "terminalCursor.background": "#A39065",
        "terminalCursor.foreground": "#A39065"
    },
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    // "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe",
    "workbench.colorTheme": "Tomorrow Night",
    "editor.fontFamily": "'UbuntuMono Nerd Font Mono', Consolas, 'Courier New', monospace",
    "editor.fontSize": 14,
    "[dockerfile]": {
        "editor.tabSize": 2,
        "editor.insertSpaces": true,
        "editor.quickSuggestions": {
            "strings": true
        }
    },
    "[html]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true,
        "editor.suggest.insertMode": "replace"
    },
    "[css]": {
        "editor.tabSize": 2,
        "editor.insertSpaces": true,
        "editor.suggest.insertMode": "replace"
    },
    "[json]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true,
        "editor.quickSuggestions": {
            "strings": true
        },
        "editor.suggest.insertMode": "replace"
    },
    "[jsonc]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true,
        "editor.quickSuggestions": {
            "strings": true
        },
        "editor.suggest.insertMode": "replace"
    },
    "[java]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true
    },
    "[javascript]": {
        "editor.tabSize": 2,
        "editor.insertSpaces": true
    },
    "[php]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true
    },
    "[xml]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true
    },
    "[typescript]": {
        "editor.tabSize": 2,
        "editor.insertSpaces": true
    },
    "[typescriptreact]": {
        "editor.tabSize": 2,
        "editor.insertSpaces": true
    },
    "[shellscript]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true
    },
    "[scss]": {
        "editor.tabSize": 2,
        "editor.insertSpaces": true
    },
    "[python]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true
    },
    "[swift]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true
    },
    "[twig]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true
    },
    "[blade]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true
    }
}

Windows 10 VSCode keybindings.json

Ctrl+Shift+P: >Preferences: Open Keyboard Shortcuts (JSON)

// ~/.config/Code - OSS/User/keybindings.json
// Place your key bindings in this file to override the defaults
[
    // copy bindings
    {
        "key": "ctrl+alt+down",
        "command": "editor.action.copyLinesDownAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+alt+up",
        "command": "editor.action.copyLinesUpAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+alt+down",
        "command": "-editor.action.copyLinesDownAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+alt+up",
        "command": "-editor.action.copyLinesUpAction",
        "when": "editorTextFocus && !editorReadonly"
    },

    // terminal toggle bindings
    {
        "key": "ctrl+shift+c",
        "command": "workbench.action.terminal.toggleTerminal"
    },
    {
        "key": "ctrl+`",
        "command": "-workbench.action.terminal.toggleTerminal"
    },
    {
        "key": "ctrl+shift+alt+c",
        "command": "workbench.action.terminal.openNativeConsole",
        "when": "!terminalFocus"
    },
    {
        "key": "ctrl+shift+c",
        "command": "-workbench.action.terminal.openNativeConsole",
        "when": "!terminalFocus"
    },
    {
        "key": "ctrl+shift+alt+c",
        "command": "workbench.action.terminal.copySelection",
        "when": "terminalFocus && terminalProcessSupported && terminalTextSelected"
    },
    {
        "key": "ctrl+shift+c",
        "command": "-workbench.action.terminal.copySelection",
        "when": "terminalFocus && terminalProcessSupported && terminalTextSelected"
    },

    // terminal focus
    {
        "key": "ctrl+shift+j",
        "command": "workbench.action.terminal.focusNext",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+shift+k",
        "command": "workbench.action.terminal.focusPrevious",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+shift+n",
        "command": "workbench.action.terminal.new",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+shift+`",
        "command": "-workbench.action.terminal.new"
    },

    // debug
    {
        "key": "ctrl+shift+r",
        "command": "workbench.action.debug.start",
        "when": "debuggersAvailable && !inDebugMode"
    },
    {
        "key": "ctrl+shift+r",
        "command": "workbench.action.debug.continue",
        "when": "inDebugMode"
    },
    {
        "key": "alt+ctrl+shift+r",
        "command": "workbench.action.debug.restart",
        "when": "inDebugMode"
    },
    {
        "key": "alt+ctrl+shift+x",
        "command": "workbench.action.debug.disconnect",
        "when": "inDebugMode"
    },
    {
        "key": "ctrl+shift+b",
        "command": "editor.debug.action.toggleBreakpoint",
        "when": "debuggersAvailable && editorTextFocus"
    },

]

WSL Notes

  • Kernel Link
https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
  • WSL 2 Enable
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
  • WSL 2 Enable Alt
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  • Check WSL version
wsl -l -v
  • Set WSL version
wsl --set-version DistroName 2
wsl --set-default-version 2

WSL .bashrc

# source ~/.bashrc
# Enable vi mode
set -o vi
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"

PATH="$HOME/.local/bin:$HOME/bin:$PATH:/mnt/c/Program Files/Oracle/VirtualBox"
export PATH;

# alias phpfpm-do="sudo /etc/init.d/php7.4-fpm $1"
# alt for show-ip `/sbin/ip route|awk '/default/ { print $3 }'`
alias show-ip="ip addr | grep eth0 | grep inet | cut -f 1 -d '/' | cut -f 2 -d 't'"
alias nginx-do="sudo /etc/init.d/nginx $1"
alias mysql-do="sudo /etc/init.d/mysql $1"
alias mongodb-do="sudo /etc/init.d/mongodb $1"
alias phpfpm-do="sudo /etc/init.d/php8.0-fpm $1"
alias redis-do="sudo /etc/init.d/redis-server $1"

export EDITOR=vim

WSL Terminal settings.json

// This file was initially generated by Windows Terminal 1.5.10271.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
    // Add custom actions and keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
    "actions":
    [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+shift+c" },
        { "command": "paste", "keys": "ctrl+shift+v" },

        // Press Ctrl+Shift+F to open the search box
        { "command": "find", "keys": "ctrl+shift+f" },

        // Press Alt+Shift+D to open a new pane.
        // - "split": "auto" makes this pane open in the direction that provides the most surface area.
        // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
        // To learn more about panes, visit https://aka.ms/terminal-panes
        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" },

        { "command" : "closeTab", "keys" : [ "ctrl+w" ] },
        { "command" : "newTab", "keys" : [ "ctrl+t" ] },
        { "command": "nextTab", "keys": "ctrl+tab" },
        { "command": "prevTab", "keys": "ctrl+shift+tab" },
        { "command": "duplicateTab", "keys": "ctrl+shift+d" },

        { "command": { "action": "newTab", "index": 0 }, "keys": "ctrl+shift+1" },
        { "command": { "action": "newTab", "index": 1 }, "keys": "ctrl+shift+2" },
        { "command": { "action": "newTab", "index": 2 }, "keys": "ctrl+shift+3" },
        { "command": { "action": "newTab", "index": 3 }, "keys": "ctrl+shift+4" },
        { "command": { "action": "newTab", "index": 4 }, "keys": "ctrl+shift+5" },
        { "command": { "action": "newTab", "index": 5 }, "keys": "ctrl+shift+6" },
        { "command": { "action": "newTab", "index": 6 }, "keys": "ctrl+shift+7" },
        { "command": { "action": "newTab", "index": 7 }, "keys": "ctrl+shift+8" },
        { "command": { "action": "newTab", "index": 8 }, "keys": "ctrl+shift+9" },

        { "command": { "action": "switchToTab", "index": 0 }, "keys": "alt+1" },
        { "command": { "action": "switchToTab", "index": 1 }, "keys": "alt+2" },
        { "command": { "action": "switchToTab", "index": 2 }, "keys": "alt+3" },
        { "command": { "action": "switchToTab", "index": 3 }, "keys": "alt+4" },
        { "command": { "action": "switchToTab", "index": 4 }, "keys": "alt+5" },
        { "command": { "action": "switchToTab", "index": 5 }, "keys": "alt+6" },
        { "command": { "action": "switchToTab", "index": 6 }, "keys": "alt+7" },
        { "command": { "action": "switchToTab", "index": 7 }, "keys": "alt+8" },
        { "command": { "action": "switchToTab", "index": 8 }, "keys": "alt+9" },

        { "command": "closePane", "keys": "alt+shift+w" },
        { "command": { "action": "moveFocus", "direction": "left" }, "keys": "alt+ctrl+h" },
        { "command": { "action": "moveFocus", "direction": "right" }, "keys": "alt+ctrl+l" },
        { "command": { "action": "moveFocus", "direction": "down" }, "keys": "alt+ctrl+j" },
        { "command": { "action": "moveFocus", "direction": "up" }, "keys": "alt+ctrl+k" },
        // { "command": { "action": "resizePane", "direction": "left" }, "keys": "alt+shift+h" },
        // { "command": { "action": "resizePane", "direction": "right" }, "keys": "alt+shift+l" },
        // { "command": { "action": "resizePane", "direction": "down" }, "keys": "alt+shift+j" },
        // { "command": { "action": "resizePane", "direction": "up" }, "keys": "alt+shift+k" },
        { "command": { "action": "splitPane", "split": "horizontal"}, "keys": "alt+shift+-" },
        { "command": { "action": "splitPane", "split": "vertical"}, "keys": "alt+shift+plus" }
    ]
}

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