Skip to content

Instantly share code, notes, and snippets.

View crunchie84's full-sized avatar
🦑
Focusing

Mark van Straten crunchie84

🦑
Focusing
View GitHub Profile
@crunchie84
crunchie84 / VS References Yuml.ps1
Last active December 10, 2015 23:28 — forked from DanTup/VS References Yuml.ps1
dependecy graph yuml generator for c# projects fork from http://blog.dantup.com/2012/05/free-dependency-graph-generation-using-powershell-and-yuml Tweaked because my powershell gave some errors about missing values for Mandatory attribute and ValueFromPipeline
function Get-ProjectReferences
{
param(
[Parameter(Mandatory=$True)]
[string]$rootFolder,
[string[]]$excludeProjectsContaining
)
dir $rootFolder -Filter *.csproj -Recurse |
@crunchie84
crunchie84 / create-azure-certificate.bat
Created April 18, 2013 08:48
example batch file to generate a certificate for usage in the Azure management portal
@echo off
SET subjectName="My-Azure-Certificate"
SET outputCertFile="AzureConf.cer"
SET storeName="My"
SET storeLocation="LocalMachine"
CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\makecert" -r -pe -a sha1 -n CN=%subjectName% -ss %storeName% -sr %storeLocation% -len 2048 -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" -sy 24 %outputCertFile%
@crunchie84
crunchie84 / karma.conf.js
Created April 18, 2013 09:28
example configuration + proj setup of Karma (formerly known as Testacular) - see http://karma-runner.github.io/0.8/config/files.html for documentation
basePath = '';// base path, that will be used to resolve files and exclude
files = [
JASMINE, JASMINE_ADAPTER,
'js/libs/jquery-*.min.js',
// source files
'js/my-epic-menu.js',
//the tests (specs)
'tests/spec/**/*.js'
@crunchie84
crunchie84 / msdeploy-package-webdir.bat
Last active December 17, 2015 14:49
Because i always forget: syntax to create a deployable (MsDeploy) IIS Website package from a regular static-files directory.
REM just a snippet
msdeploy.exe
-verb:sync
-source:iisApp="%RootPath%mywebproject"
-dest:package="%RootPath%Website.zip"
-declareParamFile:"%RootPath%\parameters.xml"
@crunchie84
crunchie84 / UriJsonTypeConverter.cs
Last active August 29, 2015 13:57
custom uri typeconvert to string for ElasticSearch indexing
namespace Domain.TypeConverters
{
using System;
using Newtonsoft.Json;
/// <summary>
/// Converter for converting Uri to String and vica versa
/// </summary>
/// <remarks>
/// Code originated from http://stackoverflow.com/a/8087049/106909
@crunchie84
crunchie84 / Nest_AddContractJsonConverters.cs
Last active August 29, 2015 13:59
Different ways to add custom JsonConverters to ElasticSearch Nest (.net client)
var settings = new ConnectionSettings("http://localhost:9200)
.AddContractJsonConverters(type =>
{
//TypeCheck to return StringEnumConverter for Enums and Nullable<T> where T : Enum
if (type.IsEnum || (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) && type.GetGenericArguments().First().IsEnum))
return new Newtonsoft.Json.Converters.StringEnumConverter();
return null;
});
@crunchie84
crunchie84 / elasticsearch-nest-geoquery-example.cs
Last active January 30, 2023 17:18
Easy example of indexing geo-based domain objects to ElasticSearch via #nest
using Nest;
using System;
using System.Globalization;
namespace elasticsearch_nest_geoindex_demo
{
public class Location
{
public string Name { get; set; }
@crunchie84
crunchie84 / BasicAuthHttpConnection.cs
Last active August 11, 2022 19:55
Basic HTTP-auth ElasticSearch with Nest client
namespace Elasticsearch.Net.Connection
{
using System.Globalization;
using System;
using System.Text;
/// <summary>
/// HttpConnection with basic auth usage
/// </summary>
public sealed class BasicAuthHttpConnection : HttpConnection
@crunchie84
crunchie84 / class1.cs
Created September 10, 2014 21:41
Testcase for NEST 1.0.2 enum as string serialization failing
using System;
using System.Text;
using Nest;
using NUnit.Framework;
namespace ClassLibrary1
{
public class MyObject
{
public MyEnum MyEnum { get; set; }
@crunchie84
crunchie84 / gist:cd117ea652a0d1e61d66
Created November 13, 2014 11:52
install elasticsearch curator
#https://github.com/elasticsearch/curator/wiki/Installation
apt-get install python-pip python-dev build-essential
pip install elasticsearch-curator
which curator
# => /usr/local/bin/curator
crontab -e
# add this to run at 3:01AM cleanup of old indices older then 90 days