Skip to content

Instantly share code, notes, and snippets.

@AshwinJay
AshwinJay / FileOutTest.java
Created September 1, 2011 06:01
Linux /dev/shm (Shared memory file system) write performance test
package linuxfs;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
/*
* Author: Ashwin Jayaprakash
*/
@AshwinJay
AshwinJay / PhaserDemo.java
Created August 2, 2011 03:24
j.u.c.Phaser demo
import java.util.concurrent.Phaser;
import java.util.concurrent.atomic.AtomicReferenceArray;
/*
* Author: Ashwin Jayaprakash
*/
public class PhaserDemo {
public static void main(String[] args) {
final int workers = 2;
final int workLength = 10;
@AshwinJay
AshwinJay / 1) jpmp.sh
Created March 2, 2011 23:05
JPMP (Java's Poor Man's Profiler) [corrected]
# Original version: http://blog.tsunanet.net/2010/08/jpmp-javas-poor-mans-profiler.html
# Usage: ./jpmp.sh <pid> <num-samples> <sleep-time-between-samples>
#!/bin/bash
pid=$1
nsamples=$2
sleeptime=$3
for x in $(seq 1 $nsamples)
@AshwinJay
AshwinJay / gist:758256
Created December 29, 2010 06:23
Sqlite FTS experiment (Full Text "Near" Search). This really is an experiment. Not kidding!
package com.javaforu.sqlite.demo;
import java.sql.*;
/*
* Author: Ashwin Jayaprakash / Date: Oct 23, 2010 / Time: 3:58:22 PM / Contact: http://www.ashwinjayaprakash.com
*
* Sqlite jdbc library (sqlite-jdbc-3.7.2.jar) from: http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC
*/
public class FtsSample {
@AshwinJay
AshwinJay / DevNullTest.java
Created July 21, 2010 05:30
Windows nul drive test
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/*
* Author: Ashwin Jayaprakash / Date: Jul 20, 2010 / Time: 10:00:22 PM / Contact: http://www.ashwinjayaprakash.com
*/
public class DevNullTest {
public static void main(String[] args) throws IOException {
File f = new File("nul:");
@AshwinJay
AshwinJay / SimpleVTest.java
Created July 12, 2010 05:49
Simple Voldemort test
import voldemort.client.ClientConfig;
import voldemort.client.SocketStoreClientFactory;
import voldemort.client.StoreClient;
import voldemort.client.StoreClientFactory;
import voldemort.versioning.ObsoleteVersionException;
import voldemort.versioning.Versioned;
/*
* Author: Ashwin Jayaprakash / Date: Jul 11, 2010 / Time: 10:05:56 PM / Contact: http://www.ashwinjayaprakash.com
*/
@AshwinJay
AshwinJay / SimpleZkTest.java
Created July 5, 2010 02:06
Simple Apache ZooKeeper test
import org.apache.zookeeper.*;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.data.Stat;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
/*
* Author: Ashwin Jayaprakash / Date: Jul 4, 2010 / Time: 6:35:45 PM / Contact: http://www.ashwinjayaprakash.com