Earlier quoted context omitted.
> try -R works :-)
I'm guessing you're on BSD (or maybe Apple)? Their version requires you to tell less there's a raw data at the input.
You can read my blog posts using curl
41–50 of 73 posts
Re: You can read my blog posts using curl
#42Earlier quoted context omitted.
I'm guessing you're on BSD (or maybe Apple)? Their version requires you to tell less there's a raw data at the input.
No, Debian 11. Fresh install too.
Terminal emulation is a spooking place full of ancient magic. One of the reasons why I assumed "modern defaults". It would turn "a weekend hack" into a session of misery. ;)
Re: You can read my blog posts using curl
#43Re: You can read my blog posts using curl
#44Earlier quoted context omitted.
Browsers send "Accept: text/html" explicitly. For my pastebin[1], I send an HTML document when "text/html" is in the list of accepted formats, and I just send the plain data otherwise. This seems to work in practice, doesn't hard-code knowledge about curl, and doesn't require curl users to add custom headers. [1]: https://sr.ht/~mort/coffeepaste/
I feel that neatly meets the kind of thing these params are for - if you ask a server for content and say "Accept: */*" the server should be free to return that content in whatever format it likes.
Re: You can read my blog posts using curl
#45If you know basic vim movements (j/k for down/up kind of basic stuff), you can pipe the output into less to read it in a more convenient way. Nothing major, just found it nicer to not have to scroll back up when the article loads Example: curl https://mahdi.blog/raw/self-hosted/ | less
The “less” program understands the standard cursor keys just fine; there is no need to use vi-style keys.
Re: You can read my blog posts using curl
#46A cool add-on to this would be a plugin that automatically redirected /latest to the latest blog post. That way, if the blogger were to publish say once a week every Tuesday, the user could alias the curl for maximum ease of use.
I once suggested this kind of strategy at a previous job...and internally, everyone liked it. But what ended up happening was: our fans of the content kept complaining that they were sharing the /latest url but "the website kept breaking" (in their mind) because last week it pointed to the blog post they wanted to share, and this week, its pointing to a different blog post, and please fix the website, etc. Clearly, o…
Re: You can read my blog posts using curl
#47Two months ago I hacked something like that for my blog: curl https://fuse.pl/beton/10print.html # with code highlighting curl https://fuse.pl/beton/cegla.html # just prose
Damn that looks really polished. How does the server know what characters to send so that my specific command line interprets it in a nice way? Sorry if I'm not being very articulate. EDIT: doesn't work when piping to less.
What if you pass '-r' to less? (I can't verify myself because it worked without -r for me)
Re: You can read my blog posts using curl
#48> To make this easily readable on small screens and terminals, I used vim’s text-width setting to make sure my lines do not exceed 80 characters: I never understand comments like these. Now if my terminal is 78 characters it is a mess or if it is 100 characters it is wasting space. If you just don't wrap the lines my terminal does it at the right width. Hard wrapping doesn't work well. You need to know the target wid…
Re: You can read my blog posts using curl
#49In these comments people have suggested to check for the User-Agent, but wouldn't it make more sense to check if the Accept header mentions text/html? I realize that curl sends "Accept: / ", but if you wanted to see a page in plain text, you would have to pass -H "Accept: text/plain". I think that uses HTTP much more like it was intended.
Browsers send "Accept: text/html" explicitly. For my pastebin[1], I send an HTML document when "text/html" is in the list of accepted formats, and I just send the plain data otherwise. This seems to work in practice, doesn't hard-code knowledge about curl, and doesn't require curl users to add custom headers. [1]: https://sr.ht/~mort/coffeepaste/
E.G,
curl https://dotfilehub.com/knoebber/emacs
results in plain text
Re: You can read my blog posts using curl
#50Two months ago I hacked something like that for my blog: curl https://fuse.pl/beton/10print.html # with code highlighting curl https://fuse.pl/beton/cegla.html # just prose
while True: print(choice("\\/"), end="")
(the `format` call doesn't seem needed and `choice` works on any iterable, including strings of characters).Al Sweigart has a repository of "scroll art" similar to 10 print that might interest you: https://github.com/asweigart/scrollart