Skip to content

Instantly share code, notes, and snippets.

@bulain
bulain / fmt_date_win.bat
Created February 27, 2012 06:19
format date in windows
set stamp=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%
echo %stamp%
@bulain
bulain / ora_impdp_expdp.bat
Created February 27, 2012 06:15
using expdp and impdp in oracle 10g 11g
# create directory
create directory dmpdir as 'c:/temp';
select directory_name,directory_path from dba_directories;
# expdp owner
create user scott identified by tiger;
grant connect, resource to scott;
...
grant read, write on directory dmpdir to scott;
expdp scott/tiger@xe directory=dmpdir dumpfile=scott.dmp logfile=expdp.log
@bulain
bulain / mysql_master_slave_driver.txt
Created January 14, 2012 13:01
mysql master-slave ReplicationDriver and Driver
jdbc:mysql:replication://localhost:3306/test
jdbc:mysql://localhost:3306/test
@bulain
bulain / jar_pom.xml
Created October 14, 2011 01:28
excludes some file when package using maven
<!-- pom.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>*.properties</exclude>
</excludes>
</configuration>
</plugin>
@bulain
bulain / assembly_plugin.xml
Created October 14, 2011 01:22
using assembly package in maven
<!-- pom.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assemble/assemble.xml</descriptor>
</descriptors>
</configuration>
@bulain
bulain / lighttpd
Created September 26, 2011 14:07
ubuntu lighttpd /etc/init.d/lighttpd
#! /bin/sh
set -e
LIGHTY=/usr/local/sbin/lighttpd
LIGHTYCONFIG=/etc/lighttpd/lighttpd.conf
test -x $LIGHTY || exit 10
test -e $LIGHTYCONFIG || exit 11
. /lib/lsb/init-functions
@bulain
bulain / ssh.sh
Created September 17, 2011 06:07
ssh remote and local
# ssh remote
ssh -N -f -R 2080:127.0.0.1:80 bulain@remoteserver
# ssh local
ssh -N -f -L 80:127.0.0.1:2080 bulain@remoteserver
@bulain
bulain / git_submodule.sh
Created September 17, 2011 05:59
git submodule
# add submodule web-static
git submodule add [email protected]:bulain/web-static.git src/main/webapp/web-static
git submodule add [email protected]:bulain/migration.git src/migration
# fetch submodule from remote
git submodule init
git submodule update
git submodule foreach git pull
@bulain
bulain / cxf-https.xml
Created August 14, 2011 06:03
CXF configuration using SSL/HTTPS with tomcat
#generate server and client keystore
keytool -genkeypair -alias server -keyalg RSA -dname "CN=Server,OU=Development,O=Test,L=Shanghai,S=SH,C=CN" -keystore server.keystore
keytool -genkeypair -alias client -keyalg RSA -dname "CN=Client,OU=Development,O=Test,L=Shanghai,S=SH,C=CN" -keystore client.keystore
keytool -list -keystore server.keystore
#copy server certificate into client.keystore
keytool -exportcert -alias server -file server-pub.cer -keystore server.keystore
keytool -importcert -alias server -file server-pub.cer -keystore client.keystore
keytool -list -keystore client.keystore
@bulain
bulain / cxf-spring.xml
Created August 12, 2011 08:24
CXF client config with HTTPS
<!--Spring Configuration-->
<http:conduit name="https://localhost:8083/WebService">
<http:tlsClientParameters>
<sec:keyManagers keyPassword="keypassword">
<sec:keyStore type="PKCS12" password="keypassword" file="keyfile"/>
</sec:keyManagers>
</http:tlsClientParameters>
</http:conduit>
<!-- Keystore File Format -->