Skip to content

Instantly share code, notes, and snippets.

Avatar
🏋️‍♂️
Out sick

AKB428 AKB428

🏋️‍♂️
Out sick
View GitHub Profile
@AKB428
AKB428 / Gemfile
Last active Nov 9, 2015
放映中のアニメ公式 Twitterアカウントのフォロワー変動履歴情報を提供するRESTful API サーバーを作りました ref: http://qiita.com/AKB428/items/c12c70b16c924a45f73f
View Gemfile
# A sample Gemfile
source "https://rubygems.org"
gem 'shangrila'
@AKB428
AKB428 / file0.sql
Last active Nov 8, 2015
MySQL と MariaDBの プリペアドステートメント バインドパラメーターがSQL関数だった時の挙動の違い ref: http://qiita.com/AKB428/items/8be7059e7e2919cea090
View file0.sql
SELECT h.follower, h.updated_at
from twitter_status_histories as h,
(SELECT id FROM bases WHERE twitter_account = 'usagi_anime' order by id desc limit 1) b
where h.bases_id = b.id AND h.updated_at < ? order by h.updated_at desc limit 100
@AKB428
AKB428 / file0.txt
Created Nov 3, 2015
ElixirでMySQLのdatetime型をUNIX TIMESTAMPに変換する ref: http://qiita.com/AKB428/items/1e6491b4badcf416d9be
View file0.txt
defmodule UnixTime do
def convert_date_to_unixtime(created_at) do
#JSTの場合9Hにしておく
epoch = {{1970, 1, 1}, {9, 0, 0}}
epoch_gs = :calendar.datetime_to_gregorian_seconds(epoch)
{{year, month, day}, {hour, minute, second, msec}} = created_at
gs = :calendar.datetime_to_gregorian_seconds({{year, month, day}, {hour, minute, second}})
gs - epoch_gs
end
@AKB428
AKB428 / quote_future.csv
Last active Sep 17, 2015
Azure Machine Learning を使った為替レートを元にした日経平均株価予想 ref: http://qiita.com/AKB428/items/8944b0b000d89b2d058c
View quote_future.csv
USD 日経株価
2015/9/17 120.539 0
2015/9/18 120.539 0
@AKB428
AKB428 / create_dummy_posdata.rb
Created Sep 12, 2015
create_dummy_posdata.rb
View create_dummy_posdata.rb
require 'date'
(1..12).each do |i|
date = Date.new(2014, i, 1)
(1..10).each do |x|
shop_id = x
sales = 100000 * date.month * shop_id
puts sprintf("%d,%s,%d", shop_id, date, sales)
end
end
View 2015_Q3_Anime.sql
SELECT
name,
title,
IF(sum(score) > 10, 10, sum(score)) as score
FROM (
SELECT
name,
title,
1 AS score,
FROM (
View CF2SQL
SELECT
name,
title,
sum(score) as score
FROM (
SELECT
name,
title,
1 AS score,
FROM (
@AKB428
AKB428 / cf.sql
Created Sep 9, 2015
協調フィルタリングデータ生成
View cf.sql
SELECT
name,
title,
sum(score) as score
FROM (
SELECT
name,
title,
1 AS score,
FROM (
@AKB428
AKB428 / application.json
Last active Aug 31, 2015
MSの画像解析サービスProject Oxfordでコスプレ ラブライブ四天王の年齢判定をプログラミングしてみる ref: http://qiita.com/AKB428/items/ba32bdf917037956b40f
View application.json
{
"Azure" : {
"subscription_key": ""
}
}
View trans.rb
#ruby trans.rb every60min20150816.log
def parser(line)
list = line.split(',')
list[0..8]
end
open(ARGV[0]) {|file|
counter = 0