Closed sentientmachine closed 3 years ago
I acknowledge it. I will investigate
Your server code behind cht.sh
: 5.9.243.188
has not been filling new queries for the last 3 or 4 days. It returns cached responses though.
http://cheat.sh/python/print+max
If you gzip all your code server side and send it to me, I'll fix it, and also replicate a fail-over server between dns and the ip address. :-DD
Eric, hi! Please test, it should work now.
It is a little bit more complicated; there are some old proprietary parts in use, which I gradually rewrite and publish, but the process is not yet finished. As soon as it is fully rewritten and published, I would be glad if you would host a cheat.sh mirror.
The service works again; could you please test?
Yep all the above is working again. If you need paper claims on labor to keep this project alive, post a donation link.
post a donation link
Not a bad idea. Although I am not sure if any donation stream is enough for fund any development of open source project.
@abitrolly The server-side query filling component of this cheat.sh open source project that touches https://api.stackexchange.com
and sits behind cht.sh
stopped filling new queries for a while, due to not-free things like server costs, maintenance costs, or call-throttling from stackoverflow. So if money isn't what floats your boat, then perhaps the social-good of the thing, see the latest use case in my muscle memory that shows how your stuff is used to create code.
@sentientmachine Eric, what do you think, what would be a reasonable monthly donation from your point of view? $1/monthly or $5?
Now serious questions:
thank you for the gif, your workflow looks pretty cool. The question is what is your hit-rate when you work like this? It is clear that if someone is querying for trivial things like python/read+yaml
oder lua/read+json
, this hit-rate is approx 100%, but in your case? What percentage of queries can be covered without leaving Vim? 10%? 50%?
I see that you didn't disable comments, and you fetch answers with them For some queries, the comments do not fit the language at the moment (for example, the problem with psql was fixed just yesterday). Does it annoy you?
What improvements of cheat.sh would you like to see first of all? Increasing stability? Better hit-rate? Standalone mode? What else?
When the coding focus freight train is ahead-full, my cht.sh hit rate is 5 or 10 times per hour, but that's at most once every few days. $100 USD per year is reasonable to me for you to do the bare minimum to keep this project on. I'd like faster turn around times, sometimes I'm waiting up to 3 seconds for a response and that needs to be 2 or 1 second. If you make another URL where I have to submit a username and password, like this: http://www.kibot.com/api/login_request.aspx
Then that would be super cool.
Half the time I can keep my fingers on home row while coding in vim and type 3 or 5 words, invoke cht and get a response that is good enough to keep me going and not retreat to browser/google search. I have a little helper vim function https://gist.github.com/sentientmachine/095dd57043ab1546c4f1f592ee2fa18b that manages saving out cht.sh queries to a history directory like ~/.vim/cht/psql/write+file
which gives me the ability to "go back to last query" without hitting your server again for the same query. When I find something I like from the cht.sh response, I promote it to a code snippet with name that allows me to https://github.com/junegunn/fzf sort of fuzzy-find search all my code snippets, allowing me to get what I need without hitting cht.sh or google.
If I get a response from cht.sh and it's not what I want, I'll put /0/1
after the query and look at 1 or 2 more answer, or try a different query. If that doesn't work I'll retreat to the browser/google.
The default auto-commenting feature is super good for the user's commentary, leave that on.
One thing that happens I don't like is like what happens when I search for python/basename the first answer for this comes up: https://stackoverflow.com/questions/22272003/what-is-the-difference-between-os-path-basename-and-os-path-dirname
Looking like this to me (Grey Underlines in comments just mean those are snippet names) https://imgur.com/a/JZ9sJGH
Your service has stripped the backticks from the stackoverflow post, making the user comments flow right into the code which is always a face palm show stopper. I'd prefer the backticks remain and at least I can overlay an: "If we're in a snippet, cht sheet, highlight those appropriately." Heck even replacing the backticks with newlines would be better.
If the stackoverflow answer contains no code example I don't want to see it. Also something we talked about 3 to 6 months ago which was super-cool someday maybe, I'd like to be able to filter answer by of conditions, like for example: "If you don't have at least 14500 reputation on stackoverflow, OR otherwise if your answer doesn't have at least 4 upvotes, then I do not want to be presented with this answer.
psql usage example has been perfect, no need to change comments there: https://imgur.com/a/FnZwm32
[...] If you make another URL where I have to submit a [...]
You mean, distinguish between free and premium users, and give some additional functionality for premium users like offline usage, lower response time, faster support, feature requests priority?
[...]making the user comments flow right into the code[...]
Yes, Markdown rendering should be fixed; absolutely agree here
[...]code example I don't want to see it.[...]
Yes, this is a good feature too. And another one: code in the answer should be always written in the queried language. It is currently a problem, especially for rare languages.
[...]filter answer by of conditions[...]
Yes, it sound interesting, but here two questions arise:
Moneywise: I just want the project's server side to stay up for the next 15 years even after you lose interest and find more important and fun things to do: server costs and code maintenance costs are substantial so altruism has its limits.
Stackoverflow's question API might have an option for you to send a flag to 'give raw markup sequences' including inline backtics for code sequences and like bold, headers, italics and links, images, references etc. https://stackoverflow.com/a/22272009/445131 If it's easy to make a flag to curl, so I can say: -J
for "Send me Stackoverflow's markdown". Then I can do post processing, when I see inline backtics inside a paragraph like this
, then I can break it out to its own lines how I like.
The filter by stackoverflow metadata question/answer conditions is a big ask, probably requiring total rewrite. I'd send an optional json string to curl in the curl post with conditions, and you'd have to untangle it and relay to the database for filtering.
What would be super cool is conditions for: "The answer must be written by someone with at least 14000 or more reputation, or failing that, the answer must have 3 or more upvotes, also the answer should have at least 1 line of code in it matching the language that I'm searching on."
All this sounds like 40 hours of programmer time.
Backtics seem to come through on this example if the markup character is inside another kind of markup like a comment or a list item: https://stackoverflow.com/questions/26547816/understanding-time-complexity-calculation-for-dijkstra-algorithm
[...]I just want the project's server side to stay up for the next 15 years even after you lose interest[...]
I agree with you, and see it the same. I think the most crucial component, needed for this, is the community (of active users and developers) around the project. Money is important too, but the users are even more important. That's why each and every bug report and feature request is very valuable and appreciated.
Stackoverflow's question API might[...]
Sure, we even fetch this data in Markdown format; it is just a bug in markdwon rendering on our side; it should be fixed; also, it should be possible to specify in what format you want to see the response (markdown, code with comments, etc).
The filter by stackoverflow metadata question/answer conditions is a big ask, probably requiring total rewrite.
It is not a trivial change, but it is feasible, I believe.
"The answer must be written by[...]"
I meant, how exactly should the query look like in this case? We don't want to use GUI, so we need some simple queries for things like that. Something like:
cht.sh python read json --reputation 14000 --upvotes 3 --code must
something like this?
That would be perfect: cht.sh python read json --reputation 14000 --upvotes 3 --code must
is zero work for me and would be a change made by me.
Those conditions make more work for the server side since remembered query-to-cache hits are less frequent. Also what about the situation where the criteria is too restrictive and there's no match? I'd say if there's no matches with criteria, just fail over and give the match without any criteria. I just want to see the answer from the high reputation user first, or a highly upvoted post first, before seeing some pile of poo laid by a zero-reputation user writing a paragraph with no upvotes and no code in the answer.
Your code mirrors Stackoverflow's ideology of always picking the green-Checkmark'ed answer as the best answer. But if there's a 144k rep user down below with a 200+ upvotes with code in it, and the checkmarked answer is some 5k reputation user with no code in it, and only 3 upvotes, I don't want to burn precious seconds reading their low value glyphs into my brain.
The reason I was suggesting users passing you a block of JSON, is because there's a lot more fields I could filter down by, for example:
https://data.stackexchange.com/stackoverflow/query/edit/1401745
select * from Posts where ViewCount > 1000 and Score > 4
like https://i.imgur.com/pFqdwGp.png
But again you have to be careful since Stackoverflow's data in table Posts
and Users
is worth a fortune, providing you this data out of a spirit of good will (minus advertisements) is a bit of a pricky-thing to do when stackoverflow financial bean-counters start counting dollars and cents and ask: "What about the Earnings?"
Keeping the service on the down-low and only for high-rep users such as myself who contribute a lot, well an argument can be made for synergizing core competencies.
I'm seeing non-response from your server when searching for /sql/ or /psql/ anything, it produces:
All of these produce the above Unknown Cheat Sheet response in browser: http://cht.sh/psql/select+from http://cht.sh/psql/rename+table http://cht.sh/psql/from%20table http://cht.sh/psql/renametable http://cht.sh/psql/rename http://cht.sh/psql/table%20statement http://cht.sh/psql/table+rename http://cht.sh/psql/table+foobar http://cht.sh/psql/table+alter http://cht.sh/psql/table+statement
Problem also occurs with other languages 'r' and 'sql': http://cht.sh/sql/table+statement http://cht.sh/sql/select+from http://cheat.sh/r/vector+permutation http://cheat.sh/r/write+file
problem also happens with curl
Issue 195 was the same problem: The example octave queries named there are producing no response, suggesting this problem affects many languages. https://github.com/chubin/cheat.sh/issues/195