Skip to content

Instantly share code, notes, and snippets.

View haruyama's full-sized avatar
🏠
Working from home

HARUYAMA Seigo haruyama

🏠
Working from home
View GitHub Profile
@haruyama
haruyama / LDclipXML2DeliciosHTML.rb
Created August 9, 2012 07:04
convert livedoor clip xml to delicious html.
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
require 'rexml/document'
require 'cgi'
require 'time'
DT_TEMPLATE=<<EOS
<DT><A HREF="%s" ADD_DATE="%d" PRIVATE="0" TAGS="%s">%s</A>
EOS
@haruyama
haruyama / gist:1702727
Created January 30, 2012 05:28
A sample of Clojure and lucene-gosen
(ns lucene_gosen_test.core (:gen-class))
(import java.util.Collections)
(defn -main [& args]
(println (first args))
(with-open [reader (new java.io.StringReader (first args))]
(let [
analyzer (new org.apache.lucene.analysis.ja.JapaneseAnalyzer org.apache.lucene.util.Version/LUCENE_35 Collections/EMPTY_SET Collections/EMPTY_SET Collections/EMPTY_SET "/home/haruyama/work/solr/dic/solr/conf/dic")
ts (.tokenStream analyzer "dummy" reader)
termAtt (.getAttribute ts org.apache.lucene.analysis.tokenattributes.CharTermAttribute)
posAtt (.getAttribute ts org.apache.lucene.analysis.ja.tokenAttributes.PartOfSpeechAttribute)
@haruyama
haruyama / gist:1441337
Created December 7, 2011 03:37
lucene-gosen くよ bug
import java.io.Reader;
import java.io.StringReader;
import org.apache.lucene.analysis.ja.JapaneseTokenizer;
public class LuceneGosenKuyoBug {
public static void main(String[] args) {
String s = "";
int count = Integer.parseInt(args[1]);
for (int i = 0; i < count; ++i) {
@haruyama
haruyama / create_macaddress2md5_table.rb
Created August 22, 2011 05:53
this creates a table of macaddress, whose prefix(vendor id) is specified, to md5
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
require 'digest/md5'
prefix =
begin
ARGV[0].downcase
rescue
'90840d'
end