Skip to content

Instantly share code, notes, and snippets.

View didyhu's full-sized avatar

Didy HU didyhu

View GitHub Profile
@didyhu
didyhu / gist:9775268
Last active August 29, 2015 13:57
JSF as MVC + Spring as IOC Container

JSF as MVC + Spring as IOC Container

Context

  • About
  • Configuration
  • Optional

About

@didyhu
didyhu / PasswordUtils.java
Created January 4, 2016 02:17
Password Salt Utils
package net.csdra.meishanshuhuayuan;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
/**
* Created by Didy on 2015-12-22.
@didyhu
didyhu / server.sh
Created February 1, 2016 09:49
spring-boot
#!/bin/bash
TARGET=PATHTOTHEJARORWAR.war
start(){
(java -jar $TARGET &)
}
stop(){
PID=$(status | awk '{ print $2 }')
if [ -z "$PID" ]
@didyhu
didyhu / .bowerrc
Last active February 1, 2016 10:12
angular
{
"directory": "src/main/webapp/bower_components"
}
@didyhu
didyhu / pom.xml
Created February 19, 2016 08:51
Getting error "Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError" when deploy war to aliyun ace.
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<packagingExcludes>
WEB-INF/lib/log4j-over-slf4j-*.jar
</packagingExcludes>
</configuration>
</plugin>
/**
* Created by Didy on 2016-04-21.
*/
var http = require("http");
var querystring = require("querystring");
var iconv = require('iconv-lite');
var BufferHelper = require('bufferhelper');
function http_post(options, postData, callback) {
var req = http.request(options, (res) => {
@didyhu
didyhu / spring-run.sh
Last active May 11, 2016 14:33
scripts to run spring boot application
#!/bin/bash
stop(){
for pid in $(ps aux | grep 'java' | grep -v 'grep' | awk '{print $2}')
do
pwd=$(pwd);
cwd=$(readlink /proc/$pid/cwd)
if [ ${cwd} -ef ${pwd} ]
then
echo "killing $pid @ $pwd"
@didyhu
didyhu / my.ini
Created May 23, 2016 09:40
MySQL settings
default_tmp_storage_engine = MyISAM
default-storage-engine = MyISAM
collation-server = utf8mb4_unicode_ci
character-set-server = utf8mb4
@didyhu
didyhu / gist:a2c8f6359a015c018f50943304a34ffc
Created May 23, 2016 10:03
Passing env arguments using maven with spring boot
java -jar xxx.jar --server.port=80
mvn spring-boot:run -Drun.jvmArguments="-Dserver.port=80"
@didyhu
didyhu / logging-best-practices.md
Created May 23, 2016 13:54
Logging best practices

#Logging Best Practices

Always log, and always log in right place, on right level.

Error Unexcepted exceptions happened, should write down the error message and the call stacks.

log.error(ex.getMessage(),ex);