Computer cables seem to be either too short or too long. You should try to find a cable of
right length, which is always advisable.
But if you can’t,you may shorten the existing one. To do that, first strip the cable.
Now cut the desired length. Strip the isolation from each of the tiny wires. The best way to do that is just burn it over a lighter flame.
Now use a stand to hold both parts together and twist the corresponding wires together, then solder each one of them.
Now isolate each with tape. It is not a bad idea to use a glue gun or epoxy compound to fix the two parts together, so they won’t disconnect when pulled hard.
Restore shielding with metal adhesive tape and cover everything in PVC tape. Apply a little bit of nail polish remover and it will melt the layers of pvc together, making them solid.
You’re done.
The cable is of exact needed length now.