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 Set-Shortcut | |
{ | |
[CmdletBinding()] | |
param ( | |
[string] $ShortcutPath, | |
[string] $TargetPath | |
) | |
$WshShell = New-Object -ComObject WScript.Shell | |
$Shortcut = $WshShell.CreateShortcut($PSCmdlet.GetUnresolvedProviderPathFromPSPath($ShortcutPath)) | |
$Shortcut.TargetPath = $PSCmdlet.GetUnresolvedProviderPathFromPSPath($TargetPath) |
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
; Open / Bring to Front / Minimize Program | |
; For hotkey syntax - https://autohotkey.com/docs/Hotkeys.htm | |
; Example Alt-C to open Conemu | |
!c::OpenProgram("c:\PortableApps\ConEmu64.exe") | |
ToggleWindow(TheWindowTitle) | |
{ | |
SetTitleMatchMode,2 | |
DetectHiddenWindows, Off |
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
#Powershell concept for Revese Polish Notation | |
#Based on ealier JS and Java variants: http://codepen.io/xainey/pen/ojbZdj | |
function Solve-RPN | |
{ | |
[CmdletBinding()] | |
[OutputType([System.Double])] | |
param | |
( | |
[parameter(Mandatory = $true)] |
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
// A task runner that invokes Pester to run all Pester tests under the | |
// current workspace folder. | |
// NOTE: This Pester task runner requires an updated version of Pester (>=3.4.0) | |
// in order for the problemMatcher to find failed test information (message, line, file). | |
// If you don't have that version, you can update Pester from the PSGallery like so: | |
// | |
// PS C:\> Update-Module Pester | |
// | |
// If that gives an error like: |
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
# Concept Based Off Faker: https://github.com/fzaninotto/Faker | |
function Random-Name | |
{ | |
[CmdletBinding()] | |
[OutputType([System.Double])] | |
param | |
( | |
[parameter(Mandatory = $false)] | |
[ValidateSet('male', 'female')] |
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
/* | |
Create an application named MarketDemo that creates instance of class Stock. | |
This class can contain collection of objects of a class Fruit or Vegetable, or Beverage (use generics). | |
Class Stock must contain a method of displaying goods and a method of sorting by price. | |
Each class must contain | |
* constructors (with parameters and without parameters), | |
* properties (title, price, weight) | |
* overridden method ToString. | |
*/ |
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 SIDtoUsername($sid) | |
{ | |
$objSID = New-Object System.Security.Principal.SecurityIdentifier($sid) | |
$objUser = $objSID.Translate( [System.Security.Principal.NTAccount]) | |
return $objUser.Value | |
} | |
function getPrinters($computer) | |
{ | |
$spacer = "-" * 99 |
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
$Adder = { | |
param ([int] $x) | |
return ( | |
{ | |
param ([string] $y) | |
return ($x + $y) | |
}.GetNewClosure() | |
) | |
} |
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 Send-WakeOnLan | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$True, Position=1, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] | |
[Alias("Name")] | |
[string[]] $ComputerName | |
) | |
Begin |
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
<# | |
Lagrange Interpolation Example | |
#> | |
function Point($x, $y) | |
{ | |
return [pscustomobject]@{ | |
PSTypeName = 'Point' | |
x = $x | |
y = $y |
OlderNewer