This is interesting
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 'json' | |
def metrics(values, keys) | |
Hash[keys.zip(values)] | |
end | |
values = %x[free -m].match(/cache:\s+(\d+)\s+(\d+)\n/).captures | |
keys = ["memory-buffers", "memory-cached"] | |
data = metrics(values, keys) |
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
$ cucumber-chef test --tags @minitest | |
cucumber-chef v2.0.0.rc1 | |
Using features directory: /home/sns/chef-repo/features | |
Cucumber-Chef Test Runner Initalized! | |
Cleaning up any previous test runs...done. | |
Uploading files required for this test run...done. | |
Executing Cucumber-Chef Test Runner | |
@minitest | |
Feature: Run minitests |
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
sh -c ' | |
portsnap fetch | |
portsnap extract | |
BATCH=yes | |
export BATCH | |
echo "RUBY_DEFAULT_VER=1.9" >> /etc/make.conf | |
pkg_add -r autoconf | |
cd /usr/ports/converters/ruby-iconv | |
make install | |
gem install chef --no-ri --no-rdoc |
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
Hhh |
Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.
Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.
To name a gist, touch its name in the toolbar.
You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.
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
Description | |
=========== | |
A brief description of the purpose of this cookbook, the problem it solves, etc. | |
Requirements | |
============ | |
Requirements for using this cookbook. Chef version can be noted if significant. |
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 | |
java_dir = %x[ls -l $(which java)].split.last | |
java_home_command = java_dir.gsub('java', 'java_home') | |
print "JAVA_HOME is: " | |
java_home = system(java_home_command) |
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
$ knife exec get_readmes.rb | |
===> Fetching metadata from Chef Server... | |
................ | |
===> Preparing to download READMEs. | |
===> Fetching ips ... | |
===> Fetching solaris ... | |
===> Fetching sudo ... | |
===> Fetching application ... | |
===> Fetching git ... | |
===> Fetching users ... |
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
if hosts.empty? | |
hosts |= @h.hosts_for(task) rescue nil | |
end |