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 / installation.md
Last active May 11, 2016 15:13
Install the ELK stack on an ubuntu-x64 machine on Azure

install the ELK stack on an ubuntu-x64 machine on Azure

This guide has been revised 06-03-2015. Start with a clean ubuntu 14.04LTS-x64 machine and get it updated

sudo su
apt-get update && apt-get dist-upgrade
reboot
@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / 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'