Skip to content

Instantly share code, notes, and snippets.

View steverhall's full-sized avatar

Steve Hall steverhall

View GitHub Profile
@steverhall
steverhall / readable.js
Created June 6, 2017 14:49
Reading Azure SQL from Node.js backend using Tedious library
'use strict';
var Connection = require('tedious').Connection;
var Request = require('tedious').Request;
// Create connection to database
var config = {
userName: 'USERNAME', // update me
password: 'PASSWORD', // update me
server: 'DBSERVERNAME.database.windows.net', // update me
@steverhall
steverhall / DbContext.cs
Created June 6, 2017 15:52
Calling Azure SQL from .NET backend
class DbContext : DataContext
{
public Table<User> Users;
public Table<UserProfile> UserProfiles;
public DbContext(SqlConnection connection) : base(connection) { }
}
using (SqlConnection connection = new SqlConnection(conn))
{
await connection.OpenAsync();
### Keybase proof
I hereby claim:
* I am srhallx on github.
* I am srhall (https://keybase.io/srhall) on keybase.
* I have a public key ASDbQsg0BLK85UWY3FHwg-RPiRPZ_TtMzUB_QlF4UyJd-wo
To claim this, I am signing this object:
@steverhall
steverhall / BMI.cs
Last active March 26, 2019 14:30
Body Mass Index Calculation
using System;
namespace HealthCorp.Core
{
public class BMI
{
private const double KILOGRAMS_PER_POUND = 0.45359237;
private const double METERS_PER_INCH = 0.0254;
@steverhall
steverhall / VisioShapeModifier.vba
Created March 29, 2019 13:54
Iterates through shapes on page and modifies master shape by clearing all connection points and adding connection point to bottom,right,top,left. Very specific to a certain shape size (1.5" width, 0.5" height)
Public Sub OpenMaster_Example()
Dim vsoMaster As Visio.Master
Dim vsoMasterCopy As Visio.Master
Dim vsoShape As Visio.Shape
Dim vsoCell As Visio.Cell
Dim success As Boolean
On Error GoTo ErrorHandler
@steverhall
steverhall / AzureAKSCommands.txt
Created April 3, 2019 01:11
Azure AKS Commands
region="EastUS"
rg="akschallenge"
#Get all versions of Kubernetes for a particular region
az aks get-versions -l $region -o table
#Get only the latest version number of Kubernetes
az aks get-versions -l ${region} --query 'orchestrators[-1].orchestratorVersion' -o tsv
#Create AKS with latest version and enable monitoring
@steverhall
steverhall / DistributingApiKeysToiOS.md
Created April 25, 2019 14:06
Distributing API keys to iOS apps

https://developer.apple.com/library/archive/qa/qa1745/_index.html#//apple_ref/doc/uid/DTS40011636

One way to provision an identity is via email. When you provision a device, send the associated user an email with their client identity attached as a PKCS#12 file. Except don't give it the standard PKCS#12 MIME type or extension, give it a MIME type and extension claimed by your app. (The extension ".p12" is claimed by iOS and cannot be claimed by another app.) The user can then open the attachment, which will launch your app, at which point you can offer to import the identity. This same technique will work if you host the identity as a web download.

@steverhall
steverhall / .zshrc
Created May 3, 2019 16:12
Azure CLI autocomplete
#Azure CLI Auto Completion
autoload bashcompinit
bashcompinit
source /usr/local/etc/bash_completion.d/az
@steverhall
steverhall / InstalledFonts.cs
Created May 8, 2019 18:21
List fonts available for iOS
###
### FROM: https://blog.verslu.is/xamarin/xamarin-forms-xamarin/custom-fonts-with-xamarin-forms-revisited/
###
#if DEBUG
var fontList = new StringBuilder();
var familyNames = UIFont.FamilyNames;
foreach (var familyName in familyNames)
{
fontList.Append(String.Format("Family: {0}\n", familyName));
Console.WriteLine("Family: {0}\n", familyName);
@steverhall
steverhall / index.html
Created May 22, 2019 18:54
Single Page App using Azure AD authentication and calling AD protected web service from JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Quickstart for MSAL JS</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js"></script>
<script src="https://secure.aadcdn.microsoftonline-p.com/lib/1.0.0/js/msal.js"></script>
</head>
<body>
<div class="container">