Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#
# Saves all dashboards in Kibana to /vagrant/dashboards
# so they can be reloaded if this vagrant instance is destroyed
#
curl -s 'http://localhost:9200/kibana-int/dashboard/_search?pretty=true&fields=' | grep "_id" | sed -E 's/.*"_id" : "(.*)",/\1/' | while read -r line; do curl -s -X GET http://localhost:9200/kibana-int/dashboard/$line/_source > /vagrant/dashboards/$line.json; done
@brianlow
brianlow / gist:9245781
Created February 27, 2014 07:17
Setup-Image
sc stop WMPNetworkSvc
sc config WMPNetworkSvc start= disabled
c:\windows\system32\sysprep\sysprep /generalize /oobe /shutdown
public static string CreateDatapoint(string feedId, string datastreamId, string value)
{
string url = string.Format("http://api.cosm.com/v2/feeds/{0}/datastreams/{1}/datapoints", feedId, datastreamId);
var datapoints = new {datapoints = new[] {new {at = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ"), value}}};
var datapointsJson = new JavaScriptSerializer().Serialize(datapoints);
var webClient = new WebClient();
webClient.Headers.Set("X-ApiKey", "KbI9MZtLvhaOuAi0DKXWzc4UZk-SAKxhQjd3MHJtd2ZwYz0g");
return webClient.UploadString(url, "POST", datapointsJson);
}
@brianlow
brianlow / PostToCosm
Created December 18, 2012 06:22 — forked from anonymous/PostToCosm
var webClient = new WebClient();
webClient.Headers.Set("X-ApiKey", "KbI9MZtLvhaOuAi0DKXWzc4UZk-SAKxhQjd3MHJtd2ZwYz0g");
var response = webClient.UploadString(
"http://api.cosm.com/v2/feeds/92158/datastreams/WaterLevel/datapoints",
"POST",
@"{
""datapoints"":[
{""at"":""2012-12-18T04:00:00Z"",""value"":""294""},
{""at"":""2012-12-18T04:01:00Z"",""value"":""295""},
{""at"":""2012-12-18T04:02:00Z"",""value"":""296""},
@brianlow
brianlow / gist:4141086
Created November 24, 2012 19:23
SublimeClang project settings for Arduino
// In Sublime:
// - Install SublimeClang
// - save new sublime project in your Arduino project folder (e.g. My Documents\Arduino I think is the default)
// - Project -> Edit Project
// - paste into file
// - now your code is recompiled on the fly
// - note this just handled .cpp and .h you'll need to convert your .ino to compile the sketch
// Credits: many of the compile options are from http://blog.tzikis.com/?p=454
{
@brianlow
brianlow / FindConflictingReferences.cs
Created January 3, 2012 03:04
Find conflicting assembly references
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
namespace MyProject
{
[TestFixture]