Live data from Hacker News

Show HN: Curl https://ec2.shop

ec2.shop

61–70 of 84 posts

Re: Show HN: Curl https://ec2.shop

#61
post #12

Color output seems to be tuned for dark terminal backgrounds. Memory, vCPUs, and Storage are nearly unreadable on a white background.

I have a white background too. Is there a workaround for this?

I disable the colorize so it should be your default terminal now.

Re: Show HN: Curl https://ec2.shop

#62
post #25
post #19

Earlier quoted context omitted.

I've moaned about this with other CLI tools as well. I wish trend of using RGB values in ANSI escape codes would die because as ugly as the 16*3 colour fields¹ are, they are at least customisable so people can use palettes that suite their terminal and eyesight. You don't get any such opportunity if the developers hard code the colour values in (and it's worse with a tool like this because you can't even set an envir…

Can you link me to a way to use colours that change with the terminal colour preset? I haven't come across anything like that or maybe didn't pay attention. It would be really helpful You said you can't even set an env variable to change them so I assume that there is an even better way?

On Linux, in X, you can use xresources. Otherwise there's termcap

Re: Show HN: Curl https://ec2.shop

#65
Neat! The prices are without currency symbols - I guess it's always USD? Or maybe dependent on the region…? Would be nice if the $ symbol is printed, and even better if I could see the prices of my european servers in european currency - maybe add a param to select the currency?

It would be very helpful if you would support the `Accept: application/json` header. This way, we could use it in combination with jq to do arbitrary filtering:

    curl -L -H "Accept: application/json" ec2.shop | jq .

Re: Show HN: Curl https://ec2.shop

#66
post #63

Interesting tool. Would be really useful if it supported Spot prices, which are even more of a PITA to find using Amazon’s UI.

Yes, it isn't that hard to support Spot prices but the price change too often so I have to scrape it for every 5 minutes. Right now, I haven't had the automation to run this yet but it's doable and my pain point too =)

Re: Show HN: Curl https://ec2.shop

#68

Is there a way to show the output in json format?

Would be nice if both of these work (they don't): curl https://ec2.shop -H 'Accept: application/json' curl https://ec2.shop?json

It should work that way now :-). Thanks for suggestion.

Re: Show HN: Curl https://ec2.shop

#69
post #55

Earlier quoted context omitted.

There should be a new mime type for this: text/x-ansi

but why "ansi"? ANSI is only an encoding. You can have html that's in ansi, and you can have something like OP's that's not in ansi (eg. if you add emojis).

This is "ANSI" as in ANSI X3.64 escape sequences, not "ANSI" as in a character encoding. You can output color to curl on an ANSI-compatible terminal but not to something expecting actual plain text like a browser.

Re: Show HN: Curl https://ec2.shop

#70

Earlier quoted context omitted.

Are you manually detecting Curl specifically? If I use anything other than Curl, e.g. HTTPie or wget, I get the HTML page, even if I provide an `Accept: text/plain` request header. If I use one of those tools and spoof the Curl user agent string, I get the text/plain response. You should probably just look at the Accept request header, it’s there specifically so clients can tell you what kind of response they want.

Great idea. I just implement it: https://github.com/yeo/ec2.shop/commit/ab258aef3ac2ad3d45b26... Now by default it's text mode, so request by http client library or tool like curl, wget, httppie all get text bersion. Only when detecting `Accept` contains `html` and user agent is safari/chrome/firefox etc it send html version.

There should be no reason to check user agent if already checking `Accept`. That's usually more for browser quirks or allow/blocking.
Post reply on HN