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