以下のような感じで実装できるかも。
# ServerからClientへのKeepAliveに対する応答
connection.on_global_request("keep-alive@openssh.com") do |data, want_reply|
puts "data: #{data.inspect}"
puts "want_reply: #{want_reploy}"
end
# ClientからServerへのKeepAlive要求
testfile="/tmp/$(basename $0).$$.tmp" | |
echo test > $testfile | |
out=$(sed -e "s/^//" -i "" $testfile 2>&1) | |
sed_exit_status=$? | |
$(echo $out | grep "sed: can't read : No such fil or directory") | |
grep_exit_status=$? | |
echo $grep_exit_status | |
if [ $sed_exit_status -ne 0 ]; then | |
echo GNU sed |
#!/bin/sh | |
/usr/libexec/java_home -V 2>&1 \ | |
| awk -F',' '$1 ~ /1.[678].0(_[a-z0-9\-]+)?$/ { gsub(/^ +/, ""); print $1 }' | |
# | |
#Output: | |
# | |
# 1.8.0 | |
# 1.7.0_06 |
#!/bin/sh | |
# Usage: | |
# source select_java_home.sh | |
function select_java_home | |
{ | |
local java_home_cmd=/usr/libexec/java_home |
#!/bin/sh | |
# | |
# 前提 | |
# | |
# awscliとjqをインストールしておくこと | |
# Mac OS Xならそれぞれbrew install awscliとbrew install jqでOK | |
# DEBUG=1 ec2-ipaddr hoge | |
# などと実行すると、デバッグモードになる |
以下のような感じで実装できるかも。
# ServerからClientへのKeepAliveに対する応答
connection.on_global_request("keep-alive@openssh.com") do |data, want_reply|
puts "data: #{data.inspect}"
puts "want_reply: #{want_reploy}"
end
# ClientからServerへのKeepAlive要求
# ~/.bash_profileなどに追加しておくと便利 | |
retry () { | |
echo retry: Running $@ with retries | |
local label=retry: | |
local temp_file=$(mktemp -t temp_file.tmp) | |
local exit_status_file=$(mktemp -t exit_status.tmp) | |
local trial_num= | |
local exit_status= | |
local max_trial_num=5 | |
local re='^[0-9]+$' |
{ | |
"Version": "2008-10-17", | |
"Id": "Policy<UNIQUE_ID>", | |
"Statement": [ | |
{ | |
"Sid": "Stmt<UNIQUE_ID>", | |
"Effect": "Deny", | |
"NotPrincipal": { | |
"AWS": "arn:aws:iam::アカウントID:user/Wercker向けIAMユーザ名" | |
}, |
require 'active_record' | |
require 'mysql2' | |
require 'minitest/autorun' | |
require 'logger' | |
puts "ActiveRecord: #{ActiveRecord::VERSION::STRING}" | |
ActiveRecord::Base.establish_connection(adapter: "mysql2", host: "localhost", database: "test") | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
class Author < ActiveRecord::Base |
Rails.application.routes.default_url_options = { :host => 'example.com' } | |
view_paths = Rails.application.config.paths["app/views"] | |
action_view = ActionView::Base.new(view_paths).tap do |av| | |
action_view.class_eval do | |
include ApplicationHelper | |
include Rails.application.routes.url_helpers | |
include JobOffersHelper | |
end | |
end; nil |
module Reliable | |
def retries(method, up_to:, on:, delay: Tryer.delay, before_retry: Tryer.before_retry, after_call: Tryer.after_call) | |
original_method = :"#{method}_without_reliable" | |
alias_method original_method, method | |
tryer = Tryer.new(up_to: up_to, on: on, delay: delay, before_retry: before_retry, after_call: after_call) | |
define_method method do |*args| | |
tryer.reliably do | |
__send__ original_method, *args | |
end |