Skip to content

Instantly share code, notes, and snippets.

View EvanMcEwen's full-sized avatar

Evan McEwen EvanMcEwen

  • Toronto, Ontario, Canada
  • 12:40 (UTC -05:00)
View GitHub Profile
@tonyc
tonyc / gist:1384523
Last active June 3, 2024 15:34
Using strace and lsof

Using strace and lsof to debug blocked processes

You can use strace on a specific pid to figure out what a specific process is doing, e.g.:

strace -fp <pid>

You might see something like:

select(9, [3 5 8], [], [], {0, 999999}) = 0 (Timeout)

@boonebgorges
boonebgorges / gist:2185537
Created March 24, 2012 17:47
Recursively sort the output of get_categories() in order of parent-child hierarchy
<?php
$categories = get_the_category();
// Assemble a tree of category relationships
// Also re-key the category array for easier
// reference
$category_tree = array();
$keyed_categories = array();
@mm53bar
mm53bar / Gemfile
Created January 30, 2013 15:37
Be sure to install the datadog agent on your server before applying this code to your app. Instructions are at https://app.datadoghq.com/account/settings#agent or use my Sunzi recipe at https://github.com/Shift81/sunzi-recipes/blob/master/ubuntu/precise/datadog.sh
gem 'dogstatsd-ruby'