How can I create a lightning like effect on a ray?

Don’t re-invent the wheel: