Ahh, SQL (or, my own personal DailyWTF)
I'm in Chicago right now. I wanted to do something on my other laptop, which is sitting in the loft at home. No problem; since it's running a real OS
, I can just SSH in via my server at home. Except I can never remember what IP address it always gets handed.
After some random guessing, I try and get the ability to query mDNS setup on my FreeBSD server. After screwing around with that for a while I give up. Then inspiration strikes, and I whip up the following in psql:
select 'ping -c 1 '|| a || '>/dev/null && touch ~/tmp/'||a || ' &' from (select '192.168.42.'||b from generate_series(50,254) b) a(a)
\g | tcsh
I now have a set of files in ~/tmp that match IP addresses. 4th one I try is the charm.
Yay PostgreSQL! :)