How do I render contextual links for blocks I render in my code?
$block = block_load('module', 'delta');
print drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));


Too bad we have to use private functions from the block module (_*()) to achieve this.