Skip to content

Instantly share code, notes, and snippets.

@ruseel
ruseel / xssh.rb
Created August 29, 2013 06:34
there is a (dumb) sock5 proxy preventing ssh 'exec' channel creation. so work around with ssh 'session' channel.
require 'net/ssh'
require 'net/ssh/proxy/socks5'
def escape s
# use ruby escpae, then replace double quote to single
buf = s.inspect
buf[0]="'"
buf[-1]="'"
buf
end
@ruseel
ruseel / gist:6387320
Last active December 22, 2015 00:09
git svn workflow - 특정 SVN 브랜치만 새로 다운로드 받기

특정 branch만 더 checkout 받으려면 .git/config에 아래처럼 추가하고

  [svn-remote "svn-aug17-n"]
      url = http://127.0.0.1/svn/someproject/branches/aug17/someproject
      fetch = :refs/remotes/git-svn-aug17

fetch하고

@ruseel
ruseel / tomcat
Last active December 22, 2015 10:19
Tomcat init.d script with CATALINA_PID and shutdown.sh --force
#
# processname: tomcat1
#
# mkdir -p $CATALINA_HOME/var/{run,lock/subsys}
# echo PID_OF_TOMCAT > $CATALINA_PID
# $CATALINA_HOME/bin/catalina.sh stop -f
#
# source function library.
. /etc/rc.d/init.d/functions
@ruseel
ruseel / InetAddressTypeHandler.java
Last active December 22, 2015 12:49
iBatis 2.3 can handle typeHandler.
package t;
import java.math.BigInteger;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ruseel
ruseel / gist:6680800
Created September 24, 2013 05:44
algospot: boggle
from functools import lru_cache
class Board:
sizex = 5
sizey = 5
def __init__(self,str):
self.str = str
def get(self,i,j):
return self.str[self.sizex*i + j]
@ruseel
ruseel / SimpleSendMail.java
Created October 4, 2013 08:37
Single call for sending mail with a attachement throught gmail(465 port) http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/
public class SimpleSendMail {
public static void mail(final String username, final String passwd, String from, String to, String subject, String body,
File file) {
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
@ruseel
ruseel / gist:7179721
Created October 27, 2013 09:43
clocksync
switches = [(0,1,2),
(3,7,9,11),
(4,10,14,15),
(0,4,5,6,7),
(6,7,8,10,12),
(0,2,14,15),
(3,14,15),
(4,5,7,14,15),
(1,2,3,4,5),
(3,4,5,9,13)]
#b::
IfWinExist,DBeauty
WinMove,DBeauty,,0,0,1240*2+800,1000
WinActivate
return
#v::
IfWinExist,DbVisualizer
WinMove,DbVisualizer,,0,0,1240*3,1000
WinActivate
@ruseel
ruseel / applicationContext.xml
Created November 26, 2013 02:25
Rails스타일 Spring DB설정. System Property "mode"에 따라 db설정을 읽는다. database.properties에는 실서버설정을 넣고 database-dev.properties에는 개발서버설정을 넣는다. 실행할 때 -Dmode=dev를 주면 개발서버설정이 적용된다.
<context:property-placeholder
ignore-resource-not-found="true"
location="classpath:database.properties,classpath:database-${mode}.properties" />
@ruseel
ruseel / appContext.xml
Created December 10, 2013 09:05
spring mvc에서 이런 ExceptionResolver를 넣어야 로그를 찍을 때가 있었다.
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="warnLogCategory" value="my.custom.apperror.log.domain" />
</bean>