Ha! When I saw the title I thought, "I wonder if I can find that pic from ten years ago" with the mold thing I made...
I started doing that with motorized bikes, because the kit throttle cables were like 2' too long.
I made that from a piece of aluminum about the same thickness as a cable end.
Used a band saw to make a groove for the cable to fit in.
Drilled a tiny pilot hole all the way thru, then a bigger hole the size of the end almost all the way through.
Clean the cable, lay it in the slot, then smash the cable a bit to unravel it.
Use a bernzomatic torch to melt the solder, let cool, and file the top while it's still in the mold.
Use a spring-loaded punch in the tiny hole in the bottom to pop it out, cut the excess cable, and file the end if necessary.
Pretty simple.
I made this back before I could find cable knarps. I didn't know they existed. Now I just use those, unless I run out and need a cable right away.
I originally posted the how-to on a motorized bike forum, but it's been shared to motorcycle forums, and other places, so that's my legacy...