Example
$ tree
├── Vagrantfile
└── serverspec
├── precise64
│ └── httpd_spec.rb
| sub check_sudo { | |
| my @commands = ( | |
| '/bin/netstat', | |
| ); | |
| my @unexecutable = grep { | |
| system("sudo -l -U user $_ > /dev/null 2>&1") != 0; | |
| } @commands; | |
| message_for_sudo(@unexecutable); |
| default["recipeA"]["name"] = "nameA" | |
| default["recipeA"]["path"] = "/tmp/#{node["recipeA"]["name"]}" |
| $ python test.py | |
| test | |
| $ echo test | |
| test | |
| $ |
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| package CLI; | |
| use Data::Dumper; | |
| sub new { | |
| bless {}, $_[0]; | |
| } |
| #!/usr/bin/env python | |
| from subprocess import * | |
| class Example(object): | |
| def run(self): | |
| a = open("/etc/example.txt").read() | |
| b = Popen("/usr/bin/example.sh", shell=True, stdout=PIPE).communicate()[0] | |
| return a + b | |
| if __name__ == "__main__": |
| cat("/etc/hosts").grep("localhost").head(:1).cut(:f => 1) | |
| #=> "127.0.0.1" |
| $ pwd | |
| /path/to/chroot | |
| $ find . -type l -printf "%l\t%p\n" | grep '^/' | |
| /etc/foo ./usr/local/etc/foo | |
| $ find . -type l -printf "%l\t%p\n" | grep '^/' | ruby -F"\t|\n" -ane 'n=$F[1].split("/").size-2; org=Array.new(n, "..").join("/")+$F[0]; system "ln -sf #{org} #{$F[1]}"' | |
| $ find . -type l -printf "%l\t%p\n" | |
| ../../../etc/hoge ./usr/local/etc/hoge |
| > db.foo.findOne().t | |
| Timestamp(1365195372000, 1) | |
| > Timestamp.prototype.toString = function() { return new Date(this.getTime()); } | |
| > db.foo.findOne().t | |
| Fri Apr 05 2013 13:56:12 GMT-0700 (PDT) |