Skip to content

Instantly share code, notes, and snippets.

View hunt3ri's full-sized avatar

Iain Hunter hunt3ri

View GitHub Profile
@hunt3ri
hunt3ri / python3-3-launch.txt
Created November 8, 2012 21:24
Python3.3 text
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 01:25:11)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
@hunt3ri
hunt3ri / GetDocumentation.cs
Created September 19, 2012 21:43
Get summary block from each API method
/// <summary>
/// Read the Summary block from each API method, grab the entire XML fragment as we'll use a series of
/// Extension methods on APIExplorer to parse the XML for output later.
/// </summary>
public virtual string GetDocumentation(HttpActionDescriptor actionDescriptor)
{
var memberNode = GetMemberNode(actionDescriptor);
if (memberNode != null)
{
@hunt3ri
hunt3ri / backup-sqlazuredb.ps1
Created August 21, 2012 12:16
Powershell script for backing up SQL Azure db
###############################################################################
# Description: Backup Script for Sql Azure DB
# Author: Iain Hunter
# Date: 21/08/12
###############################################################################
$today = Get-Date
$todayStr = $today.ToString("yyyyMMdd")
$backupFile = "your-db" + $todayStr + ".bacpac"
echo "Exporting backup to: $backupFile"
@hunt3ri
hunt3ri / importsqlazuredb.txt
Created August 20, 2012 16:03
Import your SQL Azure DB using Azure Import Export service util
.\DacIESvcCli -S YOUR-SQL-AZURE-SERVERNAME.database.windows.net -U YOUR-SQL-AZURE-USERNAME -P YOUR-SQL-AZURE-DB-PASSWORD -D YOUR-SQL-AZURE-RESCUE-DB-NAME -I -BLOBACCESSKEY YOUR-BLOB-STORAGE-ACCOUNT-KEY -BLOBURL YOUR-BLOB-STORAGE-ADDRESS/CONTAINER-NAME/BackupName.bacpac -ACCESSKEYTYPE storage
@hunt3ri
hunt3ri / exportsqldb.txt
Created August 20, 2012 15:08
Export your SQL Azure DB using Azure Import Export service util
.\DacIESvcCli -S YOUR-SQL-AZURE-SERVERNAME.database.windows.net -U YOUR-SQL-AZURE-USERNAME -P YOUR-SQL-AZURE-DB-PASSWORD -D YOUR-SQL-AZURE-DB-NAME -X -BLOBACCESSKEY YOUR-BLOB-STORAGE-ACCOUNT-KEY -BLOBURL YOUR-BLOB-STORAGE-ADDRESS/CONTAINER-NAME/BackupName.bacpac -ACCESSKEYTYPE storage
@hunt3ri
hunt3ri / ImportAzureSettings.ps1
Created August 6, 2012 14:56
How to import your azure settings
Import-AzurePublishSettingsFile -PublishSettingsFile 'c:\users\<username>\downloads\your-credentials.publishsettings' -SubscriptionDataFile 'c:\dev\tools\windowsazure\subscriptions\your-sub.xml'
@hunt3ri
hunt3ri / azureconsole.ps1
Created August 6, 2012 14:08
Setup Azure commands for Powershell
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
Set-ExecutionPolicy RemoteSigned
@hunt3ri
hunt3ri / CopyAzureDb.sql
Created August 3, 2012 10:09
Copy Azure Database
CREATE DATABASE Iain_TEST_Copy
AS COPY OF Iain_TEST
@hunt3ri
hunt3ri / migration-config.xml
Created August 2, 2012 16:56
Nant.Builder sample migration config
<!-- Database Migration Settings - expects FluentMigrator-->
<property name="run.db.migrations" value="true" />
<!--The name of the project containing your FluentMigrator tests-->
<property name="migrations.project.name" value="Nant.Builder.Sample.Migrations" />
<!--Database type, eg sqlserver2008, sqlite -->
<property name="database.type" value="sqlite" />
<!--The connection string you for the db you want to migrate-->
<property name="connection.string" value="Data Source=C:\dev\tools\sqlite\nant-builder-sample.sqlite;Version=3;" />
<!-- Set flag to true if you wish to rollback a db migration, you need to specify a migration number also-->
<property name="rollback.db.migrations" value="false" />
@hunt3ri
hunt3ri / SampleMigration.cs
Created August 2, 2012 15:47
Sample FluentMigrator migration
using FluentMigrator;
namespace Nant.Builder.Sample.Migrations
{
[Migration(3)]
public class Mig003_CreateUserRoleTable : Migration
{
private const string TableName = "UserRole";
public override void Up()