Skip to content

Instantly share code, notes, and snippets.

Sorah Fukumori sorah

Block or report user

Report or block sorah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View First-commit.patch
From 498781516131442c29fe6a967f03c404c5d830e8 Mon Sep 17 00:00:00 2001
From: sora_harakami <sora134@gmail.com>
Date: Fri, 27 Mar 2009 15:07:37 +0900
Subject: [PATCH] First commit
---
bl_10_ffffff_6a6a6a.gif | Bin 0 -> 75 bytes
br_10_ffffff_6a6a6a.gif | Bin 0 -> 74 bytes
cpass.html | 339 +++++++++++++++++++++++++++++++++++++++++++
favicon.ico | Bin 0 -> 318 bytes
@sorah
sorah / fib.erl
Created Apr 5, 2009
fibonacch on erlang.N=limit.(but start 2,5.if N=2,put a 1,1,2,5.)
View fib.erl
-module(fib).
-export([f/1,f/4]).
f(N) -> io:put_chars("1\n1\n"),f(1,1,1,N).
f(E,F,X,N) ->
if X > -1 -> io:put_chars(integer_to_list(E + F)),
io:put_chars("\n"),
if X /= N -> f(F,E+F,X+1,N);
true -> ok
end;
true -> ok
@sorah
sorah / markov.rb
Created Apr 12, 2009
日本語用 形態素解析もどき+マルコフ連鎖
View markov.rb
#日本語用 形態素解析もどき
#http://ablog.seesaa.net/article/24578324.html
#を移植したものです。とりあえずライセンスは、Creative commonsの表示で。商用利用OKですが、自分の名前を明記してください。
#クレジット:sorah 感謝:http://ablog.seesaa.net/article/24578324.html
#str=形態素解析したい文字列(日本語のみ)
#返却するのは分割された配列。
def morphAnalyzer(str)
s = str.gsub(/([一-龠々〆ヵヶ]+|[ぁ-ん]+|[ァ-ヴー]+|[a-zA-Z0-9]+|[a-zA-Z0-9]+|[,.、。!!??()()「」『』]+|[  ]+)/,"\\1|")
ary = s.split("|")
@sorah
sorah / muretweet.user.js
Created Apr 15, 2009
RetweetをNatsuLionとかでやる用のGreasemonkey
View muretweet.user.js
// ==UserScript==
// @name muReTweet
// @namespace muretweet
// @description
// @include http://twitter.com/*/statuses/*
// @include http://twitter.com/*/status/*
// ==/UserScript==
function xpath(query) {
var results = document.evaluate(query, document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
@sorah
sorah / rubyp2p.rb
Created Apr 19, 2009
ピュアP2Pでルームが1つしかないチャットのソース
View rubyp2p.rb
require 'socket'
require 'digest/md5'
require 'thread'
require 'timeout'
$q = Queue.new
$KCODE = 'u'
init_seed = []
$regi_seed = []
$talk_sum = []
if ARGV[0]
View twitterbot.nb
# -*-ruby-*-
require "open-uri"
require "uri"
require "kconv"
#Twitterのステータスのpermalinkを渡すと「id: 内容」とpost内容を返します。なにげに便利
class TwitterBot < Nadoka::NDK_Bot
def on_privmsg prefix, ch, msg
if /^http:\/\/twitter.com\/(.+)\/(statuses|status)\/.+\/?$/ =~ msg
id = $1
View titlebot.nb
# -*-ruby-*-
require "open-uri"
require "kconv"
#URLを渡すと、HTMLからTitleを取得し表示します。HTML以外ならcontent-typeを表示します
class TitleBot < Nadoka::NDK_Bot
# Yes person
def on_privmsg prefix, ch, msg
if /^(https?)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/ =~ msg
View gcalcbot.nb
# -*-ruby-*-
require "kconv"
require "cgi"
require "open-uri"
#「gcalc: 1+1」とかするとgoogle検索で計算し結果を表示します
class GcalcBot < Nadoka::NDK_Bot
#url http://www.google.co.jp/search?q=
# Yes person
def on_privmsg prefix, ch, msg
#send_notice(ch, "Yes, #{prefix.nick}!")
View quicksort.rb
#sorah's quicksort
def get_center(ar);if ar.length % 2 != 0;ar[(ar.length) / 2];else;ar[(ar.length-1) / 2];end;end
def get_center_index(ar);if ar.length % 2 != 0;return (ar.length) / 2;else;return (ar.length-1) / 2;end;end
def wsort
zen_pi = get_center_index(zen)
zen_p = get_center(zen)
i = nil
flag = false
zen.each_index {|n|
View gist:108011
http://gist.github.com/108009
You can’t perform that action at this time.