Skip to content

Instantly share code, notes, and snippets.

@tobym
tobym / gmetric_group.patch
Created October 18, 2010 22:31
patch to gmetric (from ganglia-monitor) to set group, description, and title from the command line
diff --git a/cmdline.c b/cmdline.c
index fdde32c..aa039ee 100644
--- a/cmdline.c
+++ b/cmdline.c
@@ -38,6 +38,9 @@ const char *gengetopt_args_info_help[] = {
" -s, --slope=STRING Either zero|positive|negative|both (default='both')",
" -x, --tmax=INT The maximum time in seconds between gmetric calls \n (default='60')",
" -d, --dmax=INT The lifetime in seconds of this metric (default='0')",
+ " -g, --group=STRING Group of the metric",
+ " -D, --desc=STRING Description of the metric",
# Get source
wget http://sourceforge.net/projects/ganglia/files/ganglia%20monitoring%20core/3.1.7/ganglia-3.1.7.tar.gz/download
tar xzf ganglia-3.1.7.tar.gz
cd ganglia-3.1.7
# Get dependencies
sudo apt-get install libapr1-dev libconfuse-dev libexpat1-dev libpcre3-dev
# Apply patch (http://gist.github.com/633214)
cd gmetric
@tobym
tobym / ganglia_configure_output.txt
Created October 18, 2010 22:59
Output from ganglia 3.1.7 ./configure if --sysconfdir is not set
sysconfdir appears to be the default value
Prior to release 3.1.3, Ganglia ignored the value of sysconfdir
passed to configure and would always use /etc/ganglia
This is considered a bug because the help text from configure
informs the user that the default location is PREFIX/etc
If you wish to continue using /etc/ganglia for gmond.conf and
other configuration files, you must now explicitly specify
--sysconfdir=/etc/ganglia
class User < ActiveRecord::Base
typed_serialize :preferences, Array
end
ruby-1.9.1-p378 > User.first.preferences
RuntimeError: implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly.
from /Users/toby/.rvm/gems/ruby-1.9.1-p378@jibe/gems/typed_serialize-0.1.0/lib/typed_serialize.rb:7:in `block in typed_serialize'
from (irb):3
from /Users/toby/.rvm/rubies/ruby-1.9.1-p378/bin/irb:17:in `<main>'
@tobym
tobym / pwdx_for_mac.bash
Created October 27, 2010 01:03
pwdx for mac. Usage: pwx pid
function pwdx {
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}'
}
$ find public/images/ -iname *mtv*
$ find public/images/ -iname *MTV*
public/images//MTV Networks.png
public/images//small_mtv.png
$ sudo port install findutils
$ gfind public/images/ -iname *mtv*
public/images/MTV Networks.png
function gemcd {
cd $(dirname $(gem which $1))
}
require 'mongo'
db = Mongo::Connection.new('test-db')
coll = db.collection('test')
coll.size # => 0
doc = { 'date' => Time.now.utc, 'other' => 'asdfasdf' }
coll.insert(doc)
record = coll.find.first
record['date'].class # => Time
# Example of association mapping in ElasticSearch. Assumes ES is running on localhost:9200 (the default).
# Clear index.
curl -XDELETE 'localhost:9200/testassoc'
# Store 'B' objects.
curl -XPUT 'localhost:9200/testassoc/B/1' -d '{
"content" : "Lorem ipsum dolor sit amet, consectetuer adipiscing elit"
}'
curl -XPUT 'localhost:9200/testassoc/B/2' -d '{
# Example of association mapping in ElasticSearch. Assumes ES is running on localhost:9200 (the default).
# Clear index.
curl -XDELETE 'localhost:9200/testassoc'
# Store 'B' objects.
curl -XPUT 'localhost:9200/testassoc/B/1' -d '{
"content" : "Lorem ipsum dolor sit amet, consectetuer adipiscing elit"
}'
curl -XPUT 'localhost:9200/testassoc/B/2' -d '{