View LambdaCapture.java
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");
View LogInvocationStyleBenchmark.java
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;
View productivity.md

Computer setup

Email with simple prioritization

Gmail with Multiple inboxes enabled:

  1. Inbox (Only certain important unclassified emails stay in Inbox
  • The other emails have filters such as this: Do this: Skip Inbox, Apply label "gerrit_or_build")
  1. JIRA/Wiki (-in:trash AND label:jira_or_wiki)
  2. Gerrit (-in:trash AND label:gerrit_or_build)
  3. BitBucket (from:bitbucket@company.com is:unread {"Fred Flintstone" "Homer Simpson" "Mickey Mouse"})
View bash-loop.sh
#! /bin/bash
a=(user1 pass1 user2 pass2)
for ((i=0; i<${#a[@]}; i+=2)); do
echo "Loop 1: ${a[i]}: ${a[i+1]}"
done
a1=(user1 user2)
a2=(pass1 pass2)
for ((i=0; i<${#a1[@]}; i+=1)); do
View Sync.java
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
View FjTest.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.RecursiveAction;
/**
* Author: Ashwin Jayaprakash
* Email: ashwin.jayaprakash@gmail.com
View Log4J programmatic
BasicConfigurator.configure();
org.apache.log4j.Logger.getRootLogger().setLevel(Level.INFO);
View Simple Java keytool key pair and trust store
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