One easy route is to write blog posts! People who share their knowledge and then provide a CTA for their consulting services often stand out.
If you’re focused on a specific stack then doing research on the dependents of open source projects can also be a great way to find leads. The most successful have a distinguished product or service if you’re doing outreach (eg performance, security, database optimization etc).
Full disclosure I’m building Gitwallet.co which is a platform for open source software consulting businesses.