This file contains 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 | |
# usage: | |
# ruby rand_fastq.rb hoge.fasta > random.fastq | |
require 'bio' | |
genome = "" | |
read_length = 100 | |
read_count = 10000000 |
This file contains 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 | |
require "optparse" | |
def v(s) | |
if s == "NaN" | |
return s | |
elsif s.include?("%") | |
return s.gsub("%","").to_f | |
else |
This file contains 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
# Convert tex formula into google chart API format (Jekyll/Octopress plugin) | |
# | |
# Usage: {% gctex tex_formula %} | |
# | |
# Author: yag_ays (yanagi.ayase [at] gmail.com) | |
# blog: http://yagays.github.com/ | |
# | |
# Ref: http://d.hatena.ne.jp/repose/20110506/1304612242 | |
require "cgi" |
This file contains 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 | |
require 'pp' | |
def segment(text, segs) | |
words = [] | |
last = 0 | |
for i in 0..segs.length | |
if segs[i] == "1" | |
words << text[last..i] |
This file contains 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
#include <stdio.h> | |
#include <time.h> | |
double A[1024][1024]; | |
int | |
main(){ | |
int i,j,k; | |
k = 0; | |
clock_t start,end; |
This file contains 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 math | |
import numpy as np | |
def mv_norm(x, mu, sigma): | |
norm1 = 1 / (math.pow(2 * math.pi, len(x)/2.0) * math.pow(np.linalg.det(sigma), 1.0/2.0)) | |
x_mu = np.matrix(x-mu) | |
norm2 = np.exp(-0.5 * x_mu * sigma.I * x_mu.T) | |
return float(norm1 * norm2) | |
# test data |
This file contains 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
# -*- encoding: utf-8 -*- | |
#/usr/bin/env ruby | |
require 'yaml' | |
radio_dir = "/path/to/radio" | |
rtmpdump = "/path/to/rtmpdump" | |
agqr_stream_url = "rtmp://fms-base1.mitene.ad.jp/agqr/aandg22" | |
schedule = "schedule.yaml" | |
ffmpeg = "/path/to/ffmpeg" |
This file contains 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
require 'open-uri' | |
require 'Nokogiri' | |
require 'pp' | |
uri = "http://www.agqr.jp/timetable/digital-mf.php" | |
html = Nokogiri::HTML(open(uri),nil,"utf-8") | |
html.xpath("//table[@id='timeline']/tbody/tr").each do |timeline| | |
puts "==============" | |
if timeline.xpath("th").text != "" |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
import feedparser | |
import pymongo | |
import datetime | |
anond_feed = feedparser.parse("http://anond.hatelabo.jp/rss") | |
client = pymongo.MongoClient() | |
db = client["anond"] |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
import sys | |
# File format : GROUPID,GOODSID,VIEWRATE,BUYRATE | |
# Usage : calculate_score.py target.csv predict.csv | |
def read_submit_file(submit_file): | |
viewrate = {} |