This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A sample Gemfile | |
source "https://rubygems.org" | |
gem 'shangrila' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USD | 日経株価 | ||
---|---|---|---|
2015/9/17 | 120.539 | 0 | |
2015/9/18 | 120.539 | 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
name, | |
title, | |
IF(sum(score) > 10, 10, sum(score)) as score | |
FROM ( | |
SELECT | |
name, | |
title, | |
1 AS score, | |
FROM ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
name, | |
title, | |
sum(score) as score | |
FROM ( | |
SELECT | |
name, | |
title, | |
1 AS score, | |
FROM ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
name, | |
title, | |
sum(score) as score | |
FROM ( | |
SELECT | |
name, | |
title, | |
1 AS score, | |
FROM ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Azure" : { | |
"subscription_key": "" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ruby trans.rb every60min20150816.log | |
def parser(line) | |
list = line.split(',') | |
list[0..8] | |
end | |
open(ARGV[0]) {|file| | |
counter = 0 |
NewerOlder