How to show/hide a meta box using categories, with a different post type

Instead of

if (is_admin())
add_action('admin_menu', 'add_custom_box');

use

add_action('add_meta_boxes', 'add_custom_box');

The ‘add_meta_boxes’ hook is the correct one to add meta boxes. Other than that, as you mentioned correctly change the ‘post’ to ‘$my-custom-post-type’ and register the category taxonomy for that post type:

register_taxonomy_for_object_type( 'category', '$my-custom-post-type' )