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 | |
A PowerShell game inspired by the Fallout hacking minigame. | |
.DESCRIPTION | |
This is a PowerShell game inspired by the Fallout hacking minigame. | |
The game is played by guessing the password of a computer terminal. | |
The player has a limited number of attempts to guess the password. | |
After each guess, the game will display the number of correct letters. | |
The player can use this information to narrow down the list of possible passwords. | |
The game has multiple difficulty levels. The higher the level, the longer the passwords to guess become. |
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
# Windows PowerShell (5.1) script | |
# Watch top-level window creation and log window name, process ID and process name. | |
Add-Type -ReferencedAssemblies UIAutomationClient, UIAutomationTypes -TypeDef @' | |
using System; | |
using System.Windows.Automation; | |
public class WindowWatcher | |
{ | |
public static void Watch() |
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 | |
Sets chapters to a video file using a timestamp file. | |
.DESCRIPTION | |
This function sets chapters to a video file using a timestamp file. The output file will have the same format and codec as the input file, | |
but with the chapters metadata added. | |
.PARAMETER Path | |
The path of the input video file. |
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 | |
Split an audio or video file into multiple audio files based on a time stamp file. | |
.DESCRIPTION | |
This script uses FFmpeg to extract parts of an audio or video file into separate audio files based on the time stamps in the time stamp file. | |
The function also supports creating a playlist (m3u8) for the extracted audio tracks. | |
.PARAMETER Path | |
The path to the input audio or video file. |
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 demo to self-elevate a script | |
# - Makes sure parameters are properly forwarded to the elevated script (preserving argument types and spaces in string arguments). | |
# - Passes the current directory to elevated script. | |
param( | |
[string] $Foo, | |
[int] $Bar | |
) | |
# Self-elevate the script if required | |
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { |
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 | |
List registry string values that unexpectedly contain embedded null characters. | |
.DESCRIPTION | |
Enumerates the given registry key recursively, outputting information about all registry string values (REG_SZ and REG_EXPAND_SZ) | |
that unexpectedly contain embedded null characters. | |
.PARAMETER Hive | |
The registry hive. |
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
class MyObject1 { | |
[string] $Name | |
[int] $Foo | |
} | |
class MyObject2 { | |
[string] $Name | |
[int] $Bar | |
} |
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 Write-Log { | |
param( | |
[Parameter(ValueFromPipeline, Mandatory)] | |
[object] $InputObject, | |
[parameter(Mandatory)] | |
[string] $Path, | |
[parameter()] | |
[switch] $PassThru |
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
/* Copyright 2022 zett42 | |
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 Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
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
using System; | |
using System.Linq; | |
using BenchmarkDotNet.Running; | |
using BenchmarkDotNet.Attributes; | |
using System.Text.RegularExpressions; | |
namespace Benchmark_IndexOfFirstNonWhitespaceChar { | |
class Program { | |
static void Main( string[] args ) { |
NewerOlder