teppeilog

ちょっとずつエンジンかかってきた

Archive for 2月, 2011

雪だー

leave a comment

神奈川県でも雪が降っております。

正直、北海道から上京してきた僕に感動はありません。

雪の日に傘をさすという習慣がなかったので、上京一年目に雪が降ったとき、僕はびしょ濡れになりました。

あれから10年近く経つのか。。。



このエントリーをはてなブックマークに追加
はてなブックマーク - 雪だー
Share on Facebook

Written by teppei

2月 11th, 2011 at 1:34 pm

Posted in 未分類

GoogleにClientLoginしてみる

leave a comment

GoogleのAPIを使用するためにClientLogin処理、C2DMを使ってみたいのでRubyで実装してみました。ClientLoginで取得するのは他のサービスを使うために必要なAuthのパラメータなので、それを取り出す。

require 'net/https'
require 'uri'

auth_hash = Hash.new

url = URI.parse("https://www.google.com/accounts/ClientLogin")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.verify_depth = 5

req = Net::HTTP::Post.new(url.path)

req.set_form_data({
:accountType => 'HOSTED_OR_GOOGLE',
:Email => 'hogehoge@gmail.com',
:Passwd => 'hogehoge',
:service => 'ac2dm',
:source => 'hogetest'
})

https.start do
  res = https.request(req)
  if res.code == "200"
    res.body.split("\n").each do |data|
      key,value = data.split("=")
      auth_hash[key] = value
    end
  end
end

print auth_hash['Auth'] # => 必要なAuth
このエントリーをはてなブックマークに追加
はてなブックマーク - GoogleにClientLoginしてみる
Share on Facebook

Written by teppei

2月 4th, 2011 at 2:30 pm

さくらVPSを借りてまずしたこと

4 comments

さくらVPS借りました。ある意味仕方がなく。色々使う前にいじってみるさ。
いじりはこの辺を参考にしました。

Read the rest of this entry »

このエントリーをはてなブックマークに追加
はてなブックマーク - さくらVPSを借りてまずしたこと
Share on Facebook

Written by teppei

2月 1st, 2011 at 12:59 am

Posted in ネットワーク

Tagged with , ,