Skip to content

Instantly share code, notes, and snippets.

View vinaynair's full-sized avatar

Vinay Chandrasekharan vinaynair

View GitHub Profile
# Only current directory
export PS1='${PWD/*\//}$ '
# vi on bash
set -o vi
export EDITOR=vi
package com.svb.demo.usecase.dblistener;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
import oracle.jms.AQjmsFactory;
import oracle.jms.AQjmsSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jms.*;
@vinaynair
vinaynair / View.js
Last active August 29, 2015 14:27
Simple JS Logging and AJAX JQuery wrapper
//View
var View={
processProductIDs:function(ids){
LOG.info("updating view with product IDs="+ids);
$("#productsTable tr").not(":first").remove();
$("#cartTable tr").not(":first").remove();
for(var index in ids){
AJAX.GET("/productData/"+ids[index],View.addProductToTable);
}
},
@vinaynair
vinaynair / pom.xml
Created August 11, 2015 15:46
HSQLDB Maven POM helper profiles
<!--
$> mvn exec:exec -Phsqldb-server to start the server
$> mvn exec:exec -Phsqldb-client to start the swing client to this server
-->
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@vinaynair
vinaynair / tmc-json2csv.py
Created January 9, 2015 18:55
Simple CURL based Terracotta Management REST client that converts JSON formatted cache statistics information into a CSV format and spits to the console
#!/usr/bin/env python
from types import *
import json
import csv
import sys
# Usage
# curl --silent "http://localhost:9889/tmc/api/agents/cacheManagers/caches?show=CacheMissRate&show=CacheHitRate" | python json2csv.py
# If you want to loop it, simple do:-
@vinaynair
vinaynair / JsonExtractor.java
Last active August 29, 2015 14:07
EhCache Json document search extractor
package org.terracotta.demo.search;
import net.sf.ehcache.Element;
import net.sf.ehcache.search.attribute.AttributeExtractor;
import net.sf.ehcache.search.attribute.AttributeExtractorException;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.node.ObjectNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.sf.ehcache.Cache;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
/**