View gist:7103320
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
// The test | |
[TestMethod] | |
public void Run_With_No_Arguments_Returns_Invalid_Args() | |
{ | |
var sut = new LiteDatabaseRunner(MakeDatabaseHelperMock().Object); | |
var actualResult = sut.Run(Array.Empty<string>()); | |
actualResult.Should().BeGreaterThan(0); | |
} | |
// Options class |
View RoomAlert.psm1
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
<# | |
.Synopsis | |
Gets data from a Room Alert environment monitor. | |
.Description | |
Gets all of the data from a Room Alert environment monitor. | |
.Parameter $address | |
IP address or host name of the Room Alert monitor. |
View ReadRoomAlertData.ps1
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
$room_alert_data = Invoke-RestMethod -URI 'http://10.0.0.1/getData.json' |
View ReadRoomAlertDigitalSensorData.ps1
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
# Digital sensor data | |
# The examples below use a Room Alert 3E with firmware v2.0.0 and Powershell v5 | |
$result = Invoke-RestMethod -URI 'http://10.0.0.1/getData.json' | |
# To find the sensor named 'Internal Sensor' | |
$result.sensor|where{$_.label -eq 'Internal Sensor'} | |
# Prints out the following to the console: |
View ReadRoomAlertSwitchSensorData.ps1
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
# Switch sensor data | |
# The examples below use a Room Alert 3E with firmware v2.0.0 and Powershell v5 | |
$result = Invoke-RestMethod -URI 'http://10.0.0.1/getData.json' | |
# Find the sensor named 'Switch Sen 1' | |
$result.switch_sen|where{$_.label -eq 'Switch Sens 1'} | |
# Prints out the following to the console: |
View IpPower9850ReadFirmwareVersion.ps1
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
# uses default user name and password. Couldn't get the HTTP form to work properly | |
Invoke-WebRequest -Uri "http://10.0.0.204/set.cmd?user=admin+pass=12345678+cmd=getversion" |
View IpPower9850ReadSocketState.ps1
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
# Read the current state of the power sockets... | |
Invoke-WebRequest -Uri "http://10.0.0.204/set.cmd?user=admin+pass=12345678+cmd=getpower" |
View IpPower9850PowerSocket.ps1
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
# Switch socket 1 on. All other sockets are assumed to be off | |
Invoke-WebRequest -Uri "http://10.0.0.204/set.cmd?user=admin+pass=12345678+cmd=setpower&p61=1&p62=0&p63=0&p64=0" |
View wp-hugo.py
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 mysql.connector | |
from datetime import datetime | |
class Post: | |
"""A wordpress blog post.""" | |
def __init__(self, post_id, title, slug, content, created_at): | |
self.post_id = post_id | |
self.title = title.encode("utf-8") | |
self.slug = slug | |
self.content = content.encode("utf-8") |
View checklinks.sh
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
#!/usr/bin/env bash | |
# Check all internal links on the dev site | |
echoerr() { printf "%s\n" "$*" >&2; } | |
# Script requires linkchecker | |
if ! [ -x "$(command -v linkchecker)" ]; then | |
echoerr "Error: linkchecker is not installed" | |
exit 1 |
OlderNewer