Added powershell scripts

This commit is contained in:
Anthony Wang 2020-07-21 22:59:13 +00:00 committed by GitHub
parent a0e95fa54e
commit 9624502f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

16
caffeinate.ps1 Normal file
View File

@ -0,0 +1,16 @@
# Useful references:
#
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line
# https://ss64.com/vb/sendkeys.html
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
#
# Future enhancements - use events rather than an infinite loop
while (1) {
$wsh = New-Object -ComObject WScript.Shell
# Send Shift+F15 - this is the least intrusive key combination I can think of and is also used as default by:
# http://www.zhornsoftware.co.uk/caffeine/
# Unfortunately the above triggers a malware alert on Sophos so I needed to find a native solution - hence this script...
$wsh.SendKeys('+{F15}')
Start-Sleep -seconds 59
}

1
reverse.ps1 Normal file
View File

@ -0,0 +1 @@
sudo { Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 } }