mirror of
https://github.com/chubin/cheat.sh.git
synced 2024-11-23 19:43:33 +03:00
Merge branch 'master' of https://github.com/chubin/cheat.sh
This commit is contained in:
commit
3356ac1db6
@ -6,7 +6,7 @@ Main server program.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
from gevent.wsgi import WSGIServer
|
||||
from gevent.pywsgi import WSGIServer
|
||||
from gevent.monkey import patch_all
|
||||
patch_all()
|
||||
|
||||
@ -204,5 +204,5 @@ def answer(topic=None):
|
||||
return result
|
||||
return Response(result, mimetype='text/plain')
|
||||
|
||||
SRV = WSGIServer(("", 8002), app) # log=None)
|
||||
SRV = WSGIServer(("0.0.0.0", 8002), app) # log=None)
|
||||
SRV.serve_forever()
|
||||
|
16
get-sheets.sh
Normal file
16
get-sheets.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
## this doesn't error check, if it breaks and destroys things I'm sorry
|
||||
|
||||
mkdir cheatsheets
|
||||
cd cheatsheets
|
||||
mkdir cheat tldr spool
|
||||
git clone --recursive https://github.com/adambard/learnxinyminutes-docs
|
||||
git clone --recursive https://github.com/chrisallenlane/cheat cheat-temp
|
||||
mv cheat-temp/cheat/cheatsheets/* cheat
|
||||
rm -rf cheat-temp
|
||||
git clone --recursive http://github.com/tldr-pages/tldr tldr-temp
|
||||
mv tldr-temp/pages/* tldr
|
||||
rm -rf tldr-temp
|
||||
git clone --recursive https://github.com/chubin/cheat.sheets.git
|
||||
mv cheat.sheets/sheets .
|
@ -5,6 +5,7 @@ from __future__ import print_function
|
||||
|
||||
import os
|
||||
import re
|
||||
from globals import MYDIR
|
||||
|
||||
class LearnXYAdapter(object):
|
||||
|
||||
@ -12,7 +13,7 @@ class LearnXYAdapter(object):
|
||||
Parent class of all languages adapters
|
||||
"""
|
||||
|
||||
_learn_xy_path = "/home/igor/git/github.com/adambard/learnxinyminutes-docs"
|
||||
_learn_xy_path = os.path.join(MYDIR, "cheatsheets/learnxinyminutes-docs")
|
||||
_replace_with = {}
|
||||
_filename = ''
|
||||
prefix = ''
|
||||
|
@ -311,7 +311,7 @@ def _get_answer_for_question(topic):
|
||||
else:
|
||||
topic = [topic]
|
||||
|
||||
cmd = ["/home/igor/cheat.sh/bin/get-answer-for-question"] + topic
|
||||
cmd = [os.path.join(MYDIR, "bin/get-answer-for-question")] + topic
|
||||
proc = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||
answer = proc.communicate()[0].decode('utf-8')
|
||||
return answer
|
||||
|
@ -18,10 +18,17 @@ TEMPLATES = os.path.join(MYDIR, 'share/templates')
|
||||
STATIC = os.path.join(MYDIR, 'share/static')
|
||||
PATH_VIM_ENVIRONMENT = os.path.join(MYDIR, 'share/vim')
|
||||
|
||||
PATH_TLDR_PAGES = "/home/igor/.tldr/cache/pages/*/*.md"
|
||||
PATH_CHEAT_PAGES = "/usr/local/lib/python2.7/dist-packages/cheat/cheatsheets/*"
|
||||
PATH_CHEAT_SHEETS = "/home/igor/cheat.sheets/sheets/"
|
||||
PATH_CHEAT_SHEETS_SPOOL = "/home/igor/cheat.sheets/spool/"
|
||||
USE_OS_PACKAGES = True # change it False if you pull cheat sheets repositories from GitHub
|
||||
if USE_OS_PACKAGES:
|
||||
PATH_TLDR_PAGES = "/home/igor/.tldr/cache/pages/*/*.md"
|
||||
PATH_CHEAT_PAGES = "/usr/local/lib/python2.7/dist-packages/cheat/cheatsheets/*"
|
||||
PATH_CHEAT_SHEETS = "/home/igor/cheat.sheets/sheets/"
|
||||
PATH_CHEAT_SHEETS_SPOOL = "/home/igor/cheat.sheets/spool/"
|
||||
else:
|
||||
PATH_TLDR_PAGES = os.path.join(MYDIR, "cheatsheets/tldr/*/*.md")
|
||||
PATH_CHEAT_PAGES = os.path.join(MYDIR, "cheatsheets/cheat/*")
|
||||
PATH_CHEAT_SHEETS = os.path.join(MYDIR, "cheatsheets/sheets/")
|
||||
PATH_CHEAT_SHEETS_SPOOL = os.path.join(MYDIR, "cheatsheets/spool/")
|
||||
|
||||
COLOR_STYLES = sorted(list(get_all_styles()))
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
import sys
|
||||
import colored
|
||||
import itertools
|
||||
from globals import MYDIR
|
||||
|
||||
"""
|
||||
|
||||
@ -632,8 +633,9 @@ class Template(object):
|
||||
def main():
|
||||
"Only for experiments"
|
||||
|
||||
pagepath = os.join.path(MYDIR, "share/firstpage-v2.pnl")
|
||||
template = Template()
|
||||
template.read("/home/igor/cheat.sh/share/firstpage-v2.pnl")
|
||||
template.read(pagepath)
|
||||
template.apply_mask()
|
||||
sys.stdout.write(template.show())
|
||||
|
||||
|
@ -7,3 +7,6 @@ fuzzywuzzy
|
||||
redis
|
||||
colored
|
||||
langdetect
|
||||
cffi
|
||||
polyglot
|
||||
colorama
|
Loading…
Reference in New Issue
Block a user