37 points · by tacticiankerala · 11y ago · 64 comments
function weather(){curl -s "http://api.openweathermap.org/data/2.5/weather?q=$1&units=metric" | jq .main.temp | figlet -kcf big}
$ weather london
__ _ _ ___ _____
/_ || || | |__ \ | ____|
| || || |_ ) || |__
| ||__ _| / / |___ \
| | | | _ / /_ ___) |
|_| |_|(_)|____||____/ function weather(){curl -s "http://api.openweathermap.org/data/2.5/weather?q=$1&units=imperial" | jq .main.temp | figlet -kcf big} function weather() { curl -s "http://api.openweathermap.org/data/2.5/weather?q=$1&units=metric" | jq .main.temp | figlet -kcf big ;}1) you think mutable variables are beautiful
2) you think stuffing everything into one file is beautiful
3) you think defining functions at the root namespace is beautiful
4) you think consecutive repeated property accesses stuffed into a consecutively repeating boolean check like this are beautiful: if h.Time == "0" || h.Time == "100" || h.Time == "200" || h.Time == "300" || h.Time == "400" || h.Time == "500" || h.Time == "600" || h.Time == "700" || h.Time == "1400" || h.Time == "1500" || h.Time == "1600" || h.Time == "2300"
5) if you think embedding ANSI color codes across all strings instead of centralizing all that ugliness somewhere is beautiful
6) if you think not separating your command-line-handling code from your problem-modeling code is beautiful (see: Hexagonal Architecture http://alistair.cockburn.us/Hexagonal+architecture)
7) If you think having no fucking test suite to speak of, given all that mangled mutating code is beautiful (to me this is the MOST egregious non-beautiful thing in the entire "project")
Then, yes. WeGo is beautiful.
Frankly I'm shocked that what people call "beautiful" can differ that fucking much.
As far as I can tell, the Go environment is simply being used as a cheap installer, is that correct?
So I think, at least as a go newbie, that its quite handy that pretty much every tool I might be interested in - because it was written in Go - comes with full sources onboard as a basic, starting-gate, expectation. At least, I am quite happy to be learning Go this way ..
$ env -i $(which go) get github.com/schachmat/wego
package github.com/schachmat/wego: cannot download, $GOPATH not set. For more details see: go help gopathWouldn't call it beautiful - the ascii art is really distracting.
Btw, Thanks for your kind words!
Put this in a function. Done.
Gist here since copying and pasting above didn't work. https://gist.github.com/zaargy/384889cb44960e8559d5
I find my wee-chat with 256 color urxvt with Source Code Pro font in Light Solarized to be the best looking IRC client ever :)
~/tmp/elixir-weather $ ./weather Amsterdam
=INFO REPORT==== 7-May-2015::16:37:56 ===
application: elixir
exited: {bad_return,
{{elixir,start,[normal,[]]},
{'EXIT',
{{badmatch,{error,enotsup}},
[{elixir,start,2,[{file,"src/elixir.erl"},{line,34}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},{line,272}]}]}}}}
type: temporary
Failed to start Elixir.
error: {error,
{elixir,
{bad_return,
{{elixir,start,[normal,[]]},
{'EXIT',
{{badmatch,{error,enotsup}},
[{elixir,start,2,[{file,"src/elixir.erl"},{line,34}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,272}]}]}}}}}}I love Erlang and Elixir because BEAM gives me easy concurrency, metaprogramming and best of all, fault tolerance via supervisors. For a service that I need to stay alive, this is great. For a simple command line utility, I'd lean more toward a compiled language like Go, Haskell, Common Lisp, etc.
http://fungi.yuggoth.org/weather/
Pretty cool to track the temperature with your own home temperature.