Skip to content

Instantly share code, notes, and snippets.

@arc279
arc279 / gist:d41c2520400f9025dc84
Created October 30, 2014 10:12
kuromoji 2.3 with es1.3 failed
https://github.com/elasticsearch/elasticsearch-analysis-kuromoji/tree/es-1.3#tokenfilter--kuromoji_baseform
curl -XPUT 'http://localhost:9200/kuromoji_sample/' -d'
{
"index":{
"analysis":{
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "kuromoji_tokenizer",
"filter" : ["kuromoji_baseform"]
* request
curl -XPUT 'http://localhost:9200/kuromoji_sample/' -d'
{
"settings":{
"index":{
"analysis":{
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "kuromoji_tokenizer",
$ ./bin/elasticsearch
[2014-10-30 20:35:16,997][INFO ][node ] [Samuel Guthrie] version[1.3.4], pid[24185], build[a70f3cc/2014-09-30T09:07:17Z]
[2014-10-30 20:35:16,997][INFO ][node ] [Samuel Guthrie] initializing ...
[2014-10-30 20:35:17,038][INFO ][plugins ] [Samuel Guthrie] loaded [analysis-kuromoji, marvel, river-csv], sites [marvel, head, HQ, inquisitor]
[2014-10-30 20:35:19,327][INFO ][node ] [Samuel Guthrie] initialized
[2014-10-30 20:35:19,328][INFO ][node ] [Samuel Guthrie] starting ...
[2014-10-30 20:35:19,410][INFO ][transport ] [Samuel Guthrie] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.255.54:9300]}
[2014-10-30 20:35:19,428][INFO ][discovery ] [Samuel Guthrie] elasticsearch/ab1PE8NrRtqh-hV0kqUZKg
[2014-10-30 20:35:22,478][INFO ][cluster.service ] [Samuel Guthrie] detected_master [Delilah][I0vHKk-QQsC5pDs7YxU--Q][hh1][inet[/192.168.
@arc279
arc279 / gist:f5442fde14f6fd5f7d0d
Last active November 17, 2015 08:48
golang dump check
package main
import (
"fmt"
)
type Data struct {
a int
b int
}
@arc279
arc279 / gist:93c4182b67a45d7e2c44
Last active December 8, 2015 03:11
imagemagickで画像複数合成
#!/bin/bash
convert base.jpg \
image1.png -geometry 100x100+142+142 -composite \
image2.png -geometry 150x150+242+242 -composite \
image3.png -geometry 200x200+342+342 -composite \
out.jpg
import numpy as np
import matplotlib.pyplot as plt
X = np.array([0.02, 0.12, 0.19, 0.27, 0.42, 0.51, 0.64, 0.84, 0.88, 0.99])
t = np.array([0.05, 0.87, 0.94, 0.92, 0.54, -0.11, -0.78, -0.79, -0.89, -0.04])
def phi(x):
return [ x ** i for i in range(0, 7)]
PHI = np.array([phi(x) for x in X])
@arc279
arc279 / a.go
Last active January 27, 2017 06:36
package main
import (
"bufio"
"encoding/csv"
"fmt"
"golang.org/x/text/encoding/japanese"
"golang.org/x/text/transform"
"io"
"os"
@arc279
arc279 / cowsay.utf8.patch
Last active April 12, 2019 04:27
cowsay for utf8 patch
--- cowsay.org 2017-02-01 17:40:08.000000000 +0900
+++ cowsay 2017-02-01 18:03:47.000000000 +0900
@@ -10,6 +10,7 @@
use Text::Wrap qw(wrap fill $columns);
use File::Basename;
use Getopt::Std;
+use Encode;
use Cwd;
$version = "3.03";
export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:$(python-config --prefix)/include"
def cmd2bulk(*cmd):
z = lambda x: ((lambda y=bytes(str(x), "utf-8"): len(y))(), x)
return "*%d\r\n%s" % (len(cmd), "".join(["$%d\r\n%s\r\n" % z(x) for x in cmd]))
if __name__ == '__main__':
import sys
import unittest
class TestRedisBulk(unittest.TestCase):