December 01, 2021

Simplify folder navigation in windows terminal powershell


Open settings json file in windows terminal (ctrl+shift+,), find "actions" json array, add two commands (don't forget about preceding coma):

        {
            "command":
            {
                "action": "sendInput",
                "input": "cd ..\r"
            },
            "keys": "alt+up"
        },
        {
            "command":
            {
                "action": "sendInput",
                "input": "cd \u0000"
            },
            "keys": "alt+down"
        }

From now on pressing Alt+Up will go one level up (like in Windows Explorer) and pressing Alt+Down will bring powershell hint for switching the directory:






The trick here is to use \u0000 which is a terminal equivalent of pressing Ctrl+Space. It is applicable only to powershell, since there is no directory browsing feature in a regular cmd.

January 04, 2021

How to remove all local git branches except master through Powershell

 git branch -D @(git branch --format '%(refname:lstrip=2)' | where {$_ -ne 'master'} )

October 16, 2020

How to remove annoying items from windows explorer context menu

Menu items should be removed from registry.


Share with skype:
Remove HKEY_CLASSES_ROOT\*\shell\Share with skype
Remove HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PackagedCom\Package\Microsoft.SkypeApp(XXXXXXX and so on)\Class\{xxxxxx}
Create a new string key to forbid Skyep to create this menu again HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked\{776DBC8D-7347-478C-8D71-791E12EF49D8}

Move to OneDrive:
Create a new string key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked\{CB3D0F55-BC2C-4C1A-85ED-23ED75B5106B}

October 07, 2020

Deterministic builds for .NET in .csproj

There is a feature to produce equivalent byte output for the same code https://gist.github.com/aelij/b20271f4bd0ab1298e49068b388b54ae

To setup it in csproj file there should be next section:

<PropertyGroup>
  <Deterministic>true</Deterministic>
  <PathMap>$(MSBuildProjectDirectory)=C:\</PathMap>
</PropertyGroup>

August 21, 2020

April 06, 2017

Create and checkout branch in git

git checkout -b new_branch_name

April 05, 2017

Restart machine remotely

shutdown /r /m \\machine.name /d p:4:1 /c "1"