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
; joyfocus 1.1 LazyTech | |
; A public domain work under the UnLicense. See LICENSE for details. | |
#Persistent | |
axesToWatch := { 2JoyX: 0, 2JoyY: 0, 2JoyZ: 0, 2JoyU: 0, 2JoyR: 0, 2JoyV: 0, 3JoyX: 0, 3JoyY: 0, 3JoyZ: 0, 3JoyR: 0, 3JoyU: 0, 3JoyV: 0} | |
for key, val in axesToWatch | |
{ | |
axesToWatch[key] := GetKeyState(key) | |
} | |
SetTimer, WatchAxis, 100 ; milliseconds |
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 TabExpansion2 | |
{ | |
<# Options include: | |
RelativeFilePaths - [bool] | |
Always resolve file paths using Resolve-Path -Relative. | |
The default is to use some heuristics to guess if relative or absolute is better. | |
To customize your own custom options, pass a hashtable to CompleteInput, e.g. | |
return [System.Management.Automation.CommandCompletion]::CompleteInput($inputScript, $cursorColumn, | |
@{ RelativeFilePaths=$false } |
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
$list = @" | |
1 Partridge in a pear tree | |
2 Turtle Doves | |
3 French Hens | |
4 Calling Birds | |
5 Golden Rings | |
6 Geese a laying | |
7 Swans a swimming | |
8 Maids a milking | |
9 Ladies dancing |
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 | |
{ | |
$path = '%system.teamcity.build.checkoutDir%' | |
Set-Location $path | |
$psd1 = Join-Path $path Pester.psd1 | |
Import-Module $psd1 -ErrorAction Stop | |
$xml = Join-Path $path Test.Version.xml |
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
# Add an enum with All constant | |
Add-Type -TypeDefinition @' | |
using System; | |
[Flags] | |
public enum EnumSample | |
{ | |
One, | |
Two, | |
Three, |
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
Add-Type -TypeDefinition @' | |
using System; | |
[Flags] | |
public enum MyEnum | |
{ | |
Option1 = 0x1, | |
Option2 = 0x2, | |
Option3 = 0x4, | |
All = Option1 | Option2 | Option3 |
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.exe -NonInteractive -ExecutionPolicy Bypass -NoProfile -File "%~dp0\SetupComplete.ps1" |
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
$funky = '010500000000000515000000AA7045F3F11474788C4A5F8AE9030000' | |
try | |
{ | |
$bytes = [byte[]]@( | |
for ($i = 0; $i -lt $funky.Length - 1; $i += 2) | |
{ | |
[byte]::Parse($funky.Substring($i, 2), [System.Globalization.NumberStyles]::AllowHexSpecifier) | |
} | |
) |
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 ConvertTo-Hashtable | |
{ | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
[psobject[]] $InputObject | |
) | |
process | |
{ |
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 the stuff you'll be testing. Could be dot-sourcing a ps1 file here, importing a module, whatever you need. | |
# If importing a mdoule, make sure you've only got one copy of it imported, or weird things can happen when you start | |
# to get into mocking. | |
Remove-Module [S]omeDscResource | |
Import-Module $PSScriptRoot\SomeDscResource.psm1 | |
# All of the Pester tests in a script must go inside a Describe block; you can mave many Describe blocks in the same | |
# script, if you like. Make sure to put the opening brace on the same line as Describe, since this is just a function | |
# pretending to be a keyword; no assistance from the parser allowing us to put opening braces on their own lines. |
NewerOlder