nc -X connect is the popular way to communicate with SSH over proxy. However, it's broken when your client is MacOS.
brew install corkscrew
ssh -4 \ -o "ProxyCommand corkscrew ip.http.proxy port-http-proxy %h %p" \ user@ip-machine-in-other-network
.i.e: in following example my HTTP_PROXY is
192.168.1.15:3128. And i want to login into
ssh -4 \ -o "ProxyCommand corkscrew 192.168.1.15 3128 %h %p" \ firstname.lastname@example.org
-4 is to force ipv4 over other options (ipv6)