Skip to content

Instantly share code, notes, and snippets.

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

Yusuke Oda odashi

🏠
Working from home
View GitHub Profile
@odashi
odashi / taketa.pas
Created December 15, 2012 14:24
2006年に授業で作った多倍長電卓。
program TaketaDentaku(input, output);
const KETA_MAX = 30;
type su = array[0 .. KETA_MAX - 1] of integer;
type kazu = record
plus: Boolean;
keta: integer;
abs: su;
end;
@odashi
odashi / iritweet.php
Last active June 25, 2018 10:26
PHPでTwitterのOAuth認証をするサンプルコード
<?php
/* PHPでTwitter OAuth認証を行うサンプル・プログラム
* Author : お出汁
* Creation : 2010/10/12
* Update : 2013/01/21
* Version : 0.3
* Twitter API Wikiのabraham's twitteroauth 0.2.0を使わせて頂いています。
*/
require_once('twitteroauth/twitteroauth.php');
@odashi
odashi / ibm1.py
Last active December 30, 2015 11:09
IBM Translation Model 1
# coding: utf-8
import codecs
import sys
from collections import defaultdict
# calculate IBM Model 1 translation probability
# params:
# fname_e: <str> name of corpus file in target language
# fname_f: <str> name of corpus file in foreign language
@odashi
odashi / bleu.py
Last active January 1, 2016 04:29
BiLingual Evaluation Understudy (BLEU) between corpus and BLEU+1 per sentence
# coding: utf-8
import sys
import codecs
import math
from collections import defaultdict
# calculate BLEU score between two corpus
def BLEU(ws_hyp, ws_ref, **kwargs):
# check args
@odashi
odashi / crowl.py
Created March 2, 2014 17:44
Simple Web crowler
# coding: utf-8
import chardet
import datetime
import html.parser
import optparse
import os
import re
import sys
@odashi
odashi / lame.py
Created March 9, 2014 18:37
LAMEでWAVをまとめてMP3にするスクリプト(古いもの)
# lame.py
# Convert WAV files into MP3 format by using LAME.
# Copyright (C) 2010/06/11~ by Odashi.
import os
import sys
import subprocess
# Global settings
LAME_PATH = '"C:\\Program Files\\LAME\\lame.exe"'
@odashi
odashi / parser_pascal.cpp
Created March 9, 2014 18:52
Boost.SpiritによるPascalのパーサ
// parser_pascal.cpp
#include <iostream>
#include <string>
#define BOOST_SPIRIT_USE_OLD_NAMESPACE
//#define BOOST_SPIRIT_DEBUG
#include <boost/spirit/include/classic.hpp>
#include <boost/spirit/include/classic_ast.hpp>
#include "parser.h"
using namespace boost::spirit;
@odashi
odashi / fourier.py
Created March 9, 2014 18:59
離散フーリエ変換。
# fourier.py
# This source contains below:
# * Discrete Fourier Transform (DFT)
# * Fast Fourier Transform (FFT)
# * Discrete Co-sine Transform Type-II (DCT2)
import math
def dft(samples):
n = len(samples)
@odashi
odashi / haar_dwt.py
Created March 9, 2014 18:59
Haarウェーブレットによる離散ウェーブレット変換。
# haar_dwt.py
import sys
######## input file ########
fp = open(sys.argv[1], "r")
n = int(fp.readline())
samp = []
@odashi
odashi / roland-integra-7.txt
Created March 9, 2014 19:36
Cubase用のINTEGRA-7パッチ(途中)
[cubase parse file]
[parser version 0001]
[creators first name] https://twitter.com/odashi
[creators last name] yus.takara@gmail.com
[device manufacturer] ROLAND
[device name] INTEGRA-7
[script name] Roland INTEGRA-7
[script version] version 0.03