cheat.sh
cheat.sh copied to clipboard
Cascading cheat sheets
With our "cascading cheat sheets" mode (it will be described in README.md soon), you can create a hierarchy of cheat sheets servers, where each server delivers local cheat sheets + if a requested cheat sheet is not found, the query is forwarded to the upstream server (and so on).
cheat.sh
^
|
cheat.my
^
|
clients
For the user it looks fully transparent, it uses the same clients as always. The only difference is that the clients should be configured the correct server (is some clients are used; of course, if you use nothing but curl, you change nothing but the name of the server in the query):
curl cheat.my/secret
In this query, you ask the cheat.my
server for the secret
cheat sheet.
The main advantage of this mode is that you can have your own (private or maybe public but relevant only to you and to your team) cheat sheets, and at the same time, you can use the global cheat sheets to, without changing anything.
This issue is related to #5, #14, #97
To do:
- [ ] server side implementation
- [ ] cheat.sh docker container (almost implemented by @bglopez)
- [ ] documentation (README.md)
- [X] cht.sh client custom server support
- [X] cheat.sh-vim custom server support (@dbeniamine)
- [X] vscode-snippet custom server support (@mre)
- [X] cheat-sh.el custom server support (@davep)
- [ ] cheat.sh-sublime-plugin custom server support (@gauravk-in)
- [X] windows client custom server support (@tpanj )
In cheat.sh-vim, the user can already set the server url by adding the following to its vimrc :
let g:CheatSheetBaseUrl='https://cht.sh'
@dbeniamine Perfect!
The url for cheat.sh is a constant in my Emacs package, although I guess with this approach it'd make more sense to have it be a defcustom
.
Added to vscode-snippet via https://github.com/mre/vscode-snippet/commit/1df3034c58f66eaf311e85a0ed85c6e99ab1f74c.
@mre Thank you, Matthias!
@davep Thank you Dave, I agree with you, defcustom
would make more sense
Support for windows client added: https://github.com/tpanj/cht.exe/releases/tag/v0.6
@tpanj Perfect, Tadej! Thank you very much (updated the main page)
hey @chubin what's the status on this and where can one help? also does this allow me to have my own cheatsheets in my own Github repo that I can point it to, or is the only option now to deploy it myself?
@zweicoder This mode will be available soon (and the second important feature, offline usage, too). The problem was that it was hard to implement these features (as well as several other features) without some refactoring, and it is almost done. With the new cascading cheat sheets feature it will be possible to have your own cheat sheets, and even your own adapters to connect other information sources such as Jira for example
that sounds awesome! i was planning to add some quick hack to have an offline cache but since you guys will have it soon I'll wait patiently :)
but keep in mind that in the first version with offline cheat sheets support, it will be not possible to make arbitrary programming languages queries (not yet); only cheat sheet queries:
this will work:
cht.sh tar
cht.sh btrfs
cht.sh python/Functions
And this wont:
cht.sh python/read+yaml+file
Is there any update on this feature?
@Fake4d That is exactly what I am currently working on. Estimated DoD of the initial version: 1 May
The feature is almost done. There are still several minor things open + documentation.
@Fake4d May I ask you about your prospective usecase? Just thinking about the documentation, where I should start from
@zweicoder The same. Both (1) offline usage + (2) cascading cheat sheets are supported now. What is more important for you (1) or (2)? What should be documented first, in your opinion?
@chubin I am working in a closed forensic environment with lots of servers and clients. I would love to see the cheat.sh as a clone in this environment without internet. I would activate a DNS for cheat.sh and copy the files and sources on a server with webserver. Then I hope i can use "curl cheat.sh" from every computer in this network!
Is this your idea of the offline environment?
@Fake4d Yes, this would work. What about the source of the cheat sheets? Where will the cheat sheet server get them from? What format do they have? Markdown? Something else?
I would love to have some of the official cheat sheets not our own. I dont know whether it is possible to use the ones from the github repo? Maybe i could mirror other cheat sheets and cut them into pieces to work with the cheat.sh mirror but I thought it would be possible to take some of the cheatsheets from your repo!
@Fake4d Yes sure, that would work. I will upload the documentation soo, and you will see that this would work pretty good. But what I wanted to ask was is (1) do you want to add your own cheat sheets or do you want to use only the public ones, and if you want it, then (2) what repository would you use for your own cheat sheets? Some internal git repository?
@chubin Yeah probably we would add some own repositorys too! We have Gitlab here and some own programs with man pages. But i could bring it in the right format if needed. Also we have a mediawiki with lots of documentation - maybe the Wikisyntax formated text could be a source too. The first approach for us would be the internal data of cheat.sh from the official commands and code syntax. Thank you for all your hard work on this project!
@Fake4d It sounds very good. The mediawiki can be bound too. Using pandoc, wiki pages can be converted into markdown, and markdown is handled by cheat.sh pretty good. I will help you with that if you will need my help.
Today the penultimate test became green, I hope that tomorrow the last one will be fixed, and then the branch can be merged, and deployed first on the staging server and then on the live server. And if everything will be fine, you can start with the deployment.
@Fake4d I've merged the development branch. All tests are green. The related documentation is still not published, but you can start experimenting already.
To install the standalone version:
curl https://cht.sh/:cht.sh > cht.sh
bash cht.sh --standalone-install
By default Python 2 is used, but Python 3 is supported too. You can switch it to Python 3 (in the cht.sh shell script code).
After cheat.sh is installed in the standalone mode, it can be used as a server (but you need a redis server for that, for the cache; see the config file).
Let us try from the standalone installation, and I will update the documentation in the meantime.
I tried the stand-alone installer on an fully patched Ubuntu 18.04 with Python3 - even with the solutions of some tickets to use it with python3 instead of python2 i was not able to install it locally - I got install dependency failures..
python2 "$(command -v virtualenv)" ve \
corrected into
python3 "$(command -v virtualenv)" -p python3 ve \
This solution was from the issue #157
Here is my last output: output.txt
If i want to install the docker container i run into the problem, that there is no file named You can see an issue here #156 I tested it locally and in the PlayWithDocker Environment!
I hope this summary could help - If i can do anything just let me know!
@Fake4d
I suppose that the problem is that you don't have ICU header files locally.
Please instsall libicu-dev
See also: https://stackoverflow.com/questions/40940188/error-installing-pip-pyicu
@Fake4d you need this too: libpython-dev
@chubin Already installed in its newest version:
libpython-dev ist schon die neueste Version (2.7.15~rc1-1). libpython-dev wurde als manuell installiert festgelegt.
@Fake4d Ganz komisch. Wenn man aber python3
benutzt, muss man auch libpython3-dev
installlieren
@chubin Now it finally builts after I installed libpython3-dev
- Everything seems fine - just some of the tests failed :
testsoutput.txt
I can now start to test this kind of repository! Looks really nice in this version - I think it would be a good idea to port cheat.sh to python3 with all the dependencies inside ? What do you think?
Afterwards maybe we could check the docker file?
This test is ok, it should be updated; just ignore it for the moment.
Regarding Python 3: it is already supported; no additional fixes needed.
The ICU dependency should be mentioned explicitly; and maybe it is better to do it optional. It is only for foreign languages queries
And regarding Docker, yes; it would be great to fix it
Would it be a good idea to make python3 the standard? Or are there other dependencies?
And regarding Docker, yes; it would be great to fix it
Is there a way i can help creating the 'share/scripts/get-sheets.sh' ?
Yes, I think it would be a good idea.
get-cheets.sh: that was an old Dockerfile that was contributed by someone, and that was not really actively maintained/developed; it is not relevant now, after the standalone mode was implemented.
Instead of this file we just should use cht.sh --standalone-install
- apt-get all needed dependencies before. So actually, as you've just installed it locally for your own
Sorry, I don't find any document explain how to create a private repo.
I try to change lib/config.py etc/config.yaml (this file even don't put any helpful comment, i don't know how to use it) Things seem more complicate than I think.
In theory anyone can do that. But in reality if we don't have document just a very small people spent time to understand how the source code work Please put in Readme.md or comment directly in etc/config.yaml a "tldr" solution
@Kidman1670 Excuse me for the disappearance; all your suggestions are fair and accepted; I will post an update as soon as this is done. The feature is experimental and not yet released/documented. I hope to do it in future