Skip to content

Instantly share code, notes, and snippets.

Avatar

ota42y ota42y

View GitHub Profile
@ota42y
ota42y / file0.txt
Created Mar 15, 2014
rubyでtwitterのツイートをmongodbに流し込む ref: http://qiita.com/ota42y/items/da31335243373d19a9a2
View file0.txt
# mongodb用
gem install mongo bson_ext
# twitter用
gem install tweetstream
View evernote_send.rb
require 'yaml'
# これをやらないと警告が沢山出る
# http://stackoverflow.com/questions/8783400/warning-already-initialized-constant-after-installing-tlsmail-gem
require 'net/smtp'
Net.instance_eval {remove_const :SMTPSession} if defined?(Net::SMTPSession)
require 'net/pop'
Net::POP.instance_eval {remove_const :Revision} if defined?(Net::POP::Revision)
Net.instance_eval {remove_const :POP} if defined?(Net::POP)
View file0.txt
#!/bin/bash
if [ $# -ne 1 ]; then
echo "plese set folder" 1>&2
exit 1
fi
dir=$1
main=${dir%/}
today=`date "+%d.txt"`
@ota42y
ota42y / http_post_server.coffee
Created Aug 28, 2014
When post /hubot/send_message, hubot send message to chat
View http_post_server.coffee
module.exports = (robot) ->
robot.router.post "/hubot/send_message", (req, res) ->
if not req.body
res.end ""
return
room_name = req.body.room
message = req.body.message
@ota42y
ota42y / go_twitter.go
Created Aug 31, 2014
Anacondaを使ってtwitterからツイートを取ってくる
View go_twitter.go
package main
import (
"fmt"
"github.com/ChimeraCoder/anaconda"
"net/url"
)
func showTimeLine(api *anaconda.TwitterApi, v url.Values) {
tweets, err := api.GetUserTimeline(v)
@ota42y
ota42y / go_mongodb.go
Created Sep 1, 2014
mongodbにツイートを保存する
View go_mongodb.go
package main
import (
"fmt"
"github.com/ChimeraCoder/anaconda"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"net/url"
)
@ota42y
ota42y / go_cron.go
Created Sep 8, 2014
github.com/robfig/cronの動作テスト
View go_cron.go
package main
import (
"fmt"
"github.com/robfig/cron"
"time"
)
func main() {
c := cron.New()
View tesh.hs
type Name = String
colorName :: NamedColor -> Name
colorName c = case c of
Red -> ""
Green -> ""
Blue -> ""
main =
print 1
@ota42y
ota42y / test.go
Created Jan 26, 2015
goの継承テスト
View test.go
package main
import "fmt"
type If interface{ // PrintDataメソッドを持つインターフェースを定義
PrintData()
}
type MyBase struct {
Count int
View levenshtein_distance.rb
# coding: utf-8
def get_cost(d, c1, x, c2, y)
costs = []
if c1 == c2
# 同じ場合
costs << d[y-1][x-1]
end
if c1 != c2