Skip to content

Instantly share code, notes, and snippets.

View bbehrens's full-sized avatar

Brandon Behrens bbehrens

View GitHub Profile
using System;
using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Serialization;
namespace SelfService
{
"commands": {
"web": "SelfService"
},
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
@bbehrens
bbehrens / gist:7790809602e22a552f8a
Created May 22, 2014 14:08
Sony email errors (5/22/2014)
{
"title": "Customer Error Monitor(Sony email)",
"services": {
"query": {
"idQueue": [
1,
2,
3,
4
],
@bbehrens
bbehrens / nec cloudsearch attachment.sql
Last active August 29, 2015 14:00
Sql to find attachments aws tells us are bad
select * from [file] with (nolock) where id in (select [file_id] from [attachment] with (nolock) where id in (
'b3c701da-3fc4-460f-ac53-a1930101a870',
'4721031b-c9b8-45b7-949d-a1fd017ad51f',
'75cfd34e-f930-437b-acff-a1a300e19663',
'73e904c3-84c0-4ab8-a60b-a218017aee8f',
'73c565a0-b2a8-4423-9ce7-a270014fa596',
'f85fd541-7edc-4d85-bd4a-a270014fa596',
'88df6322-c622-4b2e-a1a5-a270016a81ce',
'194ed7c4-9328-4298-bfef-a27d0180cc4c',
'f1cefb83-7188-4cf6-9a76-a2b40187e486',
<add key="FileExtractSettings.BlackListExtensions" value="7z,apk,ARTask,asc,avi,bmp,dat,docm,eml,emz,exe,gdoc,gif,gsheet,ico,ics,jpeg,jfif,jpg,jsf,mht,msg,mov,mso,mp3,mp4,odt,oft,p7s,png,ppsx,quiz,rar,raw,rtf,STX,svg,swf,td,tif,tiff,TTO__AppData__Local__Temp__msohtmlclip1_,TXT_63020131515,wav,wmv,xlr,xlsm,xml,xps,zip" />
@bbehrens
bbehrens / gist:10881258
Last active August 29, 2015 13:59
Selecting file extensions in sql server
--Distinct File extensions
SELECT DISTINCT Reverse(Substring(Reverse(originalfilename), 1,
Charindex('.', Reverse(originalfilename)
) - 1)) AS FileExt
FROM [file] WITH (nolock)
WHERE Charindex('.', originalfilename) != 0
AND Reverse(Substring(Reverse(originalfilename), 1,
Charindex('.', Reverse(originalfilename)
) - 1)) NOT IN ( 'csv', 'pdf', 'htm', 'html',
'xls', 'xlsx', 'ppt', 'pptx',
if (ExtensionProperties.HasExtensionFor(typeof(T)))
{
var componentType = typeof(ExtensionComponent<>).MakeGenericType(ExtensionProperties.ExtensionFor(typeof(T)));
if (componentType != null)
{
var component = Activator.CreateInstance(componentType) as IComponentMappingProvider;
(Components as IList<IComponentMappingProvider>).Add(component);
}
}
[Test]
public void TestDomainFilterBlacklistRuleWorks()
{
IRepository repository = _mocks.Stub<IRepository>();
repository.Stub(x => x.Query(new DomainFilterBlacklistRegEx("foo"))).Return(
new List<AdNetworkCacheDomainBlacklist> {null}.AsQueryable());
IRequestInfo requestInfo = _mocks.Stub<IRequestInfo>();
requestInfo.Stub(x => x.UserIpAddress).Return("foo");
ITidalTvAdNetworkResponse response = new TidalTvAdNetworkResponse();
IAdDecisioningRule rule = new DomainFilterBlacklistRule(repository);
[Test]
public void TestDomainFilterBlacklistRuleWorks()
{
IRepository repository = _mocks.Stub<IRepository>();
repository.Stub(x => x.Query(new DomainFilterBlacklistRegEx("foo"))).Return(
new List<AdNetworkCacheDomainBlacklist> {null}.AsQueryable());
IRequestInfo requestInfo = _mocks.Stub<IRequestInfo>();
requestInfo.Stub(x => x.UserIpAddress).Return("foo");
ITidalTvAdNetworkResponse response = new TidalTvAdNetworkResponse();
IAdDecisioningRule rule = new DomainFilterBlacklistRule(repository);