This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package linuxfs; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.nio.channels.FileChannel; | |
/* | |
* Author: Ashwin Jayaprakash | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis.clients.jedis.Jedis; | |
import redis.clients.jedis.PipelineBlock; | |
/** | |
* Author: Ashwin Jayaprakash | |
* <p/> | |
* Email: ashwin.jayaprakash@gmail.com Web: http://www.ashwinjayaprakash.com | |
*/ | |
public class RedisJavaDemo { | |
public static void main(String[] args) throws InterruptedException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create self signed key pair and add to new key store: | |
keytool -genkey -alias mykey -keyalg RSA -keystore keystore.jks -keysize 2048 | |
Export public key and import into new trust store: | |
keytool -keystore keystore.jks -export -alias mykey -file my.cer | |
keytool -import -alias mypub -file my.cer -keystore truststore.jks | |
(Alternate way) Manually import certificate from HTTPS server to trust store: | |
Firefox: Add Exception -> Get Certificat -> View -> Details -> Export as "a.der" | |
keytool -importcert -keystore truststore.jks -file a.der |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BasicConfigurator.configure(); | |
org.apache.log4j.Logger.getRootLogger().setLevel(Level.INFO); |
OlderNewer