Skip to content

Instantly share code, notes, and snippets.

View irwinwilliams's full-sized avatar

Irwin irwinwilliams

View GitHub Profile
@irwinwilliams
irwinwilliams / gh-pages-deploy.md
Created April 10, 2016 00:23 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@irwinwilliams
irwinwilliams / on-vm.sh
Created May 3, 2016 04:18
Start/Stop a classic Azure VM using the azure cli (needs jq installed)
azure login -u <username>
azure config mode asm
export vm_name=<vmname>
export vm_state="$1"
azure vm $vm_state $vm_name
azure vm show $vm_name --json | jq -s .[].InstanceStatus
azure config mode arm
@irwinwilliams
irwinwilliams / UpdateAzureBlobCORS.ps
Last active August 24, 2016 06:58
Update an Azure Blob's CORS setting
#works with Azure in Powershell v 1.3.2
clear
$StorageAccountName = "[storageaccountname]"
$Key = "[storageaccountkey]"
$Context = New-AzureStorageContext -StorageAccountKey $Key -StorageAccountName $StorageAccountName
$CorsRules = (@{
AllowedHeaders=@("*");
AllowedOrigins=@("*");
ExposedHeaders=@("content-length");
MaxAgeInSeconds=200;
@irwinwilliams
irwinwilliams / SetAzureADRoles.ps1
Created October 7, 2016 12:50
Set Roles in Azure AD via PowerShell
#'I got this from here: https://github.com/Azure-Samples/active-directory-dotnet-graphapi-console/issues/27#issuecomment-155565140
$Tenant = "[something].onmicrosoft.com";
$tenantGuid = "[find this in the manifest]"
$graphver = "1.5"
$appID = "[also manifest, but portal, too.]"
$userVal = "[username]@" + $tenant
$pass = "[password]"
$creds = New-Object System.Management.Automation.PsCredential($userVal, (ConvertTo-SecureString $pass -AsPlainText -Force))
@irwinwilliams
irwinwilliams / FillRows.vb
Created May 1, 2017 11:58
Needed to update rows in an excel document for a project called Time For Water, based on data @wasatnt released.
Sub FillRows()
For i = 1 To ThisWorkbook.Sheets.Count
Sheets(i).Activate
'You can add more code
With ActiveSheet
Dim lRow As Long
Dim lCol As Long
lRow = Cells(Rows.Count, 3).End(xlUp).Row
lCol = Cells(1, Columns.Count).End(xlToLeft).Column
@irwinwilliams
irwinwilliams / SystemWebCookieManager.cs
Created May 29, 2017 16:39
Importing a bit of code from Katana on CodePlex
//stick this in public void ConfigureAuth(IAppBuilder app)
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
// ...
CookieManager = new SystemWebCookieManager()
});
//And create this class elsewhere:
public class SystemWebCookieManager : ICookieManager
{
@irwinwilliams
irwinwilliams / change-rdp-settings-azure-web-role.ps
Created September 23, 2017 07:44
Change RDP settings on Azure Web Role
#This works with a Classic Azure Cloud Service Web Role
$SubsciptionName = "<name>"
$CloudServiceName = "<web-role-name>"
Add-AzureAccount
Select-AzureSubscription -Name $SubscriptionName
Get-AzureRole -ServiceName $CloudServiceName
$username = "<username>"
$password = "<other-options-can-be-used>"
$securepassword = ConvertTo-SecureString -String $password -AsPlainText -Force
@irwinwilliams
irwinwilliams / create-resource-group.sh
Created October 12, 2017 02:43
Create a resource group using Azure's CLI
#Prior to doing this, ensure that user is logged in
# 'az login' works
#Then, if you have multiple subscriptions attached to account, select the appropriate one using:
# 'az account set --subscription <name or id>'
#command below:
az group create --name COMP6905A2Storage #name I used
@irwinwilliams
irwinwilliams / single-storage-account-create.sh
Created October 12, 2017 02:46
Create a storage account via azure CLI
#ensure logged in to azure
#ensure default subscription is desired one
az storage account create --name comp69052017a2test \ #test storage account
--resource-group COMP6905A2Storage \#test resource group
--location eastus --sku Standard_LRS \
--encryption blob
@irwinwilliams
irwinwilliams / display-storage-account-keys.sh
Created October 12, 2017 02:48
Display storage account keys using azure cli
az storage account keys list --account-name comp69052017a2test --resource-group COMP6905A2Storage