This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function w2l($in) { | |
if ( $in -match "(^[a-zA-Z]:(\\{1,2})?$|^[a-zA-Z]:\\{1,2}[^\\])") { | |
$in = "/mnt/" + $in.Substring(0, 1).ToLower() + $in.Substring(2).Replace('\\', '/').Replace('\', '/') | |
} elseif ( $in -match "(^\.(\\{1,2})?$|^\.\\{1,2}[^\\])") { | |
$in = $in.Replace('\\', '/').Replace('\', '/') | |
} | |
return $in | |
} | |
function l2w($in) { | |
if ( $in -match "(^/mnt/[a-z]/?|^/mnt/[a-z]/[^/])") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost { | |
tls {$USERPROFILE}/.local-ca/devserver.crt {$USERPROFILE}/.local-ca/devserver.key | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\Cmder Here\command] | |
@="\"C:\\<<application path>>\\Cmder64.exe\" -here -run {powershell} -cur_console:n:d:\"%V\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LxssManager] | |
"DistributionFlags"=dword:fffffffd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-Date | Add-Content ~/.path -Encoding utf8 | |
[environment]::getEnvironmentVariable("PATH", "User") | Add-Content ~/.path -Encoding utf8 | |
[environment]::getEnvironmentVariable("PATH", "Machine") | Add-Content ~/.path -Encoding utf8 | |
"`r`n" | Add-Content ~/.path -Encoding utf8 | |
$saving = 20 | |
$maxline = 5 * $saving | |
$contents = Get-Content ~/.path | |
if ($contents.length -gt $maxline) { | |
$contents | Select-Object -Skip ($contents.length - $maxline) | Set-Content -Encoding utf8 ~/.path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setenv($key, $value, $target) { | |
if (! $target) { | |
$target = "User" | |
} | |
if (($target -eq "Process") -Or ($target -eq "User") -Or ($target -eq "Machine")) { | |
$now = [environment]::getEnvironmentVariable($key, $target) | |
if ($now) { | |
$tChoiceDescription = "System.Management.Automation.Host.ChoiceDescription" | |
$result = $host.ui.PromptForChoice("", "Already Exists. Overwrite ?", @( | |
New-Object $tChoiceDescription ("&Yes") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## article - https://qiita.com/drafts/f500f261d1292ebe2941 | |
function gh { | |
Param( | |
[ValidateSet("show","open","clone","find","grep","get","rm","cd","pushd","dir","edit","pwd","list","ls","register","create")][Parameter(Mandatory=$false)][string]$subcommand, | |
[Parameter(Mandatory=$false)][switch]$g, # globally (public) | |
[Parameter(Mandatory=$false)][switch]$e, # edit | |
[Parameter(Mandatory=$false)][switch]$d, # directory | |
[Parameter(Mandatory=$false)][switch]$r, # remote | |
[Parameter(Mandatory=$false)][switch]$p, # purge |