Skip to content

Instantly share code, notes, and snippets.

View mataki's full-sized avatar

Akihiro Matsumura mataki

  • SonicGarden
  • Kanagawa, Japan
  • X @mat_aki
View GitHub Profile
@mataki
mataki / update_flagmented_identifiers.rb
Created May 8, 2009 06:31
# SKIP rp-mode maintenance script
OpenidIdentifier.transaction do
OpenidIdentifier.all.each do |identifier|
identifier.url = OpenIdAuthentication.normalize_identifier(identifier.url)
if identifier.changed?
if identifier.save
p "update #{identifier.url}"
else
p "failure save #{identifier.url}:#{identifier.errors.full_messages.join(',')}"
end
else
# gem install paulj-hookout --source http://gems.github.com
# gem install sinatra
require 'rubygems'
require 'sinatra'
require 'hookout'
HOOKURL_APPNAME = 'reverse-http-app-name'
set :server, 'hookout'
require "rubygems"
require "oauth"
consumer_key = "consumer_key"
consumer_secret = "consumer_secret"
consumer = OAuth::Consumer.new(consumer_key,
consumer_secret,
:site => "https://www.youroom.in")
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="youRoom Home" scrolling="true">
<Require feature="opensocial-0.8" />
<Require feature="locked-domain"/>
<OAuth>
<Service name="youroom">
<Access url="http://youroom.sg/oauth/access_token" method="GET" />
<Request url="http://youroom.sg/oauth/request_token" method="GET" />
----- GET ------------------------------
[DEBUG] base_string: GET&http%3A%2F%2Fwww.youroom.sg%2Fr%2F5%2Fentries%2F502.json&oauth_consumer_key%3DTIgbVRWSQxtjenI2GGAA%26oauth_nonce%3D1623924774661838%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1278469756%26oauth_token%3DkVMqX5MubwyetjYQSfwD%26oauth_version%3D1.0
[DEBUG] signature: HPS83IIVNIvPxMqkboMlL1RKwFk=
[DEBUG] request signature: HPS83IIVNIvPxMqkboMlL1RKwFk=
[DEBUG] verify: true
----- POST ------------------------------
[DEBUG] base_string: POST&http%3A%2F%2Fwww.youroom.sg%2Fr%2F5%2Fentries.json&oauth_consumer_key%3DTIgbVRWSQxtjenI2GGAA%26oauth_nonce%3D1623956568200271%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1278469788%26oauth_token%3DkVMqX5MubwyetjYQSfwD%26oauth_version%3D1.0
[DEBUG] signature: oQXl/VvGSWmA7ZBUOFdT10rZHHI=
[DEBUG] request signature: USnE67Ypx0VkIrqKJzJIuXq0TLw=
Processing Group::EntriesController#create to json (for 118.67.95.146 at 2010-07-12 15:46:12) [POST]
Parameters: {"format"=>"json", "action"=>"create", "group_id"=>"861", "controller"=>"group/entries", "entry"=>{"content"=>"テスト", "parent_id"=>"54363"}, "subdomains"=>["www"]}
[DEBUG] base_string: POST&https%3A%2F%2Fwww.youroom.in%2Fr%2F861%2Fentries.json&entry%255Bcontent%255D%3D%25E3%2583%2586%25E3%2582%25B9%25E3%2583%2588%26entry%255Bparent_id%255D%3D54363%26oauth_consumer_key%3DwxN9D8pxK6Mne7hXNOxm%26oauth_nonce%3D2071335585280635%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1278917171%26oauth_token%3DcDYl4BT9msMxvdQXdK2w%26oauth_version%3D1.0
[DEBUG] signature: b/ckbNyHXhTtcsM+JV1hRC5LpMk=
[DEBUG] request signature: 8YN1rU/+M2NDqKbeaCWRC8mCrtQ=
[DEBUG] verify: false
@mataki
mataki / xauth_sample_for_youroom.rb
Created July 15, 2010 02:05
youRoom xauth sample
require "rubygems"
require "oauth"
consumer_key = "consumer_key"
consumer_secret = "consumer_secret"
consumer = OAuth::Consumer.new(consumer_key,
consumer_secret,
:site => "https://www.youroom.in/")
require "rubygems"
require "sinatra"
require "oauth"
require 'hpricot'
require "cgi"
set :logging, true
post "/" do
consumer_token = ENV["CTOKEN"]
require "rubygems"
require "oauth"
require "json"
require "action_pack"
require "active_support"
consumer_key = "AsuesLsQlNSqTmlr3off"
consumer_secret = "n7xvBRGBfdtIm2jQ5T2U65T7XO2hmX3FJt5f7cJw"
consumer = OAuth::Consumer.new(consumer_key,
require "rubygems"
require "pivotal_tracker"
require "rest_client"
pt = PivotalTracker::Client.token = ""
fetched_occurred_at = nil
def speach(text)
resp = RestClient.get "http://translate.google.com/translate_tts?tl=en&q=#{URI.escape(text)}"