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.
# LOGGING
logging.file=myapp.log
logging.level.root=ERROR
logging.level.info.didyapp=INFO
# EMBEDDED SERVER CONFIGURATION
server.port=8080
# DATASOURCE
spring.datasource.url=jdbc:mysql://localhost:3306/test?zeroDateTimeBehavior=convertToNull&useUnicode=yes&characterEncoding=utf8
@didyhu
didyhu / .bowerrc
Last active February 1, 2016 10:12
angular
{
"directory": "src/main/webapp/bower_components"
}
@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 / 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>
@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"
/**
* 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) => {
#!/bash
targethost='root@targethost'
# eg. 'root@dev.csdra.net'
targetpath='/var/www'
# eg. '/var/www'
targetname=TARGETNAME
# eg. 'SomeProject'
targetport=TARGETPORT
# eg. 8080
@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