Skip to content

Instantly share code, notes, and snippets.

@bulain
bulain / killpid.bat
Created July 19, 2011 01:08
kill process in windows
@echo off
@setlocal enabledelayedexpansion
for /F "tokens=* delims=;" %%i in ('netstat -nao') do call :keller %%i
:keller
set a=%2
echo %a%
if "%a%" equ "0.0.0.0:8081" (taskkill /F /PID %5)
shift
@bulain
bulain / ora_extends_conn.sql
Created July 19, 2011 01:13
extends connecions in oracle 10g
1, using system login
sqlplus system/password@xe
2, change system session configuration.
alter system set session_cached_cursors=200 scope=spfile;
alter system set session_max_open_files=200 scope=spfile;
alter system set sessions=20 scope=spfile;
alter system set license_max_sessions=200 scope=spfile;
alter system set license_sessions_warning=200 scope=spfile;
alter system set processes=200 scope=spfile;
@bulain
bulain / jms_spring.xml
Created July 19, 2011 07:15
JMS spring config
##applicationContext-jms.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:jboss.properties" />
<!-- <property name="location" value="classpath:activemq.properties" /> -->
</bean>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
@bulain
bulain / separate_jvm.jsp
Created August 11, 2011 14:40
separate jvm in applet
<applet archive="applet.jar" code="demo.applet" width="0" height="0">
<param name="separate_jvm" value="true">
</applet>
@bulain
bulain / MethodInvoking.xml
Created August 11, 2011 14:55
calling static and instance method in spring
<!-- call static method -->
<bean id="test" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="demo.Test" />
<property name="targetMethod" value="staticmethod" />
<property name="arguments">
<list>
<value>test</value>
</list>
</property>
</bean>
@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 -->
@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 / git_submodule.sh
Created September 17, 2011 05:59
git submodule
# add submodule web-static
git submodule add git@github.com:bulain/web-static.git src/main/webapp/web-static
git submodule add git@github.com:bulain/migration.git src/migration
# fetch submodule from remote
git submodule init
git submodule update
git submodule foreach git pull
@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 / 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