Skip to content

Instantly share code, notes, and snippets.

View qrtt1's full-sized avatar
🎯
Focusing

Ching Yi, Chan qrtt1

🎯
Focusing
View GitHub Profile
@qrtt1
qrtt1 / LuceneLab.java
Last active October 31, 2016 13:43
複習 Lucene 的用法 (6.x)
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.cjk.CJKAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.TextField;
@qrtt1
qrtt1 / MyApplication.java
Created September 16, 2013 13:42
沒想到,竟然有用 hk2 做 dependency injection 的一天。
package my.web.toolkits;
import javax.inject.Singleton;
import my.web.toolkits.ydl.YoutubeSignature;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.glassfish.hk2.api.Factory;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
@qrtt1
qrtt1 / punch.py
Created October 5, 2013 12:56 — forked from koenbollen/punch.py
#!/usr/bin/env python
#
# Proof of Concept: UDP Hole Punching
# Two client connect to a server and get redirected to each other.
#
# This is the client.
#
# Koen Bollen <meneer koenbollen nl>
# 2010 GPL
#
@qrtt1
qrtt1 / server.py
Last active December 25, 2015 08:29
A ydl-signature server for example
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import logging
import os
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.web.server import Site

重包 zookeeper

由於 zookeeper 3.4.5 跟 weblogic 處不太來,看 ZOOKEEPER-1696 上說了它已經修正。沒多想就直接在 gradle 上改了版本,發現他們還沒有正式 release 出來。這種看得到吃不到的情況,只能說...。 zookeeper 目前官方的版本控制系統是 SVN,依『慣例』已經 release 的能在 tags/ 目錄下找到,決定好版本後,我們取出 3.4.5

svn co http://svn.apache.org/repos/asf/zookeeper/tags/release-3.4.5/

總是要解決它的,好在 issue 上有附修正的 patch,開了一台 debian vm 來編它。由於它是 java 專案,並使用 ant 編譯,配合文件上提到的,需裝下列編譯工具:

<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Hinet unofficial notification rss</title>
<link>http://www.hinet.net/pu/notify.htm</link>
<description>hinet rss, it just works</description>
<language>zh-tw</language>
<pubDate>Fri, 01 Nov 2013 00:14:47 </pubDate>
<lastBuildDate>Fri, 01 Nov 2013 00:14:47 </lastBuildDate>
from BeautifulSoup import BeautifulSoup as Soup
from mechanize import Browser
from soupselect import select
from datetime import datetime
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
@qrtt1
qrtt1 / ChannelProcessDecider.java
Last active January 2, 2016 22:38
利用 AWS Simple Workflow Service 把一組商業流程包起來,這是個微行 Framework 的試作品。
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.qty.aws.swf.annotation.DeciderConfig;
import org.qty.aws.swf.contract.AbstractDecision;
@DeciderConfig(domain = "WorkflowLab-20140109a", taskList = "paid-video-queue")
public class ChannelProcessDecider extends AbstractDecision {
static Log logger = LogFactory.getLog(ChannelProcessWorkflow.class);
private static final String INITIAL_STATE = null;