mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-25 01:14:16 +01:00
Simple renaming to camel case
This commit is contained in:
parent
1df42cc567
commit
f98c0492a2
@ -30,7 +30,7 @@ try {
|
||||
"⏳ (3/4) Removing untracked files in repository..."
|
||||
& git -C "$RepoDir" clean -xfd -f # to delete all untracked files in the main repo
|
||||
if ($lastExitCode -ne "0") {
|
||||
"'git clean' failed with exit code $lastExitCode, retrying once..."
|
||||
Write-Warning "'git clean' failed with exit code $lastExitCode, retrying once..."
|
||||
& git -C "$RepoDir" clean -xfd -f
|
||||
if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" }
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ try {
|
||||
foreach ($Process in $Processes) {
|
||||
$Process.CloseMainWindow() | Out-Null
|
||||
}
|
||||
start-sleep -milliseconds 100
|
||||
Start-Sleep -milliseconds 100
|
||||
stop-process -name $ProgramName -force -errorAction 'silentlycontinue'
|
||||
} else {
|
||||
$Processes = get-process -name $ProgramAliasName -errorAction 'silentlycontinue'
|
||||
@ -43,7 +43,7 @@ try {
|
||||
foreach ($Process in $Processes) {
|
||||
$_.CloseMainWindow() | Out-Null
|
||||
}
|
||||
start-sleep -milliseconds 100
|
||||
Start-Sleep -milliseconds 100
|
||||
stop-process -name $ProgramName -force -errorAction 'silentlycontinue'
|
||||
}
|
||||
if ($($Processes.Count) -eq 1) {
|
||||
|
@ -17,12 +17,12 @@ param([int]$Seconds = 10)
|
||||
|
||||
try {
|
||||
for ([int]$i = 0; $i -lt $Seconds; $i++) {
|
||||
clear-host
|
||||
write-output ""
|
||||
Clear-Host
|
||||
Write-Output ""
|
||||
$CurrentTime = Get-Date -format "yyyy-MM-dd HH:mm:ss"
|
||||
./write-big $CurrentTime
|
||||
write-output ""
|
||||
start-sleep -s 1
|
||||
Write-Output ""
|
||||
Start-Sleep -seconds 1
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -97,9 +97,9 @@ $0x = "0x"
|
||||
|
||||
$array = @()
|
||||
|
||||
Clear-host
|
||||
write-host "Setting up your machine to receive Usermode Dumps via WER."
|
||||
Start-sleep -s 3
|
||||
Clear-Host
|
||||
Write-Host "Setting up your machine to receive Usermode Dumps via WER."
|
||||
Start-Sleep -seconds 3
|
||||
|
||||
|
||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpFolder" -Value "%LOCALAPPDATA%\CrashDumps" -PropertyType ExpandString -Force
|
||||
@ -225,12 +225,12 @@ If ($NCD -eq '3')
|
||||
ElseIf($Option -eq 'q')
|
||||
{
|
||||
write-host "Closing application."
|
||||
Start-Sleep -s 2
|
||||
Start-Sleep -seconds 2
|
||||
}
|
||||
Else
|
||||
{
|
||||
write-host "Invalid Option, Try again."
|
||||
Start-sleep -s 2
|
||||
Start-Sleep -seconds 2
|
||||
}
|
||||
|
||||
}
|
||||
@ -291,7 +291,7 @@ ElseIf ($NCD -eq '2')
|
||||
}
|
||||
Else
|
||||
{
|
||||
write-host "You did not enter a valid option. Please re-run Get-Dump.ps1"
|
||||
start-sleep -s 5
|
||||
Write-Host "You did not enter a valid option. Please re-run Get-Dump.ps1"
|
||||
Start-Sleep -seconds 5
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -25,7 +25,7 @@ try {
|
||||
}
|
||||
""
|
||||
"Press <Control> <C> to abort, otherwise the installation will start in 10 seconds..."
|
||||
sleep -s 10
|
||||
Start-Sleep -seconds 10
|
||||
|
||||
[int]$Step = 2
|
||||
[int]$Failed = 0
|
||||
|
@ -12,5 +12,5 @@
|
||||
#>
|
||||
|
||||
[System.Console]::Beep(500,300)
|
||||
start-sleep -m 300
|
||||
Start-Sleep -milliseconds 300
|
||||
exit 0 # success
|
||||
|
@ -16,14 +16,14 @@
|
||||
param([string]$Path = "")
|
||||
|
||||
try {
|
||||
if ($Path -eq "" ) { $Path = read-host "Enter the path to the MP3 sound file" }
|
||||
if ($Path -eq "" ) { $Path = Read-Host "Enter the path to the MP3 sound file" }
|
||||
|
||||
if (-not(test-path "$Path" -pathType leaf)) { throw "Can't access sound file: $Path" }
|
||||
$FullPath = (get-childItem $Path).fullname
|
||||
$Filename = (get-item "$FullPath").name
|
||||
if (-not(Test-Path "$Path" -pathType leaf)) { throw "Can't access sound file: $Path" }
|
||||
$FullPath = (Get-ChildItem $Path).fullname
|
||||
$Filename = (Get-Item "$FullPath").name
|
||||
|
||||
add-type -assemblyName PresentationCore
|
||||
$MediaPlayer = new-object System.Windows.Media.MediaPlayer
|
||||
Add-Type -assemblyName PresentationCore
|
||||
$MediaPlayer = New-Object System.Windows.Media.MediaPlayer
|
||||
|
||||
do {
|
||||
$MediaPlayer.open($FullPath)
|
||||
@ -37,7 +37,7 @@ try {
|
||||
$host.ui.RawUI.WindowTitle = "▶️ $Filename"
|
||||
$MediaPlayer.Volume = 1
|
||||
$MediaPlayer.play()
|
||||
start-sleep -milliseconds $Milliseconds
|
||||
Start-Sleep -milliseconds $Milliseconds
|
||||
$MediaPlayer.stop()
|
||||
$MediaPlayer.close()
|
||||
$host.ui.RawUI.WindowTitle = $PreviousTitle
|
||||
|
@ -32,7 +32,7 @@
|
||||
[System.Console]::Beep(1056,500)
|
||||
[System.Console]::Beep(880,500)
|
||||
[System.Console]::Beep(880,500)
|
||||
start-sleep -milliseconds 250
|
||||
Start-Sleep -milliseconds 250
|
||||
[System.Console]::Beep(1188,500)
|
||||
[System.Console]::Beep(1408,250)
|
||||
[System.Console]::Beep(1760,500)
|
||||
@ -51,7 +51,7 @@ start-sleep -milliseconds 250
|
||||
[System.Console]::Beep(1056,500)
|
||||
[System.Console]::Beep(880,500)
|
||||
[System.Console]::Beep(880,500)
|
||||
start-sleep -milliseconds 500
|
||||
Start-Sleep -milliseconds 500
|
||||
[System.Console]::Beep(1320,500)
|
||||
[System.Console]::Beep(990,250)
|
||||
[System.Console]::Beep(1056,250)
|
||||
@ -73,7 +73,7 @@ start-sleep -milliseconds 500
|
||||
[System.Console]::Beep(1056,500)
|
||||
[System.Console]::Beep(880,500)
|
||||
[System.Console]::Beep(880,500)
|
||||
start-sleep -milliseconds 250
|
||||
Start-Sleep -milliseconds 250
|
||||
[System.Console]::Beep(1188,500)
|
||||
[System.Console]::Beep(1408,250)
|
||||
[System.Console]::Beep(1760,500)
|
||||
@ -92,7 +92,7 @@ start-sleep -milliseconds 250
|
||||
[System.Console]::Beep(1056,500)
|
||||
[System.Console]::Beep(880,500)
|
||||
[System.Console]::Beep(880,500)
|
||||
start-sleep -milliseconds 500
|
||||
Start-Sleep -milliseconds 500
|
||||
[System.Console]::Beep(660,1000)
|
||||
[System.Console]::Beep(528,1000)
|
||||
[System.Console]::Beep(594,1000)
|
||||
|
@ -19,9 +19,9 @@ try {
|
||||
if ($Seconds -eq 0 ) { [int]$Seconds = read-host "Enter number of seconds" }
|
||||
|
||||
for ($i = $Seconds; $i -gt 0; $i--) {
|
||||
clear-host
|
||||
Clear-Host
|
||||
./write-big "T-$i seconds"
|
||||
start-sleep -s 1
|
||||
Start-Sleep -seconds 1
|
||||
}
|
||||
|
||||
"✔️ $Seconds seconds countdown finished"
|
||||
|
@ -1,8 +1,8 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Simulates the human presence against burglars
|
||||
Simulate a human against burglars
|
||||
.DESCRIPTION
|
||||
This PowerShell script simulates the human presence against burglars.
|
||||
This PowerShell script simulates the human presence against burglars. It switches a Shelly1 device on and off.
|
||||
.PARAMETER IPaddress
|
||||
Specifies the IP address of the Shelly1 device
|
||||
.EXAMPLE
|
||||
@ -16,16 +16,15 @@
|
||||
param([string]$IPaddress = "")
|
||||
|
||||
try {
|
||||
if ($IPaddress -eq "" ) { $IPaddress = read-host "Enter IP address of Shelly1 device" }
|
||||
if ($IPaddress -eq "" ) { $IPaddress = Read-Host "Enter IP address of the Shelly1 device" }
|
||||
|
||||
for ([int]$i = 0; $i -lt 1000; $i++) {
|
||||
& "$PSScriptRoot/switch-shelly1.ps1" $IPaddress on 0
|
||||
start-sleep -s 10
|
||||
Start-Sleep -seconds 10 # on for 10 seconds
|
||||
& "$PSScriptRoot/switch-shelly1.ps1" $IPaddress off 0
|
||||
start-sleep -s 60
|
||||
Start-Sleep -seconds 60 # off for 60 seconds
|
||||
}
|
||||
|
||||
"✔️ Done."
|
||||
"✔️ Done."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -18,7 +18,7 @@ param([int]$StartNumber = 10)
|
||||
try {
|
||||
for ([int]$i = $StartNumber; $i -gt 0; $i--) {
|
||||
& "$PSScriptRoot/speak-english.ps1" $i
|
||||
start-sleep -milliseconds 200
|
||||
Start-Sleep -milliseconds 200
|
||||
}
|
||||
& "$PSScriptRoot/speak-english.ps1" "zero"
|
||||
exit 0 # success
|
||||
|
@ -36,7 +36,7 @@ try {
|
||||
if ($IPaddress -eq "" ) { $IPaddress = Read-Host "Enter the host's IP address or subnet address (e.g. 255.255.255.255)" }
|
||||
|
||||
Send-WOL $MACaddress $IPaddress $Port
|
||||
start-sleep -milliseconds 100
|
||||
Start-Sleep -milliseconds 100
|
||||
Send-WOL $MACaddress $IPaddress $Port
|
||||
|
||||
"✔️ sent magic packet $MACaddress to IP $IPaddress on port $Port (twice)"
|
||||
|
@ -24,13 +24,13 @@ param([string]$color = "green", [int]$speed = 500) # milliseconds
|
||||
|
||||
function GetRandomCodeLine {
|
||||
$Generator = New-Object System.Random
|
||||
$Num = [int]$Generator.next(0, 24)
|
||||
$Num = [int]$Generator.next(0, 25)
|
||||
switch($Num) {
|
||||
0 { return " `$count = 0" }
|
||||
1 { return " `$count++" }
|
||||
2 { return " exit 0 # success" }
|
||||
3 { return " `$Files = Get-ChildItem C:" }
|
||||
4 { return " Start-Sleep 1" }
|
||||
4 { return " Start-Sleep -seconds 1" }
|
||||
5 { return " `$Generator = New-Object System-Random" }
|
||||
6 { return "} else {" }
|
||||
7 { return "} catch {" }
|
||||
@ -50,6 +50,7 @@ function GetRandomCodeLine {
|
||||
21 { return " if (`$count -eq 0) { `$count = Read-Host `"Enter number of iterations`" " }
|
||||
22 { return " } finally {" }
|
||||
23 { return " throw `"Can't open file`" " }
|
||||
24 { return " Start-Sleep -milliseconds 50" }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user