Re:Show HN: Find the email address of any GitHub user
by tsm on Wednesday May 22, 2013 @10:03PM
(#5754935)
I'm always fascinated when something like this appears on HN and it turns out to be a dozen lines of bash. I could easily imagine writing a hundred lines of a "better" language (Python, CL, Ruby...)to do the same thing. I guess it just speaks to the unreasonable effectiveness of Unix tools for certain classes of problems.
[ Parent
| on HN ]
Re:Show HN: Find the email address of any GitHub user
by muyuu on Thursday May 23, 2013 @05:50AM
(#5755987)
Half of the code is dealing with the command line and options. Since you're working in the command line anyway, it makes sense.
But the gist of it is dead simple.
For this author (hodgesmr) you just go to:
https://api.github.com/users/hodgesmr
... and if it's not shown there (author doesn't want to make it public?) then you look for it here:
https://api.github.com/users/hodgesmr/events/public
Aaaaand this is why I have a dozen different mail accounts.
Re:Show HN: Find the email address of any GitHub user
by ralph on Thursday May 23, 2013 @05:57AM
(#5755999)
It could be better bash, e.g. using [[ instead of [. Also,
curl -s https://api.github.com/users/$2/events/public |
grep "\"gravatar_id\":" |
sed -e's/[,|"]//g' |
head -n 1 |
awk '{print $(NF)}'
can be curl -sS https://api.github.com/users/$2/events/public |
sed -n '/"gravatar_id":/!d; s/",//; s/.*"//p; q'
and so on.
Re:Show HN: Find the email address of any GitHub user
by hodgesmr on Thursday May 23, 2013 @07:21AM
(#5756215)
Pull requests are always welcome :)
Re:Show HN: Find the email address of any GitHub user
by pyre on Thursday May 23, 2013 @01:18AM
(#5755472)
| I could easily imagine writing a hundred lines
| of a "better" language
You could easily do much of the same things (probably in a similar number of lines) using system calls in other languages.