Skip to content

Instantly share code, notes, and snippets.

@esell
esell / blah.json
Created April 14, 2017 21:41
blah.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"region_name": {
"defaultValue": "westus",
"type": "String"
},
"apptier_nsg_name": {
"defaultValue": "apptier",
type MyTemplate struct {
ContentVersion string `json:"contentVersion"`
// Resources could be other types outside of Resource1, hence the []string
Resources []string `json:"resources"`
}
type Resource1 struct {
ResourceType string `json:"-"`
APIVersion string `json:"apiVersion"`
Comments string `json:"comments"`
#!/bin/bash
# install docker-machine
curl -L https://github.com/docker/machine/releases/download/v0.12.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && chmod +x /tmp/docker-machine && sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
# clone repo
cd /home/esell && git clone https://github.com/esell/ethcluster.git
#!/bin/bash
# appears azure doesn't like to update
# their agent during setup so we'll hold it
apt-mark hold walinuxagent
# get Ubuntu updates
apt-get update
if [ $? -ne 0 ]; then
echo "update failed"
@esell
esell / main.go
Created September 20, 2017 21:53
dh stuff
package main
import (
"fmt"
"math/rand"
"time"
"github.com/monnand/dhkx"
)
@esell
esell / ethlab.md
Last active December 7, 2017 04:11
Setup a multi-node private etherum cluster

PRE-REQs

  • VMs should be ubuntu
  • your boot node should have the hostnamne "bootnode".
  • create at least 3 VMs, one boot node, one member node and one miner node

Setup boot node

The boot node will be the brains and what the other nodes talk to in order to find members of your cluster. The below steps will set it up so that you can use it later.

@esell
esell / backup.ps1
Created December 13, 2017 16:35
Backup a blob from one sa to another
Write-Output "PowerShell Timer trigger function executed at:$(get-date)";
# Create src/dest contexts
# DEST_KEY & SRC_KEY are set as environment variables in app settings
$DestContext = New-AzureStorageContext -StorageAccountName "destStorageAccountName" -StorageAccountKey $env:DEST_KEY
$SrcContext = New-AzureStorageContext -StorageAccountName "srcStorageAccountName" -StorageAccountKey $env:SRC_KEY
# Get timestamp
$timestamp = Get-Date -Format o | foreach {$_ -replace ":", "."}
#r "Microsoft.WindowsAzure.Storage"
using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.Blob.Protocol;
using Microsoft.WindowsAzure.Storage.Auth;
using System.IO;
using System.Threading.Tasks;
###########################################
# Generate or retrieve the API key - Log in to the Enterprise portal and follow the tutorial
# under Help - Reporting APIs. The first section under this help article explains how to
# generate or retrieve the API key for the specified enrollment.
# Source: https://docs.microsoft.com/en-us/azure/billing/billing-enterprise-api
#
# Endpoints and sample responses are here:
# https://docs.microsoft.com/en-us/rest/api/billing/enterprise/billing-enterprise-api-usage-detail#json-format
# You can use that documentation to help understand the key/values returned.
###########################################
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountDiagnosticName": {
"defaultValue": "[concat('asrmockdiag', uniqueString(resourceGroup().id))]",
"type": "String",
"metadata": {
"description": "Name of storage account"}
},