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
| #!/usr/bin/env ruby | |
| #coding:utf-8 | |
| # This script is used to rename files to the name of their parent directory when downloaded from moodle. | |
| # Given | |
| #├── user1 | |
| #│ └── foo.pdf | |
| #└── user2 | |
| # └── foo.pdf | |
| # |
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 'socket' | |
| require 'openssl' | |
| def is_ssl_enabled?(tcp_socket) | |
| ctx = OpenSSL::SSL::SSLContext.new | |
| ctx.set_params({ :options=>OpenSSL::SSL::OP_ALL }) | |
| ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
| enabled = true | |
| OpenSSL::SSL::SSLSocket.new(tcp_socket, ctx).tap do |socket| |
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
| --- | |
| :name: Test Policy 3000 | |
| :confine: | |
| :operatingsystem: Darwin | |
| :rules: | |
| - :description: The JGrep package must be installed | |
| :severity: 9.0 | |
| :resources: | |
| :package/jgrep: | |
| :ensure: present |
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
| psy@Moya ~/work/jjgrep $ cat the.json |jgrep | |
| [ | |
| { | |
| "foo": { | |
| "bar": "foo-bar-1" | |
| }, | |
| "bar": 1, | |
| "baz": [ | |
| 1, | |
| 2, |
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
| diff --git a/plugins/mcollective/pluginpackager/ospackage_packager.rb b/plugins/mcollective/pluginpackager/ospackage_packager.rb | |
| index f8ae444..5c06a6e 100644 | |
| --- a/plugins/mcollective/pluginpackager/ospackage_packager.rb | |
| +++ b/plugins/mcollective/pluginpackager/ospackage_packager.rb | |
| @@ -37,7 +37,7 @@ module MCollective | |
| puts "%30s%s" % ["Plugin Type : ", @package.plugintype.capitalize] | |
| puts "%30s%s" % ["Package Output Format : ", @package_type] | |
| puts "%30s%s" % ["Version : ", @package.metadata[:version]] | |
| - puts "%30s%s" % ["Iteration : ", @package.iteration] | |
| + puts "%30s%s" % ["Revision : ", @package.revision] |
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
| On a windows machine, start IRB and | |
| > require 'mcollective' | |
| > result = "" | |
| > cmd = MCollective::Shell.new("echo testing", :stdout => result) | |
| > cmd.runcommand | |
| > cmd.stdout |
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 'mcollective' | |
| require 'pp' | |
| require 'json' | |
| # Find the config file. Right now I'm guessing | |
| # This is not going to work in the longrun. | |
| config_file = "/etc/mcollective/client.cfg" | |
| agent = ARGV[0] | |
| action = ARGV[1] | |
| # Arguments go here |
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 "timeout" | |
| require "systemu" | |
| begin | |
| Timeout::timeout(1) do | |
| systemu("ruby -e 'loop{}'", {}){} | |
| # IO.popen("ruby -e \"exec \"sleep 5\"\"", {}) do |thing| | |
| # puts thing.read | |
| # end | |
| 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
| HEADERS : | |
| ------ ActiveMQ ------ | |
| "expires" : | |
| "mc_identity" : | |
| --------- US --------- | |
| "timestamp" : | |
| "reply-to" : | |
| "caller_id" : |
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 'mcollective' | |
| require 'pp' | |
| include MCollective::RPC | |
| client = rpcclient("rpcutil") | |
| result = client.agent_inventory | |
| File.open("/tmp/mc_debug.txt", "w") do |f| | |
| result.each do |r| |
NewerOlder