Skip to content

Instantly share code, notes, and snippets.

@nherment
nherment / mn-mock.js
Created April 23, 2012 17:25
mn-mock
/** ******************************************************* **/
/** * Imports & Utils * **/
/** ******************************************************* **/
var mncore = require("mn-core");
var ConfigManager = mncore.ConfigManager;
var confMgr = new ConfigManager();
@nherment
nherment / curl_commands.log
Created April 16, 2012 23:34
ElasticSearch issue
$ curl -XPUT 'http://localhost:9200/system/' -d '{ "settings" : { "index" : {"number_of_replicas" : 1 } } }'
{
"ok": true,
"acknowledged": true
}
$ curl -XPUT 'http://localhost:9200/system/Layout/_mapping' -d '{"Layout":{"properties":{"name":{"type":"string","index":"analyzed","store":"yes"}}}}'
{
@nherment
nherment / data.json
Created April 4, 2012 15:35
es_data
{"key":"new1","name":"new1","classIdentifier":null,"entityName":null,"layoutType":"static_widget","userId":null,"id":96592},
{"key":"newE","name":"newE","classIdentifier":null,"entityName":null,"layoutType":"static_widget","userId":null,"id":96612},
{"key":"newJ","name":"newJ","classIdentifier":null,"entityName":null,"layoutType":"static_widget","userId":null,"id":96632},
{"key":"newA","name":"newA","classIdentifier":null,"entityName":null,"layoutType":"static_widget","userId":null,"id":96596},
{"key":"newF","name":"newF","classIdentifier":null,"entityName":null,"layoutType":"static_widget","userId":null,"id":96616},
{"key":"newK","name":"newK","classIdentifier":null,"entityName":null,"layoutType":"static_widget","userId":null,"id":96636},
{"key":"newB","name":"newB","classIdentifier":null,"entityName":null,"layoutType":"static_widget","userId":null,"id":96600},
{"key":"newG","name":"newG","classIdentifier":null,"entityName":null,"layoutType":"static_widget","userId":null,"id":96620},
{"key":"newL","name":"ne
@nherment
nherment / mapping.json
Created March 22, 2012 12:49
elasticsearch issue: sort fail on not_analyzed attribute
{
"UILayout": {
"properties": {
"id": {
"store": "yes",
"type": "long"
},
"userId": {
"store": "yes",
"type": "string"
@nherment
nherment / backup.sh
Created February 29, 2012 10:37 — forked from karussell/backup.sh
Backup ElasticSearch with rsync
# TO_FOLDER=/something
# FROM=/your-es-installation
DATE=`date +%Y-%m-%d_%H-%M`
TO=$TO_FOLDER/$DATE/
echo "rsync from $FROM to $TO"
# the first times rsync can take a bit long - do not disable flusing
rsync -a $FROM $TO
# now disable flushing and do one manual flushing
@nherment
nherment / gist:0914065cd54e1720953d
Last active August 29, 2015 14:13
JS make objects serializable
function makeSerializable(obj, skipAttributes) {
if(_.isArray(obj)) {
var serializableArray = {}
for(var i = 0 ; i < obj.length ; i++) {
serializableArray[i] = makeSerializable(obj[i])
}
return serializableArray
} else if(obj instanceof Object) {
@nherment
nherment / dht22.js
Created November 24, 2014 20:51
beaglebone temperature/humidity monitor with metrano
var exec = require('child_process').exec
var Metrano = require('metrano)
var metrano = new Metrano('http://ice:3000/')
///home/nherment/Adafruit_Python_DHT/examples/AdafruitDHT.py 22 P8_11
exec('/home/nherment/Adafruit_Python_DHT/examples/AdafruitDHT.py 22 P8_11', function(err, stdout, stderr) {
if(err) {
console.log(err);