Live data from Hacker News

Show HN: Curl https://ec2.shop

ec2.shop

51–60 of 84 posts

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

#51
post #13

Could you update the `...&filter...` example to wrap the URL in quotes so that the `&` isn't interpretted by the shell as sending the process to the background?

this is an issue of ZSH.

No, plain sh also uses the ampersand as a job control operator.

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

#52
post #23

Is this open sourced? I personally try looking into implementing a curl "interface" to one of my projects, realised that it actually need to check the user-agent (of curl and a plethora of curl alternatives) which I find kind of weird...

Hey, yes it's 100% open source. https://github.com/yeo/ec2.shop The reason it check `curl` agent is because it share the same endpoint (root url) for both of `curl` page and browser version(the one with dropdown, grid etc)

I see, thanks!

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

#53
post #44

Very neat. Anyone know why curl -s https://ec2.shop | grep 't2' would work, but curl -s https://ec2.shop | grep 'm4' does not? Both commands work if I write the curl result to a file, but when I pipe from curl, the pattern `m4` matches all instances of the number 4.

Thank you, this is a bug.

The color code for blue is `"\033[34m` so it always match m4 for anything :(.

Just push a fix by disabling color as suggestion in here as well

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

#54
post #44

Very neat. Anyone know why curl -s https://ec2.shop | grep 't2' would work, but curl -s https://ec2.shop | grep 'm4' does not? Both commands work if I write the curl result to a file, but when I pipe from curl, the pattern `m4` matches all instances of the number 4.

Thank you, this is a bug. The color code for blue is `"\033[34m` so it always match m4 for anything :(. Just push a fix by disabling color as suggestion in here as well

Ah, got it, thanks for the clarity.

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

#55

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.

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).

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

#56
post #14

From time to time, I want a quick tool to help me compare EC2 instances price. https://ec2instances.info/ works great but it's somewhat slow and didn't have a way to just `curl` from terminal. So I develop this small tool which you can do thing like curl https://ec2.shop curl https://ec2.shop?region=us-west-2&filter=t2,m4

Useful tool! Do you not need to escape the ampersand in the second example? otherwise bash will run it in the background and skip the `filters=t2,m4` part.

Yes, but many terminals will escape it for you if you paste in.

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

#57
post #7
post #5

Cool! You should probably add http support and not only https. Writing `curl ec2.shop` is easier than `curl https://ec2.shop`

For HTTPS to truly be meaningful we need to stop supporting HTTP as an on-ramp, to prevent people from just hijacking that initial unencrypted connection and sending anything they want.

(speaking only for myself, not my employer)

I truly do not care if someone goes through the effort to MITM my curl of ec2.shop to inject fake prices or something like that.

There's nothing here that's going to be executed, it'll just be printed or grepped.

In theory you could exploit a 0 day in curl or my terminal or something like that, but I think if you truly think about the risks and tradeoffs here it's really not worth worrying about.

If curl had an hsts list to make this irrelevant that'd also be cool.

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

#58

From time to time, I want a quick tool to help me compare EC2 instances price. https://ec2instances.info/ works great but it's somewhat slow and didn't have a way to just `curl` from terminal. So I develop this small tool which you can do thing like curl https://ec2.shop curl https://ec2.shop?region=us-west-2&filter=t2,m4

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.

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

#60

I really like this, but the horizontal lines are not helpful at all and just double the number of lines for no benefit. You can obviously curl ec2.shop | grep -v ─ but I'm not sure I want to do that every time and I'm not exactly sure why, but when I do that, I can't select the entire row, only a column at a time (zsh on iTerm 2).

I turn off the color :-). And I must say it much nicer without color. Thank you.
Post reply on HN