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
#! /usr/bin/env ruby | |
=begin | |
backshot.rb is a Ruby program driving | |
Amazon EBS <http://aws.amazon.com/ebs/> | |
to generate snapshots for backup purposes. | |
Hourly, daily, weekly, and monthly snapshots | |
are generated by default. |
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 File.dirname(__FILE__) + '/helper' | |
class UriEncodeTest < Test::Unit::TestCase | |
it "responds with a percent-encoded encoded slash" do | |
mock_app { | |
get '/:encoded' do | |
params[:encoded] | |
end | |
} |
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
framework 'Cocoa' | |
NSApplication.sharedApplication | |
class Request | |
def get( url, &block ) | |
@buffer = NSMutableData.new | |
@block = block | |
request = NSMutableURLRequest.requestWithURL NSURL.URLWithString( url ) | |
NSURLConnection.alloc.initWithRequest( request, delegate:self ) |
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
irb(main):001:0> framework 'Cocoa' | |
=> true | |
irb(main):002:0> NSOpenPanel.openPanel | |
Sun Jan 24 15:17:49 imac.local macruby[13149] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection | |
Sun Jan 24 15:17:49 imac.local macruby[13149] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. | |
Sun Jan 24 15:17:49 imac.local macruby[13149] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection | |
=> #<NSOpenPanel:0x200274540> | |
irb(main):003:0> NSOpenPanel.openPanel | |
=> #<NSOpenPanel:0x2002fa220> | |
irb(main):004:0> |
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
-- Mac #1 (works) -- | |
$ macruby --version | |
MacRuby version 0.5 (ruby 1.9.0) [universal-darwin10.0, x86_64] | |
$ file test.rbo | |
test.rbo: Mach-O universal binary with 2 architectures | |
test.rbo (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 | |
test.rbo (for architecture i386): Mach-O dynamically linked shared library i386 |
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 'chef' | |
require 'fog' | |
require 'google_spreadsheet' | |
Chef::Config.from_file("~/.chef/knife.rb") | |
ec2 = Fog::AWS::EC2.new(:aws_access_key_id => ENV["AWS_KEY"], | |
:aws_secret_access_key => ENV["AWS_SECRET"] ) |
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
files = directory.files.all | |
truncated = files.is_truncated | |
while truncated | |
set = directory.files.all( :marker => files.last.key ) | |
truncated = set.is_truncated | |
files = files + set | |
end |
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
$ export FOG_MOCK=false && bundle exec shindo tests/dns/requests/dnsimple | |
Skipping tests for terremarkecloud due to lacking credentials (add some to '~/.fog' to run them) | |
DNSimple::dns | DNS requests (dnsimple, dns) | |
success | |
+ get current zone count | |
- create zone | |
undefined method `>' for nil:NilClass (Excon::Errors::SocketError) | |
/Users/dje/.rvm/gems/ruby-1.9.2-p180/gems/excon-0.5.6/lib/excon/response.rb:59:in `parse' | |
/Users/dje/.rvm/gems/ruby-1.9.2-p180/gems/excon-0.5.6/lib/excon/connection.rb:120:in `request' |
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
No. Time Source Destination Protocol Info | |
213 1819.711144 173.255.232.227 192.168.1.2 HTTP HTTP/1.1 201 Created (application/json) | |
Frame 213: 1203 bytes on wire (9624 bits), 1203 bytes captured (9624 bits) | |
Ethernet II, Src: AppleCom_f3:cd:d5 (00:1b:63:f3:cd:d5), Dst: AppleCom_99:72:75 (00:1b:63:99:72:75) | |
Internet Protocol, Src: 173.255.232.227 (173.255.232.227), Dst: 192.168.1.2 (192.168.1.2) | |
Transmission Control Protocol, Src Port: http (80), Dst Port: 54688 (54688), Seq: 1, Ack: 251, Len: 1137 | |
Hypertext Transfer Protocol | |
HTTP/1.1 201 Created\r\n | |
Server: nginx/0.7.65\r\n |
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
"Why should a financial engineer be paid 4 to 100 times more than a real engineer? A real engineer builds bridges. A financial engineer builds dreams. When those dreams turn out to be nightmares other people pay for it." | |
-- Andrew Sheng, China Banking Regulatory Commission |
OlderNewer