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-BashArguments { | |
| [CmdletBinding()] | |
| [OutputType([PSObject[]])] | |
| param( | |
| [Parameter(Mandatory = $true)] | |
| # Path to a bash script | |
| [string[]] | |
| $Path | |
| ) |
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
| # Make sure to backup your profile, just in case that Elgato changes the file format. | |
| # Scroll down to bottom to see example use case. | |
| function Update-Profiles { | |
| <# | |
| .SYNOPSIS | |
| Replaces outputType in all Stream Deck profiles for Elgato's Soundboard plugin. | |
| .DESCRIPTION |
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 5.1 -RunAsAdministrator | |
| function Remove-XHunter1 { | |
| param () | |
| Stop-Service xhunter1 -Force -NoWait -Confirm:$false | |
| Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Services\xhunter1" -ErrorAction SilentlyContinue | |
| Remove-Item -Path "C:\Windows\xhunter1.sys" -Force -ErrorAction SilentlyContinue | |
| } | |
| function Test-XHunter1 { |
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 Write-Log { | |
| <# | |
| .SYNOPSIS | |
| Standard Event Log entry writer | |
| .DESCRIPTION | |
| Writes an entry to the local system's Event Log in a predictable and dependable way. | |
| .INPUTS | |
| None | |
| .OUTPUTS | |
| None |
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 Start-SleepProgressBar { | |
| <# | |
| .SYNOPSIS | |
| A Start-Sleep alternative that prints a progress bar with a spinning wheel at the end. | |
| .DESCRIPTION | |
| A Start-Sleep alternative that prints a progress bar with a spinning wheel at the end. | |
| See: https://github.com/tonsky/FiraCode | |
| .PARAMETER Seconds | |
| Duration in seconds to wait. | |
| .PARAMETER NoBar |
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
| #!/usr/bin/env bash | |
| # MacOS Condition on Low Disk Space. Pass a number such as 90 as an argument, and if the exit code is 1, then a drive is over 90%. | |
| # This exludes any mounted dmg's, USB drives, or cdrom/dvd. | |
| Percentage=$1 | |
| IsOver=$(df -H | grep -vE '^Filesystem|tmpfs|cdrom|loop|devfs|map| \/Volumes' | awk '{ print substr($5,1,length($5)-1) }' | awk -v p=$Percentage -F: '{if($1>p){print 1}else{print 0}}' | grep 1 | tail -n1) | |
| exit "$IsOver" |
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-Parameters { | |
| param( | |
| # Path to a .ps1 script | |
| [string]$Path | |
| ) | |
| begin {} | |
| process { | |
| $ScriptPath = Get-Item -Path $Path | |
| $ScriptCommand = Get-Command $ScriptPath | |
| $ScriptBlock = $ScriptCommand.ScriptBlock |
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
| # No GetNewClosure - print $a as what ever it is before printing | |
| & { | |
| $a = 10 | |
| $myScript = { | |
| $a | |
| } | |
| & $myScript | |
| $a = 20 | |
| & $myScript |
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
| <%# | |
| kind: provision | |
| name: Preseed default | |
| model: ProvisioningTemplate | |
| oses: | |
| - Debian | |
| - Ubuntu | |
| test_on: | |
| - debian4dhcp | |
| - ubuntu4dhcp |
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-ProgramBit { | |
| [CmdletBinding()] | |
| param ([string]$Path) | |
| process { | |
| if (-not $(Test-Path -Path $Path -ErrorAction SilentlyContinue)) { | |
| Write-Error "Invalid Path" | |
| return | |
| } | |
| $re32 = [regex]::new('PE\W\WL') | |
| Get-Content -Path $Path -ReadCount 1 | ForEach-Object { |