Skip to content

Instantly share code, notes, and snippets.

@danielscholl
danielscholl / certgen.rb
Created March 24, 2017 13:33
Generate Certificates for Docker
# Generates necessary certificates to ~/.docker
#
# Usage:
# bundle install
# ruby certgen.rb <domain>
require 'certificate_authority'
require 'fileutils'
if ARGV.empty?
@danielscholl
danielscholl / lbruleset.sh
Created April 21, 2017 22:07
Azure CLI 2.0 Load Balance Rule Set Addition (Simple)
#!/bin/bash
#set -o errexit -o pipefail
RESOURCE_GROUP=<your_resource_group>
if [[ ! $1 ]]; then
echo "\$1 Protocol Argument Required"
exit 1
fi
#!/bin/bash
if [[ ! $1 ]]; then
echo "\$1 Argument required for Virtual Machine Name"
exit 1
fi
VM=$1
GROUP=$1
#DOCKER
alias dpst='watch -n 3 "docker ps"'
alias dps='docker ps -a'
alias dclean='docker rm -v $(docker ps -a -q -f status=exited)'
alias rmc='docker ps -q -a | xargs docker rm -f'
alias rmi='docker images -q | xargs docker rmi -f'
alias d='docker $@'
alias registry-stop='docker rm -f registry'
alias registry-web='docker run -d -p 8000:80 --name registry-web --link registry -e ENV_DOCKER_REGISTRY_HOST=registry
-e ENV_DOCKER_REGISTRY_PORT=5000 konradkleine/docker-registry-frontend:v2'
@danielscholl
danielscholl / DevLab.md
Last active May 12, 2017 14:57
Win10 Workstation Install Notes

DevLab Install Notes

Ubuntu Machine Setup

$ sudo apt-get -y install apt-transport-https ca-certificates curl
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
$ sudo apt-get update
@danielscholl
danielscholl / urlparser
Created June 10, 2017 22:39
URL Function Parser
module.exports = function (context, data) {
var parsedForm = parseQuery(data.form);
context.log(parsedForm);
context.res = {
body: parsedForm
}
context.done();
};
RESOURCE_GROUP=linux-group
LOCATION=southcentralus
IMG=UbuntuLTS
SIZE=Standard_DS1_v2
VNET=linux-group-vnet
ADDRESS_RANGE=10.10.0.0/16
SUBNET=Nodes
SUBNET_RANGE=10.10.0.0/24
LB=linux-group-lb
NSG=linux-group-vm-nsg
#!/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 ##