Models | Examples |
---|---|
Display ads | Yahoo! |
Search ads |
This file contains hidden or 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
mkcloud: | |
cloudid: default | |
TESTSHEAD: 1 | |
source: develcloud5 | |
nodes: | |
- os: sle12 | |
role: compute | |
hv: xen | |
- os: sle11sp3 |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# irb3 - Runs an IRB-esque prompt (but it's NOT really IRB!) over multiple | |
# versions of Ruby at once (using RVM) | |
# | |
# By Peter Cooper, BSD licensed | |
# | |
# Main dependency is term-ansicolor for each impl: | |
# rvm exec gem install term-ansicolor |
This file contains hidden or 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
context "Restart a service on the installation system" do | |
it "restarts a service with a specialized inst-sys helper if available" do | |
File.stub(:exist?).with('/bin/service_start').and_return(true) | |
service = SystemdService.find("sshd") | |
SCR.stub(:Execute).and_return({'stderr'=>'', 'stdout'=>'', 'exit'=>0}) | |
expect(service).not_to receive(:command) # SystemdUnit#command | |
expect(service).to receive(:stop) | |
expect(service).to recieve(:start) | |
expect(service.restart).to be_true | |
end |
This file contains hidden or 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
AddOnProduct.add_on_products = Builtins.maplist( AddOnProduct.add_on_products) do |prod| | |
media = Ops.get_string(prod, "media_url", "") | |
pth = Ops.get_string(prod, "product_dir", "/") | |
if String.StartsWith(media, "relurl://") | |
base = AddOnProduct.GetBaseProductURL | |
media = AddOnProduct.GetAbsoluteURL(base, media) | |
Builtins.y2milestone("relurl changed to %1", media) | |
end | |
Ops.set(@sources, media, Ops.get(@sources, media, {})) | |
# set addon specific sig-handling |
This file contains hidden or 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
# USAGE: Hash.from_xml:(YOUR_XML_STRING) | |
require 'nokogiri' | |
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297 | |
class Hash | |
class << self | |
def from_xml(xml_io) | |
begin | |
result = Nokogiri::XML(xml_io) | |
return { result.root.name.to_sym => xml_node_to_hash(result.root)} |
This file contains hidden or 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
# USAGE: Hash.from_libxml(YOUR_XML_STRING) | |
require 'xml/libxml' | |
# adapted from | |
# http://movesonrails.com/articles/2008/02/25/libxml-for-active-resource-2-0 | |
class Hash | |
class << self | |
def from_libxml(xml, strict=true) | |
begin | |
XML.default_load_external_dtd = false |
YARD CHEATSHEET http://yardoc.org
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
This file contains hidden or 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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# prints a sparkline in the terminal using the supplied list of numbers | |
# examples: | |
# spark.rb 10 20 30 100 90 80 | |
# spark.rb 1 2 0.4 0.1 1.3 0.7 | |
@ticks = %w[▁ ▂ ▃ ▄ ▅ ▆ ▇] | |
values = ARGV.map { |x| x.to_f } |
Unicorn was by far the best performing (5.94 trans/sec over the 1-minute test, 352 total). Puma (3.95 trans/sec, 235 total) appeared to perform no better than Webrick, despite the default behavior of using up to 16 threads. Perhaps increasing its worker count to the number of cores will improve its performance.
I've tried to run multiple Puma workers with the workers
directive (per their sample documentaiton), but I receive errors about undefined method 'workers' for #<Puma::Configuration::DSL:0x007ffca4bde798>
).
$ bundle exec rails server