Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View AKB428's full-sized avatar
🥳
Out sick

AKB428 AKB428

🥳
Out sick
View GitHub Profile
@AKB428
AKB428 / Gemfile
Last active November 9, 2015 16:33
放映中のアニメ公式 Twitterアカウントのフォロワー変動履歴情報を提供するRESTful API サーバーを作りました ref: http://qiita.com/AKB428/items/c12c70b16c924a45f73f
# A sample Gemfile
source "https://rubygems.org"
gem 'shangrila'
@AKB428
AKB428 / file0.sql
Last active November 8, 2015 17:18
MySQL と MariaDBの プリペアドステートメント バインドパラメーターがSQL関数だった時の挙動の違い ref: http://qiita.com/AKB428/items/8be7059e7e2919cea090
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 November 3, 2015 18:36
ElixirでMySQLのdatetime型をUNIX TIMESTAMPに変換する ref: http://qiita.com/AKB428/items/1e6491b4badcf416d9be
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 September 17, 2015 10:05
Azure Machine Learning を使った為替レートを元にした日経平均株価予想 ref: http://qiita.com/AKB428/items/8944b0b000d89b2d058c
USD 日経株価
2015/9/17 120.539 0
2015/9/18 120.539 0
@AKB428
AKB428 / create_dummy_posdata.rb
Created September 12, 2015 05:24
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
@AKB428
AKB428 / 2015_Q3_Anime.sql
Created September 12, 2015 03:01
2015_Q3_Anime.sql
SELECT
name,
title,
IF(sum(score) > 10, 10, sum(score)) as score
FROM (
SELECT
name,
title,
1 AS score,
FROM (
@AKB428
AKB428 / CF2SQL
Created September 9, 2015 08:38
CF2
SELECT
name,
title,
sum(score) as score
FROM (
SELECT
name,
title,
1 AS score,
FROM (
@AKB428
AKB428 / cf.sql
Created September 9, 2015 08:20
協調フィルタリングデータ生成
SELECT
name,
title,
sum(score) as score
FROM (
SELECT
name,
title,
1 AS score,
FROM (
@AKB428
AKB428 / application.json
Last active August 31, 2015 17:20
MSの画像解析サービスProject Oxfordでコスプレ ラブライブ四天王の年齢判定をプログラミングしてみる ref: http://qiita.com/AKB428/items/ba32bdf917037956b40f
{
"Azure" : {
"subscription_key": ""
}
}
@AKB428
AKB428 / trans.rb
Created August 17, 2015 16:42
trans.rb
#ruby trans.rb every60min20150816.log
def parser(line)
list = line.split(',')
list[0..8]
end
open(ARGV[0]) {|file|
counter = 0