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
echo "$SHELL" |
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
import requests | |
import json | |
import time | |
import datetime | |
import os.path | |
INTERVAL_TIME = 10 | |
HOST = 'https://...' | |
CAMERA_NAME = 'Mango' | |
# Set up an offline username/password in UniFi with Protect read permissions |
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
#/bin/sh | |
file="/tmp/exos_smartctl" | |
if [ -f "$file" ] ; then | |
rm "$file" | |
fi | |
sudo smartctl /dev/sata1 -a -v 1,raw48:54,Read_Error_Rate -v 7,raw48:54,Seek_Error_Rate -v 9,msec24hour32,Power_On_Hours -v 188,raw16,Command_Timeout -v 194,raw24/raw32,Temperature -v 240,msec24hour32,Head_Flight_Hours >> "$file" | |
sudo smartctl /dev/sata2 -a -v 1,raw48:54,Read_Error_Rate -v 7,raw48:54,Seek_Error_Rate -v 9,msec24hour32,Power_On_Hours -v 188,raw16,Command_Timeout -v 194,raw24/raw32,Temperature -v 240,msec24hour32,Head_Flight_Hours >> "$file" | |
sudo smartctl /dev/sata3 -a -v 1,raw48:54,Read_Error_Rate -v 7,raw48:54,Seek_Error_Rate -v 9,msec24hour32,Power_On_Hours -v 188,raw16,Command_Timeout -v 194,raw24/raw32,Temperature -v 240,msec24hour32,Head_Flight_Hours >> "$file" | |
sudo smartctl /dev/sata4 -a -v 1,raw48:54,Read_Error_Rate -v 7,raw48:54,Seek_Error_Rate -v 9,msec24hour32,Power_On_Hours -v 188,raw16,Command_Timeout -v 194,raw24/raw32,Temperature -v 240,msec24hour32,Head_Flight_Hours >> "$file" | |
sudo smartctl /dev/sata5 - |
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
$drive = "C:" | |
Get-CimInstance -ClassName Win32_LogicalDisk | Where-Object { $_.DeviceID -eq $drive } | |
$partition = Get-CimInstance Win32_LogicalDiskToPartition | Where-Object { $_.Dependent.DeviceID -eq $drive } | Select-Object -ExpandProperty Antecedent | Select-Object -ExpandProperty DeviceID | |
$diskDrive = Get-CimInstance -ClassName Win32_DiskDriveToDiskPartition | Where-Object { $_.Dependent.DeviceID -eq $partition } | Select-Object -ExpandProperty Antecedent | Select-Object -ExpandProperty DeviceID | |
Get-CimInstance -Class Win32_DiskDrive | Where-Object { $_.DeviceID -eq $diskDrive } |
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
let GetPatchTuesday = (timestamp: datetime) { | |
case( | |
dayofweek(startofmonth(timestamp) + 07d) == 2d, startofmonth(timestamp) + 07d, | |
dayofweek(startofmonth(timestamp) + 08d) == 2d, startofmonth(timestamp) + 08d, | |
dayofweek(startofmonth(timestamp) + 09d) == 2d, startofmonth(timestamp) + 09d, | |
dayofweek(startofmonth(timestamp) + 10d) == 2d, startofmonth(timestamp) + 10d, | |
dayofweek(startofmonth(timestamp) + 11d) == 2d, startofmonth(timestamp) + 11d, | |
dayofweek(startofmonth(timestamp) + 12d) == 2d, startofmonth(timestamp) + 12d, | |
startofmonth(timestamp) + 13d | |
) |
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
SELECT DISTINCT | |
CASE | |
WHEN ss.EngineEdition = 8 | |
THEN NULL | |
ELSE d.HostName | |
END | |
AS ComputerName, | |
CASE | |
WHEN ss.EngineEdition = 8 | |
THEN UPPER(esc.ObjectName) |
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
# As of SQL 2017 | |
/Record @id @type @time | |
/Record/ConnectivityTraceRecord/ClientConnectionId | |
/Record/ConnectivityTraceRecord/IsClient | |
/Record/ConnectivityTraceRecord/LocalHost | |
/Record/ConnectivityTraceRecord/LocalPort | |
/Record/ConnectivityTraceRecord/OSError | |
/Record/ConnectivityTraceRecord/RecordSource | |
/Record/ConnectivityTraceRecord/RecordTime |
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 Get-Interactive { | |
[CmdletBinding()] | |
param ( | |
) | |
-not ( | |
<# Jenkins and other services #> | |
$false -eq [Environment]::UserInteractive -or | |
<# Invoke-Command -ComputerName is ASSUMED to be non-interactive #> | |
$Host.Name -eq 'ServerRemoteHost' -or | |
<# RSJob, Workflow #> |
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
$webSession = New-Object Microsoft.PowerShell.Commands.WebRequestSession | |
$postValues = @{ Email = "..."; Password = "..."; } | |
$login = Invoke-WebRequest -WebSession $webSession -Uri "https://my.sentryone.com/login" -Method POST -Body $postValues | |
$page = Invoke-WebRequest -WebSession $webSession -Uri "https://my.sentryone.com/" | |
$regex = [regex] 'id="(\d+?)" class="list-group-item serverFriendlyNameContainer sqlSentryItem"' | |
$ids = $regex.Matches($page.RawContent) | %{ $_.Groups[1].Value } | |
$keys = @() |
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
$test = @( | |
[PSCustomObject] @{ IsReady = $false } | |
[PSCustomObject] @{ IsReady = $true } | |
) | |
if ($test.IsReady) { | |
"Output 1" | |
} | |
if ($true -eq $test.IsReady) { | |
"Output 2" | |
} |
NewerOlder