Rewrite a filter as shortcode (or something like that) to use anywhere in CPT

To make your code simple and be able “to be used anywhere” is pretty subjective. Since you’re writing code and you don’t specify where you want your code to ultimately be used, the easiest thing to do would be to make it a function:
function my_function() { ... }

However, to make it a shortcode, there are some great examples on the codex that I use all the time when I want to make a shortcode:

function bartag_func( $atts, $content = null ) {
    $a = shortcode_atts( array(
        'foo' => 'something',
        'bar' => 'something else',
    ), $atts );

    //Run whatever code I want to here...

    return $my_result;
}
add_shortcode( 'bartag', 'bartag_func' ); //[bartag foo="foo-value"]

If you don’t want any variables passed in, then you can remove the first block of code designed to extract the variables.

With shortcodes, you must return your result. Anything that is echoed/printed directly will end up in weird places on your page — and not where you want it to. If a function you want to use wants to echo directly, use the output buffer to capture the data and put it into a string:

ob_start();
    //My Code
$result = ob_get_clean();

Shortcode functions should be able to add and apply filters depending on what you are wanting to do, but it’s worth noting that if you are using a shortcode/filter combination that WP uses (like filtering the content of a post in your shortcode function that is placed in the content of a post), you may get stuck in a filtering loop.