Skip to content

Instantly share code, notes, and snippets.

@tgrall
tgrall / redis-alert.py
Created April 8, 2020 09:25
SYSlog demonstration
import time
import json
import requests
import re
import sys
# Read log
def tail(f):
f.seek(0, 2)
while True:
//with a previously create client
client.set('some-key','42',function(err) {
if (err) {
throw err; /* in production, handle errors more gracefully */
} else {
client.get('some-key',function(err,value) {
if (err) {
throw err;
} else {
@tgrall
tgrall / mapr-beta-labs.md
Created October 17, 2017 05:35
6.0 Labs

Lab 1

  • select customer_id from dfs.root.`/user/mapr/product_sales` where customer_id=1288034;

  • Open another terminal and create the following indices

maprcli table index add -path /user/mapr/product_sales -index index_customer_id -indexedfields '"customer_id"'

maprcli table index list -path /user/mapr/product_sales -json
@tgrall
tgrall / drill-workshop.md
Last active April 4, 2016 09:27
Drill Workshop Preparation
@tgrall
tgrall / demo.MapRDBSJSONType.java
Created October 3, 2015 12:55
OJAI/MapR-DB Sample code to save/get binary content
package demo;
import com.mapr.db.MapRDB;
import com.mapr.db.Table;
import org.ojai.Document;
import javax.print.Doc;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@tgrall
tgrall / distinct.go
Created October 29, 2014 10:37
Go Sample : How to do a Distinct
package main
import (
"fmt"
"log"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
type City struct {
@tgrall
tgrall / sec_tutorial.md
Last active September 4, 2020 07:27
MongoDB Security Tutorial

#Simple MongoDB Security Tutorial

###1 - Start mongod without any "security option"

$ mongod --port 27017

@tgrall
tgrall / samplegeoquery.java
Last active August 29, 2015 14:05
Sample Java GeoQuery
import com.mongodb.*;
/**
* Created by tgrall on 8/27/14.
*/
public class TestApp {
public static void main(String[] args) throws Exception {
package com.couchbase.devday;
import com.couchbase.client.CouchbaseClient;
import com.couchbase.client.protocol.views.*;
import java.net.URI;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
@tgrall
tgrall / DummyInjector.java
Created September 24, 2013 14:18
Simple class to show how to deal with async set operation
package com.couchbase.devday;
import com.couchbase.client.CouchbaseClient;
import net.spy.memcached.internal.OperationFuture;
import java.net.URI;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;