Skip to content

Instantly share code, notes, and snippets.

View yagays's full-sized avatar
🦊
hi

Yuki Okuda yagays

🦊
hi
View GitHub Profile
FORMAT: 1A
# レシピサイトWebAPIドキュメント
http://gotofritz.net/blog/weekly-challenge/restful-python-api-bottle/
## すべてのレシピのXMLを表示する [/recipes/]
### recipes_list [GET]
すべてのレシピのリストを返します。
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,:]
@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 = {}
#!/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"]
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 != ""
@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"
@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 / 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;
#/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 / 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"