This file contains hidden or 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
[appdomain]::CurrentDomain.GetAssemblies() | ForEach { | |
Try { | |
$_.GetExportedTypes() | Where { | |
$_.Fullname -match 'Exception' | |
} | |
} Catch {} | |
} | Select FullName |
This file contains hidden or 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
# Copyright: (c) 2021, Jordan Borean (@jborean93) <[email protected]> | |
# MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
Function Get-ModernCredential { | |
<# | |
.SYNOPSIS | |
Modern credential prompt. | |
.DESCRIPTION | |
Uses the modern Windows credential prompt to build a credential object. |
This file contains hidden or 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 Get-CommandSourceCode | |
{ | |
<# | |
.SYNOPSIS | |
Get SourceCode of an powershell cmdlet | |
.DESCRIPTION | |
Get SourceCode of an powershell cmdlet | |
.PARAMETER Command | |
Must be a valid powershell cmdlet/function | |
.EXAMPLE |
This file contains hidden or 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
// LICENSE | |
// ======= | |
// Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved. | |
// ------- | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation | |
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, | |
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the | |
// Software is furnished to do so, subject to the following conditions: | |
// ------- | |
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the |
This file contains hidden or 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
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
This file contains hidden or 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
// The MIT License(MIT) | |
// | |
// Copyright(c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of | |
// this software and associated documentation files(the "Software"), to deal in | |
// the Software without restriction, including without limitation the rights to | |
// use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of | |
// the Software, and to permit persons to whom the Software is furnished to do so, | |
// subject to the following conditions : |
This file contains hidden or 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Name | |
merge_gdl_archives - merge multiple download archives into one | |
Usage | |
merge_gdl_archives.py merged.sqlite old1.sqlite old2.sqlite ... | |
""" |
This file contains hidden or 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
0..10 | ForEach-Object { | |
Measure-Command {&{ | |
$fileA = (Get-Item .\lorem1.txt).OpenRead() | |
$fileB = (Get-Item .\lorem2.txt).OpenRead() | |
for(($i = 0), ($z = 0); $i -lt $fileA.Length -or $z -lt $fileB.Length; $i++, $z++) { | |
if(-not $fileA.ReadByte().Equals($fileB.ReadByte())) { | |
break | |
} | |
} |
This file contains hidden or 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 Join-Array { | |
[CmdletBinding()] | |
param( | |
[parameter(ValueFromPipeline, Mandatory)] | |
[object[]] $InputObject, | |
[parameter(Mandatory)] | |
[string[]] $Columns | |
) |
This file contains hidden or 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
<# | |
A time estimator for use with PowerShell's Write-Progress. Provided a total | |
number of cycles, it tracks how long the last 100 or less itterations of your | |
main loop took and calculates the remaining time based on velocity. Note: when | |
ticks exceed total, it returns a seconds remaining of 0, but continues to track | |
the rate that work is getting done. | |
The intended use case is with Write-Progress, calls to that cmdlet are really | |
slow on PowerShell 2-5, efforts have been made to maintain low overhead. If | |
you're after performance this is still useful, just log the progress yourself. | |
For instance, using [System.Diagnostics.Trace]::Write() and watching with |