the page you linked shows how to remove a capability from a role:
global $wp_roles;
// remove capability $cap from role $role
$wp_roles->remove_cap( $role, $cap );
and an example would be:
// for example
$wp_roles->remove_cap( 'subscriber', 'view_galleries' );
or remove a capability from a specific user:
// get the user by username say for example its admin
$user= new WP_User( null, 'admin' );
// remove a capability from the user
$user->remove_cap( 'view_galleries');
as for what hook you should use, you don't need any just paste this code once in your theme's functions.php file, save and remove, since the roles and capabilities are saved in the database.