Skip to content

Instantly share code, notes, and snippets.

View tjrobinson's full-sized avatar

Tom Robinson tjrobinson

View GitHub Profile
@tjrobinson
tjrobinson / StandardNoStopWordsAnalyser.cs
Last active August 29, 2015 14:01
Upgrade from Lucene.NET 3 to Lucene.NET 4.0
public class StandardNoStopWordsAnalyser : StandardAnalyzer
{
public StandardNoStopWordsAnalyser() : base(Version.LUCENE_29, new HashSet<string>()) { }
}
@tjrobinson
tjrobinson / Web.config
Created July 2, 2014 12:57
Defining a redirect/rewrite in the Web.config
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Index Request" enabled="true" stopProcessing="true">
<match url="^$"/>
<action type="Rewrite" url="App/app.html" logRewrittenUrl="true"/>
</rule>
</rules>
@tjrobinson
tjrobinson / AcmeUserAccountService.cs
Created August 11, 2014 08:45
MembershipReboot UserAccountService implementation with custom username validation
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using BrockAllen.MembershipReboot;
namespace Acme.Users.MembershipReboot
{
public class AcmeUserAccountService<TAccount> : UserAccountService<TAccount>
@tjrobinson
tjrobinson / es-curator.ps1
Created May 14, 2015 08:05
es-curator.ps1
# get indexes in "logstash" alias
$indexes = Invoke-RestMethod "http://localhost:9200/logstash/_settings"
# get the names of the indexes
$indexNames = Get-Member -InputObject $indexes -MemberType NoteProperty|%{$_.Name}
# foreach index check its age. If over 10 days, delete it
$indexNames|sort |%{
$datePart = $_.Substring(9)
$indexAge = [datetime]::UtcNow.Date.Subtract([DateTime]::Parse($datePart)).Days
@tjrobinson
tjrobinson / install-psget.ps1
Created June 22, 2015 14:19
install-psget.ps1 - suitable for use as part of a Group Policy Object
function Install-PsGet {
$Destination = "C:\Windows\System32\WindowsPowerShell\v1.0\Modules"
New-Item -Path ($Destination + "\PsGet\") -ItemType Directory -Force | Out-Null
Write-Host 'Downloading PsGet from https://github.com/psget/psget/raw/master/PsGet/PsGet.psm1'
$client = (New-Object Net.WebClient)
$client.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$client.DownloadFile("https://github.com/psget/psget/raw/master/PsGet/PsGet.psm1", $Destination + "\PsGet\PsGet.psm1")
Write-Host "PsGet is installed and ready to use" -Foreground Green
}
@tjrobinson
tjrobinson / CommonLoggingTarget.cs
Created July 26, 2011 16:17
Common.Logging.NLog2
using System;
using System.Collections.Generic;
using Common.Logging;
using Common.Logging.Configuration;
using NLog;
using NLog.Targets;
using CommonLogging = Common.Logging;
namespace Hydra.Common.Infrastructure.Crosscutting.Logging.NLog
{
@tjrobinson
tjrobinson / jquery.bannerrotator.css
Created August 11, 2011 15:23
jquery.bannerrotator
.bannerrotator a.linkbox {
background: #ddd;
opacity: .5;
filter: alpha(opacity=50);
}
.bannerrotator a.linkbox:hover {
background: white;
opacity: 1;
filter: alpha(opacity=100);
}
using System;
using System.Collections.Generic;
using Microsoft.Synchronization;
using Microsoft.Synchronization.MetadataStorage;
using Microsoft.Synchronization.SimpleProviders;
namespace RemoteStorage
{
/// <summary>
/// Abstract class containing common functionality used by all FullEnumerationSimpleSyncProviders
@tjrobinson
tjrobinson / Python27.reg
Created January 17, 2012 21:18
Python for Windows registry entries for Windows x64
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\Help]
@tjrobinson
tjrobinson / gist:1633831
Created January 18, 2012 16:21
Generate EDMX file from Entity Framework Code First Context
// See: http://social.msdn.microsoft.com/Forums/en-US/adonetefx/thread/4aa54da1-3099-48ef-9402-ca94cbca19eb/
builder.DiscoverEntitiesFromContext(typeof(MyContext));
DbModel model = builder.CreateModel();
XmlWriter writer = new XmlTextWriter(Path + "MyContext.edmx", Encoding.UTF8);
model.WriteEdmx(conn, writer);
writer.Close();