Skip to content

Instantly share code, notes, and snippets.

View pandanote-info's full-sized avatar

pandanote-info pandanote-info

View GitHub Profile
@pandanote-info
pandanote-info / kuromoji-pom-20200521.patch
Created June 20, 2020 13:27
kuromojiに最新のNEologdを組み込むためのパッチ(1/2)
--- /dev/null 2020-06-19 08:45:04.478343399 +0900
+++ kuromoji/kuromoji-ipadic-neologd/ymd.sh 2020-06-19 13:42:58.453048740 +0900
@@ -0,0 +1,4 @@
+#!/bin/sh
+BUILD_DIR=`find dictionary/mecab-ipadic-neologd/build -type d -regex ".*-neologd-[0-9]+" -print`
+NEW_BUILD_DIR=`echo $BUILD_DIR | perl -pe 's/-\d+$//g'`
+ln -s `basename $BUILD_DIR` $NEW_BUILD_DIR
--- kuromoji/kuromoji-ipadic-neologd/src/test/java/com/atilika/kuromoji/ipadic/neologd/TokenizerTest.java.ORG 2020-06-19 14:11:39.984931179 +0900
+++ kuromoji/kuromoji-ipadic-neologd/src/test/java/com/atilika/kuromoji/ipadic/neologd/TokenizerTest.java 2020-06-19 14:11:48.113053245 +0900
@@ -290,6 +290,7 @@
@pandanote-info
pandanote-info / hackgennerdconfig.el
Created June 3, 2020 13:03
HackGenNerdフォントをEmacsで使用するための設定例。
(set-face-attribute 'default nil :family "HackGenNerd" :height 110)
(set-fontset-font nil '(#x80 . #x10ffff) (font-spec :family "HackGenNerd"))
@pandanote-info
pandanote-info / floor_function.py
Created May 13, 2020 13:15
第1引数に与えられた数xの最上位の桁以外の桁を0にした数を出力するPython3のプログラム。
#!/usr/bin/env python3
import sys
import math
args = sys.argv
x = float(args[1])
n = math.floor(math.log10(x))
y = math.floor(x/math.pow(10,n))*math.pow(10,n)
@pandanote-info
pandanote-info / floor_function.php
Created May 13, 2020 12:51
第1引数に与えられた数xの最上位の桁以外の桁を0にした数を出力するPHPのプログラム。
<?php
$x = intval($argv[1]);
$n = floor(log10($x));
$y = floor($x/pow(10,$n))*pow(10,$n);
echo $y."\n";
?>
@pandanote-info
pandanote-info / nbonacci.scala
Last active May 2, 2020 08:57
nbonacci sequence (n-bonacci数列)の初項から指定した数の項までを計算するためのScalaのコード例。
//
// See https://pandanote.info/?p=6259 for details.
//
package info.pandanote.nbonaccitest
import scopt.OParser
import org.slf4j.LoggerFactory
import scala.collection.mutable.ListBuffer
@pandanote-info
pandanote-info / nbonacci.py
Last active May 2, 2020 08:15
nbonacci sequence (nボナッチ数列)の計算及び出力のためのPython3のコード例。
#!/usr/bin/env python3
#
# See https://sidestory.pandanote.info/nbonacci.html for details.
#
import sys
import re
if (len(sys.argv) < 3 or re.match(r'^[1-9]\d*$',sys.argv[1]) == None or re.match(r'^[1-9]\d*$',sys.argv[2]) == None):
print("Usage: nbonacci.py <number of terms to compute the next term> <number of terms to calculate>")
@pandanote-info
pandanote-info / ScalaJHttpClientSample.scala
Last active April 27, 2020 12:27
GROWIのAPIの実行用のScalaのプログラム例のサンプル。URLとAPI Tokenはダミーの値を設定している。
package info.pandanote.scalajhttptest
// See https://pandanote.info/?p=6186 for details.
import java.net.{ URLEncoder, URLDecoder }
import scalaj.http._
import play.api.libs.json._;
case class CustomResponse(statusCode: Int, status: String, body: String)
@pandanote-info
pandanote-info / getclassexample.php
Last active March 28, 2020 03:12
PHPのget_class関数の使用例。
<?php
/*
* See https://sidestory.pandanote.info/php_get_class.html for details.
*/
class Hoge {
public function name() {
return get_class($this);
}
}
@pandanote-info
pandanote-info / getticker.py
Created February 9, 2020 12:37
bitFlyer LightningのHTTP Public APIから直近の取引情報を取得し、データベースに書き込むPython3のプログラム。
#!/usr/bin/env python3
#
# See https://pandanote.info/?p=5966 for details.
#
import sys
import os
import re
import json
import httplib2
from datetime import datetime
@pandanote-info
pandanote-info / crypto_currency_info_cache.sql
Last active February 9, 2020 12:35
bitFlyer LightningのHTTP Public APIから取得した取引情報をMariaDB上に格納するためのテーブル定義。
-- See https://pandanote.info/?p=5966 for details.
drop table if exists crypto_currency_info_cache;
create table crypto_currency_info_cache (
id int (11) not null auto_increment,
product_code varchar(40) unique,
info_at datetime,
tick_id int,
best_bid double,
best_ask double,
best_bid_size double(20,8),