Skip to content

Instantly share code, notes, and snippets.

View akordowski's full-sized avatar

Artur Kordowski akordowski

  • Hamburg, Germany
  • 08:42 (UTC +01:00)
View GitHub Profile
@akordowski
akordowski / RenameWslDistro.ps1
Last active February 18, 2025 08:59
RenameWslDistro.ps1
function Rename-WslDistro {
param (
[string]$OldDistroName,
[string]$NewDistroName
)
Clear-Host
Write-Warning "This function performs a rename operation on the Windows Registry."
$confirm = Read-Host "Do you want to proceed? (y/n)"
@akordowski
akordowski / OpenWithVSCode.ps1
Created February 22, 2023 09:06
Add "Open with VSCode" to Windows Explorer Context Menu (including folders)
Clear-Host
$PATH = "C:\Users\<USERNAME>\AppData\Local\Programs\Microsoft VS Code\Code.exe"
Write-Host "Add for all file types" -ForegroundColor Green
REG ADD "HKEY_CLASSES_ROOT\*\shell\VSCode" /ve /t REG_EXPAND_SZ /d "Open with Code" /f
REG ADD "HKEY_CLASSES_ROOT\*\shell\VSCode" /v "Icon" /t REG_EXPAND_SZ /d "$PATH" /f
REG ADD "HKEY_CLASSES_ROOT\*\shell\VSCode\command" /ve /t REG_EXPAND_SZ /d """$PATH"" ""%1""" /f
Write-Host "Add for directories" -ForegroundColor Green
@akordowski
akordowski / OpenWithSublimeText.ps1
Created February 22, 2023 09:02
Add "Open with Sublime Text" to Windows Explorer Context Menu (including folders)
Clear-Host
$PATH = "C:\Program Files\Sublime Text\sublime_text.exe"
Write-Host "Add for all file types" -ForegroundColor Green
REG ADD "HKEY_CLASSES_ROOT\*\shell\SublimeText" /ve /t REG_EXPAND_SZ /d "Open with Sublime Text" /f
REG ADD "HKEY_CLASSES_ROOT\*\shell\SublimeText" /v "Icon" /t REG_EXPAND_SZ /d "$PATH" /f
REG ADD "HKEY_CLASSES_ROOT\*\shell\SublimeText\command" /ve /t REG_EXPAND_SZ /d """$PATH"" ""%1""" /f
Write-Host "Add for directories" -ForegroundColor Green
@akordowski
akordowski / AssemblyInfo.props
Created March 15, 2018 08:18
MSBuild AssemblyInfo Properties
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<In>$([System.IO.File]::ReadAllText('$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs'))</In>
<Pattern>^\s*\[assembly: AssemblyVersion\(\D*(\d+)\.(\d+)\.(\d+)\.(\d+)</Pattern>
<AssemblyVersionMajor>$([System.Text.RegularExpressions.Regex]::Match($(In), $(Pattern), System.Text.RegularExpressions.RegexOptions.Multiline).Groups[1].Value)</AssemblyVersionMajor>
<AssemblyVersionMinor>$([System.Text.RegularExpressions.Regex]::Match($(In), $(Pattern), System.Text.RegularExpressions.RegexOptions.Multiline).Groups[2].Value)</AssemblyVersionMinor>
<AssemblyVersionPatch>$([System.Text.RegularExpressions.Regex]::Match($(In), $(Pattern), System.Text.RegularExpressions.RegexOptions.Multiline).Groups[3].Value)</AssemblyVersionPatch>
<AssemblyVersionBuild>$([System.Text.RegularExpressions.Regex]::Match($(
@akordowski
akordowski / MSBuild.props
Last active March 15, 2018 08:19
MSBuild Reserved and Well-Known Properties
<Message Text="MSBuildBinPath: $(MSBuildBinPath)" />
<Message Text="MSBuildExtensionsPath: $(MSBuildExtensionsPath)" />
<Message Text="MSBuildExtensionsPath32: $(MSBuildExtensionsPath32)" />
<Message Text="MSBuildExtensionsPath64: $(MSBuildExtensionsPath64)" />
<Message Text="MSBuildLastTaskResult: $(MSBuildLastTaskResult)" />
<Message Text="MSBuildNodeCount: $(MSBuildNodeCount)" />
<Message Text="MSBuildProgramFiles32: $(MSBuildProgramFiles32)" />
<Message Text="MSBuildProjectDefaultTargets: $(MSBuildProjectDefaultTargets)" />
<Message Text="MSBuildProjectDirectory: $(MSBuildProjectDirectory)" />
<Message Text="MSBuildProjectDirectoryNoRoot: $(MSBuildProjectDirectoryNoRoot)" />
@akordowski
akordowski / gist:8a2b89d2216aa91e9960
Created March 31, 2015 16:18
Disable/enable Mac start sound
Disable
sudo nvram SystemAudioVolume=%00
Enable
sudo nvram -d SystemAudioVolume