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 {