Cheat sheet for programmers or "we google for you"
Introduction, which can not read
A modern programmer, and even more so a beginner at a level lower than junior, hell, needs the ability to use a search engine. It seems there is nothing difficult in this, but nevertheless questions often pop up on questionnaires, which have long been answered in the first tab of the search engine output. Why is that? Inexperience, laziness - a lot of reasons. We are interested in laziness, let's simplify a little and automate the process of “googling”.
Actually, the essence
So, I present to you the service " cheat.sh ". It is written in Python, so that Pythonists may be interested. There are several implementations of it:
- Through "curl" on the command line;
- Through the browser.
- Through code editors: Emacs, Vim, Sublime Text, VSCode.
How to use
Here you need to have the utility "curl". On Linux distributions, it already exists; for Windows, it needs to be installed separately. I had no problems with Windows.
Go to the console and send a request of this type:
Get the answer:
$ curl cht.sh/python/how-to-read-text-file # How to read a text file into a list or an array with Python ...## You will have to split your string into a list of values using split()## So, lines = text_file.read().split(',') # [Achrome] [so/q/14676265] [cc by-sa 3.0]
Initially, the utility was conceived as a cheat sheet for commands for the Linux terminal, so you can look for help on them:
$ curl cheat.sh/tar $ curl cht.sh/curl $ curl https://cheat.sh/rsync $ curl https://cht.sh/tr
You can also install the console utility:
$ curl https://cht.sh/:cht.sh > ~/bin/cht.sh $ chmod +x ~/bin/cht.sh
Use example here .
There are no such commands for Windows, so there is an option to use Cygwin, Git bash and so on.
At your peril.
Using a browser
Just go to the desired link in the browser.
A link can be sent as a response to Stackoverflow, for example.
Using code editors
What for? In order not to leave the editor get a copy-paste solution code.
Installation for bash:
$ curl https://cheat.sh/:bash_completion > ~/.bash.d/cht.sh $ . ~/.bash.d/cht.sh $ # and add . ~/.bash.d/cht.sh to ~/.bashrc
Installation for ZSH:
$ curl https://cheat.sh/:zsh > ~/.zsh.d/_cht $ echo'fpath=(~/.zsh.d/ $fpath)' >> ~/.zshrc $ # Open a new shell to load the plugin
If you do not need syntax highlighting in the answer:
If you need only code without comments:
You can combine this:
Open the client version with the parameter "--shell" and use:
$ cht.sh --shell [язык программирования]
$ stealth [параметры]
Why? To quickly get an answer. The author proposes to use this in remote interviews. It's just a matter of your own conscience.
There is even for Python. Yes, for a language where the separation of blocks of code is a newline.
Oddities of programming languages
View another answer
If you are not satisfied with the current response to your request, you can see another:
curl cht.sh/[язык]/[запрос]/[номер ответа]
And what, with the help of one utility you can learn the basics of the language?
$ curl cht.sh/[язык]/:learn
In general, everything. Maybe someone already knows about “cht.sh” and uses it, but I did not find any normal materials about it in Russian. On GitHub there is a table of completeness “cht.sh” by languages, links to plug-ins for editors, and a complete guide if someone doesn’t like mine. Thanks for reading.