Skip to content

Instantly share code, notes, and snippets.

@csfrancis
csfrancis / gdb_ruby_backtrace.py
Last active June 25, 2024 19:12
Dump an MRI call stack from gdb
# Updated for Ruby 2.3
string_t = None
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
else:
return s['as']['ary'].string()
@eladroz
eladroz / gist:5081492
Last active October 6, 2016 18:14
Graphite aggregation rules for StatsD (excl. for threshold metrics)
#
# These settings are REALLY sensitive! do you feel lucky??
# Consult the documentation for etsy/statsd, but it doesn't have all the info.
#
# Notes:
#
# (a) When determining xFilesFactor, make sure the actual reporting rate would fill enough buckets,
# so that the downsampling won't result in null values.
#
# (b) Up to StatsD v0.5.0, counters are written in two places:
@mleinart
mleinart / carbon-0_9_10-logrotation.patch
Created February 4, 2013 14:44
Patch to Carbon 0.9.10 to support external log rotation
diff --git a/conf/carbon.conf.example b/conf/carbon.conf.example
index 53708a8..7f35e8e 100644
--- a/conf/carbon.conf.example
+++ b/conf/carbon.conf.example
@@ -30,6 +30,9 @@
#
#LOCAL_DATA_DIR = /opt/graphite/storage/whisper/
+# Enable daily log rotation. If disabled, a kill -HUP can be used after a manual rotate
+ENABLE_LOGROTATION = True
@collegeman
collegeman / setup-statsd.sh
Created March 9, 2011 16:12
Turn an Ubuntu 10.04 linode into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
require 'rubygems'
require 'net/telnet'
require 'memcache'
require 'action_view'
include ActionView::Helpers::TextHelper
cache = MemCache.new 'localhost:11211'
raw = Net::Telnet.new("Host" => "localhost", "Port" => 11211, "Prompt" => /END/)
@deepak
deepak / mon_passenger.sh
Created July 28, 2010 06:32
collectd plugin to monitor passenger
#!/bin/bash
# collectd plugin to monitor passenger
# has better memory-requirement than a ruby script
# TODO: try writing it in c - if it makes a difference
HOSTNAME="production-host-01"
INTERVAL="${COLLECTD_INTERVAL:-10}"
PLUGIN_NAME="passenger_status"
while sleep "$INTERVAL"