Skip to content

Instantly share code, notes, and snippets.

View haruyama's full-sized avatar
🌴
On vacation

HARUYAMA Seigo haruyama

🌴
On vacation
View GitHub Profile
(find-assertions (query-syntax-process '(job ?x (computer programmer)))
(singleton-stream '()))
@haruyama
haruyama / gist:3b429ef86d3a74ece040
Created June 6, 2014 09:10
Unixuser\Slim\CsrfGuard
<?php
// Copyright (c) HARUYAMA Seigo
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is furnished
// to do so, subject to the following conditions:
//
@haruyama
haruyama / gist:641aebe049050d01bb0b
Created July 21, 2014 14:46
unite_lua_filter_head.patch
diff --git a/autoload/unite/filters.vim b/autoload/unite/filters.vim
index 0156643..d7af4f5 100644
--- a/autoload/unite/filters.vim
+++ b/autoload/unite/filters.vim
@@ -158,9 +158,9 @@ do
local input = vim.eval('tolower(a:input)')
local candidates = vim.eval('a:candidates')
for i = #candidates-1, 0, -1 do
- local word = string.lower(candidates[i].action__path)
- or string.lower(candidates[i].word)
// +build OMIT
package main
import (
"errors"
"fmt"
"math/rand"
"sort"
@haruyama
haruyama / hoge
Created August 4, 2014 10:47
hoge
(unify-match 1 '(? x)
(singleton-stream '()))
(unify-match '(? x) 1
(singleton-stream '()))
(unify-match '(? x) '(? x)
(singleton-stream '()))
;(query-syntax-process '(?x ?x))
@haruyama
haruyama / lychrel.c
Last active August 29, 2015 14:26
lychrel number
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <gmp.h>
bool check_symmetry(mpz_t i)
{
char* s = mpz_get_str(NULL, 10, i);
size_t len = strlen(s);
@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 / 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 / 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 / grep.hs
Last active December 11, 2015 06:58
grep using Haskell.
import qualified System.Environment as SE
import qualified System.IO as SIO
import qualified Data.Text as T
import qualified Data.Text.ICU.Regex as TIR
import qualified Data.Text.IO as TIO
import Control.Monad (unless, when)
main :: IO ()
main = do
args <- SE.getArgs