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.
Show HN: Curl https://ec2.shop
51–60 of 84 posts
Re: Show HN: Curl https://ec2.shop
#52Is 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)
Re: Show HN: Curl https://ec2.shop
#53Very 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.
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
#54Very 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
#55Earlier 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
Re: Show HN: Curl https://ec2.shop
#56From 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.
Re: Show HN: Curl https://ec2.shop
#57Cool! 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.
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
#58From 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.
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
#59Re: Show HN: Curl https://ec2.shop
#60I 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).