Skip to content

Instantly share code, notes, and snippets.

View davew-msft's full-sized avatar

Dave Wentzel davew-msft

View GitHub Profile
# Disable automatic sleep on AC only
# Run this as Administrator
Write-Host "Disabling automatic sleep when on AC..." -ForegroundColor Cyan
# AC power (plugged in)
powercfg /change standby-timeout-ac 0
# Battery power
# powercfg /change standby-timeout-dc 0
# Disable IPv6 on all network adapters (including VPNs)
# Run this script as Administrator
# you may need to run this first:
# Set-ExecutionPolicy RemoteSigned -Scope Process -Force
# this is to run it
# .\disable-ipv6.ps1
# this is full-blown automation...runs when you login
RESOURCE_GROUP=blah
STORAGE_NAME=blah234234234
APP_NAME=blahfunc
ACR=blahacr
az login
# make sure you are connected to the right subscription (IsDefault = True)
az account list --output table
az group create --name $RESOURCE_GROUP --location eastus2
{
"scriptFile": "__init__.py",
"bindings": [
{
"type": "eventHubTrigger",
"name": "event",
"direction": "in",
"eventHubName": "ch-7-eventhub",
"connection": "myEventHubReadConnectionAppSetting",
"cardinality": "many",
import logging
import json
import uuid
import azure.functions as func
def main(event: func.EventHubEvent, doc: func.Out[func.Document]):
message = event.get_body().decode('utf-8')
logging.info('Python EventHub trigger processed an event: %s', message)
sale_events = json.loads(message)
import logging
import azure.functions as func
import json
def main(req: func.HttpRequest, ratings: func.DocumentList) -> func.HttpResponse:
if ratings.count == 0:
return func.HttpResponse(
import logging
import azure.functions as func
from jsonschema import validate, ValidationError
import requests
import uuid
import time
import json
def main(req: func.HttpRequest, ratings: func.Out[func.Document]) -> func.HttpResponse:
schema = {