Skip to content

Instantly share code, notes, and snippets.


Bill Wilder codingoutloud

View GitHub Profile
codingoutloud / run.csx
Created Mar 25, 2018
Get User Agent Summary from within an Azure Function using API
View run.csx
#r "Newtonsoft.Json"
using System.Net;
using System.Net.Http;
using System.Text;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
codingoutloud / IpTools.psm1
Created Jan 29, 2018
PowerShell module for IP address tools
View IpTools.psm1
# put this in some shared module folder, such as /usr/local/share/powershell/Modules
Function Get-IpCountry {
$country = Invoke-RestMethod -Method GET -Uri$ip/country
return $country
codingoutloud / gitpush.ps1
Last active Dec 1, 2017
Simple mode to continually push from a remote machine to a git repo
View gitpush.ps1
git add --all
git commit --all -m "Update"
git push
codingoutloud / Publish-CertFromKeyVaultToWebApp.ps1
Created Nov 21, 2017
Get an SSL Cert from Key Vault and push it to a Web App
View Publish-CertFromKeyVaultToWebApp.ps1
Select-AzureRmSubscription -SubscriptionName AzureFAQ # subscription where the Web App resides
$webAppName = "pageofphotos" # Web App resource Name, (Get-AzureRmWebApp)[0].Name
$fqdn = "" # what is the DNS address? could be if that's what's mapped
$vaultName = "GlobalOpsVault"
$certificateName = "MySSL"
$passwordLength = 50
codingoutloud / AzureFunctionRandomQuote.js
Created Sep 14, 2017
Simple "hello world"-level web page intended for use with Azure Functions - paste this text into a JavaScript HTTP trigger, upload project.json to kudu, and set up MOVIE_API_KEY as an environment variable.
View AzureFunctionRandomQuote.js
var request = require('request');
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
var html = "<html><body><h1>didn't work</h1></body></html>"
var movieApiUrl = '';
// go get your own API key:
var movieApiKey = process.env['MOVIE_API_KEY'];
// context.log('MOVIE API KEY = ' + movieApiKey);
codingoutloud /
Created Sep 7, 2017
Usage: [number of times to repeat] -- no param means once.
for i in `seq 1 $1`;
echo $i
curl "$URL"
codingoutloud / Fail75.js
Created Sep 7, 2017
Code for an Azure Function that sometimes returns failure (on purposes, 75% of the time, useful for testing)
View Fail75.js
module.exports = function (context, req) {
if (Math.random() > 0.75) {
context.log('Azure Function "Fail75" is randomly (25%) returning 200 OK.');
context.res = {
body: "Randomly (25%) returning 200 OK."
else {
context.log('Azure Function "Fail75" is randomly (75%) returning 500 as a transient error.');
context.res = {
View geo-ip-services.txt
FORMAT: URL - LOWEST ACCESS TIER - NOTES - 1,000/day free - $50/m for 10,000/day with support - 15,000/hour free - open source - - NO API - interactive only - NO API - interactive only - NO API - interactive only - not looking promising - attributed my Boston-area IP as being in LA with Verizon - free API, but need API key and single IP address to source requests from - also has a commercial DB dowload ("The has a goal of providing high-quality geolocation service to all users for free.")
codingoutloud / RandomTokenGenerator.cs
Created Dec 4, 2012
Generate a random string that is URL safe.
View RandomTokenGenerator.cs
using System;
using System.Security.Cryptography;
using System.Web;
namespace DevPartners
// author: Bill Wilder, @codingoutloud
// original:
public static class RandomTokenGenerator
codingoutloud /
Last active Mar 13, 2017
Using Azure CLI 2, show all the resources in a resource group
if [ $1 ]
echo "Resources in Azure Resource Group $1"
az resource list --query "[?resourceGroup=='$1'].{ name: name, flavor: kind, resourceType: type, region: location }" --output table
echo "usage: $0 [name-of-azure-resource-group]"