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' | |
require 'rack' | |
require 'erb' | |
class RackApp | |
def call(env) | |
[200, {'Content-Type' => 'text/html'}, [<<END_HTML] | |
<html> | |
<head><title>Rack test</title></head> |
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
# -*- coding: utf-8 -*- | |
require 'net/http' | |
require 'aws-sdk' | |
instance_id = Net::HTTP.get('169.254.169.254', '/latest/meta-data/instance-id') | |
ec2_region = 'ec2.' + Net::HTTP.get('169.254.169.254', '/latest/meta-data/placement/availability-zone').chop + '.amazonaws.com' | |
image_name = instance_id + '-' + Time.now.strftime("%Y%m%d%H%M") | |
comment = "automatically generated image" | |
@ec2 = AWS::EC2.new( |
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
# Use 'ruby clone-github.rb' | |
# ユーザー名とかdepthオプションは自分で書き換えてください。 | |
require "json" | |
require "open-uri" | |
response = open("https://api.github.com/users/Hiroto-K/repos?per_page=100").read | |
JSON.parse(response).each do |info| | |
clone_url = info["ssh_url"] | |
to = info["name"] |