Skip to content

Instantly share code, notes, and snippets.

@zimbatm
zimbatm / gist:487157
Created July 23, 2010 07:57
Temporary disable $stdout
/* Temporary disable $stdout
============================
This method works for Ruby and new sub-processes.
I have seen other techniques on the net which re-assign $stdout with another IO,
but then the sub-processes will still use the old stdout.
*/
@rkumar
rkumar / gist:445735
Created June 20, 2010 10:47
ruby's OptionParser to get subcommands
#!/usr/bin/env ruby -w
## Using ruby's standard OptionParser to get subcommand's in command line arguments
## Note you cannot do: opt.rb help command
## other options are commander, main, GLI, trollop...
# run it as
# ruby opt.rb --help
# ruby opt.rb foo --help
# ruby opt.rb foo -q
# etc
# Make sense of puppet circular dependency error messages.
# Tags: graphviz, puppet
# See output at http://i41.tinypic.com/b6yeqv.jpg
$ cat circular.pp
node default {
exec { "/a": require => Exec["/b"] }
exec { "/b": require => Exec["/c"] }
exec { "/c": require => Exec["/a"] }
}