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 / 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 / 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
@crunchie84
crunchie84 / gist:8e6bc9fe3ac76ceec890
Created November 13, 2014 13:50
install logstash 1.4.2 ubuntu 14.04
partial from http://blog.dimaj.net/content/howto-view-and-analyze-your-logs-web-page
cd ~
wget https://download.elasticsearch.org/logstash/logstash/logstash-1.4.2.tar.gz
tar xzvf logstash-1.4.2.tar.gz
sudo mv logstash-1.4.2 /opt/logstash
sudo adduser --system --disabled-login --no-create-home --group logstash
sudo usermod -a -G adm logstash
#auto start script for logstash
@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 / keybase.md
Created February 19, 2016 10:25
keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object: