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
<# | |
This may not work properly or completely in all PowerShell hosts. Because the function | |
relies on Get-CimInstance it will not work on Linux platforms. | |
It is also admittedly not speedy as it is doing a lot of stuff, although there is an | |
attempt to cache some information which gets updated every 15 minutes. | |
To use, dot source this script in your PowerShell profile to make it your default prompt. | |
Sample prompt: |
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
<# | |
.SYNOPSIS | |
Wrap commands with DebuggerNonUserCode attribute to prevent the PowerShell debugger stepping into them | |
.DESCRIPTION | |
Generates proxy functions that wrap the original commands, and put an attribute on the proxy to prevent the debugger stopping. | |
.EXAMPLE | |
Get-Command -Module Pester | Hide-FromDebugger | |
Hides all pester functions from the debugger, so you can debug in your code without stepping into Pester functions. | |
#> |
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
[CmdletBinding()] | |
param( | |
[System.Management.Automation.CommandMetadata] | |
$Command | |
) | |
begin { | |
$ProxyFactory = [System.Management.Automation.ProxyCommand] | |
<# | |
class TraceInformation { | |
[String]$Message |
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) 2014, Joel Bennett | |
// Licensed under MIT license | |
using System; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using Microsoft.Win32.SafeHandles; | |
using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; | |
namespace CredentialManagement | |
{ |
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
#Requires -version 2.0 | |
## Stupid PowerShell Tricks | |
################################################################################################### | |
add-type @" | |
using System; | |
using System.Runtime.InteropServices; | |
public class Tricks { | |
[DllImport("user32.dll")] | |
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); | |
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-ParameterValue { | |
#.Synopsis | |
# Get the actual values of parameters which have manually set (non-null) default values or values passed in the call | |
#.Description | |
# Unlike $PSBoundParameters, the hashtable returned from Get-ParameterValues includes non-empty default parameter values. | |
# NOTE: Default values that are the same as the implied values are ignored (e.g.: empty strings, zero numbers, nulls). | |
#.Example | |
# function Test-Parameters { | |
# [CmdletBinding()] | |
# param( |
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
; ---------------------------------------------------------------------------------------------------------------------- | |
; Name ..........: TrayIcon library | |
; Description ...: Provide some useful functions to deal with Tray icons. | |
; AHK Version ...: AHK_L 1.1.13.01 x32/64 Unicode | |
; Original Author: Sean (http://goo.gl/dh0xIX) (http://www.autohotkey.com/forum/viewtopic.php?t=17314) | |
; Update Author .: Cyruz (http://ciroprincipe.info) (http://ahkscript.org/boards/viewtopic.php?f=6&t=1229) | |
; Mod Author ....: Fanatic Guru | |
; License .......: WTFPL - http://www.wtfpl.net/txt/copying/ | |
; Version Date...: 2014 - 01 - 16 | |
; Note ..........: Many people have updated Sean's original work including me but Cyruz's version seemed the most straight |
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 Add-Parameter { | |
[CmdletBinding()] | |
param( | |
[Parameter(Position = 0)] | |
[Management.Automation.RuntimeDefinedParameterDictionary] | |
$Dictionary = @{}, | |
[Parameter(Position = 1, Mandatory, ValueFromPipeline)] | |
[Management.Automation.RuntimeDefinedParameter]$Parameter | |
) |
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 Convert-CodeCoverage { | |
<# | |
.SYNOPSIS | |
Convert the file name and line numbers from Pester code coverage of "optimized" modules to the source | |
.EXAMPLE | |
Invoke-Pester .\Tests -CodeCoverage (Get-ChildItem .\Output -Filter *.psm1).FullName -PassThru | | |
Convert-CodeCoverage -SourceRoot .\Source -Relative | |
Runs pester tests from a "Tests" subfolder against an optimized module in the "Output" folder, | |
piping the results through Convert-CodeCoverage to render the code coverage misses with the source paths. |
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 Out-HtmlTable { | |
[CmdletBinding()] | |
param( | |
[Parameter(ValueFromPipeline)] | |
$InputObject | |
) | |
begin { | |
$Buffer = [System.Collections.ArrayList]::new() | |
if($InputObject) { |