Skip to content

Instantly share code, notes, and snippets.

View yagays's full-sized avatar
🦊
hi

Yuki Okuda yagays

🦊
hi
View GitHub Profile
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 = {}
import numpy as np
import scipy as sp
import xgboost as xgb
from sklearn import datasets
from sklearn.metrics import confusion_matrix
from sklearn.grid_search import GridSearchCV
from sklearn.grid_search import RandomizedSearchCV
iris = datasets.load_iris()
trainX = iris.data[0::2,:]
# -*- coding: utf-8 -*-
require "pp"
require "optparse"
def open_t_delimited_file(filename)
h = { }
File.open(filename).readlines.each do |line|
a = line.split("\t")
if /\d+/ =~ a[6]
if h[a[0]] #もし既にidとfpkmの配列がhに入っている場合
#!/bin/sh
#$ -o cuffout.txt -e cufferr.txt
LD_LIBRARY_PATH=/usr/local/boost-1.40.0/lib
export LD_LIBRARY_PATH
/usr/local/cufflinks-0.8.2/bin/cufflinks -p 2 $1
@yagays
yagays / bedgraph.rb
Created August 17, 2010 23:40
tmapっぽい形式のファイルから全遺伝子IDそれぞれのwigファイル(bedgraph format)を作成します.
#/usr/bin/env ruby
require "pp"
require "optparse"
# Usage : ruby bedgraph.rb [-o output_dir] input_file
# Output_dir is optional. Default output_dir is "bedgraph".
#
# Input_file format must be tab delimited file and the following format below.
# gene_id gene_name fpkm chr start end
#
@yagays
yagays / parser.rb
Created August 19, 2010 10:03
タブ区切りテキストをmarshal_dump, marshal_loadするスクリプト
#/usr/bin/env ruby
def open_t_delimited_file(filename)
h = {}
File.open(filename).readlines.each do |line|
a = line.split("\t")
h[a[0]] = a
end
puts filename.to_s + " was loaded."
return h
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require "pp"
def input_marshal_data(path)
a = 0
a_id_list = []
open(path,"rb") {|f|
a = Marshal.load(f)
#/usr/bin/env ruby
def open_indel_file(filename)
h = []
open(filename) { |f|
f.each_line do |line|
a = line.chomp.split("\t")
h << a
end