This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import csv | |
import os | |
from optparse import OptionParser | |
import numpy as np | |
if __name__ == '__main__': | |
parser = OptionParser() | |
parser.add_option("-d", "--delimiter", default = ",", dest = "delimiter") |

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
require 'RMagick' | |
FONTPATH = "/usr/share/fonts/takao-fonts/TakaoPMincho.ttf" | |
draw = Magick::Draw.new{ | |
self.font = FONTPATH | |
self.fill = "black" | |
self.gravity = Magick::CenterGravity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'twitter/json_stream' | |
require 'twitter_oauth' | |
require 'json' | |
require 'pp' | |
CONSUMER_KEY = "consumer key" | |
CONSUMER_SECRET = "consumer secret" | |
ACCESS_KEY = "access key" | |
ACCESS_SECRET = "access secret" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env gosh | |
(use gauche.collection) | |
(define (qsort ls) | |
(if (null? ls) | |
'() | |
(receive (left right) (partition (cut < <> (car ls)) (cdr ls)) | |
(append (qsort left) (list (car ls)) (qsort right))))) | |
(define (main args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy.random as nprand | |
import matplotlib.pyplot as plt | |
def dnorm(x, m, s): | |
return np.exp(-((x - m) ** 2)/(2 * s)) / np.sqrt(2 * np.pi * s) | |
def EM(data, init, iter): | |
params = np.array(init) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'MeCab' | |
require 'json' | |
require 'readline' | |
class NaiveBayesClassifier | |
@@FEATURES = ["名詞", "形容詞", "動詞"] | |
def initialize(train) | |
@users = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy as np | |
import numpy.random | |
import numpy.linalg | |
import matplotlib.pyplot as pyplot | |
RANGE = 2 * np.pi | |
def noise_sin(x): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## usage | |
# sh notify.sh REPOSITORY_PATH FORMAT_STRING | |
TWEET_PROGRAM="ruby tweet.rb" | |
pushd `dirname $0` | |
# update repository | |
cd $1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
new_icon=$1 | |
old_icon=$2 | |
composite_icon_name=$3 | |
percentage=35 | |
size=`identify $new_icon | cut -d' ' -f3 | cut -d'x' -f1` | |
resize_size=$(($size * $percentage / 100)) | |
geometry=$(($size - $resize_size)) |