Skip to content

Instantly share code, notes, and snippets.

upgrade GMavenPlus dependencies
1. dependency part about Groovy and Spock
2. plugin part about gmavenplus and source plugin (compiler plugin not included)
@chenrui333
chenrui333 / migrate_svn_repo_to_git.txt
Last active May 26, 2016 19:45
Migrate SVN repo to Git
Tool: svn2git
Steps
1. extract the SVN repo user list
svn log {repo} --quiet | grep "^r" | awk '{print $3}' | sort | uniq
e.g.
rui.chen
2. put the authors info to authors.txt, add the email mapping
e.g.
@chenrui333
chenrui333 / download_weicheng.sh
Last active April 14, 2016 00:47
download audio book from pingshu8.com
#! /usr/bin/sh
eps=(19 20 21 22 23 24 25 26 27 28 29 30 31 32)
#total of episodes
total=${#eps[*]}
echo 'total is ', $total
# step 1, download the episodes

The script is used for encrypting the datasource passwords on jboss servers [ref][jboss-wiki].

The flow is as follows:

  1. Encrypt the plain texts of passwords
  2. Change the *-ds.xml files, like
<!-- REPLACED WITH security-domain BELOW
<user-name>admin</user-name>

Problem statement:

We still used sun proprietary API (sun.misc.BASE64Decoder, sun.misc.BASE64Encoder), which gives compilation warnings. So someday, I decide it to the codec replacement.

BASE64 codec choices:

  • apache commons
  • javax.xml.bind
  • java8 BASE64 API

http://stackoverflow.com/questions/21741166/lombok-alternatives-for-clear-code-without-getters-setters-tostring-constructors/21741964#21741964

I like this one better: http://programmers.stackexchange.com/questions/232971/implementation-difference-between-lombok-autovalue

AutoValue is a standard Java annotation processor, meaning that it uses only the javax.* interfaces for annotation processing. 
Lombok is also an annotation processor, but it references implementation-specific classes in order to do things that standard processors 
cannot. Most notably, it changes the code being generated for source classes, for example by inserting getter and setter methods. 
The standard for annotation processors very deliberately did not allow that because it was felt to violate Java's WYSIWYG qualities.
package org.hbsp.cl.directory.config;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;
import javax.sql.DataSource;
@Configuration