Skip to content

Instantly share code, notes, and snippets.

View hoetz's full-sized avatar

Florian Hötzinger hoetz

View GitHub Profile
@hoetz
hoetz / gist:5568826
Created May 13, 2013 14:45
Scriptcs + StreamO = Exchange notifications done easy
scriptcs -install StreamO
scriptcs
> using StreamO;
> using Microsoft.Exchange.WebServices.Data;
> var cred = new WebCredentials("serviceaccount@yourcompany.com","password");
> var listener=new StreamingListener(cred,(eventData)=>{ Console.WriteLine("Event incoming for "+eventData.Sender.ToString()); });
> listener.AddSubscription("florian.hoetzinger@yourcompany.com");
@hoetz
hoetz / nodeazurecheat
Last active August 29, 2015 13:56
node.js express azure web site cheat sheet
-[install node.js azure sdk mac os x]
-azure account download
-[save pub file to disk]
-azure account import xxx.publishsettings
-azure site create sitename --git
-sudo npm install express -g
-express
-npm install
-[rename app.js to server.js]
-[node server.js] will start your app locally
@hoetz
hoetz / gist:2de70b06b55747570887
Created May 25, 2014 13:26
KRuntime build.sh error
Building Microsoft.Framework.ApplicationHost .NETFramework,Version=v4.5
System.TypeLoadException: Could not load type 'System.Reflection.Internal.MemoryMappedFileBlock' from assembly 'System.Reflection.Metadata, Version=1.0.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
...
.
..
at Microsoft.Framework.Project.BuildManager.Build () [0x00000] in <filename unknown>:0
[Fact]
public void Index_OneGet_ReturnsViewModel()
{
var sut= new HomeController();
var httpContext = new Mock<HttpContext>().Object;
var actionContext=new ActionContext(httpContext, new RouteData(), new ActionDescriptor());
sut.ActionContext=actionContext;
ViewResult result= sut.Index() as ViewResult;
Assert.True(result.ViewData.Model is StartPageViewModel);
@hoetz
hoetz / gist:940a975e8f1238f156a0
Last active August 29, 2015 14:12
aspnet vNext + Autofixture + NSubstitute (Bonus: setup for MVC Controllers)
using Web.Controllers;
using Web.Model;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Http;
using Xunit;
public class HomeTests
{
[Theory]
@hoetz
hoetz / gist:3f517a2a28e4e78053b8
Last active December 27, 2016 16:02
asp.net vNext Identity for dummies: your own storage providers
using Microsoft.AspNet.Builder;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.AspNet.Diagnostics;
using Microsoft.AspNet.Identity;
using ManagementWeb.Models;
using ManagementWeb.Storage;
namespace HelloMvc
{
@hoetz
hoetz / gist:09391592d11e28032c6e
Created January 1, 2015 19:04
WindowsAzure.Storage 4.3.2 problem with k runtime on Mac OS X
System.TypeLoadException : Could not load type 'Microsoft.WindowsAzure.Storage.Core.Executor.RESTCommand`1[Microsoft.WindowsAzure.Storage.Table.TableResult]' from assembly 'Microsoft.WindowsAzure.Storage, Version=4.3.2.0, Culture=neutral, PublicKeyToken=null'.
Stack Trace:
at Microsoft.WindowsAzure.Storage.Table.TableOperation.ExecuteAsync (Microsoft.WindowsAzure.Storage.Table.CloudTableClient client, System.String tableName, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0
at Microsoft.WindowsAzure.Storage.Table.CloudTableClient.ExecuteAsync (System.String tableName, Microsoft.WindowsAzure.Storage.Table.TableOperation operation, Microsoft.WindowsAzure.Storage.Table.TableRequestOptions requestOptions, Microsoft.WindowsAzure.Storage.OperationContext operationContext, CancellationToken cancellationToken) [0x00000] in <filen
@hoetz
hoetz / gist:8c2760fa58e1f14b6c28
Created August 19, 2015 09:06
Windows 10 Store Tweetium Trouble
{D980E029-7ABF-427A-9FED-5625CB9DE2A7} 2015-08-19 11:05:11:340+0200 1 181 [AGENT_INSTALLING_STARTED] 101 {797679CC-F58D-49D7-989E-8994053A5D6A} 1 0 WSAcquisition Success Content Install Installation Started: Windows has started installing the following update: Microsoft.WinJS.2.0
{1EC36165-BFB3-461B-A83F-416D3C6F03AE} 2015-08-19 11:05:11:480+0200 1 182 [AGENT_INSTALLING_FAILED] 101 {797679CC-F58D-49D7-989E-8994053A5D6A} 1 80073cff WSAcquisition Failure Content Install Installation Failure: Windows failed to install the following update with error 0x80073cff: Microsoft.WinJS.2.0.
{E6336110-7369-4CB8-BA83-992FF0C9CEDA} 2015-08-19 11:05:11:480+0200 1 181 [AGENT_INSTALLING_STARTED] 101 {32A453D8-DB4A-4DDA-8E62-56C0C7A04C2B} 1 0 WSAcquisition Success Content Install Installation Started: Windows has started installing the following update: Tweetium
{23E872CA-FA67-4959-9E9F-5DF9F9288C0D} 2015-08-19 11:05:11:699+0200 1 182 [AGENT_INSTALLING_FAILED] 101 {32A453D8-DB4A-4DDA-8E62-56C0C7A04C2B} 1 80073cff WSAcquisition
@hoetz
hoetz / githubpstoken.ps1
Last active March 27, 2018 18:22
Github auth token with powershell
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("USERNAME:PASSWORD")))
Invoke-RestMethod -Uri "https://api.github.com/authorizations" -method post -ContentType "application/json" -Body "{""scopes"" : ""gist"",""note"":""VSCode-Gist-Extension""}" -Headers @{"Authorization"="Basic $base64AuthInfo"}
@hoetz
hoetz / Untitled-1
Created February 1, 2016 13:07
DN split
private List<string> GetDistinguishedNamePartList(bool withNameQualifier)
{
string ouQualifier = "ou=";
string nameQualifier = "cn=";
string domainQualifier = "dc=";
string[] arrayOfEntryStrings = null;
List<string> listOfEntryStrings = new List<string>();
if (withNameQualifier)
{