Launchd Tools are for reading and creating launchd jobs.
For example, to see info about all Apple LaunchAgents and LaunchDaemons.
Or to create your own launchd job from an existing command:
cmd2launchd /usr/local/bin/daemond -d --mode foreground
Check it out here: https://github.com/kcrawford/launchd_tools
It can be tempting to store unstructured data as key value pairs to avoid lots of schema changes and capture dynamic data. But it can lead to problems.
- Overly complex queries/reporting
- No type support
This article explains some of the issues.
My conclusion is that it is fine if you will only be accessing the data rather than querying it, or as a temporary capture means until you’ve identified where the data really belongs.
If you have another way to query, like a Lucene index it may also be perfectly fine.
A key value store NoSQL solution may be appropriate, but that brings with it other baggage. Depending on the NoSQL solution you choose, you may have to do some extra work to get the type of search you need or use a Lucene style indexing solution anyway.
If you are using PostgreSQL, you can get much of the best of both worlds using hstore.
And you can easily use it with rails!
This will have the drawback of not being portable to other SQL backends, but that may be a tradeoff worth making.
With the PostgreSQL solution, you can retain one datastore and still allow some ability to store unstructured key values. Then as needed, you can integrate these back into the schema to permanent normalized columns.
“Time is stored internally as the number of seconds with fraction since the Epoch, January 1, 1970 00:00 UTC.”
>>Time.parse("January 1, 1970 00:00 UTC").to_i
As expected, but nice to verify.
For the reverse, be sure to use Time.at rather than Time.new
Once in a while you need to control an interactive command line tool. I kept getting a block when trying to read from a ruby IO popen pipe that was waiting for input. Here is my simple solution/workaround:
sh_process = IO.popen('sh > out.log', 'w')
f = File.open("out.log", "r")
Basically, just create a temp file and read from that. A little hackish, but it works.
Rails turns on protection from CSRF Cross-Site Request Forgery by default. It can make load testing more challenging since you need to get an authenticity_token for posting form data.
More information here: http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html
Ruby’s built-in telnet capability has been extremely useful for scripting automated RAID changes like LUN masking, etc.
It is super simple. Connect, login, issue commands, read and parse results.
The example code I used is here.
This is telnet, so don’t do this if eavesdropping is a concern.