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 Get-HexValue { | |
param( | |
[Parameter(Mandatory=$true)] | |
[Char]$Character, | |
[ValidateSet("ASCII","BigEndianUnicode","Default","Unicode","UTF32","UTF7","UTF8")] | |
[String]$Encoding = "Unicode" | |
) | |
$E = [Text.Encoding]::$Encoding | |
$Bytes = $E.GetBytes($Character) |
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
$CfgData =@{ | |
AllNodes =@( | |
@{ | |
NodeName = $Env:Computername; | |
PSDscAllowPlainTextPassword = $true; | |
} | |
) | |
} | |
configuration TestFile { |
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
try { | |
$MyProcess = New-Object System.Diagnostics.Process | |
$MyProcess.StartInfo.FileName = "c:\MyProcess.exe" | |
$MyProcess.StartInfo.Arguments = "arguments for process" | |
$MyProcess.StartInfo.UseShellExecute = $false | |
$MyProcess.StartInfo.RedirectStandardInput = $true | |
$MyProcess.Start() | |
$StdIn = $MyProcess.StandardInput | |
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
[Reflection.Assembly]::LoadWithPartialName("System.Speech") > $null | |
function InitGrammar { | |
param( | |
$Attention, | |
$CommandArray | |
) | |
$choices = new-object System.Speech.Recognition.Choices($CommandArray) |
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 Test-Function { | |
param( | |
[Parameter(Mandatory=$true,ValueFromPipeline=$true)] | |
[ValidateNotNull()] | |
[System.Management.Automation.FunctionInfo]$Function, | |
[switch]$IgnoreWarnings, | |
[switch]$IgnoreMissingHelp | |
) |
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
<# | |
.SYNOPSIS | |
Start a web server that will route requests to a series of script blocks as defined by the -Routes parameter. | |
.DESCRIPTION | |
Starts a single-threaded web server and responds to requests by executing the script blocks that are | |
defined as routes on the command line. | |
.NOTES | |
Copyright 2013 Chris Duck |
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 Get-ClipboardAsCsv { | |
param( | |
[Parameter(Mandatory=$false)] | |
[char]$Delimiter, | |
[Parameter(Mandatory=$false)] | |
[ValidateNotNullOrEmpty()] | |
[string[]]$Header | |
) | |
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") > $null | |
$ms = [Windows.Forms.clipboard]::getdata([Windows.Forms.DataFormats]::CommaSeparatedValue) |
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
<# | |
.DESCRIPTION | |
Converts an image to ASCII art. | |
.PARAMETER Path | |
The path to an image file to convert to ASCII. This can be any image format supported by System.Drawing.Bitmap. | |
.PARAMETER Uri | |
The URI for an image to download and convert to ASCII. This can be any image format supported by System.Drawing.Bitmap. | |
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
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic") > $Null | |
$Watchers = @{} | |
$TabCollectionChangedEvent = { | |
$EventArgs.NewItems | %{ | |
Register-ObjectEvent -InputObject $_.Files -EventName CollectionChanged -Action $FileCollectionChangedEvent | |
} | |
} | |
$FileCollectionChangedEvent = { |
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
import java.util.zip.* | |
String backupFile = "c:\\backup.ab"; | |
String outFile = "c:\\backup.tar"; | |
int skip = 0; | |
System.setProperty("line.separator", (String)(char)10); | |
File f = new File(backupFile); | |
FileInputStream fis = new FileInputStream(f); | |
InputStreamReader sr = new InputStreamReader(fis); |
OlderNewer