3 ms·
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 "
by tsm 13y ago
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.
- nsmartt 13y agoRuby uses `` to execute installed programs, which is the best part of bash. I'd say Ruby rivals bash in this sense.
- pyre 13y ago| 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.
- muyuu 13y agoHalf 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 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 https://api.github.com/users/hodgesmr/events/public Aaaaand this is why I have a dozen different mail accounts.
- ralph 13y agoIt 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.
- hodgesmr 13y agoPull requests are always welcome :)
- deleted 13y ago[deleted]