Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cascading cheat sheets #98

Open
5 of 9 tasks
chubin opened this issue Aug 12, 2018 · 33 comments
Open
5 of 9 tasks

Cascading cheat sheets #98

chubin opened this issue Aug 12, 2018 · 33 comments

Comments

@chubin
Copy link
Owner

chubin commented Aug 12, 2018

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)
  • cht.sh client custom server support
  • cheat.sh-vim custom server support (@dbeniamine)
  • vscode-snippet custom server support (@mre)
  • cheat-sh.el custom server support (@davep)
  • cheat.sh-sublime-plugin custom server support (@gauravk-in)
  • windows client custom server support (@tpanj )
@dbeniamine
Copy link

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'

@chubin
Copy link
Owner Author

chubin commented Aug 12, 2018

@dbeniamine Perfect!

@davep
Copy link
Contributor

davep commented Aug 13, 2018

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.

@mre
Copy link
Contributor

mre commented Aug 13, 2018

Added to vscode-snippet via mre/vscode-snippet@1df3034.

@chubin
Copy link
Owner Author

chubin commented Aug 13, 2018

@mre Thank you, Matthias!
@davep Thank you Dave, I agree with you, defcustom would make more sense

@tpanj
Copy link

tpanj commented Sep 4, 2018

Support for windows client added: https://github.com/tpanj/cht.exe/releases/tag/v0.6

@chubin
Copy link
Owner Author

chubin commented Sep 4, 2018

@tpanj Perfect, Tadej! Thank you very much (updated the main page)

@zweicoder
Copy link

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?

@chubin
Copy link
Owner Author

chubin commented Feb 21, 2019

@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

@zweicoder
Copy link

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 :)

@chubin
Copy link
Owner Author

chubin commented Feb 21, 2019

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

@Fake4d
Copy link

Fake4d commented Apr 29, 2019

Is there any update on this feature?

@chubin
Copy link
Owner Author

chubin commented Apr 29, 2019

@Fake4d That is exactly what I am currently working on. Estimated DoD of the initial version: 1 May

@chubin
Copy link
Owner Author

chubin commented Apr 30, 2019

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?

@Fake4d
Copy link

Fake4d commented May 6, 2019

@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?

@chubin
Copy link
Owner Author

chubin commented May 6, 2019

@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?

@Fake4d
Copy link

Fake4d commented May 7, 2019

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!

@chubin
Copy link
Owner Author

chubin commented May 7, 2019

@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?

@Fake4d
Copy link

Fake4d commented May 8, 2019

@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!

@chubin
Copy link
Owner Author

chubin commented May 9, 2019

@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.

@chubin
Copy link
Owner Author

chubin commented May 19, 2019

@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).

Screenshot_2019-05-19_21-11-35

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.

@Fake4d
Copy link

Fake4d commented Oct 21, 2019

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!

@chubin
Copy link
Owner Author

chubin commented Oct 21, 2019

@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
Copy link

Fake4d commented Oct 21, 2019

@chubin This changed "something" now i even get more error-output ;-)

Please see this:
error.txt

@chubin
Copy link
Owner Author

chubin commented Oct 21, 2019

@Fake4d you need this too: libpython-dev

@Fake4d
Copy link

Fake4d commented Oct 21, 2019

@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.

@chubin
Copy link
Owner Author

chubin commented Oct 21, 2019

@Fake4d Ganz komisch. Wenn man aber python3 benutzt, muss man auch libpython3-dev installlieren

@Fake4d
Copy link

Fake4d commented Oct 21, 2019

@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?

@chubin
Copy link
Owner Author

chubin commented Oct 21, 2019

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

@Fake4d
Copy link

Fake4d commented Oct 21, 2019

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' ?

@chubin
Copy link
Owner Author

chubin commented Oct 21, 2019

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

@Kidman1670
Copy link

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

@chubin chubin mentioned this issue Oct 12, 2020
5 tasks
@chubin
Copy link
Owner Author

chubin commented Oct 12, 2020

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants