Skip to content

Instantly share code, notes, and snippets.

View domgreen's full-sized avatar
👻
Boo!

Dominic Green domgreen

👻
Boo!
View GitHub Profile
@domgreen
domgreen / gist:923281
Created April 16, 2011 16:58
cspack to create a cloud web site from a standard asp.net site
cspack ServiceDefinition.csdef
/out:Azure.csx /copyOnly
/role:MvcTestAzure;MvcTestAzure
/sites:MvcTestAzure;Web;MvcTestAzure
/generateConfigurationFile:ServiceConfiguration.cscfg
/rolePropertiesFile:MvcTestAzure;Props.txt
@domgreen
domgreen / gist:923280
Created April 16, 2011 16:56
Azure Service Def file
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="mySiteInAzure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="MvcTestAzure">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
@domgreen
domgreen / gist:923268
Created April 16, 2011 16:43
IronRuby test to call into C#
require "test/unit"
require "IronRubyMine/bin/Debug/IronRubyMine.dll"
class PersonTest < Test::Unit::TestCase
include IronRubyMine
def test_create_person_called_dominic
dominic = Person.new("Dominic")
assert_not_nil(dominic)
@domgreen
domgreen / gist:923265
Created April 16, 2011 16:42
Simple C# class to be called from IronRuby
namespace IronRubyMine
{
public class Person
{
}
}
@domgreen
domgreen / gist:923256
Created April 16, 2011 16:36
calling memcached in Azure
AzureMemcached.Client.Store(StoreMode.Set, key, value);
AzureMemcached.Client.Get(key);
@domgreen
domgreen / gist:923254
Created April 16, 2011 16:34
setting up memcached in Azure
_endpoints = new Dictionary();
foreach (var endpoint in RoleEnvironment.Roles[_memcachedRoleName].Instances)
{
foreach (var epi in endpoint.InstanceEndpoints)
{
if (epi.Key == "memcached")
{
_endpoints.Add(epi.Value.RoleInstance.Id.ToString(),epi.Value.IPEndpoint);
}
}
@domgreen
domgreen / gist:923250
Created April 16, 2011 16:31
running memcached from Azure
string arguments = "-m " + cacheSize +
" -l " + endpoint.Address +
" -p " + endpoint.Port;
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = "memcached.exe";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = arguments;
@domgreen
domgreen / gist:923242
Created April 16, 2011 16:25
calling REST from REST
using(new OperationContextScope((IContextChannel)WebRole.serviceManagement))
{
var hostedServices = WebRole.serviceManagement.ListHostedServices(subscriberID);
foreach (HostedService service in hostedServices)
{
Trace.TraceInformation("Hosted Service: {0}", service.ServiceName);
}
}
@domgreen
domgreen / gist:923240
Created April 16, 2011 16:21
regex to check the naming of Azure Queues
bool match = false;
var exp = new Regex(@"^[0-9a-z]+-*[0-9a-z]+$");
if (exp.IsMatch(input))
{
if (input.Length >= 3 && input.Length <= 63)
{
match = true;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("VALID Queue Name: {0}", input);
}
@domgreen
domgreen / gist:923235
Created April 16, 2011 16:15
Configuration file for utilizing the ServiceManagementAPI on Azure
<configuration>
<system .servicemodel="">
<bindings>
<webhttpbinding>
<binding name="WindowsAzureServiceManagement_WebHttpBinding" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00">
<readerquotas maxstringcontentlength="1048576" maxbytesperread="131072">
<security mode="Transport">
<transport clientcredentialtype="Certificate">
</transport>
</security>