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
# adapted from http://hg.python.org/cpython/file/2.7/Lib/getopt.py | |
# argv: | |
# array of arguments | |
# shortopts: | |
# string of single-letter options. options that take a parameter | |
# should be follow by ':' | |
# longopts: | |
# array of strings that are long-form options. options that take | |
# a parameter should end with '=' | |
# returns @(opts hash, remaining_args array, error string) |
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
## Convert-StarDate.ps1 | |
#Requires -Version 3 | |
<# | |
.SYNOPSIS | |
Calculates the stardate. | |
.DESCRIPTION | |
Returns the current stardate with no parameters, or you can enter a specific date as a string or as a DateTime ` | |
object and Get-Stardate will return the stardate for that time. |
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-LinkTarget.ps1 | |
# Note: Script should be symlinked as follows: | |
# Get-LinkTarget.ps1 -> Resolve-UNCPath.ps1 | |
# Get-LinkTarget.ps1 -> Resolve-JunctionPath.ps1 | |
# Get-LinkTarget.ps1 -> Resolve-HardlinkPath.ps1 | |
# Get-LinkTarget.ps1 -> Resolve-SymlinkPath.ps1 | |
# Get-LinkTarget.ps1 -> Resolve-ReparsePointPath.ps1 | |
function Global:Get_UNCPath($l_dir) | |
{ |
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
############################################################################################################################################ | |
## Prompt ## | |
############################################################################################################################################ | |
Clear-Host | |
[ScriptBlock]$Prompt = { | |
$origLastExitCode = $global:LASTEXITCODE | |
Set-StrictMode -Version 'Latest' | |
$gitLoaded = $false # skip stupid git module, adds ~1000ms to startup time. |
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
## File: Get-FileAttributesEx.ps1 | |
<# | |
.SYNOPSIS | |
Lists NTFS file or folder attributes and flags. | |
.DESCRIPTION | |
Lists many undocumented or otherwise inaccessible file attributes and flags. | |
.PARAMETER Path | |
Path to file(s)/folder(s) to list properties. Wildcards and hidden or system files are supported. | |
.INPUTS System.Management.Automation.PathInfo, System.String | |
You can pipe PathInfo objects or strings that contain paths to this cmdlet. |
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-Clipboard.ps1 - Gets clipboard content if content type is text. | |
Note: Conflicts/replaces Pscx\Get-Clipboard which doesn't work in powershell >= 6 | |
#> | |
function Get-ClipboardText([switch][Alias("S*","L*")]$SplitLF) { | |
Set-StrictMode -Version 'Latest' | |
if($SplitLF) { | |
# Note: Newline CRLF/CR/LF handling should be automatic, but just in case... | |
$cmd = { | |
Add-Type -Assembly PresentationCore |
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
<# | |
volume.ps1 - Get/Set IAudioEndpointVolume | |
Note: Get-Volume/Set-Volume conflicts with Storage\MSFT_Volume | |
#> | |
function GetSet-Volume { | |
Param( | |
[Parameter(mandatory=$false)] [float] [ValidateRange(0.000,1.000)] $Value, | |
[Alias("M*","U*")] [switch] $Mute | |
) |
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-WSLPaths | |
<# | |
.SYNOPSIS | |
Gets paths and names of WSL distributions installed from Windows Store. | |
If no parameters supplied, it prints all installed WSL distributions. | |
.EXAMPLE | |
PS> Get-WSLPaths debian | |
PackageFullName : TheDebianProject.DebianGNULinux_1.1.6.0_x64__76v4gfsz19hv4 | |
InstallLocation : C:\Program Files\WindowsApps\TheDebianProject.DebianGNULinux_1.1.6.0_x64__76v4gfsz19hv4 | |
rootfsPSPath : ${env:LOCALAPPDATA}\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState\rootfs |
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
# Remove-Bloatware.ps1 | |
#Requires -Version 3 | |
#Requires -Modules Appx | |
#Requires -RunAsAdministrator | |
$ErrorActionPreference = 'Continue' | |
$VerbosePreference = 'Continue' | |
$apps = @( |
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 tofileio { | |
[ -f "$1" ] && { | |
local filename="$1" Uri='https://file.io/'; | |
curl -sL -F file=@"$filename" -H accept: application/json "$Uri" | { jq -r .link 2>/dev/null || cat; } | |
} | |
} | |
#> | |
function ToFileIO { | |
if (Test-Path $args[0] -type Leaf) { |
NewerOlder