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
#!/bin/bash | |
set -e | |
## Exit options not passed. | |
if [ "$1" == "" ];then | |
cat <<EOL | |
Add AWS MarketPlase OwnerID to your AMI and Snapshot. | |
Usage: | |
add_owner_to_ami.sh AMI_ID [PROFILE_NAME] |
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
bash -c ' | |
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%> | |
exists() { | |
if command -v $1 &>/dev/null | |
then | |
return 0 | |
else | |
return 1 | |
fi |
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
# -- snip -- | |
config.vm.define machine do |config| | |
config.vm.provider :virtualbox do |vb| | |
at_disk = 'tmp/name_of_file.vdi' | |
unless File.exists?(at_disk) | |
vb.customize ['createhd', '--filename', at_disk, '--size', 5 * 1024] | |
end | |
vb.customize ['storageattach', :id, '--storagectl', 'IDE Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', at_disk] | |
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
<source> | |
type tail | |
# format /(?<time>[\w]+\s+[\d]+\s[\d:]+)\s+(?<host>[\w]+)\s+(?<process>[\w\/]+)\[(?<pid>[\d]+)\]\:\s(?<queue_id>[\w]{11}):\s(?<data>.+)/ | |
format /(?<time>[\w]+\s+[\d]+\s[\d:]+)\s+(?<data>.+)/ | |
time_format %b %d %H:%M:%S | |
path /var/log/mail.log | |
pos_file /opt/fluentd/tmp/mail.log.pos2 | |
tag raw.postfix.result | |
</source> |
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
curl -XPUT http://localhost:9200/_template/main_template?pretty -d ' { | |
"template" : "logstash-*", | |
"order" : 10, | |
"settings" : { | |
"index.number_of_replicas" : 0 | |
}, | |
"mappings" : { | |
"_default_" : { | |
"numeric_detection" : true | |
} } |
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
Ohai.plugin(:Joyent) do | |
%w{ sm_uuid sm_id sm_image sm_image_id sm_image_ver sm_baseimage sm_baseimage_id sm_baseimage_ver sm_pkgsrc }.each do |info| | |
provides "joyent/#{info}" | |
end | |
provides 'virtualization/guest_id' | |
depends 'os', 'platform', 'virtualization' | |
def collect_solaris_guestid | |
command = '/usr/sbin/zoneadm list -p' |
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
$ chef-client -v | |
Chef: 11.12.4 | |
$ sudo chef-apply cron.rb | |
Recipe: (chef-apply cookbook)::(chef-apply recipe) | |
* cron[at_reboot] action create | |
- add crontab entry for cron[at_reboot] |
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
# -- snip -- | |
if c.host != host | |
c.ssh.close if c.ssh | |
c.host = host | |
## ここでCapybara.app_hostを設定しちゃう。 | |
Capybara.app_host = "http://#{host}" | |
options = Net::SSH::Config.for(c.host) | |
user = options[:user] || Etc.getlogin | |
c.ssh = Net::SSH.start(host, user, options) | |
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
require 'chamber' | |
env_confs = [ | |
File.expand_path('../../config/environment.yml', __FILE__), | |
File.expand_path('../../config/environment.local.yml', __FILE__) | |
] | |
EnvSettings = Chamber.load files: env_confs | |
app_confs = [ |
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
# chef-apply test.rb | |
Recipe: (chef-apply cookbook)::(chef-apply recipe) | |
* service[test] action nothing (up to date) | |
* file[/tmp/hoge] action create | |
- update content in file /tmp/hoge from 2b795c to 04db98 | |
--- /tmp/hoge 2014-04-15 03:13:48.000000000 +0000 | |
+++ /tmp/.hoge20140415-4288-ulgn9f 2014-04-15 03:15:43.000000000 +0000 | |
@@ -1,2 +1,2 @@ | |
-2014-04-15 03:13:48 +0000 | |
+2014-04-15 03:15:43 +0000 |