Skip to content

Instantly share code, notes, and snippets.

View tillig's full-sized avatar

Travis Illig tillig

View GitHub Profile
@tillig
tillig / CallLogger.cs
Last active September 14, 2015 09:51
Intercepting SignalR Hubs with Autofac
using System;
using System.Diagnostics;
using System.Linq;
using Castle.DynamicProxy;
namespace SignalInterceptor
{
public class CallLogger : IInterceptor
{
public void Intercept(IInvocation invocation)
@tillig
tillig / gist:ebe7ca1af84aa5f28c38
Last active September 28, 2015 17:19
Boxstarter Package Detection Test
# Detects whether a specific package is already installed
function Test-PackageInstalled
{
param([Parameter(Mandatory=$true)][string] $packageName)
$found = Get-ChildItem -Path "$env:ChocolateyInstall\lib" -Directory -Filter "$packageName.*" | Measure-Object | Select-Object -ExpandProperty Count
return $found -ne 0
}
Test-PackageInstalled nuget.commandline
@tillig
tillig / gist:a6cb81f8986d2fe5011a
Last active April 13, 2016 19:01
Boxstarter - Windows Server 2012 Dev Machine Base Setup
# Base explorer features
$Boxstarter.RebootOk = $true
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-MicrosoftUpdate
Update-ExecutionPolicy -Policy RemoteSigned
# Base updates
Install-WindowsUpdate -GetUpdatesFromMS -AcceptEula
# Installation platforms
@tillig
tillig / Sync-AzureAD.ps1
Created July 26, 2016 17:30
Force an Azure AD Connect delta synchronization
# Run this as administrator
Import-Module ADSync
Start-ADSyncSyncCycle -PolicyType Delta
@tillig
tillig / InstallApp.cs
Last active January 4, 2017 21:15
Example console app showing how to add items to the Visual Studio toolbox
using System;
using System.Reflection;
using System.Runtime.InteropServices;
namespace ToolboxIntegration
{
class InstallApp
{
protected const string DTE_PROG_ID = "VisualStudio.DTE.7.1";
@tillig
tillig / KeyedCollection.cst
Created January 4, 2017 21:54
CodeSmith template for generating a KeyedCollection
<%@ CodeTemplate Language="C#" TargetLanguage="C#" Description="Generates a strongly typed collection based on a generic KeyedCollection." %>
<%@ Property Name="Accessibility" Type="System.String" Optional="True" Default="public" Category="Options" Description="The accessibility of the collection class." %>
<%@ Property Name="ClassName" Type="System.String" Optional="True" Category="Context" Description="The name of the collection class." %>
<%@ Property Name="TargetNamespace" Type="System.String" Optional="True" Category="Namespaces" Description="The namespace of the collection class." %>
<%@ Property Name="KeyPropertyName" Type="System.String" Category="Context" Description="The name of the property on each collection member that returns the key value." %>
<%@ Property Name="KeyType" Type="System.String" Category="Context" Description="The key type of the collection." %>
<%@ Property Name="KeyNamespace" Type="System.String" Optional="True" Category="Namespaces" Description="The namespace of the key type." %
@tillig
tillig / DatabaseMaintenance.aspx
Last active January 4, 2017 22:10
Subtext database administration page
<%@ Page Language="C#" Debug="true" EnableTheming="false" Title="Subtext Admin - Database Maintenance" MasterPageFile="~/aspx/Admin/WebUI/AdminPageTemplate.Master" AutoEventWireup="True" Inherits="Subtext.Web.Admin.Pages.AdminPage" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="Microsoft.ApplicationBlocks.Data" %>
<%@ Import Namespace="Subtext.Framework.Providers" %>
<script runat="server">
// Timeout has to be longer than the default because these ops can take a while.
@tillig
tillig / CreateTimeSnapperTaskDb.sql
Created January 4, 2017 22:35
Simple primary/subtask database integration for TimeSnapper.
USE [TimeSnapperTaskDb]
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_DiagramPaneCount' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'task_list'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_DiagramPane1' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'task_list'
GO
ALTER TABLE [dbo].[task] DROP CONSTRAINT [FK_task_project]
GO
@tillig
tillig / EnableCustomLyncStatus.reg
Created January 4, 2017 22:39
Enable a custom status in Microsoft Lync.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Office\15.0\Lync]
"EnableSIPHighSecurityMode"=dword:00000000
"CustomStateURL"="file:///C:/Users/tillig/OneDrive/Settings/Lync/presence.xml"
@tillig
tillig / itunes2html.xsl
Created January 4, 2017 23:36
XSL to convert your iTunes library to an HTML table
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<table border="1">
<tr>
<th>Track ID</th>
<th>Name</th>
<th>Artist</th>
<th>Album</th>