code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
module Puppet::Parser::Functions
newfunction(:set_role_attr) do |args|
address = args[0]
roleid = args[1]
rname = args[2]
rvalue = args[3]
cmd = "curl -s \"%s/status/setRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, rname, rvalue]
puts cmd
system(cmd)
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:get_provider_attr, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getProviderAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets }
... | Ruby |
module Puppet::Parser::Functions
newfunction(:get_role_attr, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getRoleAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets }
puts re... | Ruby |
module Puppet::Parser::Functions
newfunction(:set_profile_applied) do |args|
roleid = args[0]
address = args[1]
cmd="curl -s \"%s/setRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, "ProfileABCApplied", "True"]
puts cmd
system(cmd)
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:write_line_to_file) do |args|
filename = args[0]
str = args[1]
File.open(args[0], 'a') {|fd| fd.puts str }
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:get_dependent_attrlist, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getDependentAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets... | Ruby |
require 'puppet/provider/parsedfile'
shells = "/etc/shells"
Puppet::Type.type(:shells).provide(:parsed,
:parent => Puppet::Provider::ParsedFile,
:default_target => shells,
:filetype => :flat
) do
desc "The shells provider that ... | Ruby |
module Puppet
newtype(:shells) do
@doc = "Manages shells in /etc/shells. For example::
shells { \"/bin/bash\":
ensure => present,
}
There is also an optional target attribute if your
shells file is located elsewhere."
ensurable
newparam(:shell, :name... | Ruby |
Facter.add("etctest") do
setcode do
"/etc/test.conf"
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:set_role_attr) do |args|
address = args[0]
roleid = args[1]
rname = args[2]
rvalue = args[3]
cmd = "curl -s \"%s/status/setRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, rname, rvalue]
puts cmd
system(cmd)
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:get_role_attr, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getRoleAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen("date") { |f| result=f.gets }
puts... | Ruby |
module Puppet::Parser::Functions
newfunction(:set_profile_applied) do |args|
roleid = args[0]
address = args[1]
cmd="curl -s \"%s/setRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, "ProfileABCApplied", "True"]
puts cmd
system(cmd)
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:write_line_to_file) do |args|
filename = args[0]
str = args[1]
File.open(args[0], 'a') {|fd| fd.puts str }
end
end
| Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
#!/usr/bin/env ruby
require 'puppet'
result = Puppet::Node::Facts.new(Puppet[:certname].to_s, Facter.to_hash)
result.add_local_facts
result.stringify
result.downcase_if_necessary
puts result.to_yaml
| Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "puppetmasterd"
require 'puppet'
# if you want debugging:
ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/puppetmasterd... | Ruby |
#
# To change this template, choose Tools | Templates
# and open the template in the editor.
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/testtask'
spec = Gem::Specification.new do |s|
s.name = 'cloudi'
s.version = '0.0.1'
s.has_rd... | Ruby |
module Cloudi
class ServerSocket
include Socket::Constants
def initialize(win, port, timer)
@win = win
@port = port
@nick = "Server" # Server user's Nickname
@mutex = Mutex.new # For synchronization, so there's no corruption of memory
@clients = [] # For the sockets t... | Ruby |
# wxRuby2 Sample Code. Copyright (c) 2007-???? Mario J. Steele
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
class Socket
# Socket#recv_packet()
#
# This method retrives 1kb of data from the socket. It uses
# IO#readpartial due to the fact, that IO#read() uses buffered IO,
# which can cause e... | Ruby |
module Cloudi
ClientInfo = Struct.new(
:name, # User's Nickname
:host, # User's Host Address
:port, # User's Port
:sock, # User's Sock
:buffer, # Buffer for the socket
:finished # 是否完成通信
)
end | Ruby |
module Cloudi
SW_PANDING = 20 # 两个端口之间的间隔
SW_WIDTH = 200 # 交换机宽度
SW_X = 400
SW_Y = 100
PT_WIDTH = 40 # 端口的宽度
PT_HEIGHT = 40 # 端口的高度
ST_WIDTH = 150 # 文本框宽度
ST_PANDING = 20 # 文本框补白
class Switcher
attr_reader :x
attr_reader :y
attr_reader :width
attr_reader :height
attr_rea... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
lib = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
lib = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | Ruby |
# Be sure to restart your server when you modify this file.
Cloudideas::Application.config.session_store :cookie_store, :key => '_cloudideas_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with... | Ruby |
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | Ruby |
Cloudideas::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned... | Ruby |
Cloudideas::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the we... | Ruby |
Cloudideas::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the te... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Cloudideas::Application.initialize!
| Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module Cloudideas
class Application < Rails::Application
... | Ruby |
Cloudideas::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
match 'main' => 'main#test'
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample ... | Ruby |
module ApplicationHelper
end
| Ruby |
module MainHelper
end
| Ruby |
class MainController < ApplicationController
def test
end
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
Cloudideas::Application.load_tasks
| Ruby |
source 'http://rubygems.org'
gem 'rails', '3.0.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.... | Ruby |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name =>... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Cloudideas::Application
| Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integrati... | Ruby |
{fileheader}
class StdClass
def initialize
end
end
x = StdClass.new
| Ruby |
# For complete documentation of this file, please see Geany's main documentation
[styling]
# Edit these in the colorscheme .conf file instead
default=default
commentline=comment_line
number=number_1
string=string_1
character=character
word=keyword_1
global=type
symbol=preprocessor
classname=class
defname=function
opera... | Ruby |
class A
def a()
super(" do ")
end
def b()
end
end
| Ruby |
class Foo
def foo
File.open("foo", "r") do |infile|
infile.readline
end
end
def bar
print "bar"
end
end
| Ruby |
#!/usr/bin/ruby
module ModuleExample
class ClassExample
def class_method
puts "in class_method"
end
def ClassExample.singleton_class_method
puts "in singleton_class_method"
end
def class_method_exclamation!
puts "in class_method_exclamatio... | Ruby |
class A
def a
dummy = "\n while true do \n"
end
def b
dummy = %Q{\n while true do \n}
end
def c
dummy = %{\n while true do \n}
end
def d
dummy = %/\n while true do \n/
end
# raw strings
def e
dummy = ' while true do '
end
def f
dummy = %q{ while true do }
end
#... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Copies a file to a running instance.
def copy_to_instance(keyfile, local, remote, instances, i)
if i < 0 || (i+1) > instances.size
puts "unknown instance #{i}"
ex... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/S3'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Display the names of all the buckets.
if ARGV[0] == '-?'
puts "usage: list-buckets"
exit 1
end
Signal.trap("INT") do
exit 2
end
config = BasicConfiguration.new
s3 =... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Disassociate an ElasticIP address with an instance
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: disassociate-address public-ip"
exit 1
end
public_ip = ARGV[0]... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Display information about all our instances.
# the optional argument -f gives the image manifest name instead of the
# ami-name.
if ARGV[0] == '-?'
puts "usage: list-in... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SQS'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Create a queue.
# Apparently if you create another queue by the same name, it will return
# the existing queue id.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: ... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Log in to an instance.
# An ami-name can be supplied.
# If there is only, use it.
# Otherwise, list the instances and let the user choose.
def login_instance(keyfile, insta... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Delete a security group.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: delete-group name"
exit 1
end
name=ARGV[0]
Signal.trap("INT") do
exit 2
end
config =... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SQS'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Sends a message to the given queue.
# The contents of the message are given as "body"
if ARGV[0] == '-?' || ARGV.size != 2 then
puts "usage: send-queue name message"
ex... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SQS'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Receive and display a message from the given queue.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: receive-queue name"
exit 1
end
name=ARGV[0]
Signal.trap("INT... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Wait for a given instance to enter the active state.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: wait-for-active-instance instance-name"
exit 1
end
name=ARGV... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SimpleDB'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Create or update a SimpleDB item's attributes
if ARGV[0] == '-?' || ARGV.size < 2 then
puts "usage: put-attributes domain-name item-name [-r] [attribute:value]+"
e... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Associate an ElasticIP address with an instance
if ARGV[0] == '-?' || ARGV.size != 2 then
puts "usage: associate-address instance-id public-ip"
exit 1
end
instance_id =... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'basic_configuration'
require 'aws_context'
require 'pp'
# List all images belonging to the current account.
if ARGV[0] == '-?'
puts "usage: list-my-images"
exit 1
end
Signal.trap("INT") do
exit 2
end
config = BasicConfiguration.new
ec2 = Aw... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SimpleDB'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# List SimpleDB domains.
if ARGV[0] == '-?' then
puts "usage: list-domains [max-domains]"
exit 1
end
if ARGV.size > 0
max_domains = ARGV[0]
else
max_domains = 1... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Stop the given instance.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: stop-instance instance-name"
exit 1
end
name=ARGV[0]
Signal.trap("INT") do
exit 2
end... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/S3'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Retrieves the signed uri to share an S3 object.
# The bucket may be supplied on the command line or in the environment.
if ARGV[0] == '-?' || ARGV.size < 2 then
puts "usa... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SQS'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Display information about the given queue.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: get-queue-info name"
exit 1
end
name=ARGV[0]
Signal.trap("INT") do
... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SimpleDB'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Query SimpleDB
if ARGV[0] == '-?' || ARGV.size < 1 then
puts "usage: query domain-name [query-expression]"
exit 1
end
domain_name = ARGV[0]
if ARGV.size > 0
quer... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Get the console output from a running instance.
# This information is stored by amazon, for retrieval if needed.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: ... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Display information on an ElasticIP addresses
if ARGV[0] == '-?' then
puts "usage: describe-addresses"
exit 1
end
Signal.trap("INT") do
exit 2
end
config = BasicCon... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Create a volume.
if ARGV[0] == '-?' || ARGV.size != 2 then
puts "usage: create-volume avilability-zone size|snapshot-id"
exit 1
end
zone=ARGV[0]
size_or_snapshot = ARGV[1... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SQS'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Display the names of each queue.
if ARGV[0] == '-?'
puts "usage: list-queues"
exit 1
end
Signal.trap("INT") do
exit 2
end
config = BasicConfiguration.new
sqs = AwsC... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# List all images.
# It takes a while, so be patient.
# If a pattern is supplied, it is used to filter the output.
if ARGV[0] == '-?'
puts "usage: list-images [pattern]"
... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SimpleDB'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Delete a SimpleDB domain.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: delete-domain name"
exit 1
end
name = ARGV[0]
Signal.trap("INT") do
exit 2
end
c... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/S3'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Display the names of all the buckets.
if ARGV[0] == '-?'
puts "usage: list-buckets"
exit 1
end
Signal.trap("INT") do
exit 2
end
config = BasicConfiguration.new
s3 =... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SimpleDB'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Delete a SimpleDB item's attributes
if ARGV[0] == '-?' || ARGV.size < 2 then
puts "usage: delete-attributes domain-name item-name [attribute[:value]]*"
exit 1
end
... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SQS'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Create a queue.
# Apparently if you create another queue by the same name, it will return
# the existing queue id.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: ... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Get the console output from a running instance.
# This information is stored by amazon, for retrieval if needed.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: ... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/S3'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Deletes all S3 objects (key-value pairs) matching a given prefix.
# The bucket may be supplied on the command line or in the environment.
if ARGV[0] == '-?' ||ARGV.size < 1
... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Allocate an ElasticIP address
if ARGV[0] == '-?' then
puts "usage: allocate-address"
exit 1
end
Signal.trap("INT") do
exit 2
end
config = BasicConfiguration.new
ec2... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Log in to an instance.
# An ami-name can be supplied.
# If there is only, use it.
# Otherwise, list the instances and let the user choose.
def login_instance(keyfile, insta... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Delete a security group.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: delete-group name"
exit 1
end
name=ARGV[0]
Signal.trap("INT") do
exit 2
end
config =... | Ruby |
#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/EC2'
require 'basic_configuration'
require 'aws_context'
require 'pp'
# Detach a volume from a running instance.
if ARGV[0] == '-?' || ARGV.size != 1 then
puts "usage: detach-volume volume-id"
exit 1
end
volume_id = ARGV[0]
Signal.trap("INT"... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.