Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# get internal IP address
# used for outgoing Internet connections
resolve() {
(gethostip -d $1 || getent ahostsv4 $t | grep RAW | awk '{print $1; exit}') 2>/dev/null
}
noip() {
[ -n "$(echo $1 | tr -d '0-9.\n')" ]
function Invoke-DatabaseRestore {
param ([String]$SQLServer="(local)", $BackupPath, [String]$BackupFileFilter = "*.bak")
#load assemblies
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended") | Out-Null
[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") | Out-Null
[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum") | Out-Null
gci $BackupPath -Filter $BackupFileFilter | select fullname | % {
$backupFile = $_.FullName
#!/usr/bin/env bash
# Copyright (c) 2017, cloudcodeit.com
#
# Purpose: Create a App Service Web App
# Usage:
# web-app-git.sh <unique> <src_directory> <location>
###############################
## SCRIPT SETUP ##
@danielscholl
danielscholl / page2block.ps1
Last active June 21, 2018 21:33
PowerShell Script to convert a container of page blobs to block blobs
<#
.SYNOPSIS
Page Blob to Block Blob Copy Script
.DESCRIPTION
Using a Data Factory copy a blob from one place to another
** DOWNLOAD IT **
$url = "https://gist.githubusercontent.com/danielscholl/d9f26bb5ae13980ad5f09ece7582fccd/raw/fb3447098251838a9a5c9fdb94c745e86339cfca/page2block.ps1"
Invoke-WebRequest -Uri $url -OutFile page2block.ps1
# Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force;
# Install AzureRM Powershell Module
Install-Module -Name Azure -Repository PSGallery -Force -AllowClobber
Install-Module -Name AzureRM -Repository PSGallery -Force -AllowClobber
Import-Module -Name Azure
Import-Module -Name AzureRM
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters":{
"prefix": {
"type": "string",
"metadata": {
"description": "Small unique string."
},
"minLength": 2,
This is Release 1
version: '3'
services:
sai-sample:
image: "microsoft/aci-helloworld"
deploy:
replicas: 10

Demo (Prepare)

Introduce CloudShell

Install DirEnv in CloudShell

git clone https://github.com/direnv/direnv.git
cd direnv

Demo (Prepare)

Create an Ubuntu Workstation and use VSCode (Insiders) remote-ssh extension to SSH to it.

Install Azure CLI

# Install CLI
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash