Skip to content

Instantly share code, notes, and snippets.

@naoh16
naoh16 / maze_convert.m
Last active November 5, 2020 08:57
情報工学実験B(人工知能実験)の迷路作成用スクリプト
function maze_st = maze_convert(maze)
% MAZE_CONVERT Convert from a map to Adjacency matrix
% maze_st = MAZE_CONVERT(maze)
% ARGS
% maze Maze matrix
% RETURN
% maze_st.A Adjacency Matrix
% maze_st.initial_node Initial node
% maze_st.target_node Target node
% maze_st.xy xy for gplot
@naoh16
naoh16 / fstdm_example.py
Last active October 3, 2016 06:30
Example of Dialog Management using Finite State Transducer (FST)
# -*- coding: utf-8 -*-
"""
Example of Dialog Management using Finite State Transducer (FST)
"""
import csv
from collections import deque
##
## Load FST file
@naoh16
naoh16 / Makefile
Last active October 31, 2016 02:02
情報工学実験B(人工知能) 最終レポートのサンプルとMakefileの例
#
# 演習室でのレポート作成用 Makefile 例
#
# by Sunao Hara 2016-10-31
#
##
## 作りたいPDFファイル名に変更する
## PDF は同名のTeXファイルから作成される
##
@naoh16
naoh16 / run_pdfcrop.js
Created March 16, 2016 04:34
特定フォルダ以下のpdfの余白を削除したpdfファイルを作るJSスクリプト。LaTeX作業のお供に。
/** RUN_PDFCROP.JS
* Find pdf files in "img" directory, and convert them into cropped pdf files.
* The job is skipped if the source file is old than the cropped file.
*
* Example:
* img/inc1.pdf -> img/inc1-crop.pdf (convert)
* img/inc1-crop.pdf -> img/inc1-crop.pdf (skip)
*
* Author: Sunao Hara ([email protected])
* Last Modified: 2016-03-16 13:32:00.
@naoh16
naoh16 / cb_download_attachment.pl
Last active April 8, 2019 11:21
サイボウズLiveの添付ファイルをダウンロードするスクリプト
#!env perl
=encoding UTF-8
=head1 NAME
cb_download_attachment.pl - サイボウズLiveの添付ファイルを取得する
=head1 SYNOPSIS
# 1. Prepare download directory
$ mkdir download
@naoh16
naoh16 / sample_queue_job.bash
Created July 11, 2014 02:09
最大実行数を制限してコマンドを実行するサンプル
#!/bin/bash
#
# Sample of job queing
#
# Copyright (C) 2014 Sunao HARA ([email protected])
# Copyright (C) 2014 Abe laboratory, Okayama university
# Last Modified: 2014/07/11 11:08:14.
#
function queue_job() {
@naoh16
naoh16 / chasen-2.3.3-darts-0.32.patch
Created August 24, 2012 10:26
Patch file for chasen-2.3.3 with darts-0.32
--- chasen-2.3.3/lib/dartsdic.cpp.org 2003-07-31 01:06:57.000000000 +0900
+++ chasen-2.3.3/lib/dartsdic.cpp 2012-08-24 19:24:13.000000000 +0900
@@ -68,7 +68,7 @@
da = (darts_t*)cha_malloc(sizeof(darts_t));
da->da_mmap = cha_mmap_file(daname);
- darts->setArray(cha_mmap_map(da->da_mmap));
+ darts->set_array(cha_mmap_map(da->da_mmap));
da->da = darts;
da->lex_mmap = cha_mmap_file(lexname);
@naoh16
naoh16 / predict2.patch
Created March 19, 2012 10:12
Print label and dec_value for LIBLINEAR 1.8
*** predict.c 2011-02-05 21:21:49.000000000 +0900
--- predict2.c 2012-03-19 19:08:41.905910501 +0900
***************
*** 138,145 ****
}
else
{
! predict_label = predict(model_,x);
! fprintf(output,"%d\n",predict_label);
}
@naoh16
naoh16 / excel_latex_copy.pl
Created March 5, 2012 08:24
Convert Excel table to LaTeX table format
#!/usr/bin/perl
#
# excel_latex_copy.pl
#
# Convert Excel table to LaTeX table format
# using Win32::Clipboard (Windows only)
#
# Copyright (C) 2012- Sunao HARA, NAIST/JAPAN. All rights reserved.
# Last Modified: 2012/03/05 17:22:08.
#
@naoh16
naoh16 / emsnr.c
Created February 3, 2012 16:57
Calculate SNR (Signal-to-Noise Ratio) based on an assumption of two-mixture Gaussian distribution
/**
* emsnr
* SNRを計算する
*
* Usage: echo datafilename | emsnr -r residual -l maxloop
* Output: filename SNR SNR_fix SNR_ptile weight low_power high_power low_variance high_variance loglikelyhood
*
* 2012-02-18 Add licence
* 2008-10-12 引数をすべてオプションに変更(-h, -s, -x, -r, -l)
* Pre-Emphasis オプション€(-e)