-
鳥取某所
-
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
-
aws-sdk (1.7.0)
-
鳥取某所2
-
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin10.8.0]
-
aws-sdk (1.6.6)
-
EC2
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
#!/bin/env ruby | |
RAILS_BASE = "/my/rails/dir/" | |
require RAILS_BASE + 'config/environment' | |
dbconfig = YAML.load_file(RAILS_BASE + 'config/database.yml')['production'] | |
ActiveRecord::Base.establish_connection(dbconfig) | |
p User.all |
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 'uri' | |
require 'json' | |
require 'net/http' | |
role = Net::HTTP.get(URI.parse("http://169.254.169.254/latest/meta-data/iam/security-credentials/")) | |
ret = Net::HTTP.get(URI.parse("http://169.254.169.254/latest/meta-data/iam/security-credentials/#{role}")) | |
dat = JSON.parse(ret) | |
puts dat["AccessKeyId"] | |
puts dat["SecretAccessKey"] |
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
package { | |
import flash.display.*; | |
import flash.text.*; | |
public class HelloWorld extends Sprite { | |
public function HelloWorld () { | |
var textField:TextField = new TextField(); | |
textField.text = "Hello World"; | |
addChild(textField); | |
} |
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
/* | |
クロスドメインの画像を読み込む場合、下記のコメントアウトを外して対処しないとcrossdomain.xmlが配置してあっても以下のエラーとなる | |
SecurityError: Error #2122: セキュリティサンドボックス侵害 : BitmapData.draw:file:///hoge/LoadImage.swf は https://example.com/hoge.jpg にアクセスできません。ポリシーファイルが必要ですが、このメディアがロードされたとき、checkPolicyFile フラグが設定されませんでした。 | |
at flash.display::BitmapData/draw() | |
at MethodInfo-1() | |
*/ | |
package { | |
import flash.display.*; |
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 'rubygems' | |
gem 'aws-sdk' | |
require 'aws' | |
require 'optparse' | |
require 'net/http' | |
class Net::HTTP | |
alias :create :initialize | |
def initialize(*args) |
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
gem 'aws-sdk' | |
gem 'mime-types' | |
require 'aws' | |
require 'mime/types' | |
require 'optparse' | |
access_key_id = nil | |
secret_access_key = nil | |
endpoint = 's3-ap-northeast-1.amazonaws.com' | |
bucket = nil |
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
gem 'aws-sdk' | |
require 'rubygems' | |
require 'aws-sdk' | |
ec2 = AWS::EC2.new(:access_key_id => nil, | |
:secret_access_key => nil, | |
:proxy_uri => ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']) | |
ec2.regions.each do |region| | |
reg = ec2.regions[region.name] | |
reg.instances.each do |instance| |
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
gem 'net-irc' | |
require 'net/irc' | |
require 'yaml' | |
data = YAML.load(DATA) | |
class TestBot < Net::IRC::Client | |
attr_accessor :target_channels | |
def initialize(*args) |
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
#! /bin/env ruby | |
require 'webrick' | |
require 'yaml' | |
require "socket" | |
server = WEBrick::HTTPServer.new( | |
:Port => 8080, | |
:BindAddress => IPSocket::getaddress(Socket::gethostname), | |
:Logger => WEBrick::Log::new(STDERR, WEBrick::Log::DEBUG) | |
) |