Skip to content

Instantly share code, notes, and snippets.

public Thermometer(FEZ_Pin.AnalogIn pin, int interval, int min, int max)
{
// Set reading parameters
_interval = interval;
_minScale = min;
_maxScale = max;
// Initialise thermometer sensor
_sensor = new AnalogIn((AnalogIn.Pin)pin);
_sensor.SetLinearScale(_minScale, _maxScale);
public Thermometer(FEZ_Pin.AnalogIn pin, int interval, int min, int max)
{
// Set reading parameters
_interval = interval;
_minScale = min;
_maxScale = max;
// Initialise thermometer sensor
_sensor = new AnalogIn((AnalogIn.Pin)pin);
_sensor.SetLinearScale(_minScale, _maxScale);
@scott-kloud
scott-kloud / Migrate-AzureVM.ps1
Last active December 31, 2021 02:02
Migrates a Azure Virtual Machine to another subscription or data centre
<#
.SYNOPSIS
Migrates a Azure Virtual Machine to another subscription or data centre
.DESCRIPTION
Shutsdown the source VM
Exports the VM config to a temporary file
Loops through all Azure disks attached to the source VM
Schedules an async copy of the underlying VHD to the destination storage account
- optionally overwrites existing VHD in destination if it exists
workflow AutoShutdownWorkflow
{
#$VerbosePreference = "continue"
# Automation Settings
$pscreds = Get-AutomationPSCredential -Name "runbook-account"
$subscriptionName = "[subscription name here]"
$tagName = "autoShutdown"
# Authenticate using WAAD credentials
%dw 1.0
%output application/dw
---
(
payload
)
<ns0:invoiceResponse xmlns:ns0="http://ns0.com.au/api/invoices">
<ns0:invoices>
<ns0:invoice>
<ns0:date>2016-01-01T12:00:00</ns0:date>
<ns0:billingHours>240</ns0:billingHours>
</ns0:invoice>
<ns0:invoice>
<ns0:date>2016-01-02T12:00:00</ns0:date>
<ns0:billingHours>540</ns0:billingHours>
</ns0:invoice>
%dw 1.0
%namespace ns0 http://ns0.com.au/api/invoices
---
{
ns0#invoiceResponse: {
ns0#invoices: {
ns0#invoice: {
ns0#date: "2016-01-01T12:00:00",
ns0#billingHours: "240"
},
<ns0:invoiceResponse xmlns:ns0="http://ns0.com.au/api/invoices">
<ns0:invoices/>
</ns0:invoiceResponse>
%dw 1.0
%namespace ns0 http://ns0.com.au/api/invoices
---
{
ns0#invoiceResponse: {
ns0#invoices: ""
}
}
%dw 1.0
%output application/json
%namespace ns0 http://ns0.com.au/api/invoices
---
(
payload.ns0#invoiceResponse.ns0#invoices.*ns0#invoice map ((invoice , indexOfInvoice) -> {
invoiceNo: indexOfInvoice,
invoiceDate: invoice.ns0#date as :datetime as :string {format: "dd/MM/YYYY HH:mm:ss"},
billingTime: invoice.ns0#billingHours
})