Moved to Designing, programming, testing, writing & other useful topics.
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
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); |
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.foo; | |
import java.util.LinkedList; | |
import java.util.List; | |
public class LambdaCapture { | |
public static void main(String[] args) { | |
List<String> strings = new LinkedList<>(); | |
strings.add("one"); | |
strings.add("two"); |
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.foo; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.runner.Runner; | |
import org.openjdk.jmh.runner.RunnerException; | |
import org.openjdk.jmh.runner.options.Options; | |
import org.openjdk.jmh.runner.options.OptionsBuilder; | |
import java.util.Random; | |
import java.util.function.Supplier; |
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
package com.javaforu.rsync; | |
import com.javaforu.rsync.Sync.CharRingBuffer.Visitor; | |
import rollinghash.RabinKarpHash; | |
import java.util.*; | |
import java.util.zip.CRC32; | |
/** | |
* Author: Ashwin Jayaprakash / ashwin.jayaprakash@gmail.com / http://www.ashwinjayaprakash.com |
NewerOlder