Skip to content

Instantly share code, notes, and snippets.

View cbattlegear's full-sized avatar

Cameron Battagler cbattlegear

View GitHub Profile
@cbattlegear
cbattlegear / get_latlong_for_address.csx
Created February 3, 2022 15:12
get_latlong_for_address.csx
#r "Newtonsoft.Json"
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
<#
.SYNOPSIS
Register provided subscriptions with Automatic Registration feature. Failed registration information will be stored in RegistrationErrors.csv
file in the current directory where this script is executed. RegistrationErrors.csv will be empty when there are no errors in subscription registration.
.DESCRIPTION
Registering each subscription is a two step process:
-Register subscription to Microsoft.SqlVirtualMachine Resource provider.
-Register subscription to the Automatic Registration feature.
Prerequisites:
- The user account running the script should have "Microsoft.SqlVirtualMachine/register/action" RBAC access over the subscriptions.
@cbattlegear
cbattlegear / mattparker19.ipynb
Created December 1, 2020 14:56
My solution for the Matt Parker Math's Puzzle #19
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cbattlegear
cbattlegear / run.csx
Created October 28, 2020 14:28
Simple API proxy to allow Azure Data Factory REST API connector to use Link header pagination. It makes some assumptions about API structure so verify if works with your use case.
#r "Newtonsoft.Json"
using System.Net;
using System.Net.Http;
using System.Web;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
@cbattlegear
cbattlegear / listmintls.sh
Created August 20, 2020 19:40
Azure CLI command to list minimum TLS version for all Azure WebApps
# Run in Bash Azure Cloud Shell
webapps=$(az webapp list --query [].id -o tsv)
az webapp config show --ids $webapps --query "[].{WebApp:name,ResourceGroup:resourceGroup,minTlsVersion:minTlsVersion}" -o table
apiVersion: v1
kind: Service
metadata:
name: sql-distributions-0
labels:
app: sql-distribution
spec:
type: LoadBalancer
ports:
- port: 1433
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Microsoft.CognitiveServices.Speech;
function _HeyMisty(data) {
misty.PlayAudio("s_PhraseHello.wav");
//Record Voice Command
misty.StartRecordingAudio("VoiceCommand.wav");
misty.Pause(3000);
misty.StopRecordingAudio();
misty.Pause(1000);
//Check if Exists
misty.GetAudioList();
@cbattlegear
cbattlegear / examplebody.json
Last active August 15, 2019 20:42
An azure function to get a power bi embedded token via rest api call
{
"WorkspaceId":"6173e6bf-f90a-4e7a-9f97-b3672e7b9fa5",
"ReportId":"b2309d7f-5347-4e97-aab5-04f68eacc7be"
}
@cbattlegear
cbattlegear / AutoFailoverWebhook.ps1
Last active April 22, 2019 17:01
Azure Automation Webhook and Azure Function for monitoring and failing over a SQL Azure Failover Group.
<#
.DESCRIPTION
A runbook which fails over your Azure SQL Failover group to the secondary with allow data loss
This can be used for triggered emergency failovers.
.NOTES
AUTHOR: Cameron Battagler
LASTEDIT: Apr 18, 2019
#>