Skip to content

Instantly share code, notes, and snippets.

View yagays's full-sized avatar
🦊
hi

Yuki Okuda yagays

🦊
hi
View GitHub Profile
@yagays
yagays / rand_fastq.rb
Created May 29, 2012 08:23
NGSのサンプルデータっぽい感じで,fastaから適当に短い配列取ってきてfastqにするスクリプト
#/usr/bin/env ruby
# usage:
# ruby rand_fastq.rb hoge.fasta > random.fastq
require 'bio'
genome = ""
read_length = 100
read_count = 10000000
@yagays
yagays / soapdenovo2_stats.rb
Created October 11, 2012 06:43
SOAPdenovo2のscafStatisticsの統計情報を集計してtsv形式で出力するスクリプト
#/usr/bin/env ruby
require "optparse"
def v(s)
if s == "NaN"
return s
elsif s.include?("%")
return s.gsub("%","").to_f
else
@yagays
yagays / googlechart_tex.rb
Created October 19, 2012 02:35
Convert tex formula into google chart API format (Jekyll/Octopress plugin)
# 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"
#/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]
@yagays
yagays / c1.c
Last active December 17, 2015 01:49
#include <stdio.h>
#include <time.h>
double A[1024][1024];
int
main(){
int i,j,k;
k = 0;
clock_t start,end;
@yagays
yagays / gmm_em.py
Last active December 25, 2015 20:38
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
@yagays
yagays / agqr.rb
Last active March 19, 2020 13:33
# -*- 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"
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 != ""
#!/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"]
@yagays
yagays / calculate_score.py
Created August 15, 2014 14:43
zozo/recontest
#!/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 = {}