Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Happy Days

Simon Waight sjwaight

😎
Happy Days
View GitHub Profile
@sjwaight
sjwaight / connection-logic-app-kv-msi.bicep
Created Jan 3, 2023
Bicep file snippet showing how to define the MSI to use when connecting to a key vault.
View connection-logic-app-kv-msi.bicep
resource connections_keyvault_resource 'Microsoft.Web/connections@2016-06-01' = {
name: connections_keyvault_name
location: resource_group_location
properties: {
displayName: 'KeyVaultMIAccess'
parameterValueType: 'Alternative'
alternativeParameterValues: {
vaultName: key_vault_name
}
customParameterValues: {}
@sjwaight
sjwaight / logic-app-parameters.bicep
Created Jan 3, 2023
Logic Apps Parameters section bicep snippet
View logic-app-parameters.bicep
parameters: {
'$connections': {
value: {
keyvault: {
connectionId: connections_keyvault_resource.id
connectionName: 'keyvault'
connectionProperties: {
authentication: {
type: 'ManagedServiceIdentity'
}
@sjwaight
sjwaight / key-vault.bicep
Created Jan 3, 2023
Sample Azure Bicep snippet showing definition of a Key Vault that uses a Managed Identity
View key-vault.bicep
resource key_vault_resource 'Microsoft.KeyVault/vaults@2022-07-01' = {
name: key_vault_name
location: resource_group_location
properties: {
sku: {
family: 'A'
name: 'standard'
}
tenantId: subscription().tenantId
accessPolicies: [
@sjwaight
sjwaight / managed-identity.bicep
Created Dec 30, 2022
Sample of Azure Bicep definition for a new Managed Identity
View managed-identity.bicep
resource managed_service_identity_kv_resource 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = {
name: managed_identity_name
location: resource_group_location
}
@sjwaight
sjwaight / blogpostsample.json
Created Dec 16, 2022
Sample post data for an API call to cross-post content to multiple services.
View blogpostsample.json
{
"Title": "A sample blog post",
"Summary": "This is a test blog post summary.",
"Link": "https://blog.siliconvalve.com/"
}
@sjwaight
sjwaight / SetupJava11Dev.ps1
Created Nov 22, 2022
Short PowerShell Script that uses Chocolatey to install JDK 11 and Community Editon of IntelliJ IDEA
View SetupJava11Dev.ps1
# Install Java 11 SDK using Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install openjdk --version 11.0.2.01 -y
choco install intellijidea-community -y
@sjwaight
sjwaight / samplerecord.json
Created Aug 15, 2022
Sample Cosmos DB record for data received from a sensor
View samplerecord.json
{
"SensorName": "PurpleAir-XXX",
"ReadingTime": "2022-08-15T05:26:41+00:00",
"Latitude": -00.000000,
"Longitude": 00.000000,
"PressureMillibars": 993.75,
"Humidity": 27,
"Temperature": 22,
"Pm25ChannelA": 0,
"Pm25ChannelB": 0,
@sjwaight
sjwaight / anomdetectmodelstatusresponse.json
Created Jun 16, 2022
Azure Anomaly Detector API - List models API response sample
View anomdetectmodelstatusresponse.json
{
"models": [{
"modelId": "e88247b4-ed17-11ec-85a9-xxxxxxxxxxx",
"createdTime": "2022-06-16T01:59:08Z",
"lastUpdatedTime": "2022-06-16T02:00:34Z",
"status": "READY",
"displayName": "Air Quality",
"variablesCount": 4
}],
"currentCount": 1,
@sjwaight
sjwaight / AirSensorDataParser.asaql
Last active Jun 20, 2022
Azure Stream Analytics query used to parse incoming data to make it ready for training Cognitive Services Anomaly Detector
View AirSensorDataParser.asaql
SELECT
DATETIMEFROMPARTS (DATEPART(year,readtime), DATEPART(month,readtime), DATEPART(day,readtime), DATEPART(hour, readtime), DATEPART(minute, readtime), 30, 0) as 'timestamp',
temperature as value
INTO
[temperaturedatacsv]
FROM
[rawiotjsondata]
SELECT
DATETIMEFROMPARTS (DATEPART(year,readtime), DATEPART(month,readtime), DATEPART(day,readtime), DATEPART(hour, readtime), DATEPART(minute, readtime), 30, 0) as 'timestamp',
@sjwaight
sjwaight / sample-curl-graphql-query.sh
Created Mar 29, 2022
Bash script showing how to invoke a GraphQL API using curl.
View sample-curl-graphql-query.sh
# Originally from: https://www.meetup.com/api/guide/#p02-querying-section
query='query($eventId: ID) {
event(id: $eventId) {
title
description
dateTime
}
}
'